|
发表于 2018-1-30 11:37:36
|
显示全部楼层
本帖最后由 sky 于 2018-1-30 15:00 编辑
刷题? 看着还好像是机器翻译的
1 是让你写一个convert_to_f函数 功能是转换摄氏温度为华氏温度
公式:οF = ℃ × 1.8 + 32
- def convert_to_f(c):
- f = c * 1.8 + 32
- return f
复制代码
2 用python写一个box类 box对象有width height length属性 有volume方法和area方法计算体积和面积
- class Box():
- def __init__(self, width, height, length):
- pass
- def volume(self):
- pass
- def area(self):
- pass
复制代码
3 写个Bicycle基类 有各种属性 然后写个继承他的RacingBike类 新增几个属性和方法
- class Bicycle():
- def __init__(self):
- pass
- class RacingBike(Bicycle):
- def __init__(self):
- super().__init__(self)
- pass
复制代码 |
|