How does this code work? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponse
+ 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 🇮🇳