1
ic02
CS8 M17
Name:
(as it would appear on official course roster)
Umail address: @umail.ucsb.edu
Optional: name you wish to be called
if different from name above.
Optional: name of "homework buddy"
(leaving this blank signifies "I worked alone"

ic02: Review for Final Exam

ready? assigned due points
true Wed 09/06 09:30AM Wed 09/06 10:50AM

You may collaborate on this homework with AT MOST one person, an optional "homework buddy".

MAY ONLY BE TURNED IN IN THE LECTURE/LAB LISTED ABOVE AS THE DUE DATE.
There is NO MAKEUP for missed assignments, and you may not submit work in advance, or on behalf of another person.
In place of that, we drop the four lowest scores (if you have zeros, those are the four lowest scores.)


https://ucsb-cs8-m17.github.io/hwk/ic02/

Disregard the instruction above about “homework buddies” for this in-class assignment. For this assignment:

Those conditions will NOT be true on the final exam. This is just for practice.

  1. (12 pts) Please fill in the information at the top of this homework sheet, as usual. WRITE DARK, and remember, if you MUST submit it on multiple sheets, JUST write your name at the top of both sheets and turn in both sheets UNCONNECTED. No staples, paper clips, fold/tear etc or anything that would jam up the scanner.

  2. (20 pts) Write the definition of a Python function maskedPassword that takes one parameter pw and return a string consisting of the first three characters contained in the variable password followed by ‘x’s instead of the remaining characters in password. The length of the returned value should be the same as the length of the parameter passed in. (YOU MAY ASSUME pw is of type str)

  3. Write three test cases (in the style of the pytest module) that for the function maskedPassword as defined above.

    1. (8 pts) Write your one test case here:
    2. (8 pts) Write a second test case here:
    3. (8 pts) Write a third test case here:
  4. (20 pts) Write the definition of a Python function isValidPassword that takes a parameter pw and returns True if the variable password is of type str and is a valid password, according to the following rules: it must consist of at least 8 characters, include one of the special characters * or # and terminate with a numeric digit (0-9).

  5. Write three test cases (in the style of the pytest module) that for the function maskedPassword isValidPassword as defined above.

    1. (8 pts) Write one test case here:
    2. (8 pts) Write a second test case here:
    3. (8 pts) Write a third test case here: