start of day 2

This commit is contained in:
2026-01-21 11:03:09 +01:00
parent 0b7a3a698a
commit 2fed48e17f
4 changed files with 80 additions and 0 deletions

19
week 1/day 2/exo3.py Normal file
View 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")