+ 3

# Plz anyone explain... 🙏

print(int(30>=30)) (Python) Why the above statement giving the output "1"? I'm not doing any mathematical operation, so why it's showing me "1"? I found this question while doing the SoloLearn challenge with someone else. And i got confused what will be correct answer. Plz tell me it will help me grabbing the concepts.

5 Answers

+ 3

Here between the parenthesis there are a convertion.You ask to convert a boolean value to integer value.boolean value are 1 or 0 .1 for true 0 for false and here when trying to compare 30 and 30 will give true so converted to int it is ....

+ 6

Int(true)=1

+ 6

If i will calculate this
If(30>30) this is false because 30 is not greater than 30 but if u will write with equal sign then its not greater than but value is equal so it will give true or 1

+ 2

HBhZ_C ok ok now i got that.
Thank you so much bro/sis 😄

+ 1

Julia Shabanova I didn't understood what do you mean