-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5.py
More file actions
38 lines (27 loc) · 1.03 KB
/
5.py
File metadata and controls
38 lines (27 loc) · 1.03 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
class Movie:
def __init__(self, title, director):
self.title = title
self.director = director
self.is_watched = False
def display_info(self):
status = "Watched" if self.is_watched else "Not Watched"
print(f"Title: {self.title}, Director: {self.director}, Status: {status}")
def mark_watched(self):
self.is_watched = True
print(f"{self.title} has been marked as watched.")
m = Movie("Inception", "Christopher Nolan")
m.display_info()
m.mark_watched()
m.display_info()
print("\n\n\n")
class Friends:
def __init__(self, fun, care, love):
self.fun = fun
self.care = care
self.love = love
self.is_friend = True
def display_friendship(self):
status = "Friend" if self.is_friend else "Not a Friend"
print(f"Fun: {self.fun}, Care: {self.care}, Love: {self.love}, Status: {status}")
f = Friends("Laughing", "Helping", "Caring")
f.display_friendship()