How does this code work? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

How does this code work?

a, b = 5, 6 c = (a, b) [a<b] print(c) output: 6

2nd Oct 2022, 2:36 PM
Shantanu
Shantanu - avatar
1 Respuesta
+ 4
a<b is True int(True) returns 1 , index is type int. Automatically type casted. so (a, b) [a<b] => (a, b)[1] => 6
2nd Oct 2022, 2:52 PM
Jayakrishna 🇮🇳