How To Add A Space When You're Multiplying Variables In Python
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!)') c = int(input())
Solution 1:
Use str.join to place a space between a sequence of strings:
print(' '.join([x] * c))
Solution 2:
You can use string formatting:
print('{} '.format(x)*c)
Post a Comment for "How To Add A Space When You're Multiplying Variables In Python"