What I'm trying to do here is to ask the user to enter any number, and then ask the user to enter any names, and then save this entry in the list.
However, when I enter any number, it asks to enter the name only once and displays the output in the list:
def main():
a = input("Enter number of players: ")
tmplist = []
i = 1
for i in a:
pl = input("Enter name: " )
tmplist.append(pl)
print(tmplist)
if __name__== "__main__":
main()
exit:
Enter number of players: 5
Enter name: Tess
['Tess']
I want the loop to be executed 5 times and the user to enter 5 values that are saved in the list.
source
share