-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoops.py
More file actions
126 lines (95 loc) · 2.94 KB
/
Copy pathoops.py
File metadata and controls
126 lines (95 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
class Student:
def __init__(self, name, age):
self.name = name
self.age = age
s1 = Student("Ayush", 20)
s2 = Student("Balvant", 20)
print(f"Student 1 is {s1.name} {s1.age}")
print(f"Student 2 is {s2.name} {s2.age}")
class Car:
def __init__(self, brand, price):
self.brand = brand
self.price = price
def show_detail(self):
print(f"Brand name: {self.brand} and its price is: {self.price}")
c1 = Car("Thar", 1000000)
c1.show_detail()
class Employee:
def __init__(self, name, salary):
self.name = name
self.salary = salary
def createObj(self):
c1 = Employee("Balvant", 54)
c1.showDetail()
def showDetail(self):
print(self.name, self. salary)
e1 = Employee("Ayush", 43555)
print(e1.name, " ", e1.salary)
e1.createObj()
class Mobile:
def __init__(self, brand, model):
self.brand = brand
self.model = model
def printDetail(self):
print(f"Mobile brand is {self.brand} and model is {self.model}")
m1 = Mobile("Vivo", "T2")
m2 = Mobile("Apple", "iphone")
m3 = Mobile("Vivo", "IQ")
m1.printDetail();
m2.printDetail();
m3.printDetail();
class Book:
def __init__(self, title, author):
self.title = title
self.author = author
def display(self):
print(f"Book name {self.title} and it\'s author is {self.author}")
b1 = Book("Playing it my way", "Sachin Tendulkar")
b2 = Book("Heart Lamp", "Banu mustak")
b1.display()
b2.display()
class College:
college_name = "BBD University"
def __init__(self, student_name):
self.student_name = student_name
def printDetail(self):
print(f"Student name: {self.student_name} and college name is: {self.college_name}")
a1 =College("Ayush")
a1.printDetail()
class Bike:
def __init__(self, brand, color):
self.brand = brand
self.color = color
def start(self):
print("Bike is starting......")
def printDetail(self):
print(f"Bike name: {self.brand} and its color is: {self.color}")
b1 = Bike("Hero", "Black")
b1.start()
b1.printDetail()
class Laptop:
def __init__(self, brand, RAM):
self.brand = brand
self.RAM = RAM
def printValue(self):
print(f"Your laptop brand is {self.brand} and its RAM is {self.RAM} ")
l1 = Laptop("HP", "12GB")
l2 = Laptop("Lenovo", "12GB")
l1.printValue()
l2.printValue()
class Techer:
def __init__(self, name, subject):
self.name = name
self.subject = subject
def printDetail(self):
print(f"Techer name: {self.name} and its subject {self.subject}")
t1 = Techer("Vinayak", "Python Programming")
t1.printDetail()
class Company:
company_name = "Infosys"
def __init__(self, emp_name):
self.emp_name = emp_name
def printDetail(self):
print(f"Employee name {self.emp_name} and he is working in {self.company_name}")
c1 = Company("Ayush")
c1.printDetail()