Is there a way to make a variable inside an if statement global to the whole program? In the following code, I want to change my favorite color to purple, but it only does it for the if statement. For example, Apple's Siri knows your name. Let's say you for some reason want to change it, so you say "Siri change my name to Bob". Then from that point on, Siri calls you bob. I'm trying to model the same thing but with color.
color = "red"
command = input()#the variables have been defined
if command == "What is my favorite color":
print(color, "is your favorite color")#this prints red
if command == "Change my favorite color":
color = input()
print(color, "is your new favorite color")#this prints whatever
#color I put, purple
#now if I ask what is my favorite color again, it will still say red, but I want it to say purple from now until I change it to another color and so on