8点下课到家也9点多。眼睛抬不起来
明天到周二要为好几十个兄弟姐妹们,完成日志和反馈表,还要保证低错误。明天还要完成单位的一些工作。
哦对了,还有这些兄弟姐妹们的视频。
好先看一下Fan类的代码,它继续存在exCode07
class Fan:
SLOW = 1
MEDIUM = 2
FAST = 3
def __init__(self, speed=1, on=False, radius_num=1, color_num="blue"):
self.speed = speed
self.on = on
self.radius_num = radius_num
self.color_num = color_num
def set_on(self, on):
self.color_num = on
def get_on(self):
return self.on
def set_speed(self, speed):
self.speed = speed
def get_speed(self):
if self.speed == 3:
print("Speed is FAST")
return self.speed
elif self.speed == 2:
print("Speed is MEDIUM")
return self.speed
elif self.speed == 1:
print("Speed is SLOW")
return self.speed
def set_radius(self, radius):
self.radius_num = radius
def get_radius(self):
return self.radius_num
def set_color_num(self, color):
self.color_num = color
def get_color_num(self):
return self.color_num
接下来是main 两个
import exCode07
def main():
method_txt= eval(input("Enter method number: "))
speed_int =eval(input("Enter speed number: "))
on_off= input("Enter on or off is: ")
radius_int = eval(input("Enter radius number: "))
color_int = input("Enter color name: ")
a =exCode07.Fan(speed_int,on_off,radius_int,color_int)
print(f"method{method_txt} on is {a.get_on()}")
print(f"method{method_txt} speed is {a.get_speed()} and radius is {a.get_radius()}")
print(f"method{method_txt} color is {a.get_color_num()}")
main()
main()