0
Why do they use programs with incorrect logic as their examples?
For example: num = 12 if num > 5: print("Bigger than 5") if num <=47: print("Between 5 and 47") This code would seem ok to a beginner, but if you type four, it would still say: between 5 and 47. WHy would you use a program that would make no sense for a good program to show beginners how to program? They could have made it a two ending story, something that would spark interest, or at least be a decent program.
3 Respuestas
+ 6
There is no way this program prints "Between 5 and 47" for num = 4
+ 1
@Darian brown reconsider the importance of indents (spaces) in python.
the logic is correct.
0
if num <=47:
print("Between 5 and 47")
only runs when the first if is true, because it is also indented