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
3 Antworten
+ 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")
+ 1
Because 10 is more then 5, as you wrote 10>5
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")
*