Skip to content

Commit 77027a2

Browse files
committed
playing with classes
1 parent e8e4a26 commit 77027a2

File tree

2 files changed

+93
-45
lines changed

2 files changed

+93
-45
lines changed

code-files/.idea/workspace.xml

+64-45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code-files/class_play.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
__author__ = "Harsh Thakkar"
2+
__license__ = "Creative Commons Attribution license (CC BY 4.0)"
3+
__email__ = "hthakkar@uni-bonn.de"
4+
__status__ = "Testing"
5+
6+
# define the Vehicle class
7+
class Vehicle:
8+
name = ""
9+
kind = "car"
10+
color = ""
11+
value = 100.00
12+
def description(self):
13+
desc_str = "%s is a %s %s worth $%.2f." % (self.name, self.color, self.kind, self.value)
14+
return desc_str
15+
# your code goes here
16+
car1 = Vehicle()
17+
car2 = Vehicle()
18+
car1.name = "Fer"
19+
car1.color = "red"
20+
car1.kind = "convertible"
21+
car1.value = 60000.00
22+
car2.name = "Jump"
23+
car2.color = "blue"
24+
car2.kind = "van"
25+
car2.value = 10000.00
26+
27+
# test code
28+
print(car1.description())
29+
print(car2.description())

0 commit comments

Comments
 (0)