So I'm using Textwrangler and running my script through Terminal. Everything in the script works fine on its own, but as an example, if I enter the birthdate in incorrectly, instead of asking me again for it, it just keeps moving on through the script. How do I repeat that part until all the criteria has been met?
Here is my script, it's simple and it's my first python program. I'm following along with the CS course for MIT online.
As an example, if I go in and enter nothing when it asks for my birthdate, it will print "I told you to enter your birthdate." but it moves on after that and makes you enter your last name.
birthdate = raw_input('Enter your birthdate here.')
if len(birthdate) > 0:
print 'Good job. Now:'
print 'I told you to enter your birthdate.'
last_name = raw_input('Enter your last name here.')
if len(last_name) > 0 and last_name.isalpha():
print "Good job. You entered:" + ' ' + last_name + ' ' + birthdate + '.'
print 'I told you to enter your last name, dammit. Pay attention!'