ic01 : Review for Final Exam
num | ready? | description | assigned | due |
---|---|---|---|---|
ic01 | true | Review for Final Exam | Wed 09/05 09:30AM | Wed 09/05 10:50AM |
-
Write the definition of a Python function
maskedPassword
that takes one parameterpassword
and return a string consisting of the first three characters contained in the variablepassword
followed by ‘x’s instead of the remaining characters inpassword
. The length of the returned value should be the same as the length of the parameter passed in. (YOU MAY ASSUMEpassword
is of typestr
) -
Write three test cases (in the style of the
pytest
module) that for the functionmaskedPassword
as defined above.- Write your one test case here:
- Write a second test case here:
- Write a third test case here:
-
Write the definition of a Python function
isValidPassword
that takes a parameterpassword
and returns True if the variablepassword
is of typestr
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
). -
Write three test cases (in the style of the
pytest
module) that for the functionmaskedPasswordisValidPassword
as defined above.- Write one test case here:
- Write a second test case here:
- Write a third test case here: