How to repeat a string N times in Python

2 Answers

0 votes
n = 3; 

s = "Python "; 

print(s * n); 



'''
run

Python Python Python 

'''

 



answered Apr 9, 2019 by avibootz
0 votes
s = "Python"
 
repeated = s * 5
 
print(repeated)
 
 
 
'''
run:
 
PythonPythonPythonPythonPython
 
'''

 



answered Jan 17, 2025 by avibootz

Related questions

1 answer 246 views
3 answers 316 views
316 views asked Apr 24, 2021 by avibootz
1 answer 190 views
1 answer 176 views
176 views asked Dec 23, 2024 by avibootz
1 answer 197 views
197 views asked Dec 23, 2024 by avibootz
1 answer 177 views
177 views asked Dec 23, 2024 by avibootz
...