Console. WriteLine( string. Concat(Enumerable. Repeat("Hello\n", 10)) );
In Python, we utilize the asterisk operator to repeat a string. This operator is indicated by a “*” sign. This operator iterates the string n (number) of times. The “n” is an integer value.
To print on the same line in Python, add a second argument, end=' ', to the print() function call. print("It's me.")
Python 2.x:
print '-' * 3
Python 3.x:
print('-' * 3)
The accepted answer is short and sweet, but here is an alternate syntax allowing to provide a separator in Python 3.x.
print(*3*('-',), sep='_')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With