PROBLEM 1. What’s your postal code?
In main(), the function calls are provided for you as starter code.
Write your own function definitions, based on the starter code. (Do not modify the starter code).
You will need to add code to begin program execution.
FUNCTION 1: get_input()
The function get_input() should prompt the user to enter a correctly formatted Canadian postal
code, with the format: A1A 1A1 or A1A-1A1, where A is a letter and 1 is a digit, with a space or
dash separating the 3rd and 4th characters.
- Use a loop in get_input() to continually prompt the user for a postal code, until they have
entered a correctly formatted Canadian postal code. (This means you should convert user
input to uppercase letters, if they input lowercase letters).
- Use text like in the expected output below.
get_input() should return a correctly formatted postal code (as a string).
FUNCTION 2: display_code(postal_code)
This function will print the parameter passed in, to the console, like the output below.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
30 | 31 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 1 | 2 | 3 |
Get Free Quote!
307 Experts Online