What will the following script do?
1 x = 0
2 for x in range(5):
3 if x == 3:
4      continue
5   print(x)

Practice More Questions From: Quiz 3 – Intro to Lists & Loops

Q:

Which of the following is used to represent a List in Python?

Q:

What will be the result of the following script? x = [1, 2, 3, 4] print(x[4])

Q:

What will be the result of the following script? my_list = [1, 2, 3, 4] my_list.append(5) my_list.pop() my_list.pop(1) print(my_list)

Q:

What will be the result of the following script? my_list = [‘cat’, ‘dog’, ‘fish’] print(‘cat’ in my_list)

Q:

What does the following script do? 1 for i in range(5): 2 print(i)

Q:

What will the following script do? 1 x = 0 2 while x <= 5: 3 if x == 4: 4 break 5 print(x) 6 x += 1

Q:

What will the following script do? 1 x = 0 2 for x in range(5): 3 if x == 3: 4 continue 5 print(x)

Q:

What will be the result of the following script? string = ‘pasta’ result = ” for i in range(len(string) – 1, -1, -1): result += string[i] print(result)

Q:

What will be the result of the following script? lst = [] for i in range(2): for j in range(1, 3): lst.append(i * j) print(lst)

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments