Post

Python Coding
Python Coding@clcoding·
What will be the output of the following Python code? print(10 == 10.0)
English
11
6
42
20.6K
Coding Computing Coach
Coding Computing Coach@CodingComputing·
@clcoding Answer: True Solution: We are checking equality of two values here: 10 and 10.0 Notice their data types: 10 is an int. 10.0 is a float. Now, if we check the equality among 10 and 10.0, python is smart enough to know that both these are numeric types. So, +
English
1
0
6
624
Coding Computing Coach
Coding Computing Coach@CodingComputing·
@clcoding it forces the int 10 to its float type before comparison. 10 converted to float is 10.0. 10 == 10.0 thus simplifies to 10.0 == 10.0 which works out to be True, and that's what gets printed.
English
0
0
0
79
Paylaş