[Tutor] While Loop?

Sam Ball samball72 at hotmail.com
Wed May 14 11:45:07 CEST 2014


I'm attempting to create a program where the user inputs their account number (which must be 8 digits) and if what the user enters is not 8 digits in length I want python to tell the user this is invalid and then keep asking for the account number until a suitable number has been entered.
 I'm guessing it's a sort of while loop but I'm not 100% sure as I'm quite new to Python.
 
So far I have...



 
userAccountNumber = eval(input("Please Input Your Account Number:"))
while userAccountNumber > 100000000 or <=9999999:
    print userAccountNumber ("Invalid Account Number! Account Must Be Eight Digits")
 
 
 
When I run this however it gives me an invalid syntax and highlights the = in <=9999999:
 
Would appreciate any help with sorting this out.
 
Thank you.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140514/b021694e/attachment.html>


More information about the Tutor mailing list