How many stars(*) will the following snippet send to the console?
i = 0
while i < i+2 : i += 1 print("*")
else: print("*") - ANSWER-the snippet will enter an infinite loop, printing one star per line
What is the output for the following piece of code?
x = 1
y = 2
x, y, z = x, x, y
z, y, z, = x, y ,z
print(x, y, z) - ANSWER-1 1 2
How many hashes(#) will the following snippet send to the console?
lst = [[x for x in range (3)] for y range in (3)]
for r in range (3): for c in range (3): if lst [r][c] % 2 != 0: print("#") - ANSWER-three
What is the output of the following piece of code if the user enters two lines containing 3
and 2 respectively?
x = int(input())
y = int(input())
x = x % y
x = x % y
y = y % x
print(y) - ANSWER-0
The meaning of a positional argument is determined by: - ANSWER-its position within the argument list What is the output of the following piece of code?
x = 1 // 5 + print(x) - ANSWER-0.2
What is the output of the following snippet?
def fun(inp=2, out=3) : return inp * out
print(fun(out=2) - ANSWER-4
The following snippet:
def func(a, b): return b ** a
print(func(b=2, 2)) - ANSWER-is erroneous
What is the output of the following piece of code if the user enters two lines containing 3
and 6 respectively?
y = input()
x = input()
print(x + y) - ANSWER-63
Take a look at the snippet, and choose the true statement: nums = [1, 2, 3] vals = nums del vals[ : ] - ANSWER-nums and vals have the same length
Which of the following lines correctly invoke the function below? (select two answers)
def fun(a, b, c=0): # Body of the function. - ANSWER-fun (0, 1, 2)
fun (b=0, a=0)
Assuming that my_tuple is a correctly created tuple, the fact that tuples are immutable means that the following instruction:
my_tuple [ 1 ] = my_tuple [ 1 ] +my_tuple [ 0 ] - ANSWER-is illegal
What is the output of the following snippet:
dct = {'one': 'two' , 'three': 'one', 'two': 'three'}