start of day 2
This commit is contained in:
19
week 1/day 2/exo3.py
Normal file
19
week 1/day 2/exo3.py
Normal file
@@ -0,0 +1,19 @@
|
||||
name = input("please enter your name: ")
|
||||
badChar = False
|
||||
|
||||
for ch in name:
|
||||
if ch == ' ' or ( '0' <= ch <= '9'):
|
||||
badChar = True
|
||||
break
|
||||
|
||||
|
||||
# verify if name less than 20 charachter, start with a letter and don't contain a bad Chararccer
|
||||
|
||||
first = name[0]
|
||||
isLetter = ('A' <= first <= 'Z') or ( 'a' <= first <= 'z')
|
||||
|
||||
|
||||
if(len(name) <= 20 and badChar == False and isLetter ):
|
||||
print("Accepted")
|
||||
else:
|
||||
print("Refused")
|
||||
Reference in New Issue
Block a user