Can't Assign to Literal in Python -


i'm receiving error in python says i, "can't assign literal". hoping me understand why coming up. here's code:

# chapter 3 challenge part 3 # use code below , following # directions see if can solve problem  # co-worker has been asked write #   1st time "log-in" program in user has #    sign in user name. if enter #    correct id name need asked #    create password.  #   required make sure user did #   not leave username entry blank , must have #   correct user name or progam should re-ask #   them sign in... cannot figure out #   do, have called on help...  #   here have far... #   started program this.... #   , included of documentation.    # username, check see if not empty, # verify username correct. # using username "jalesch" test user. name = false while not name:     name = raw_input("enter user name: ")  print "welcome," , name ,  "you must create password."  password = false  while not password:     password = raw_input("""enter password. password must @ least 6 characters in length, , must include 1 of these symbols (!, $, ?, &): """)     while len(password) < 6:         "!" in password or "$" in password or "?" in password or "&" in password:             password = raw_input("""enter password. password must @ least 6 characters in length, , must include 1 of these symbols (!, $, ?, &): """)      print "this has met requirements."  check = raw_input("please re-enter password:") while check != password:     print "you have entered wrong password"     check = raw_input("please re-enter password:") print "welcome program!"   # prompt user create password meets # following requirements: #       - must @ least 6 characters in length #       - must include @ least 1 of these 4 symbols #           - ! $ ? & # once user has entered password, program #  must check see if meets requirements. #   if requirements not met, should reask them #   put in password meets requirements #   until correct. #   test password is:  $program!  #   if meets requirements prompt user #   re enter password, , check #   first , second entry matches. #       if 1st , 2nd match. display "welcome program" #       if 1st , 2nd don't match, re-prompt password #       until correct match.  

i believe code malfunctioning when try find special characters, because skipping 1 of while loops. appreciated, thanks.

on line:

for "!" in password or "$" in password or "?" in password or "&" in password: 

you meant use if:

if "!" in password or "$" in password or "?" in password or "&" in password: 

for x in y iterates on y, assigning each member x sequentially, running following indented code in loop each member of y. can't assign value "!" because that's literal character, not variable.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -