-
Notifications
You must be signed in to change notification settings - Fork 0
/
oop.py
41 lines (29 loc) · 796 Bytes
/
oop.py
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
class Car:
def __init__(self, mark, model, color):
self.mark = mark
self.model = model
self.color = color
def get_listCar(self):
print(self.mark, self.model)
#crates new instance of class
ourCar = Car("Ford", "F-350", "Ruby Red")
yourCar = Car("Mazda", "3", "White")
print(ourCar.color)
ourCar.color = "purple"
print(ourCar.color)
'''
class Car:
def __init__(self, make, model, color):
self.make = make
self.model = model
self.color = color
# Method
def listCar(self):
print(self.make, self.model)
#Creates new instance of Class Car
ourCar = Car("Ford", "F-350", "Ruby Red")
yourCar = Car("Mazda", "3", "White")
print(ourCar.color)
ourCar.color = "Midnight Black"
print(ourCar.color)
'''