Skip to content
Snippets Groups Projects
Commit 4b65f254 authored by Pál Boldizsár's avatar Pál Boldizsár
Browse files

harmadik feladat

parent ebec44cd
No related branches found
No related tags found
No related merge requests found
"""
ez file lenne ami ossyekoti a db-t a programunkal. hogy egyszerubb legyen
az eletunk, ezert most csak egyszeru dictekbe, meg setekbe tarolunk mindent
"""
fake_db = {}
def check_user_name(username=None):
if not username:
return 'No name given'
if username in fake_db['u_names']: # legyen u_names a usernevek setje
return 'Username taken'
else:
return ''
def hasNumbers(inputString):
return any(char.isdigit() for char in inputString)
def validate_password(password=None):
if isinstance(password, str) is False:
return 'Bad password'
elif len(password) < 8 or 'dick' in password:
return 'Password is too short'
elif hasNumbers(password) is False:
return 'must contain number'
else:
return ''
def create_user(username, password):
try:
fake_db['u_names'].add(username)
fake_db['users'].append({'Username': username, 'Password': password})
except Exception as e:
return 'oopsie', e
return True
>>> def Kiiro():
... print("gimme your name")
... txt = input()
... print(txt)
...
>>> Kiiro()
...@@ -3,5 +3,6 @@ def Kiiro(): ...@@ -3,5 +3,6 @@ def Kiiro():
txt = input() txt = input()
print(txt) print(txt)
if __name__ == "__main__": if __name__ == "__main__":
Kiiro() Kiiro()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment