python filling a dictionary with user input

Solutions on MaxInterview for python filling a dictionary with user input by the best coders in the world

showing results for - "python filling a dictionary with user input"
Agustín
27 Oct 2020
1# ***Filling a dictionary with user input
2responses = {}
3
4active = True
5while active:
6    name = input("What is your name?: ")
7    language = input("What is your favorite language?: ")
8    responses[name] = language
9    ask = input("Would you like someone else to also enter their votes? (yes/no)")
10    if ask == "yes":
11        continue
12    else:
13        print("________________________________")
14        print("This is your dictionary: ")
15        for nam, lang in responses.items():
16            print(f"{nam}'s favourite language is {lang}")
17    break
18