How does the loop through tuple works?? (in Python ) | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 5

How does the loop through tuple works?? (in Python )

Actually i have seen using for loop... for tuple and set bt i couldn't i understand.. how it worked... 🙄🙄

8th Apr 2019, 3:58 AM
Vivek😊🤓
Vivek😊🤓 - avatar
4 Réponses
+ 6
Saksham Jain could u give an example to explain....okay see this.... a=(1,2,3,4) for x in a: print(x) wht actually is happening here.. I'm not understanding 🙄🙄
8th Apr 2019, 4:03 AM
Vivek😊🤓
Vivek😊🤓 - avatar
+ 5
Saksham Jain this is satisfying answer.. thx bro😊😊
8th Apr 2019, 4:27 AM
Vivek😊🤓
Vivek😊🤓 - avatar
+ 4
@Vivek first of all there is indentation error,ignoring that x takes the value of a one by one 1st execution x=1st element of tuple means index 0 n th execution x=nth element of tuple index n-1
8th Apr 2019, 4:15 AM
Saksham Jain
Saksham Jain - avatar
+ 2
just like in a list it iterates over every element of tuple
8th Apr 2019, 4:00 AM
Saksham Jain
Saksham Jain - avatar