Skip to content
Closed
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
Empty file added .appmodconfig
Empty file.
9 changes: 8 additions & 1 deletion Programs/P01_hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
def justPrint(text):
'''This function prints the text passed as argument to this function'''
print(text)
a=10
b=20
c=a+b
d=b-a
e=c+d
print(c,d,e)

if __name__ == '__main__':
justPrint('Hello')
justPrint('Hello Sindhuja')
justPrint('Welcome to Python Programming')
32 changes: 32 additions & 0 deletions Programs/login.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class LoginSystem:
def __init__(self):
self.valid_email = "user@test.com"
self.valid_password = "Password@123"
self.failed_attempts = 0
self.locked = False

def login(self, email, password):
if self.locked:
return "Account is locked. Contact support."

if email == self.valid_email and password == self.valid_password:
self.failed_attempts = 0
return "Login Successful ✅"

else:
self.failed_attempts += 1

if self.failed_attempts >= 3:
self.locked = True
return "Account locked due to 3 failed attempts ❌"

return f"Invalid credentials. Attempts left: {3 - self.failed_attempts}"

# ----- Testing the function -----

app = LoginSystem()

print(app.login("wrong@test.com", "123")) # Test case 1
print(app.login("wrong@test.com", "123")) # Test case 2
print(app.login("wrong@test.com", "123")) # Test case 3 (locks account)
print(app.login("user@test.com", "Password@123")) # Should fail because account is locked