How to use repeat() to repeat a value in Python

1 Answer

0 votes
from itertools import *     

for val in repeat('python', 3):       
    print(val)


    
   
'''
run:
 
python
python
python

'''

 



answered May 21, 2019 by avibootz

Related questions

1 answer 148 views
1 answer 114 views
3 answers 188 views
188 views asked Apr 24, 2021 by avibootz
2 answers 246 views
1 answer 159 views
...