Project 4: ISBN Check With Loops
Modify your previous ISBN project so that the user may check as many ISBNs as they want,
and they also can make repeated errors when entering the digits.
What you need to do
Modify your project 2 with the following enhancements:
- In project 2, users could only make one error per digit. That is, they could
enter a digit outside of the range 0-9 only once, and the program would ask them
to fix it, but if they made a mistake on that same digit again, the program would
simply continue. For this project, change your code so that they can make repeated
errors and the program will continue asking them to fix it until they enter a digit
in the correct range.
- In project 2, users could only check a single ISBN each time the program was
run. For this project, change your code so that after the user finishes entering
an ISBN and they see the check digit, they are asked if they want to enter another
ISBN. If they say yes, let them enter another one (and they can continue entering
ISBNs until they decide to stop). If they say no, end the program.
Sample Interaction
Digit 1? 1
Digit 2? 5
Digit 3? 8
Digit 4? 2
Digit 5? 6
Digit 6? 1
Digit 7? 6
Digit 8? 8
Digit 9? 4
Last digit of ISBN should be 1.
Do you want to check another ISBN (type yes or no)? yes
Digit 1? 0
Digit 2? 6
Digit 3? 8
Digit 4? 8
Digit 5? -1
Bad digit, re-enter please.
Digit 5? 99
Bad digit, re-enter please.
Digit 5? 0
Digit 6? 6
Digit 7? 6
Digit 8? 7
Digit 9? -8
Bad digit, re-enter please.
Digit 9? 8
Last digit of ISBN should be X.
Do you want to check another ISBN (type yes or no)? no
Your code does not have to follow this exact script verbatim, but all the
mentioned functionality should be there: asking for digits, printing the check digit, and not allowing
digits out of range to be entered.
Hints
You will need to use one or more while loops in your code.
What to turn in
Through Moodle, turn in your code as a file called isbn_loops_yourLastName_yourFirstName.py.