Reputation: 11
Here is what i am trying to do.. I want the user to pick a number, and then print word from my list that the number indexes. This is what i have so far
mylist = ["john","jack","jen","judy","jill"]
mylist
add = input("please state a name")
mylist.append(add)
print (mylist)
add = input("please state a number")
Upvotes: 1
Views: 16792
Reputation: 9837
This would work:
index = input("please state a number")
index = int(index)
name = mylist[index]
print(name)
Upvotes: 1