Answered step by step
Verified Expert Solution
Link Copied!

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)

image text in transcribed

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 Territories

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

Explain the basic functioning of K-means clustering.

Answered: 1 week ago