How to use iterator with a tuple to print the items in Python

1 Answer

0 votes
tpl = ("python", "c", "c++", "php")

it = iter(tpl)

print(next(it))
print(next(it))
print(next(it))
print(next(it))


'''
run:

python
c
c++
php

'''

 



answered Nov 23, 2018 by avibootz

Related questions

1 answer 95 views
1 answer 201 views
2 answers 208 views
1 answer 176 views
...