Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code on IDLE python 3.6 by using dictionaries. can not include any if statements, loops or lists.(computer science 217) Canadian postal costs consist of 6
code on IDLE python 3.6 by using dictionaries. can not include any if statements, loops or lists.(computer science 217)
Canadian postal costs consist of 6 characters. The first, third and fifth characters are letters while the second, fourth and sixth characters are digits. Postal codes are grouped by province, with the first letter in the postal code identifying the province or territory. Subsequent digits identify a smaller area within the province or territory. The following table shows the first letter(s) used by each province: Write a program that reads a postal code from the user and displays the name of the province in which that postal code resides. Your program cannot include any if statements, loops or lists. As a result, you will almost certainly want to use a dictionary to solve this problem. Your program does not need to do any error checking. The user will always enter a 6 character postal code that begins with one of the letters indicated in the previous table. Sample Input and output: Run #1: Enter a 6 character postal code (A1A1A1): A1A1A1 That postal code resides in Newfoundland Run #2: Enter a 6 character postal code (A1A1A1): T2N1N4 That postal code resides in Alberta Run #3: Enter a 6 character postal code (A1A1A1): X1Y2Z3 That postal code resides in Nunavut or Northwest Territories Canadian postal costs consist of 6 characters. The first, third and fifth characters are letters while the second, fourth and sixth characters are digits. Postal codes are grouped by province, with the first letter in the postal code identifying the province or territory. Subsequent digits identify a smaller area within the province or territory. The following table shows the first letter(s) used by each province: Write a program that reads a postal code from the user and displays the name of the province in which that postal code resides. Your program cannot include any if statements, loops or lists. As a result, you will almost certainly want to use a dictionary to solve this problem. Your program does not need to do any error checking. The user will always enter a 6 character postal code that begins with one of the letters indicated in the previous table. Sample Input and output: Run #1: Enter a 6 character postal code (A1A1A1): A1A1A1 That postal code resides in Newfoundland Run #2: Enter a 6 character postal code (A1A1A1): T2N1N4 That postal code resides in Alberta Run #3: Enter a 6 character postal code (A1A1A1): X1Y2Z3 That postal code resides in Nunavut or Northwest TerritoriesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started