@@ -77,25 +77,22 @@ def play(self, arg):
77
77
if isinstance (arg , str ):
78
78
self .movie = arg
79
79
self .current_chapter = 0
80
- print (self .description + " playing \" " + self .movie + " \" " )
80
+ print (f' { self .description } playing " { self .movie } "' )
81
81
elif isinstance (arg , int ):
82
82
if self .movie is None :
83
83
print (f"{ self .description } can't play chapter { arg } no movie selected" )
84
84
else :
85
85
self .current_chapter = arg
86
86
print (
87
- f"{ self .description } playing chapter { self .current_chapter } "
88
- + " of \" "
89
- + self .movie
90
- + "\" "
87
+ f'{ self .description } playing chapter { self .current_chapter } of "{ self .movie } "'
91
88
)
92
89
93
90
def stop (self ):
94
91
self .current_chapter = 0
95
- print (self .description + " stopped \" " + self .movie + " \" " )
92
+ print (f' { self .description } stopped " { self .movie } "' )
96
93
97
94
def pause (self ):
98
- print (self .description + " paused \" " + self .movie + " \" " )
95
+ print (f' { self .description } paused " { self .movie } "' )
99
96
100
97
def set_two_channel_audio (self ):
101
98
print (f"{ self .description } set two channel audio" )
@@ -104,6 +101,46 @@ def set_surround_audio(self):
104
101
print (f"{ self .description } set surround audio" )
105
102
106
103
104
+ class CdPlayer :
105
+ def __init__ (self , description , amplifier ):
106
+ self .description = description
107
+ self .current_track = 0
108
+ self .amplifier = amplifier
109
+ self .title = None
110
+
111
+ def __str__ (self ):
112
+ return self .description
113
+
114
+ def on (self ):
115
+ print (f"{ self .description } on" )
116
+
117
+ def off (self ):
118
+ print (f"{ self .description } off" )
119
+
120
+ def play (self , arg ):
121
+ if isinstance (arg , str ):
122
+ self .title = arg
123
+ self .current_track = 0
124
+ print (f'{ self .description } playing "{ self .movie } "' )
125
+ elif isinstance (arg , int ):
126
+ if self .title is None :
127
+ print (f"{ self .description } can't play track { self .current_track } , no cd inserted" )
128
+ else :
129
+ self .current_track = arg
130
+ print (
131
+ f'{ self .description } playing track { self .current_track } '
132
+ )
133
+
134
+ def eject (self ):
135
+ print (f'{ self .description } eject' )
136
+
137
+ def stop (self ):
138
+ print (f'{ self .description } stopped' )
139
+
140
+ def pause (self ):
141
+ print (f'{ self .description } paused "{ self .title } "' )
142
+
143
+
107
144
class Projector :
108
145
def __init__ (self , description , player ):
109
146
self .description = description
@@ -119,10 +156,10 @@ def off(self):
119
156
print (f"{ self .description } off" )
120
157
121
158
def wide_screen_mode (self ):
122
- print (self .description + " in widescreen mode (16x9 aspect ratio)" )
159
+ print (f" { self .description } in widescreen mode (16x9 aspect ratio)" )
123
160
124
161
def tv_mode (self ):
125
- print (self .description + " in tv mode (4x3 aspect ratio)" )
162
+ print (f" { self .description } in tv mode (4x3 aspect ratio)" )
126
163
127
164
128
165
class Screen :
0 commit comments