ENGR 147 Computer Programming Lab 3 v2
ENGR 147 Computer Programming Lab 3 v2
Lab 3
27 September 2024
1. Add a validation loop to the program from last week’s lab so that only time values between
0 and 70 inclusive are accepted. Upload to Moodle the source course (.py) and an example
output as shown below.
Sample dialogue
2. Write a program that calculates the dollar amount of a certain number of nickels and dimes.
- Use a while loop with a “keep_going” variable
- Prompt the user to enter the number of nickels.
- Use a second while loop to validate the input, ensuring the number of nickels input is
greater than zero.
- Prompt the user to enter the number of dimes.
- Use a third while loop to validate the input, ensuring the number of dimes input is
greater than zero.
- You can use the following formula to calculate the dollar amount:
- Print a message showing the number of nickels and dimes and the dollar amount, as
shown below. Use an f-string.
- Prompt the user to “keep going”
- Add comments at the start of the program briefly explaining what it does, before the
input statements, before the validation while loops, and before the calculations.
- Upload to Moodle the source code (.py) and an example output as shown below.
Sample dialogue