Question: a) Pretend you are the python interpreter. Write down what would be printed out when the following code is executed: def foo(n): print n*3 return
a) Pretend you are the python interpreter. Write down what would be printed out when the following code is executed:
def foo(n):
print n*3
return n*2
print "Begin"
y = foo(7)
if (y > 15):
print "Breakfast" elif (y > 10): print "Lunch" if (y > 5):
print "Dinner" else:
print "Dessert" if ('a' < 'b'): print "Apple" elif ('a' <'A'): print "Peanut" else:
print "Butter" print "Finished"
b) Given the following code, what is printed?
if type("True") == bool or type(5 // 4) == float:
print ("Braves")
I
elif type(5) == int:
print("'Falcons")
else:
print("Hawks")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
