+ 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... 🙄🙄
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 🙄🙄
+ 5
Saksham Jain this is satisfying answer.. thx bro😊😊
+ 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
+ 2
just like in a list it iterates over every element of tuple