I am making a word chain game in python but I am stuck at one place. The thing I wanted to do is
The game begins by asking how many people wish to play, and then prompting you to enter a name
for each of the players.
For this, I have created a code
def inputWord():
Players = str(input("Enter Number of Players:"))
Name = []
WordChain = 0
ls = list()
PlayerNames = {}
for i in range(0, int(Players)):
Name = input("Enter Player Name:")
PlayerNames = ls.append(Name)
print(PlayerNames)
print(PlayerNames)
inputWord()
the Output that I am getting is
Enter Number of Players:2
Enter Player Name:David
None
Enter Player Name:Martin
None
None
Instead, I need this
Enter Number of Players:2
Enter Player Name:David
David
Enter Player Name:Martin
Martin
[David, Martin] #list of the names for later use
I am new to python please help me.