Files
7-Modern-Languages-in-7-Wee…/week 1/day 2/exo4.py
2026-01-21 11:27:18 +01:00

16 lines
424 B
Python

users = ["admin", "root1", "John_Doe", "Alice", "Bob42"]
badChar=False
for user in users:
for ch in user:
if ('a' <= ch <='z') or ('A' <= ch <='Z') or ch == ' ':
badChar=False
else:
badChar=True
break
if badChar == False and len(user) <= 20:
print(user + " is Valid")
else:
print(user + " Error contain special character, space or digit !")