How to add a space when you're multiplying variables in python

前端 未结 2 1001
闹比i
闹比i 2021-01-23 13:21

Here is my code

print(\"Type in another set of words\")
    x = input()
    print(\"Now type in how many times you want it to appear (WHOLE NUMBERS ONLY!)\")
           


        
2条回答
  •  有刺的猬
    2021-01-23 13:33

    Use str.join to place a space between a sequence of strings:

    print(' '.join([x] * c))
    

提交回复
热议问题