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 160 views
3 answers 189 views
189 views asked Apr 24, 2021 by avibootz
1 answer 111 views
1 answer 99 views
99 views asked Dec 23, 2024 by avibootz
1 answer 120 views
120 views asked Dec 23, 2024 by avibootz
1 answer 108 views
108 views asked Dec 23, 2024 by avibootz
...