The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #696
def verify(num1, num2):
if num1 > num2:
return num1
elif num1 == num2:
return True
else:
return num2
def display(arg1, arg2):
if verify(arg1, arg2) == arg1:
print("A")
elif verify(arg1, arg2):
print("C")
else:
print("B")
display(1000, 3500)
Watch the trap! A function that returns anything that is not False or 0 will be evaluated as True within an if statement. Here, if verify(arg1, arg2): always evaluates to True . (docs.python.org/3/reference/expressions.html#boolean-oper...)
Question difficulty: 🔵🔵🔵🔵🔵
Similar questions: