These questions are based off Analyzing Patient Data from here
Given this list:
my_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Which element will be printed with the following command:
print my_list[-1]
0
1
9
8
Using this same list, what would be printed with the following command:
print my_list[2:9]
- [2, 3, 4, 5, 6, 7, 8, 9]
- [1, 2, 3, 4, 5, 6, 7, 8]
- [1, 2, 3, 4, 5, 6, 7, 8, 9]
- [2, 3, 4, 5, 6, 7, 8]
The misconceptions are:
- Using inclusive end.
- Started index at 1 instead of 2.
- Both bad index start and using inclusive end.
- Correct.