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...
icon
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")
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
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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…
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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY