Question: write the python code that corresponds to each pseudocode. Loop Programs 1 . THIS MENU DOES NOT HAVE AN EXIT CHOICE Write a program that

write the python code that corresponds to each pseudocode. Loop Programs
1. THIS MENU DOES NOT HAVE AN EXIT CHOICE
Write a program that prompts the user for a choice from the following me:
Did you fill out a financial aid application?
1) Yes
2) No
Input Validation: The user must enter a 1 or 2.
Pseudocode:
Declare variables
String financialAid
financialAid =
while financialAid !=1 and financialAid !=2:
Display menu
Did you fill out a financial aid application?
1) Yes
2) No
Prompt for financialAid
if financialAid ==1:
Display Congrats, your application is complete!
elif financialAid ==2:
Display You must fill out an application
else:
Display Invalid. You must choose 1 or 2 from menu.
2. Use a while loop to prompt a user for a weight. Validate that the weight is not negative.
Pseudocode:
Declare variables
float weight
weight =-1
while weight <0:
Prompt for weight
if weight <0:
Display Invalid. Weight must be at least 0.
3. THIS MENU DOES HAVE AN EXIT CHOICE
Write a program that prompts the user for a choice from the following menu:
Please choose a color from the following menu until they choose to exit:
1) Blue
2) Green
3) Red
4) Exit
Input Validation: The user must enter 1,2,3 or 4.
Pseudocode:
Declare variables
String menuChoice
menuChoice =-1
while menuChoice !=4:
Display menu
Please choose a color from the following menu until they choose to exit:
1) Blue
2) Green
3) Red
4) Exit
if menuChoice ==1:
.....
elif menuChoice ==2:
.....
elif menuChoice ==3:
.....
elif menuChoice ==4:
Display Good Bye
else:
Display Invalid
Prompt the user for the speed a car is travelling. Use a for loop to create a distance chart for the first 5 hours travelled. Validate that rate is at least 0.
Distance = rate * time
Sample Output:
Enter the speed of the car (mph): 60
Hours Travelled Distance Travelled (miles)
------------------------------------------------------------------
160
2120
3180
4240
5300
Pseudocode:
float rate, distance
rate = distance =0.0
int hours
hours =0
rate =-1
while rate <0:
Prompt for rate
if rate <0:
Display Invalid. Rate must be at least 0.
Display Chart
Display Hours Travelled Distance Travelled (miles)
----------------------------------------------------------------------------
for hours in range(1,6):
Calculate distance
distance = hours * rate
Display hours, \t, distance

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!