Reputation: 53
I have the following code
UserInput = input("Input a number :")
Numbers = []
for index in range(int(UserInput)):
print("Entry " + str(index+1) + " is ")
Numbers.append(input())
I would like the output to look like this
Input a number :2
Entry 1 is 1
Entry 2 is 4
However I get the below using my current code - Python 3.6
Input a number :2
Entry 1 is
1
Entry 2 is
4
I guess I am missing something simple somewhere?
Upvotes: 0
Views: 118
Reputation: 1539
With reference to your answer:-
UserInput = input("Input a number :")
Numbers = []
for index in range(int(UserInput)):
print("Entry " + str(index+1) + " is ",end='')
Numbers.append(input())
Upvotes: 0
Reputation: 1528
This works:
UserInput = input("Input a number :")
Numbers = []
for index in range(int(UserInput)):
Numbers.append(input("Entry " + str(index+1) + " is ")) # change here
Upvotes: 1