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 253 views
3 answers 321 views
321 views asked Apr 24, 2021 by avibootz
1 answer 196 views
1 answer 181 views
181 views asked Dec 23, 2024 by avibootz
1 answer 202 views
202 views asked Dec 23, 2024 by avibootz
1 answer 180 views
180 views asked Dec 23, 2024 by avibootz
...