Q3 class vehicle(): def start(self): print ("vehicle Start") class car(vehicle): def start(self): print ("car is started ") Swift=car() Swift.start() Output car is started
case sensitive,neenga ellam caps la kuduthurukeenga,keywords also class employee(): def __init__(self,name,salary): self.name=name self.salary=salary
class manager(employee): def __init__(self,name,salary,department): super().__init__(name,salary) self.department=department def display(self): print(self.name,self.salary,self.department) ob=manager("deepa","120000","IT") ob.display() this is crt ans
For 3rd question class vehicle (): def start(self): print("vehicle started") class car(vehicle): def start(self): print("car started") a1 = car() a1 . start() RESULT : car started
class Shape: def area(self): return 0 class Rectangle(Shape): def area(self,length,breadth): self.l=length self.b=breadth print(f"The lenght {self.l} and breadth {self.b} and the total {self.l*self.b}") obj_01=Rectangle() obj_01.area(12,13)
QN 4 with the help of user input: class employee(): def __init__(self,nam,salar): self.name=nam self.salary=salar class manager(employee): def __init__(self,depart): self.department=depart super(). __init__ (nam,salar) def display(self): print(self.name,self.salary,self.department) nam=input("Enter your name:") salar=int(input("Your salary:")) depart=input("Which department you are from?") obj1=employee(nam,salar) obj=manager(depart) obj.display()
Bro 3rd question ans is correct or not please tell bro class Vehicle(): def start(self): print("Vehicle Started...") class Car(Vehicle): def start(self): print("Car Started...") c1 = Car() c1.start()
@@premkumarms7607 but bro, we already declare the name and salary value self.name,self salary, then why we set value M1=manager name, salary, department
class employee(): def __init__(self,name,salary): self.name=name self.salary=salary class manager(employee): def __init__(self,name,salary,department): super().__init__(name,salary) self.department=department def display(self): print("The name of the employee is {} The salary of the employee is {} And the employee department is {}".format(self.name,self.salary,self.department))
Q3
class vehicle():
def start(self):
print ("vehicle Start")
class car(vehicle):
def start(self):
print ("car is started ")
Swift=car()
Swift.start()
Output
car is started
Class Employee();
def__init__(self,name, salary);
Self.name =name
Self.salary= salary
Class Manager (Employee);
def__init__(Self,name,salary, department);
Super().__init__(name,salary)
Self.department=department
def display (Self);
Print("Self.name,Self.salary, self.department)
M1= Manager(" John","50000","CSE")
M1.display()
case sensitive,neenga ellam caps la kuduthurukeenga,keywords also
class employee():
def __init__(self,name,salary):
self.name=name
self.salary=salary
class manager(employee):
def __init__(self,name,salary,department):
super().__init__(name,salary)
self.department=department
def display(self):
print(self.name,self.salary,self.department)
ob=manager("deepa","120000","IT")
ob.display()
this is crt ans
🎉
Task completed ✅
For 3rd question
class vehicle ():
def start(self):
print("vehicle started")
class car(vehicle):
def start(self):
print("car started")
a1 = car()
a1 . start()
RESULT :
car started
class Shape:
def area(self):
return 0
class Rectangle(Shape):
def area(self,length,breadth):
self.l=length
self.b=breadth
print(f"The lenght {self.l} and breadth {self.b} and the total {self.l*self.b}")
obj_01=Rectangle()
obj_01.area(12,13)
Idhuku output varudha
class employee():
def __init__(self,name,salary):
self.name=name
self.salary=salary
class manager(employee):
def __init__(self,name,salary,dept):
super().__init__(name,salary)
self.dept=dept
def display(self):
print("Name:",self.name,"Salary:", self.salary,"Dept:",self.dept)
m=manager("Arun","10000","Admin")
m.display()
output:
Name: Arun Salary: 10000 Dept: Admin
class employee():
def __init__(self,name,salary):
self.name=name
self.salary=salary
class manager(employee):
def __init__(self,name,salary,department):
super().__init__(name,salary)
self.department=department
def display(self):
print(self.name,self.salary,self.department)
m1=manager("Bhuven", "RM15000" , "IT")
m1.display()
class vehicle():
def start(self):
print("Vehicle Started")
class car(vehicle):
def start(self):
print("Car started")
suzuki=car()
suzuki.start()
Super() keyword ah vachi constructor matum tha inherit panni use panna mudiyum ah ila yantha function nalum use pannikalam ah
entha parent class ahh vena inherit panala bro
QN 4 with the help of user input:
class employee():
def __init__(self,nam,salar):
self.name=nam
self.salary=salar
class manager(employee):
def __init__(self,depart):
self.department=depart
super(). __init__ (nam,salar)
def display(self):
print(self.name,self.salary,self.department)
nam=input("Enter your name:")
salar=int(input("Your salary:"))
depart=input("Which department you are from?")
obj1=employee(nam,salar)
obj=manager(depart)
obj.display()
Sir 4th question is this correct sir
class Employee():
def __init__(self,name,salary):
self.name = name
self.salary =salary
class Manager(Employee):
def __init__(self,name,salary,dept):
self.dept = dept
super().__init__(name,salary)
def display(self):
print("Name :",self.name)
print("Salary :",self.salary)
print("Department :",self.dept)
m1 = Manager("Nandha",100000,"FSWD")
m1.display()
Hi Bro, could you please cover Regular expressions also ?
QN 2: (USER INPUT)
class person():
def __init__(self,name):
self.name=name
class student(person):
def __init__(self,name,grade):
super(). __init__ (name)
self.grade=grade
def display(self):
print(self.name,self.grade)
name=input("Enter your name:")
grade=float(input("Enter your grade:"))
obj=student(name,grade)
obj.display()
Last question super keyword use panaamale output varudhu
Apdi pana kudadha bro
16.02 name ah student class la store panalam la bro ( self.name= name)
Bcz inherit panirukom la Apdi save pana output varudhu.
Apdi pana kudadha?
panlam vro naa apdithan panen....
Bro,
Self.name="success"
Self.salary="30000"
Entha mathiri variable use panna mudiyuma
Yeah bro
Give more examples...
Bro 3rd question ans is correct or not please tell bro
class Vehicle():
def start(self):
print("Vehicle Started...")
class Car(Vehicle):
def start(self):
print("Car Started...")
c1 = Car()
c1.start()
Class employee:
def__init__(self,name,salary):
Self.name="success"
Self.salary="20000"
Class manager (employee):.
def__init__(self,name, salary,
department):
super ().__init__(name,
salary)
self department="CSE"
def display(self):
print(self.name,self.salary,
self. department)
M1=manager()
M1.display()
ERROR:
TYPE ERROR: manager.__init__() missing 3 required positional arguments:"name","salary","department"
Entha program enna mistake nu sollunka bro
class employee:
def __init__(self, name, salary):
self.name = "success"
self.salary = "20000"
class manager(employee):
def __init__(self, name, salary, department):
super().__init__(name, salary)
self.department = "CSE"
def display(self):
print(self.name, self.salary, self. department)
M1 = manager("Prem","20","CSE")
M1.display()
@@premkumarms7607
but bro, we already declare the name and salary value
self.name,self salary,
then why we set value M1=manager name, salary, department
Class Employee();
def__init__(self,name, salary);
Self.name =name
Self.salary= salary
Class Manager (Employee);
def__init__(Self,name,salary, department);
Super().__init__(name,salary)
Self.department=department
def display (Self);
Print("Self.name,Self.salary, self.department)
M1= Manager(" John","50000","CSE")
M1.display()
last prgm anwer thrla bro?
any on know the ans pls tell meee
Class Employee();
def__init__(self,name, salary);
Self.name =name
Self.salary= salary
Class Manager (Employee);
def__init__(Self,name,salary, department);
Super().__init__(name,salary)
Self.department=department
def display (Self);
Print("Self.name,Self.salary, self.department)
M1= Manager(" John","50000","CSE")
M1.display()
@@gayathribaskaran6530 tq❤
class employee():
def __init__(self,name,salary):
self.name=name
self.salary=salary
class manager(employee):
def __init__(self,name,salary,department):
super().__init__(name,salary)
self.department=department
def display(self):
print(self.name)
print(self.salary)
print(self.department)
m1=manager("ERAI","20000","SUPPORT")
m1.display()
class employee():
def __init__(self,name,salary):
self.name=name
self.salary=salary
class manager(employee):
def __init__(self,name,salary,department):
super().__init__(name,salary)
self.department=department
def display(self):
print("The name of the employee is {} The salary of the employee is {} And the employee department is {}".format(self.name,self.salary,self.department))
m1=manager("Arun",9000,"I.T")
m1.display()
class employee():
def __init__(self,name,salary) -> None:
self.name=name
self.salary=salary
class manager(employee):
def __init__(self, name, salary, dept) -> None:
super().__init__(name, salary)
self.dept=dept
def display(self):
print(self.name,self.salary, self.dept)
boj=manager("xyz", 1345645, "CS")
boj.display()
Vara Vara sollikodukathu puriya mattika
Ila bro first time enakum apdi tah irunchi but video va extra oru time pathu tu try Pannu bro
class employee():
def __init__(self, name, salary):
self.name = name
self.salary = salary
class manager(employee):
def __init__(self,name,salary,department):
self.department=department
super().__init__(name,salary)
def display(self):
print(self.name, self.salary,self.department)
m1=manager("Ronit", "20000", "Ops")
m1.display()
class employee():
def __init__(self,name, salary):
self.name=name
self.salary=salary
class manager (employee):
def __init__(self,name,salary, department ):
self.department=department
super ().__init__(name, salary)
def display (self):
print(self.name,self.salary,self.department)
m1=manager ("john","5k","cse")
m1.display()