What would you have to enter as an input for the following code to exit the loop?
answer = "N"
while answer != "Y":
print("are we there yet?")
answer = input("Please respond Y or N")
print("Yay! We are there!")
Give this one a try later!
Y
x = []
for i in range(2):
x.append(i)
x += x
,print(x)
Give this one a try later!
Before Loop: x = []
After Iteration 1: i = 0, x = [0, 0]
After Iteration 2: i = 1, x = [0, 0, 1, 0, 0, 1]
int('3') # Line 1
float('3.14') # Line 2
float('2') # Line 3
int('2.5') # Line 4
Give this one a try later!
Line 4, you cannot convert a float in a string into an integer
how_many=10
if how_many == 1:
print("Single")
elif how_many == 2:
print("Couple")
elif how_many < 5:
print("Few")
elif how_many < 10:
print("Several")
elif how_many > 10:
print("Lots")
else:
print("None")
Give this one a try later!
, None
What is the output of the following program?
language = ['P', 'y', 't', 'h', 'o', 'n']
print(language[:-4])
Give this one a try later!
['P', 'y']
What is the value stored in variable X after the following python statements are
executed?
X=2
Y=5
Z = X*Y
X = X*Z - X
Give this one a try later!
18
What is the output of the following code?
a=10
answer = "N"
while answer != "Y":
print("are we there yet?")
answer = input("Please respond Y or N")
print("Yay! We are there!")
Give this one a try later!
Y
x = []
for i in range(2):
x.append(i)
x += x
,print(x)
Give this one a try later!
Before Loop: x = []
After Iteration 1: i = 0, x = [0, 0]
After Iteration 2: i = 1, x = [0, 0, 1, 0, 0, 1]
int('3') # Line 1
float('3.14') # Line 2
float('2') # Line 3
int('2.5') # Line 4
Give this one a try later!
Line 4, you cannot convert a float in a string into an integer
how_many=10
if how_many == 1:
print("Single")
elif how_many == 2:
print("Couple")
elif how_many < 5:
print("Few")
elif how_many < 10:
print("Several")
elif how_many > 10:
print("Lots")
else:
print("None")
Give this one a try later!
, None
What is the output of the following program?
language = ['P', 'y', 't', 'h', 'o', 'n']
print(language[:-4])
Give this one a try later!
['P', 'y']
What is the value stored in variable X after the following python statements are
executed?
X=2
Y=5
Z = X*Y
X = X*Z - X
Give this one a try later!
18
What is the output of the following code?
a=10