Explain why the program did not print "clap", and how to fix it.
#takes number of fingers and recommends a thoughtful response
fingers = 10
if fingers >= 2:
print("whistle")
elif fingers >= 4:
print("snap")
elif fingers >= 10:
print("clap")
else:
input("are you human?")

Respuesta :

Answer:

Because you're using "elif".

If I were to have this code:

if *blank*:

    *action 1*

elif *blank*:

    *action 2*

If and elif is basically saying "one or the other". Since 10 is >= 2, it prints out only whistle. Instead of elif, you were to replace them all with "if", it would print out:

whistle

snap

clap