diff --git a/banking_app/login.py b/banking_app/login.py index 2bbab36..ad67b2f 100644 --- a/banking_app/login.py +++ b/banking_app/login.py @@ -1,6 +1,10 @@ # login.py - Placeholder for login functionality def login(username, password): + + if username== "" or password=="" : + raise ValueError("All field are requred") + print ("Signup susscessful!") """ Handles the user login process by verifying the provided username and password. diff --git a/banking_app/signup.py b/banking_app/signup.py index a920e5b..9e466ec 100644 --- a/banking_app/signup.py +++ b/banking_app/signup.py @@ -1,7 +1,21 @@ # signup.py - Placeholder for signup functionality def signup(username, password, email): - """ + + if username== "" or password=="" or email== "": + raise ValueError("All field are requred") + print ("Signup susscessful!") + + if (len(password) < 8 or + all(char.isdigit() == False for char in password) or + all(char.isupper() == False for char in password) or + all(char.islower() == False for char in password) or + all(char in "!@#$%^&*()_+-=[]{}|;:',.<>?/`~" == False for char in password)): + raise ValueError("Password does not meet minimum requirements") + + + +""" Handles the user signup process by validating the provided username, password, and email. Instructions for Implementation: diff --git a/banking_app/user_management.py b/banking_app/user_management.py index fd7d1e0..02c7322 100644 --- a/banking_app/user_management.py +++ b/banking_app/user_management.py @@ -6,6 +6,7 @@ def read_users(): """Reads all users from the CSV database and returns a list of dictionaries.""" users = [] try: + with open(DATABASE_FILE, mode='r') as file: reader = csv.DictReader(file) for row in reader: @@ -36,4 +37,4 @@ def write_users(users): "balance": f"{user['balance']:.2f}", }) except Exception as e: - raise RuntimeError(f"Failed to write to database: {str(e)}") # except this error in your code + raise RuntimeError(f"Failed to write to database: {str(e)}") # except this error in your code \ No newline at end of file diff --git a/functions_to_test.py b/functions_to_test.py index 330fa02..8301489 100644 --- a/functions_to_test.py +++ b/functions_to_test.py @@ -1,36 +1,49 @@ # Placeholder functions for Python basics, to be implemented later def add_numbers(a, b): - pass + return (a+b) def find_maximum(a, b, c): - pass + return max(a,b,c) + + def is_palindrome(string): - pass + string = string.replace(" ","") + reversed_word = string[::-1] + return string.lower() == reversed_word.lower() def count_word_occurrences(text, word): - pass + text.lower().count(word.lower()) def read_file_lines(filepath): - pass + with open('filepath', 'r') as file: + file = file.readlines() + for line in file: + print(line.strip()) + def factorial(n): - pass + if n == 0: + return 1 + else: + return n* factorial(n-1) -def is_prime(n): - pass + + def is_prime(n): + pass def sort_numbers(numbers): - pass + return sorted(numbers) def factorial(n): pass def fibonacci(n): - pass + + -def tower_of_hanoi(n, source, auxiliary, target): + def tower_of_hanoi(n, source, auxiliary, target): """ Solve the Tower of Hanoi problem for n disks.