Question
What will be the result of running the following code fragment?
x = -12
if x > 0:
print("pos")
elif x < 0:
print("neg")
else:
print("zero")
Question
What will be the result of running the following code fragment?
x = 0
if x > 0:
print("pos")
elif x < 0:
print("neg")
else:
print("zero")
Question
What will be the result of running the following code fragment?
x = 120
if x > 0:
print("pos")
elif x < 0:
print("neg")
else:
print("zero")
Question
What will be the result of running the following code fragment?
x = "neg"
if x > 0:
print("pos")
elif x < 0:
print("neg")
else:
print("zero")
Question
In the box provided, enter the value that will be printed as a result of running the following code fragment:
x = 8
if x < 6:
if x > 3:
x = x + 1
else:
x = x - 1
else:
if x > 9:
x = x + 2
else:
x = x - 2
print(x)
Question
In the box provided, enter the value that will be printed as a result of running the following code fragment:
x = 2
if x < 6:
if x > 3:
x = x + 1
else:
x = x - 1
else:
if x > 9:
x = x + 2
else:
x = x - 2
print(x)
Question
In the box provided, enter the value that will be printed as a result of running the following code fragment:
x = 10
if x < 6:
if x > 3:
x = x + 1
else:
x = x - 1
else:
if x > 9:
x = x + 2
else:
x = x - 2
print(x)
Question
Select all values of x
for which running the following code fragment will result in printing "Yes"
. There may be more than one correct choice.
if x > 5:
if x < 29:
print("No")
elif x <= 50:
print("Yes")
else:
print("Maybe")
Question
Select all values of x
for which running the following code fragment will result in printing "Maybe"
. There may be more than one correct choice.
if x > 5:
if x < 29:
print("No")
elif x <= 50:
print("Yes")
else:
print("Maybe")
Question
Select all values of x
for which running the following code fragment will result in printing "No"
. There may be more than one correct choice.
if x > 5:
if x < 29:
print("No")
elif x <= 50:
print("Yes")
else:
print("Maybe")