Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions banking_app/login.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# login.py - Placeholder for login functionality

def login(username, password):

if username=='' or password=='':
raise ValueError
elif not username.isalnum() or not password.isalnum():
raise ValueError
else:
return True
"""
Handles the user login process by verifying the provided username and password.

Expand Down
45 changes: 45 additions & 0 deletions banking_app/signup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
# signup.py - Placeholder for signup functionality

import string
def is_password_secure(password):

uppercase=0
lowercase=0
digit=0
special=0

if len(password)<8:
return False

for i in password:
if i.isupper():
uppercase += 1
if uppercase==0:
return False

for i in password:
if i.islower():
lowercase += 1
if lowercase==0:
return False

for i in password:
if i.isdigit():
digit+=1
if digit==0:
return False

# for i in password:
# if i in string.punctuation:
# special+=1
# if special==0:
# return False
return True




def signup(username, password, email):
if username=='' or password=='' or email=='':
raise ValueError
if is_password_secure(password)==False:
raise ValueError
else:
return True
"""
Handles the user signup process by validating the provided username, password, and email.

Expand Down
21 changes: 21 additions & 0 deletions banking_app/transaction.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
# transaction.py - Placeholder for transaction functionality

def transact(sender_account, receiver_account, amount):
if sender_account==receiver_account:
raise ValueError
if amount<=0:
raise ValueError

with open("database.csv",'r') as f:
the=f.read().splitlines()
for i in the:
i.split(',')
if sender_account not in the or receiver_account not in the:
raise ValueError
# else:

# for i in the:
# if sender_account in i:
# if int(i[-1])<amount:
# raise ValueError
# else:
# int(i[-1])-=amount
# if receiver_account in i:
# int(i[-1])+=amount
"""
Handles the transfer of funds between two user accounts.

Expand Down
81 changes: 71 additions & 10 deletions functions_to_test.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,91 @@
# 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
maximum=[a,b,c]
return max(maximum)

def is_palindrome(string):
pass
if string==string[::-1]:
return True
else:
return False

def count_word_occurrences(text, word):
pass

if isinstance(text, int):
raise TypeError
else:
count=0
word1=text.lower()
for i in word1.split():
if i == word :
count+=1
return count


def read_file_lines(filepath):
pass
with open(filepath,'r') as f:
the=f.read().split()

return the

def factorial(n):
pass
if n<0:
raise ValueError
elif isinstance(n, str):
raise TypeError
else:
# count=1
# if n==0:
# return count
# else:
# for i in range(n+1):
# count*=i
return n


def is_prime(n):
pass
if n<0:
raise ValueError
elif isinstance(n, str):
raise TypeError
else:
count=0
for i in range(2,n):
if n%i==0:
count+=1
if n==1:
return False
elif count>0:
return False
else:
return True

def sort_numbers(numbers):
pass
if len(numbers)>0:
for i in numbers:
if isinstance(i,str):
raise TypeError
else:
return sorted(numbers)
else:
return numbers

def factorial(n):
pass

def fibonacci(n):
pass
if n==0 or n==1:
return n
else:
count=[0,1]
for i in range(n):
num=count[-1]+count[-2]
count.append(num)
return count

def tower_of_hanoi(n, source, auxiliary, target):

Expand All @@ -52,7 +109,11 @@ def tower_of_hanoi(n, source, auxiliary, target):

class Person:
def __init__(self, name, age):
pass
if isinstance(name,str) and isinstance(age,int):
self.name=name
self.age=age
else:
raise TypeError


if __name__ == "__main__":
Expand Down