How to repeat a string in Python

2 Answers

0 votes
s = 5 * "abc-"

print(s)


'''
run:

abc-abc-abc-abc-abc-

'''

 



answered Dec 2, 2017 by avibootz
0 votes
s = "python"
 
repeated_string = (s + ' ') * 4
 
print(repeated_string)
 
 
 
'''
run:
 
python python python python 
 
'''

 



answered Apr 23, 2024 by avibootz

Related questions

1 answer 187 views
1 answer 246 views
2 answers 358 views
3 answers 316 views
316 views asked Apr 24, 2021 by avibootz
2 answers 366 views
...