+ 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 Answers
+ 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