Question 1
What is printed by the following program?
L = [23, 9, 18, 17, 12]print(len(L), L[len(L) - 1])5 175 12IndexError4 12
Week 6 of Programming in Python: Basic collections: lists, tuples. Extra important questions based on the recent, changing patterns of the exams, from basic to advanced. Practise them in learning mode: each question has a worked solution.
What is printed by the following program?
L = [23, 9, 18, 17, 12]print(len(L), L[len(L) - 1])5 17
5 12
IndexError
4 12
What will be the output of the code below?
L = [26, 29, 28, 8, 23, 13]print(len(L), L[len(L) - 1])5 13
6 23
6 13
IndexError
Consider the program given below. What does it print?
L = [12, 18, 22, 1, 19, 28]print(L[6])12
IndexError
28
19
Authorise with Google to see every question with its answer and explanation and practise it in learning mode.