How to print a string two times with single statement in Python?


When used with strings, asterisk (*) is defined as repetition operator. It concatenates given string as many times as number followed by asterisk.

>>> string = 'abcdefghij'
>>> print (string*2)
   abcdefghijabcdefghij

Updated on: 30-Jul-2019

163 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements