Step 1 · Read and run
Cutting a slice
A slice gives you a piece of a string. town[0:4] means "from index 0, up to but not including index 4", the same rule as range().
| S | w | a | n | s | e | a |
|---|---|---|---|---|---|---|
| 0 | 1 | 2 | 3 | 4 | 5 | 6 |
Leave out the first number and the slice starts at the beginning; leave out the second and it goes to the end.
Run the program to carry on.