Question: Someone please help! I am new to python and I am try to create a program that asks for user input and collects name, age,

Someone please help! I am new to python and I am try to create a program that asks for user input and collects name, age, sex, and then provides the user the total number of males and the total number of females and rhe average age of both. i have written the code below that is producing no syntax errors in my IDE nor any other areas it just keeps looping back to name age, name age. Im not sure how to debug it or if I am just way of base.
Help Please!
class Empty(object):
pass
name = " "
age = " "
sex = " "
list = []
while name !="":
name = input("Enter Your Name Here: ")
if name == "":
print("Exiting the Progam")
break
else:
pass
try:
age = int(input("Enter Your Age Here: "))
except:
print("Please Try Only Numbers")
if int(age) > 65 and int(age) < 18:
print("Age Must Be Between 18 and 65, Please Try Again")
continue
else:
pass
while sex !="":
sex = input("Enter 'Male' or 'Female' Here: ")
if sex != 'Male' or 'Female'.upper:
print("Please Check Your Spelling and Try Again")
continue
list.append(name)
list.append(age)
list.append(sex)
break
class Empty2(object):
pass
countmale = list.count('Male')
countfemale = list.count('Female')
males = []
x = list(['Male'])
for x in range(0, x - 1):
males.append(x)
pass
val_m = sum(males)
try:
avg_m = val_m/len(countmale)
except:
print("Not Enough Data to Compute")
else:
break
class Empty3(object):
pass
females = []
y = list(['Female'])
for y in range(0, y -1):
females.append(y)
pass
val_f = sum(females)
try:
avg_f = val_f/len(countfemale)
except:
print("Not ENough Data to Compute")
else:
break
print("Total Males= ", countmale)
print("Total Females= ", countfemale)
print("Average Age of Males= ", avg_m)
print("Average Age of Females= ", avg_f)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!