Reputation: 27
I have issues with python that i cant figure it out. I want to print a repetition of a word when the user enter a word and then he will tell how many times that word will repeat. I cant * by the way . Here code so far
b = raw_input 'enter word'
c = input 'enter the amount of time the word will repeat'
for g in range (c)
print (b)
like you see you can see the repetition of the input but on vertical line, how I can print it horizontal?
Upvotes: 2
Views: 819
Reputation: 1756
Very simple. Just add comma.
print (b),
So your code becomes:
b = raw_input('enter word: ')
c = input('enter the amount of time the word will repeat: ')
for g in range (c):
print b,
Upvotes: 5
Reputation: 691
Here's how you do it
import sys
b = raw_input('enter word')
c = input('enter the amount of time the word will repeat')
for g in range (c):
sys.stdout.write(b)
Upvotes: 1