Reputation: 1
I am trying to create a loop for python to create a variable of different input values.
I want to input 3 different words into the name variable. This is my code:
name = raw_input("What is your name? ")
if len(name) > 0:
print name
I want to repeat the action from the input till I stop input.
Upvotes: 0
Views: 251
Reputation:
Maybe (although I'm not sure if I understand what you're asking for)
n = 0
while n < 3:
name = raw_input('What is your name?')
if name:
print name
n + =1
The variable name will change each time, keep in mind.
Upvotes: 2