how to print variable few time?

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Sun Nov 13 10:27:23 EST 2016


andy writes:

> Sat, 12 Nov 2016 04:58:20 -0800 wrote guy asor:
>
>> hello!
>> 
>> this is my code:
>> 
>> 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)



More information about the Python-list mailing list