a = 0
b = -10
if a >= b:
print(“a is greater or equal to b.”)
if a == 0:
print(“a is 0.”)
if a <= 5:
print(“a is not more than 5.”)
Can anyone explain the above program and please let me know the output of the above one too.
For the above one i got the answer “a is greater or equal to b. a is 0. a is not more than 5. Program ends” all the print statements as answer.
Learning course: Learn Python
Problem Link: CodeChef: Practical coding for everyone
Here you specify that giving output as a=0 and b=-10.
1st condition in your code is a>=b, means 0>=-10 this one is correct, So it prints “a is greater or equal to b”.
2nd condition in your code is a==0, means it checks that a=0 or not, Its true ,so it prints “a is 0”
3rd condition in your code is a<=5, means 0<=5 this is also correct, it prints “a is not more than 5”,
and last prints “program ends”.
In your code you had given that if statement, means it check all statements.