This function is supposed to determine whether the user input is one of the viable (in this case, the strings "red", "yellow", and "blue" options, and if not ask for input again. However, upon typing in "yellow", it says NameError: name 'yellow' is not defined. Why does this happen?
valid = False
while not valid:
init_choice = input("Give a primary color")
if type(init_choice) == str:
init_choice = init_choice.lower()
if init_choice == "red" or init_choice == "yellow" or init_choice == "blue":
valid = True
if valid == False:
print ("That is not a valid input.")
return init_choice