4.8k views
2 votes
In this lab, you use the pseudocode in figure below to add code to a partially created Python program. When completed, college admissions officers should be able to use the Python program to determine whether to accept or reject a student, based on his or her class rank.

start
input testScore, classRank
if testScore >= 90 then
if classRank >= 25 then
output "Accept"
else
output "Reject"
endif
else
if testScore >= 80 then
if classRank >= 50 then
output "Accept"
else
output "Reject"
endif
else
if testScore >= 70 then
if classRank >= 75 then
output "Accept"
else
output "Reject"
endif
else
output "Reject"
endif
endif
endif
stop
Instructions

Study the pseudocode in picture above.

Write the interactive inputstatements to retrieve:

A student’s test score (testScoreString)

A student's class rank (classRankString)

Write the statements to convert the string representation of a student’s test score and class rank to the integer data type (testScoreand classRank, respectively).

The rest of the program is written for you.

Execute the program by clicking the "Run Code" button at the bottom and entering 87for the test score and 60 for the class rank.

Run the program again by entering 60 for the test score and 87 for the class rank.

User McLawrence
by
4.5k points

1 Answer

2 votes

Answer:

Python code is given below with appropriate comments

Step-by-step explanation:

#Prompt the user to enter the test score and class rank.

testScore = input()

classRank = input()

#Convert test score and class rank to the integer values.

testScore = int(testScore)

classRank = int(classRank)

#If the test score is greater than or equal to 90.

if(testScore >= 90):

#If the class rank is greater than or equal to 25,

#then print accept message.

if(classRank >= 25):

print("Accept")

#Otherwise, display reject message.

else:

print("Reject")

#Otherwise,

else:

#If the test score is greater than or equal to 80.

if(testScore >= 80):

#If class rank is greater than or equal to 50,

#then display accept message.

if(classRank >= 50):

print("Accept")

#Otherwise, display reject message.

else:

print("Reject")

#Otherwise,

else:

#If the test score is greater than or equal to

#70.

if(testScore >= 70):

#If the class rank is greater than or equal

#to 75, then display accept message.

if(classRank >= 75):

print("Accept")

#Otherwise, display reject message.

else:

print("Reject")

#Otherwise, display reject message.

else:

print("Reject")

User Alex Byrth
by
5.0k points