Python: Store input in empty dictionary

Viewed 163

im trying to store the userinput of "name", "adress" and "number" into an empty dictionary. When running the code, I get this output:

Bitte gib dein Name an: elia
Bitte gib deine Adresse an: rosen
Bitte gib deine Mobilnummer an: 112
{'Elia': 'elia', 'Rosen': 'rosen', '112': '112'}

As you can see, the input get stored twice into the dictionary.

Here is my code:

d = { }

for i in range(1):
    name = input("Bitte gib dein Name an: ")
    adress = input("Bitte gib deine Adresse an: ")
    number = input("Bitte gib deine Mobilnummer an: ")
    d[name.title()] = name
    d[adress.title()] = adress
    d[number] = number
    

print(d)

Does anyone know what im doing wrong?

0 Answers
Related