Post

Python Developer
Python Developer@PythonDvz·
Everyone thinks this line will throw an error… But Python says: ‘Nope, I got this.’ 🧠🔥
Python Developer tweet media
English
22
8
98
18.5K
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@Python_Dv Answer: B) world True > False is valid in Python because bool is a subclass of int (True==1, False==0). So True > False → 1 > 0 → True, and it prints "hello"? Wait — careful: If condition is True, it prints "hello". So the correct output is A) hello
English
4
0
18
1.9K
Shantun Singh Parmar
Shantun Singh Parmar@ParmarShantun·
@Python_Dv A) hello. bool type is a subclass of int. This means that True and False have underlying integer values: True is equal to 1 False is equal to 0
English
0
0
7
1.5K
Jenny
Jenny@JennyTheDev·
@Python_Dv Python: "True > False evaluates to True, so print hello" Everyone: "wait that's illegal"
English
1
0
7
1.6K
Jimmy Fikes
Jimmy Fikes@akajim·
@Python_Dv A. “hello” prints since True == 1 and False == 0
English
1
0
1
491
Dave Hart
Dave Hart@DJ_Hart_93·
@Python_Dv The correct answer is A, but the most correct answer is to lock up whoever wrote this code.
English
0
0
0
0
Terry | Full Stack Dev
Terry | Full Stack Dev@CodeByTerry·
@Python_Dv A. Hello In Python, True is greater than False. Why? Because booleans are a subclass of integers: True == 1 False == 0
English
0
0
0
110
Paylaş