Sep-04-2019, 10:11 PM
Hello! I'm trying to run any code but my Kernel needs to be re-started all the time (I have Windows, is that related?), besides I have syntax problems. If someone can help me, I would really appreciate it!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#3. A website requires a user to input username and password to register. # Write a program to check the validity of password given by user. # Following are the criteria for checking password: # 1. At least 1 letter between [a-z] # 2. At least 1 number between [0-9] # 3. At least 1 letter between [A-Z] # 4. At least 1 character from [$#@] # 5. Minimum length of transaction password: 6 # 6. Maximum length of transaction password: 12 #Hint: In case of input data being supplied to the question, #it should be assumed to be a console input. name = str ( input ( 'Name: ' , )) password = str ( input ( 'Enter a password with: At least 1 capital or lower case letter, 1 number and 1 of these characters: $#@. The password must have between 6 and 12 characters ' , )) |
Error:File "<ipython-input-2-97a716fd38be>", line 6
if not password.isupper() and not password.islower() and not password.isnum()
^
SyntaxError: invalid syntax
1 2 |
characters = list (password) special_characters = [ '$' , '#' , '@' ] |
Error:NameError Traceback (most recent call last)
<ipython-input-3-a33fe6ef79e7> in <module>
----> 1 characters=list(password)
2 special_characters=['$', '#','@']
NameError: name 'password' is not defined
1 2 3 4 5 |
if not password.isupper() and not password.islower() and not password.isnum() and character in special_charaters and len (password)> = 6 and len (password)< = 12 print ( 'Valid password' ) else print ( 'Invalid password' ) password = str ( input ( 'Enter a password with: At least 1 capital or lower case letter, 1 number and 1 of these characters: $#@. The password must have between 6 and 12 characters ' , )) |