Module 3 Quiz
How many hashes will the following snippet send to the console? for i in range (-1,1) print("#")
two
How many stars will the following snippet send to the console? i = 2 while i >=0: print("*") i -= 2
two
Take a look at the snippet and choose one of the following statements which is true: nums = [ ] vals = nums[:] vals.append(1)
vals is longer than nums
An operator able to check whether two values are not equal is coded as:
!=
What value will be assigned to x variable? z = 10 y = 0 x = z > y or z == y
True
What is the output of the following code? lst = [3, 1, -1] lst[-1] = lst[-2] print(lst)
[3, 1, 1]
Second Assignment: vals = [0, 1, 2] vals[0], vals[1] = vals[1], vals[2]
doesn't change the list's length
Take a look at the snippet and choose one of the following statements which is true: nums = [ ] vals = nums vals.append(1)
nums and vals are the same length
What is the output of the following snippet? lst = [0, 1, 2, 3] x = 1 for elem in lst: x *= elem print(x)
0
How many elements does the 1 list contain? 1 = [0 for i in range(1, 3)]
two