-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass_Example19.py
More file actions
29 lines (25 loc) · 880 Bytes
/
Class_Example19.py
File metadata and controls
29 lines (25 loc) · 880 Bytes
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
"""
Define a class called Bike that accepts a string and a float as input, and assigns those inputs respectively to two instance variables, color and price. Assign to the variable testOne an instance of Bike whose color is blue and whose price is 89.99. Assign to the variable testTwo an instance of Bike whose color is purple and whose price is 25.0.
"""
class Bike:
"""
Describes about the bike
"""
def __init__(self, color , price):
"""
Initializes the variable
:param color: assigns to color
:param price: assigns to price
"""
self.color = color
self.price = price
def __repr__(self):
"""
Represents the String
:return:
"""
return f"Bike({self.color},{self.price})"
testone = Bike('blue', 89.99)
testTwo = Bike('Purple', 25.0)
print(testone)
print(testTwo)