Input:-
Output:-
import
re
class
employee(object):
employee_id=0
employee_name=""
designation =""
Email_id=""
DOB =""
City =""
emailmatch =
"^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$"
dateofbirthmatch =
"^[0-3]?[0-9]/[0-3]?[0-9]/(?:[0-9]{2})?[0-9]{2}$"
def
set(self,employee_id,employee_name,designation,Email_id,DOB,City):
self.employee_id=employee_id
self.employee_name=employee_name
self.designation=designation
self.Email_id=Email_id
self.DOB=DOB
self.City=City
def get(self):
print()
print("Employee details:-")
print("Id:-",self.employee_id)
print("Name:-",self.employee_name)
print("Designation:-",self.designation)
if(re.search(self.emailmatch,self.Email_id)):
print(self.Email_id,"is
Valid")
else:
print(self.Email_id,"is not
Valid")
if(re.search(self.dateofbirthmatch,self.DOB)):
print(self.DOB,"is
Valid")
else:
print(self.DOB,"is not
Valid")
print("City",self.City)
class
Account(employee):
acc_id=0
acc_type=""
amount=0
def set(self,acc_id,acc_type,amount):
self.acc_id=acc_id
self.acc_type=acc_type
self.amount=amount
def get(self):
print()
print("Account details:-")
print("Account id
is:",self.acc_id)
print("Account type
is:",self.acc_type)
print("amount
is:",self.amount)
m =
employee()
m.set(1,"Parth","Developer","parthshah01@gmail.com","27/06/1993","Surat")
m.get()
m.set(1,"Parth","Developer","parthshah0ail.com","27/061993","Surat")
m.get()
h =
Account()
h.set(2,"Saving
Account",25000)
h.get()
Output:-
No comments:
Post a Comment