0

It seemed to work fine until I started the 'is this in this string' bit.

#This is the introduction to the code
import time
MinPass = 6
MaxPass = 12
Uppercase = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
Lowercase = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
Symbols = ["!", "£", "$", "%", "^", "&", "*", "(", ")", "_", "-", "+", "=", ":", ";", "@", "'", "#", "~", "<", ">", "?", "/", "|", "¬", "`"]
print ("Hello, user, welcome to the SSPC program, or the Safe and Secure Password Creater.")

print ("Please type your name")
NAME = input()
print ("Great. For a secure password, do not use your name,", NAME, "!")
time.sleep(2)
print ("Now, lets try with a password. Please enter one here")
EnteredPassword = input("Password: ")
while len(EnteredPassword) < MinPass:
    print ("That password is too small. Please try again")
    EnteredPassword = input("Password: ")
while len(EnteredPassword) > MaxPass:
    print ("That password is too long, please try again")
    EnteredPassword = input("Password: ")
print ("Ok, that password is great!")

if EnteredPassword not in Uppercase:
    continue
    if EnteredPassword not in Symbols:
        print ("Your password is weak")
        continue
elif EnteredPassword in Uppercase:
    continue
    if EnteredPassword in Lowercase:
        continue
    elif EnteredPassword not in Lowercase:
        continue
        if EnteredPassword in Symbols:
            print ("Your password is medium")
        elif EnteredPassword not in Symbols:
            print ("Your password is weak")
elif EnteredPassword in Lowercase:
    continue
    if EnteredPassword in Uppercase:
        continue
        if EnteredPassword in Symbols:
            print ("Your password is strong")
elif EnteredPassword not in Lowercase:
    continue
    if EnteredPassword in Symbols:
        print ("Your password is medium")
    elif EnteredPassword not in Symbols:
        print ("Your password is weak")   

The error message that comes up: continue not properly in loop. What is wrong? It worded fine until the 'continue' parts and I don't know what's wrong... I would appreciate any help please...

gmuraleekrishna
  • 3,375
  • 1
  • 27
  • 45
Lucas
  • 54
  • 1
  • 11
  • In Python indentation is part of language syntax. Is indentation in question 100% as in your code? – Łukasz Rogalski May 20 '16 at 10:01
  • You should try to include an [mcve] instead of the entire program. This will help you isolate the problem yourself, and if you can't, save the time of others because they won't have to read the entire thing. – Arc676 May 20 '16 at 10:01
  • 2
    `continue` is a statement that immediately causes a loop statement (`for`, `while`) to go to the next iteration. You are using `continue` inside an `if` statement without a loop. You also might want to re-check your code. I'm pretty sure e.g. `EnteredPassword not in Uppercase` does not do what you expected it to. – dhke May 20 '16 at 10:02
  • 1
    Take a look at [regex](http://stackoverflow.com/questions/2990654/how-to-test-a-regex-password-in-python). Easier way to do it btw. – ElTête May 20 '16 at 10:03
  • `import string; list(string.ascii_lowercase)` or `list(string.ascii_uppercase)` #=> alphabet as a list; also `list(string.punctuation)` #=> symbols – gmuraleekrishna May 20 '16 at 10:07

1 Answers1

0

I think the problem is in these lines of code

if EnteredPassword not in Uppercase:
    ...
elif EnteredPassword in Uppercase:
    ...

and so on your UPPERCASE variable is a list of characters and EnteredPassword is a string in that case "in" won't be able to fulfill what you are trying to do here.

and secondly "continue" is not working here as you have expected !

Just saw somebody already commented that out. apology for repetition !

sumit
  • 3,210
  • 1
  • 19
  • 37