Browse Source

POLYMORPHISM

Mahiva 2 weeks ago
parent
commit
805c791a23
4 changed files with 82 additions and 0 deletions
  1. 5 0
      MULTIPLICATION TABLE
  2. 37 0
      day 11
  3. 24 0
      dy 12
  4. 16 0
      login.py

+ 5 - 0
MULTIPLICATION TABLE

@@ -0,0 +1,5 @@
+#MULTIPLICATION TABLE
+num = int(input("Enter a number to display its multiplication table: "))
+for i in range(1, 11):
+    print(num, 'x', i, '=', num*i)
+    

+ 37 - 0
day 11

@@ -0,0 +1,37 @@
+#1 GRADE CALCULATOR
+#Write a code that accepts user input for grade and will record them as A,B, C, D,E orF based on the following scale:
+# A: 80-100 
+# B: 70-79
+# C: 60-69
+# D: 50-59
+# E: 40-49
+# F: Below 40
+
+#2 LOGIN SYSTEM
+#Accept username and password
+#USERNAME: THURSDAY
+#PASSWORD: 90DAYS
+
+#3 MULTIPLICATION TABLE
+
+Grade = input("Enter your grade: ") 
+
+if 80<=Grade<=100:
+    print("A")
+elif 70<=Grade<=79:
+    print("B")
+elif 60<=Grade<=69:
+    print("C")
+elif 50<=Grade<=59:
+    print("D")
+elif 40<=Grade<=49:
+    print("E")
+elif 40>Grade:
+    print("F")  
+else:
+    print("error")  
+
+    
+
+
+

+ 24 - 0
dy 12

@@ -0,0 +1,24 @@
+#POLYMORPHISM
+class Employee:
+    def work(self):
+        print("Employee is working")
+
+class Manager(Employee):
+    def work(self):
+        print("Manager is managing")
+
+class Developer(Employee):
+    def work(self):
+        print("Developer is coding")
+
+class Designer(Employee):
+    def work(self):
+        print("Designer is designing")
+
+manager = Manager()
+developer = Developer()
+designer = Designer()
+
+manager.work()
+developer.work()
+designer.work()

+ 16 - 0
login.py

@@ -0,0 +1,16 @@
+#LOGIN SYSTEM
+username = "THURSDAY"
+password = "9DAYS"
+
+while True:
+    entered_username = input("Enter your username: ")
+    entered_password = input("Enter your password: ")
+
+    if entered_username == username and entered_password == password:
+        print("Login successful!")
+        break # stop the loop if login is successful
+    else:
+        print("Invalid username or password. Please try again.")
+
+
+