This preview shows page 1. Sign up to view the full content.
Unformatted text preview: or a user setting up a new account of some sort) until one is given, or the
user reaches the maximum guesses allowed. You must use a while-loop in your solution. You may assume
that max_attempts is at least 1.
t ID: Tes : 16 80 ID
Do wn lo ad er ID 29 85 Te def get_password (max_attempts):
’’’Prompt the user for a valid password until a valid one is given
or they have entered max_attempts invalid passwords.
A valid password is one that is at least length 6 and is not the word "password".
Each time the user gives an invalid password, tell them that it
was invalid and prompt again if they have not reached max_attempts tries.
If the user gives max_attempts invalid passwords, return the empty string;
otherwise return the valid password they gave’’’.
Te st ID : 16 80 16 ade r ID: 298
5 ID: 2985 ID
oader om nlo 80 Dow Te 2985
c st 80 16 nlo Dow ad
e r ID : de
dd r ID: ade Do wn 5 lo 298 er ID: 2985 85
0 Tes t ID: 168 :...
View Full Document
This note was uploaded on 11/27/2010 for the course CS 108 taught by Professor Paulgries during the Spring '08 term at University of Toronto- Toronto.
- Spring '08