I am very new in python. i need someone to help me out with running a simple script in python. I have a code that I have attached along. I am new with defining functions and running if else functions so I need help on how to make the following function work?
I do not know if defining different functions is necessary and I know I must be wrong at many lines in the code below. I need someone to help me revise it
def values():
p1g = float(input("Player 1 Utility for green"))
p2r = float(input("Player 2 ulitity for red"))
p1r = float(input("Player 1 utility for red"))
p2g = float(input("Player 2 utility for green"))
d1 = float(input("Player 1 Disagreement point"))
d2 = float (input("Player 2 Disagreement point"))
return [p1g,p2r,p14,p2g,d1,d2]
def slope_int(p1g,p2r,p1r,p2g):
"""Returns the slope and intercept of the payoff/utilities"""
m = (p2g-p2r)/(p1r-p1g)
c = p2r - ((p2g-p2r)/(p1r-p1g))* p1g
return [m,c]
def nash_bargaining_x(p1g,p2r,p1r,p2g,d1,d2,m,c):
return -(p2r -d2 - m*p1g - m*d1)/2*m
def nash_bargaining_y(p1g,p2r,p1r,p2g,d1,d2,m,c):
return -(p2r -d2 - m*p1g - m*d1) + c # where c = p1g-p2r*((p2g-p2r)/(p1r-p1g)
solution = [nash_bargaining_x(),nash_bargaining_y()]
print (solution)
if abs.(p1g-nash_bargaining_x) > (p1r-nash_bargaining_x):
solution = "P1 has Red"
else:
solution = "P2 has red"
expect the program to calculate all the values as listed in the script and return the values required from the user input variables.