title: Program in Python that will prompt the user to enter an account number consists of 7 digits?
body: <p>I'm taking an intro Python course and a little stuck on an assignment. Any advice or resources would be greatly appreciated! </p>
  
  <p>Here's the problem:
  Write a program in Python that will prompt the user to enter an account number consists of 7 digits.</p>
  
  <p>After getting that account number from user, verify if the account is valid or not. You should have a list called current_accts that hold all valid accounts.</p>
  
  <p>Current valid accounts are shown below and you must use them in your program.</p>
  
  <p>5679034   8232322   2134988    6541234   3984591   1298345   7849123    8723217</p>
  
  <p>Verifying the account number entered should be done in a function called check_account() that will accept the account entered by the user and also the list current_accts. This function should return a 1 if account is valid otherwise return 0 if account is not valid.</p>
  
  <p>Here's what I've written so far, but I'm stuck and also receiving syntax errors for indentation in lines 6-15. I'm also receiving error messages saying that variable 'current_accts' is not defined. </p>
  
  <pre><code>prompt = "Please, enter the 8 digit account  number: "
  current_accts = current_accts[1:]
  current_accts [-1] = "valid"
  
  
  while True: 
      try:
        userinput = current_accts(prompt)
        if len(userinput ) &gt; 8:
          raise ValueError()
        userinput = int(userinput)
      except ValueError:
       print('The value must be an 8 digit integer. Try again')
      else:
          break 
  
  userinput = str(userinput)
  
  a =int(userinput[7])+int(userinput[5])+int(userinput[3])+int(userinput[1])
  b1 = str(int(userinput[6])*20)
  b2 = str(int(userinput[4])*20)
  b3 = str(int(userinput[2])*20)
  b4 = str(int(userinput[0])*20)
  y = int(b1[0])+int(b1[1])+int(b2[0])+int(b2[1])+int(b3[0])+int(b3[1])+int(b4[0])+int(b4[1])
  
  x = (a+y)
  
  if x % 10 == 0:
     print('The account number you entered is valid!')
  else:
     print('The account number you entered is invalid!')
  </code></pre>