ACTIVITY 27 / 50
Try as many times as you needPart of a list
Let’s understand
A slice items[start:stop] returns part of a list. The start is included; the end is excluded. items[:2] takes the first two items. Reading a slice does not change the original list.
Listen to the explanation
Example
print([2, 4, 6, 8][1:3])Print the first two values of readings using a slice.
I need a hint
The slice [:2] stops before index 2.
How to find an error
- Read the last line of the error message.
- Find the indicated line. Check quotes, parentheses and indentation.
- Change one thing and run again.
main.py
4 spaces
Your draft stays in this browser.
Result
PythonYour program’s output will appear here. Click Run.
Мой профиль