Adds python code (#7)

This commit is contained in:
Abhishek Singh Thakur
2022-10-13 19:54:41 +05:30
committed by GitHub
parent 8c24d0345a
commit 59d2d5acfb
19 changed files with 221 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
from oop.inheritance.User import *
from oop.inheritance.StudentStatus import *
class Student(User):
__status = StudentStatus.ACTIVE
def __init__(self, name: str, email: str, batch_name: str, psp: int) -> None:
super().__init__(name, email)
self.__batch_name = batch_name
if (psp < 0 or psp > 100):
raise Exception("PSP should be between 0 and 100")
self.__psp = psp
def print_details(self) -> None:
print("In Student", self.get_name(), self.__batch_name)
def change_batch(self, batch_name: str) -> None:
self.batch_name = batch_name

View File

@@ -0,0 +1,6 @@
from enum import Enum
class StudentStatus(Enum):
ACTIVE = 1
PAUSED = 1
COMPLETED = 1

View File

@@ -0,0 +1,16 @@
class User:
def __init__(self, name: str, email: str) -> None:
self.__name = name
self.__email = email
def change_email(self, email: str) -> None:
self.__email = email
def get_name(self) -> str:
return self.__name
def print_details(self) -> None:
print("Print with no args")
def print_details(self, title: str) -> None:
print("\n In User:", title, self.get_name())