Q:

TypeError in calculations with user-input values

I realize this has been answered but Im a super noob. I know it has to do with male/female being a string but I thought I had it defined? How can I get the calculation to work?
num = int(input('Please enter number of standard drinks consumed:'))
while num <= 0:
    print ('Error: The number cannot be negative or zero.')
    num = int(input('Please enter number of standard drinks consumed:'))
weight = int(input('Please enter weight in pounds:'))
while weight <= 0:
    print ('Error: The weight cannot be negative or zero.')
    weight = int(input('Please enter weight in pounds:'))
time = int(input('Please enter number of hours since first drink:'))
while time <= 0:
    print ('Error: The time cannot be negative or zero.')
    time = int(input('Please enter number of hours since first drink:'))
gender = input('Please enter the sex male or female:')
male = 0.68
female = 0.55

B = -0.015 * time(2.84 * num / weight * gender)
print ('The BAC is', format(B, ',.2f'))

A:

Don't forget, in Python indentation is used to define a block of code. If not indented, the lines following while are executed only once. Secondly, you will need to convert the gender variable into the correct numerical value (depending on the user input) before calculating the BAC. Finally, I believe you want to change the calculation so that you are actually multiplying with thetime variable. 
Here's an example that demonstrates how to fix these problems. Notice that this script allows a few different options for the user input, and converts everything to lower-case before checking gender:
gender = input('Please enter the sex male or female:').lower()
while gender not in ['m', 'f', 'male', 'female']:
    print ("Error: Gender must be male or female.")
    gender = input('Please enter the sex male or female:').lower()

if gender in ['male', 'm']:
    gender = 0.68
else:
    gender = 0.55

B = -0.015 * time * 2.84 * num / weight * gender
print ('The BAC is {0:.6f}'.format(B))

I also took the liberty of changing the formatted output a bit. Note, with Python 2.x you need to replace input with raw_input to automatically get the gender value as a string. 

