if 10 > 5: print("10 less than 5") print("Program ended") | Sololearn: Learn to code for FREE!
0

if 10 > 5: print("10 less than 5") print("Program ended")

The output is 10 less than 5 Program ended How is this possible as 10 is greater than 5

16th Mar 2020, 5:18 AM
Purushotham D
Purushotham D - avatar
3 odpowiedzi
+ 4
Purushotham D as you know x + 1 always will be greater than x where x is positive so don't think that whatever written in print function inside that condition will print. Here "10 less than 5" is just to confuse people. But you should believe that 10 is always greater than 5. So don't be confused. We can print anything it doesn't mean that 10 will not be greater than 5. if 10 > 5: print("10 == 5") print("10 <= 5") print("10 >= 5")
16th Mar 2020, 5:42 AM
A͢J
A͢J - avatar
+ 1
Because 10 is more then 5, as you wrote 10>5
16th Mar 2020, 5:30 AM
Danil SwD
Danil SwD - avatar
0
What is the output of the following code? num = 10 if num > 5: print("Greater than 5") else: print("Less than or equal to 5") *
11th Apr 2023, 7:42 AM
Raj Bavishi
Raj Bavishi - avatar