Tuesday 15 May 2012

python possible indentation error? don't know what's gone wrong? -



python possible indentation error? don't know what's gone wrong? -

i'm having issues programme had completed it. don't see much wrong error saying "while" syntax error.

pass1 = raw_input("please come in password(must contain number,at to the lowest degree 1 capital letter , must longer 6 characters): ") time.sleep(1) pass2 = raw_input("please re-enter password: ") updown = any(map(str(isupper, pass1)) while not pass1 or not pass1 == pass2 or not num_there(pass1) == true or len(pass1) < 6: if updown == false: print "\n password not accepted!" pass1 = raw_input("please come in password(must contain number,at to the lowest degree 1 capital letter , must longer 6 characters): ") time.sleep(1) pass2 = raw_input("please re-enter password: ") else: go on else: print "password accepted!" f.write(pass1)

you missing closing parenthesis:

updown = any(map(str(isupper, pass1)) # ^ ^ ^ ^^? # \ \ \------------/// # \ ----------------// # --------------------

fix problem adding missing 3rd ):

updown = any(map(str(isupper, pass1)))

python allows logical lines implicitly span multiple physical lines, provided surround look in parentheses or brackets or braces.

but means if missing closing parenthesis, python doesn't find out there problem look until next line.

so, rule of thumb, if syntax error in python doesn't create sense, @ lines before , count brackets.

however, in case added opening parentheses should have used .. look tried utilize should be:

updown = any(map(str.isupper, pass1))

python syntax-error

No comments:

Post a Comment