The main focus of this Module will be Visualization and Graphical User Interfaces with Python, along with some exam prep
Note: THe practical exam will be completed on class computers in Idle, no internet, so you may want to practice under those conditions
Files for exercises: postal_codes.txt,
# Practice 1: write a function according to the docstring description
def postalValidation(postalCode):
""" (str) -> bool
Returns True if postal code entered by user is at least 3 characters and first 3 characters
match a postal code in postal_codes.txt
>>>piostalValidation('m6h')
True
>>>postalValidation('m6')
False
>>>postalValidation('LLK')
False
"""
# Practice 2: write a function according to the docstring description.
def isAutomorphic(num1):
""" (int) -> bool
Returns True iff the square of the integer, num1, ends in the same digits as num1 itself.
Single-digit numbers are considered Automorphic.
>>>isAutomorphic(25)
True
>>>isAutomorphic(13)
False
"""
# Practice 3: write a function according to the docstring description.
def evenDigs(lower, upper):
""" (int, int) -> str
Write a program, which will find all numbers within a range, defined by integers lower and upper, whose digits
are all even. The numbers obtained should be printed in a comma-separated sequence on a single line.
>>> evenDigs(900, 2070)
2000,2002,2004,2006,2008,2020,2022,2024,2026,2028,2040,2042,2044,2046,2048,2060,2062,2064,2066,2068
>>> evenDigs(100, 150)
"""
Quiz 7?
This work and other materials under
github.com/ICS4U-ICS4C,
are licensed under Creative Commons Attribution 4.0 Int'l License.