how to print variable few time?

andy wants at no.mail.local
Wed Nov 16 16:29:29 EST 2016


Sun, 13 Nov 2016 17:27:23 +0200 wrote Jussi Piitulainen:


>>> word=raw_input()
>>> print word*3
>>> 
>>> 
>>> with this code im getting - wordwordword.
>>> what changes i need to make to get - word word word - instead?
>>> 
>>> thanks
>>
>> using python3.x:
>>
>> word=input()
>> print((word+' ')*2, end='')
>> print(word)
> 
> print(*[word]*3)

thanks for this starred expression - it took me one afternoon to 
understand ;-)

one should search the library and https://www.python.org/dev/peps/
pep-0448/ and try to

>>> import this

for clarification.



More information about the Python-list mailing list