-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.py
More file actions
60 lines (41 loc) · 1.26 KB
/
main.py
File metadata and controls
60 lines (41 loc) · 1.26 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
# # THIS IS A BLUEPRINT
# class Car:
# # CONSTRUCTOR METHOD
# def __init__(self, model, year, color, dates_of_service):
# self.model = model
# self.year = year
# self.color = color
# self.dates_of_service = dates_of_service
# def greet(self):
# print("VROOOOOM")
# def print_service_dates(self):
# for date in self.dates_of_service:
# print(date)
# cars = []
# while len(cars) < 2:
# model = input("Wht brand do you want? ")
# year = input("What year? ")
# color = input("What color? ")
# services = []
# new_car = Car(model, year, color, services)
# cars.append(new_car)
# print(cars)
# print("We're full")
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
print("Hi")
def __str__(self):
return f"Hi I'm {self.name}, and I'm {self.age} years old"
class Student(Person):
def __init__(self, name, age, grade):
super().__init__(name, age)
self.grade = grade
def __str__(self):
return f"{super().__str__()} and my grade is {self.grade}"
person_one = Person("Laila", 25)
print(person_one)
student_one = Student("Abbas", 55, 100)
print(student_one)