Python Question / Quiz; What is the output of the following Python code, and why? 🤔🚀 Comment your answers below! 👇 #python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming

Python_Dv's tweet image. Python Question / Quiz;

What is the output of the following Python code, and why? 🤔🚀 Comment your answers below! 👇

#python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming…

Answer is false the condition (3 > 2) evaluates to True because 3 is greater than 2. In Python, True is treated as 1 and False as 0 when used in numeric comparisons. The becomes 1 > 1, which is False.


B. False. (3>2) is true which in boolean value is 1. So 1>1 is false so output will False


B) False as the result of expression (3>2) will be true hence 1 and now the expression is 1>1 which is false as 1 is equal to 1 not greater than 1 hence the whole condition will be false and the code will move to the else block. Am I Correct?


B. False


1 (True) > 1 is False BUT 1 (True) >= 1 is True


if 3 > 2 > 1: print("True") else: print("False") ans: True


United States Trends
Loading...

Something went wrong.


Something went wrong.