Question 1
What is printed by the following program?
print(list(range(0, 11, 2)))Error[0, 2, 4, 6, 8, 10][0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10][1, 3, 5, 7, 9]
Week 4 of Programming in Python: Iterations & ranges. 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?
print(list(range(0, 11, 2)))Error
[0, 2, 4, 6, 8, 10]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[1, 3, 5, 7, 9]
What will be the output of the code below?
print(len(range(6, 13, 3)))4
0
3
7
Consider the program given below. What does it print?
print(sum(range(1, 11, 5)))Authorise with Google to see every question with its answer and explanation and practise it in learning mode.