Answered! (For example:output 1 output2 output 3 etc.) def silly (a, b, c): if a > b: if b > c: print("Spam!") else: print("Ni!") elif b…

dit View History Bookmarks Window Help canvas, southseattle.edu Quiz: Quiz 3 (For example: output1 output output3 etc.) def ailly (a,b, c): if b c: print (Spam!) else: print (Ni!) elif b c: print (Python!) if (a c) print (cobra) else: print (viper) else: print (Done a. silly (3,7,5) Python! cobra b. silly(2,0,0) Nii c, silly(1,3,5) Done! d, silly(2,7,-5) Python! viper e, silly (0,0,0) Done! Python Prog

(For example:output 1 output2 output 3 etc.) def silly (a, b, c): if a > b: if b > c: print(“Spam!”) else: print(“Ni!”) elif b > c: print(“Python!”) if (a

Expert Answer

def silly(a, b, c):
if a > b:
if b > c:
print(“Spam!”)
else:
print(“Ni!”)
elif b > c:
print(“Python!”)
if(a <= c):
print(“cobra”)
else :
print(“viper”)
else:
print(“Done!”)

silly(3,7,5)
print(‘n’)
silly(2,0,0)
print(‘n’)
silly(1,3,5)
print(‘n’)
silly(2,7,-5)
print(‘n’)
silly(0,0,0)

If you want to understand the flow of execution, i will explain it for first case,

silly(3,7,5):

here a =3, b = 7, c = 5;

we can see that first if condition of a > b is not met, hence it goes to next if condition of b > c. This condition is true, hence it goes inside code block and prints Python!, then a <= c is checked which is true, hence it prints cobra and comes out.

Similarly other cases execute too.

Still stressed from student homework?
Get quality assistance from academic writers!