Question: can you turn the below python code into pseudocode? #Part 1: #This section prompts for name, age, and sex, looping until the name is not

can you turn the below python code into pseudocode?

#Part 1:

#This section prompts for name, age, and sex, looping until the name is not

entered. The inputs are

#stored in their associated lists for later computation.

male = []

female = []

user = []

name = " "

while name <> "":

name = raw_input("Enter a name or press enter to exit: ")

user.append(name)

if name == "":

break

age = int(raw_input("Enter age: "))

sex = raw_input("Enter sex(m/f): ")

if sex == 'm':

male.append(age)

if sex == 'f':

female.append(age)

print "Loop Completed"

#Part 2

#This command will give me the number of males vs females

print ("The total number of males is")

print len(male)

print ("The total number of females is")

print len(female)

#Part 3

#This command will calculate and display the average age of males and females

if len(male)>0:

print ("The average age of the males is")

print sum(male)/len(male)

if len(female)>0:

print ("The average age of the females is")

print sum(female)/len(female)

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 Programming Questions!