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?
if 3 > 2 > 1: print("True") else: print("False") ans: True
United States Trends
- 1. Lakers 74.1K posts
- 2. #Talus_Labs N/A
- 3. Luka 67.9K posts
- 4. Wemby 26K posts
- 5. Marcus 31.5K posts
- 6. #LakeShow 5,591 posts
- 7. Blazers 8,395 posts
- 8. Russ 10.4K posts
- 9. Ayton 15.7K posts
- 10. Will Richard 6,388 posts
- 11. #AmphoreusStamp 6,469 posts
- 12. Horford 1,983 posts
- 13. #RipCity N/A
- 14. #dispatch 63.2K posts
- 15. Podz 2,398 posts
- 16. Thunder 36.7K posts
- 17. Godzilla 33.4K posts
- 18. Kuminga 3,341 posts
- 19. Nico Harrison 1,798 posts
- 20. Spencer Knight N/A
Something went wrong.
Something went wrong.