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 111 views
1 answer 157 views
2 answers 244 views
3 answers 180 views
180 views asked Apr 24, 2021 by avibootz
2 answers 244 views
...