Hello I am extremely new to programming so bear with me. I am trying to write a program that asks you for a color out of three choices and then generates a random color of its own and tells you if you win or lose based on if your color matches the generated color. I can't seem to nail down my syntax and I keep getting errors that I am unfamiliar with. This is my program.
import random
def ranred():
global color
color = 1
global color_out
color_out = "purple"
f_color(color, color_in, color_out)
return color, colorq
def ranblack():
global color
color = 2
global color_out
color_out = "black"
f_color(color, color_in, color_out)
def ranpurple():
global color
color = 3
global color_out
color_out = "purple"
f_color(color, color_in, color_out)
def f_color(color, color_in, color_out):
print (color_out)
if color == color_in:
print ("win")
else:
print ("lose")
def main():
color_in = input("Purple, Black or Red? ")
Purple = 1
purple = 1
Black = 2
black = 2
Red = 3
red = 3
randomcolor1 = random.randrange(0, 2)
randomcolor2 = random.randrange(0, 2)
if randomcolor1 == 1 and randomcolor2 == 1:
ranred()
if randomcolor1 == 2 and randomcolor2 == 2:
ranblack()
if randomcolor1 == 2 and randomcolor2 == 1:
ranpurple()
if randomcolor1 == 1 and randomcolor2 == 2:
ranpurple()
main()