I need to create a personality task for this assignment and I've written this block of code. I know it's probably not the best way but I would like to know why it is not working.
I have 3 questions which are all functions (Only 1 shown here) and their structures are all the same with the exception that instead of num_1, I used num_2 and num_3 for questions 2 and 3. I'm getting the error: '<' not supported between instances of 'int' and 'str. I have tried putting num_1 into an int(num_1) but that didn't work. Any help would be appreciated, thanks!
def question1():
print("What's your favorite genre of music?")
print("1. Pop")
print("2. Rap")
print("3. Metal")
music = int(input("Enter 1, 2, or 3: "))
if music == 1:
num_1 = 3
elif music == 2:
num_1 = 2
else:
num_1 = 1
def main():
question1()
if "num_1" + "num_2" + "num_3" == 9:
print("Your favorite color is red")
elif 5 < "num_1" + "num_2" + "num_3" < 9:
print("Your favorite color is blue")
else:
print("Your favorite color is green")
main()