Can anyone help me with this? I’m throwing all sorts of syntax errors because I don’t understand how to format a Dictionary of Lists. I feel like my while loops are also a bit messy now.
#Color Dictionairy
#David S Milgate
#4/21/2024
#Create a dictionairy of students and their favorite colors
oldName = input("enter your name: ")
nameDict = {"name":[], "color":[]};
NoColor = False
#"""Check to see if my name and color are on the list"""
if oldName not in nameDict:
NoColor = False
if oldName in nameDict:
NoColor = True
print("your favorite color is: " + str(nameDict[oldName]))
break
"""If my name is on the list, tell me what my favorite color is"""
if oldName not in nameDict:
NoColor = False
#adding new name to Dictionairy
while NoColor = False:
print("your name is not on our list.")
newColor = str(input("enter your favorite color: "))
nameDict["name"].append(oldName)
nameDict["color"].append(newColor)
NoColor = True
print("your favorite color is: " + str(nameDict[oldName]))