Skip to content

Instantly share code, notes, and snippets.

@nullset2
Created December 2, 2015 22:38
Show Gist options
  • Save nullset2/0f217e7f0debddcfa930 to your computer and use it in GitHub Desktop.
Save nullset2/0f217e7f0debddcfa930 to your computer and use it in GitHub Desktop.
import re
while True:
input_str = raw_input("What's your name? ") #reads user input
if ( re.match('[0-9]+', input_str) ): # while the input doesn't match the pattern "one or more numbers in the string"
print "Your name must NOT include numbers." #error out of the program
else:
break
print "if you see this, the entered name fullfilled the logical condition"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment