-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathidcheck.py
More file actions
31 lines (23 loc) · 727 Bytes
/
idcheck.py
File metadata and controls
31 lines (23 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import string
__author__ = 'patrick'
alphas = string.ascii_letters + '_'
nums = string.digits
overall = alphas+nums
print(alphas)
print(nums)
print('Welcome to the Identifier Checker v1.0')
print('Testees must be at least 2 chars long.')
my_input = input('Identifier to Test:')
print(my_input)
if len(my_input)>1:
if my_input[0] not in alphas:
print('''invalid input,
first symbols must be alphanumberic ''')
else:
for otherChar in my_input[1:]:
if otherChar not in overall:
print('''invalid:
remaining symbols must be alphanumberic but %s is not''' % otherChar)
break
else:
print('okay as an identifier')