Read the password function assignment again. It asks "How many such passwords are there?"
Do you think there is any other way of finding an answer for it? Remember, computer science is applied mathematics and as such many programming problems are mathematical in nature. This means that you can use (perhaps mathematical, or non programmatic) ways to determine the answer.
In short, if the length of the password is n and each character is one of the 70 allowed characters (a-zA-Z0-9 and 8 symbols: 26+26+10+8 = 70),
What is the total number of passwords possible if there were no restrictions?
What is the total number of passwords possible with the given restrictions that there is at least a character of each kind (lower case letter, upper case letter, decimal digit, and a symbol)?
Read the password function assignment again. It asks "How many such passwords are there?"
Do you think there is any other way of finding an answer for it? Remember, computer science is applied mathematics and as such many programming problems are mathematical in nature. This means that you can use (perhaps mathematical, or non programmatic) ways to determine the answer.
In short, if the length of the password is
n
and each character is one of the 70 allowed characters (a-zA-Z0-9
and 8 symbols: 26+26+10+8 = 70),