Plz anyone explain... 🙏 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

15th Oct 2020, 5:07 PM
‎Keshav
‎Keshav - avatar
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 ....
15th Oct 2020, 5:13 PM
HBhZ_C
HBhZ_C - avatar
+ 6
Int(true)=1
15th Oct 2020, 5:10 PM
Julia Shabanova
Julia Shabanova - avatar
+ 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
15th Oct 2020, 5:24 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
HBhZ_C ok ok now i got that. Thank you so much bro/sis 😄
15th Oct 2020, 5:21 PM
‎Keshav
‎Keshav - avatar
+ 1
Julia Shabanova I didn't understood what do you mean
15th Oct 2020, 5:12 PM
‎Keshav
‎Keshav - avatar