Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.
Join our LinkedIN Community.
Write a function that receives a password as a parameter and determines its complexity, according to these rules:
A very weak password contains only numbers and is less than eight characters long.
A weak password contains only letters and is less than eight characters long.
A strong password contains letters and at least one number, and is at least eight characters long.
A very strong password contains letters, numbers, and special characters and is at least eight characters long.
Passwords that are not weak or strong are normal.
Remember that in theory class we have seen the following predefined functions in Python:
isdigit
, to check if a string has digits.
isalpha
to check if a string only contains characters of the alphabet.
To test your function well, how many test cases have you run? Have you thought about both lowercase and uppercase?
Insist that the students test their programs by asking them
questions on what would be good test cases.