Skip to content

Commit fb5d9fc

Browse files
committed
Python
1 parent a2040f5 commit fb5d9fc

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

day43(inheritance).py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def show(self):
88

99
class programmer(Employee):
1010
def showlang(self):
11-
print("h=my fav lang is Python")
11+
print("my fav lang is Python")
1212

1313

1414
e=Employee("vishal",420)

day46(instance).py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Employee:
2+
company="Linit " #ye claSSS se associated hai # ye class variable h
3+
noofemplyee=0
4+
def __init__(self,name):
5+
self.name=name
6+
self.income=2.0 # instance se relsted h
7+
Employee.noofemplyee+=1
8+
def showdetails(self):
9+
print(f"the name of the employee is {self.name} of sized {self.noofemplyee} of {self.company},his salary is {self.income}")
10+
emp1=Employee("vishal")
11+
emp1.income=50 # ye jo h insatnce se related h
12+
emp1.company="Blinkit"
13+
emp1.showdetails()
14+
Employee.company="blinkeee"
15+
print(Employee.company)
16+
emp2=Employee("Vipul")
17+
emp2.company="happy"
18+
emp2.showdetails()

ex-6 (LMS).py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Library:
2-
def __init__(self):
2+
def __init__(self):
33
self.noBooks = 0
44
self.books = []
55

0 commit comments

Comments
 (0)