python - int has no len error Help me please? -


i have problem program , it's annoying me keep getting error don't know why can please me?

i keep getting builtins.typeerror: object of type 'int' has no len() error

when gets password verfication stage , cannot figure out problem is..

#program asking username, password , security pin  #written cole johnston #19/08/13 -   #declare/initialize variables sfirstname = "" #user's input of first name (the minimum 2 characters) (string)  slastname = "" #user's input of last name (the minimum 4 characters) (string) spassword = "" #user's input of password (it must have minimum length of 6 characters , maximum length of 10 characters. must contain @ least 2 numbers in password, case sensitive) ipinno = 0 #user's chosen input of security pin (it must 4 characters long , contain numbers single digit , range between 0-9) icount = 0 #the amount of times user enters invalid username (integer) smessage = "" #message user (string) ifirstnamecheck=0 #checks first name ilastnamecheck=0 #checks last name ipasswordcheck=0 #checks password ipinnocheck=0 #checks pin susername = "" #creates username user (uses first , last name) spasswordverification = "" #checks password correct , same first 1  def apfirsterror():      print(("error: incorrect attemps consisting of 3 \n\t closing program"))      sys.ext   def apseconderror():      print (("error: incorrect attemps consisting of 3 \n\t closing program"))      sys.ext  def apthirderror():      print (("error: incorrect attemps consisting of 3 \n\t closing program"))      sys.ext  def apfourtherror():      print (("error: incorrect attemps consisting of 3 \n\t closing program"))      sys.ext   #ask users first name   while len(sfirstname) <2:       sfirstname=input("could please enter first name: ")       if len(sfirstname) <2:           print("\terror: i'm sorry, must enter minumum of 2 characters")          firstname = ""          ifirstnamecheck = ifirstnamecheck +1         print (ifirstnamecheck, "incorrect attempt")          if ifirstnamecheck == 3:              apfirsterror()   #ask users last name         while len(slastname)  <4:      slastname = input("could please enter last name: ")      if len(slastname) <4 :          print ("\terror: i'm sorry, must enter minumum of 4 characters")          lastname = ""          ilastnamecheck = ilastnamecheck +1         print (ilastnamecheck, "incorrect attempt")          if ilastnamecheck==3:              apseconderror()      susername = "congratulations, username " + slastname[0:4] + sfirstname[0:1]  print (susername)               while spassword "":      spassword=input("could please enter password: ")      if len(spassword) <6 or len(spassword) >10 :          print("error: i'm sorry, password must 6 characters or more not exceeding 10 characters.\nplease try again")          if sum(c.isdigit() c in spassword) <2:              print("im sorry, password not contain enough numbers.\nthe requirements minimum of 2 numbers")                      spassword=""              ipasswordcheck=ipasswordcheck+1             print(ipasswordcheck, "incorrect attempt")              if ipasswordcheck ==3:                  spassword="incorrect"                 aperrorthird()                              break   #verify password  while spasswordverification "":      spasswordverification=input("please enter password second time verification: ")      if spasswordverification==spassword:         print("that password accepted")          if not spasswordverification==spassword:              spasswordverification=""              print ("i'm sorry, password is: not accepted")                   #ask user pin creation  while len(ipinno) <4:      ipinno= input("now please create pin number. requirements must numbers (0-9). must 4 numbers long\n\tpin=?\t\n:")      if not re.match("^[1-9]*$", ipinno):          print ("error: i'm sorry numbers between 1-9 allowed!")          if len (ipinno) <4:              print ("i'm sorry, pin number must 4 characters.")              ipinnocheck=ipinnocheck+1             print (ipinnocheck, "incorrect attempt")              if ipinnocheck==3:                  ipinno ="incorrect"                 aperrorfourth()                   #display username, password , pin number  print ("okay, " + (sfirstname) +" username is: ",susername)  print("and, password is: ",spassword)    print ("finally , security pin is: ",ipinno)      

here: while len(ipinno) < 4:

ipinno integer, , you're not supposed call len() on integers (hence error): object passed len() must sequence or mapping.

convert string first, using str(), call len(), amount of digits.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -