Challenge 7

Open your previous challenge program where you tested exam results based on a user input.

Save a new version of the file and alter it so that you pass the value that the user enters into a function.

This function checks that it is a number between 0 and 100 inclusive and returns True if it is and False if it isn’t. The function should tell the user when it isn’t a valid number.

Add a loop so the program keeps asking the user to enter a number until they enter a valid one.

Change the response part of the program into a procedure that takes the exam result and prints the output string based on the value. You can now remove the checks from the is/elif/else block that warn for invalid numbers as they are covered in the first function.

Report a Glow concern
Cookie policy  Privacy policy