0

a = 2 + float("3") b = 5 c = a == b print(c) why is python silently converting 'b' into a float 5.0 in comparison '==' operatn

Python boolean

26th Mar 2018, 9:24 PM
PyDiv()
PyDiv() - avatar
2 Respuestas
+ 2
because a is a float
26th Mar 2018, 9:41 PM
Skipper
Skipper - avatar
+ 2
Python coerces the int into a float to perform the addition, then returns a float as the result.
26th Mar 2018, 9:44 PM
Damyan Petkov
Damyan Petkov - avatar
En tendencia hoy
.
1 Votes
What?
0 Votes
HTML
0 Votes
Web
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
help
0 Votes
AI
2 Votes
APIs
1 Votes