I'm trying to write a function the returns BAC for both male and female sexes. The formula for BAC for my assignment is  BAC = (drinks / Weight * R) with R being a different value for males and females. How would I get it to return the value for both sexes?
This is the code I tried using but it doesn't work:
if sex =='M':
    R = 3.8
    BAC = (drinks / Weight * R) 
    BAC = BAC - (0.01 * (Duration / 40))
    return BAC
if sex == 'F':
    R = 4.5
    BAC = (drinks / Weight * R) 
    BAC = BAC - (0.01 * (Duration / 40))
    return BAC
I have another function in the code that does define sex, but putting that into the function seems to complicate things, so I think I need to remove the variable sex altogether, but I'm not sure where to go from there.
 
     
     
     
    