Write a function is cdn.postal.code(st) which netaras Trif st is a valid Canadian postal code. The rules to follow here are firly simple. A Canadlian postal code consists of three uppercase ketters alternating with three digits with a space in the middle, e.g. H3Z 2LA or CSA 1G8 In addition, no curent Canadian postal code hegins with the letter Z assert is.cdn postal.code ("H2Y 185) assert is cdn postal.code("S7K 1L9") assert is c dn postal.code("XIA IES") assert is cdn, postal.code ("YIA IA4) assert not is.cdn.postal.code ("H4T 162") assert not is cdn postal.code("TIAIAS") ASsert not is.cdn.postal.code("24A 2NS")
Write a function is cdn.postal.code(st) which netaras Trif st is a valid Canadian postal code. The rules to follow here are firly simple. A Canadlian postal code consists of three uppercase ketters alternating with three digits with a space in the middle, e.g. H3Z 2LA or CSA 1G8 In addition, no curent Canadian postal code hegins with the letter Z assert is.cdn postal.code ("H2Y 185) assert is cdn postal.code("S7K 1L9") assert is c dn postal.code("XIA IES") assert is cdn, postal.code ("YIA IA4) assert not is.cdn.postal.code ("H4T 162") assert not is cdn postal.code("TIAIAS") ASsert not is.cdn.postal.code("24A 2NS")
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![5. Write a function is cdn_postal.code(st) which neturas Tre if st is a valid Canadian postal code. The rules to follow
here are falirly simple. A Canadian postal code consists of three uppercase letters alternating with three digits with a
space in the middle, e.g H3Z 2LA or COA IGO. In addition, no current Canadian postal code begins with the letter Z
assert is cdn_postal.code ("H2Y 1B5)
assert is cdn_postal.code ("S7K IL9")
assert is c dn postal.code("X1A IES")
assert is cdn postal.code ("YIA IA4")
assert not is.cdn_postal code ("14T 162")
assert not is cdn postal_code("YIAIAS")
assert not is cdn.postal.code("Z4A 2NS")](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F63ddaf76-1a50-4fb7-9423-cf7218976983%2Ff56adcfd-a70f-421e-a55e-41b1e05ae294%2Fcfolgz_processed.jpeg&w=3840&q=75)
Transcribed Image Text:5. Write a function is cdn_postal.code(st) which neturas Tre if st is a valid Canadian postal code. The rules to follow
here are falirly simple. A Canadian postal code consists of three uppercase letters alternating with three digits with a
space in the middle, e.g H3Z 2LA or COA IGO. In addition, no current Canadian postal code begins with the letter Z
assert is cdn_postal.code ("H2Y 1B5)
assert is cdn_postal.code ("S7K IL9")
assert is c dn postal.code("X1A IES")
assert is cdn postal.code ("YIA IA4")
assert not is.cdn_postal code ("14T 162")
assert not is cdn postal_code("YIAIAS")
assert not is cdn.postal.code("Z4A 2NS")
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY