python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

python

num = int(input()) range = list(range(5,10)) def func(): if num < 5: print("I got this!") if num >= 5 : print("Help me Batman") if num > 10: print("Good luck out there!") func() if i were to use this code then run the test for a sololearn code coach. why is it that it only executes the first statement but ignores the rest of them once "i got this!" has already been printed out. What do I have to do so the code doesn't only look at the first statement and its condition but continue on the rest.

29th Jun 2022, 8:07 PM
athaleyah weise
1 Answer
+ 6
Because of indentation. A number can't pass the if num < 5 statement AND an if num >= 5 statement. That will always be impossible
29th Jun 2022, 8:21 PM
Slick
Slick - avatar