+ 1
Where I'm lacking in this python question
var = int(input()) if var > 10: print("High Five") if var < 1: print ("shh") if var > 1: print("Ra!"*var) My answer body and question is : https://www.sololearn.com/coach/20?ref=app
2 odpowiedzi
+ 4
All conditions are getting tested no matter what the value is, whereas it should stop testing as soon as one condition is found to be true.
Suppose var = 15. It will print both, "High Five" and "Ra"*var, because both conditions are true: 15>10 as well as 15>1.
Solution: use elif
+ 4
Thanks alot Brian ❣️👍