How do u convert a floating number to a tuple | 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 do u convert a floating number to a tuple

Let's say u are asked to display final mark of a student as a tuple

27th Oct 2020, 8:10 PM
Simbarashe Mpofu
Simbarashe Mpofu - avatar
2 Réponses
+ 1
Simbarashe Mpofu Do you mean ie. 67.56 becomes (67, 56)?
27th Oct 2020, 8:15 PM
Sousou
Sousou - avatar
+ 6
To store a float inside a tuple this can be done: x = 765.432, print(x, type(x))
27th Oct 2020, 8:35 PM
Lothar
Lothar - avatar