diff --git a/.appmodconfig b/.appmodconfig new file mode 100644 index 0000000..e69de29 diff --git a/Programs/P01_hello.py b/Programs/P01_hello.py index 5754bc3..82c9b60 100644 --- a/Programs/P01_hello.py +++ b/Programs/P01_hello.py @@ -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') \ No newline at end of file diff --git a/Programs/login.py b/Programs/login.py new file mode 100644 index 0000000..34ab7d2 --- /dev/null +++ b/Programs/login.py @@ -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