在Python 2.7中使用for打印水平

Lui*_*lon 2 python python-2.7

我有python的问题,我无法弄明白.我想在用户输入单词时打印一个单词的重复,然后他会告诉该单词将重复多少次.顺便说一句,我不能.这里代码到目前为止

b = raw_input 'enter word'
c = input 'enter the amount of time the word will repeat'

for g in range (c)
    print (b)
Run Code Online (Sandbox Code Playgroud)

就像你看到你可以看到输入的重复但在垂直线上,我怎么能水平打印?

Ale*_* R. 5

非常简单.只需添加逗号即可.

print (b),
Run Code Online (Sandbox Code Playgroud)

所以你的代码变成:

b = raw_input('enter word: ')
c = input('enter the amount of time the word will repeat: ')

for g in range (c):
    print b,
Run Code Online (Sandbox Code Playgroud)