Question: I used the following code to generate my MokiDex but the “MokeDex[name]= MokeBeast” line is overwriting the stats for all Mokebeasts i.e. it takes the latest MokeBeast dictionary and assigns it to all name keys rather than the latest name key. Can somebody please explain why this is happening?
Repl link:
MokeDex = {}
MokeBeast = {"type":None, "specialmove":None, "startingHP":None,"startingMP":None}
while True:
name = input("Input your beast's name >")
for key in MokeBeast.keys():
MokeBeast[key] = input(f"Input your beast's {key} >")
#print(MokeBeast)
MokeDex[name]= MokeBeast
#print(MokeDex)
check = input("Do you want to add another beast? y/n>")
if check == "n":
break