Instruction
Great! In Python, you can also slice strings. Take a look:
alphabet = 'abcdefghijklmnopqrstuvwyxz' alphabet[2:5]
The query above will return all characters with indices between 2 (inclusive) and 5 (exclusive). This means that we'll get the following:
- The third element (
c, index2) - The fourth element (
d, index3) - The fifth element (
e, index4)
Exercise
Here is pi with 75 digits after the decimal point:
Use string slicing to print the first 10 digits after the decimal point.
Stuck? Here's a hint!
Just type: print(pi[2:12]).



