Answers for "python filling a dictionary with user input"

0

python filling a dictionary with user input

# ***Filling a dictionary with user input
responses = {}

active = True
while active:
    name = input("What is your name?: ")
    language = input("What is your favorite language?: ")
    responses[name] = language
    ask = input("Would you like someone else to also enter their votes? (yes/no)")
    if ask == "yes":
        continue
    else:
        print("________________________________")
        print("This is your dictionary: ")
        for nam, lang in responses.items():
            print(f"{nam}'s favourite language is {lang}")
    break
Posted by: Guest on August-13-2021

Code answers related to "python filling a dictionary with user input"

Python Answers by Framework

Browse Popular Code Answers by Language