如何用PYTHON编写是否超速程序
1、打开JUPYTER NOTEBOOK,新建一个PY文档。

3、def caught_speeding(speed, is_birthday): if is_birthday: if speed <= 65: return 0 elif speed >= 66 and speed <=85: return 1 elif speed >= 86: return 2 if not is_birthday: if speed <= 60: return 0 elif speed >= 61 and speed <=80: return 1 elif speed >= 81: return 2 print(caught_speeding(60, False))print(caught_speeding(65, False))print(caught_speeding(65, True))这里是详细的步骤。

5、def caught_speeding(speed, is_birthday): more = 0 if is_birthday: more == 5 if speed <= 60 + more: return 0 elif speed >= 81 + more: return 2 else: return 1print(caught_speeding(60, False))print(caught_speeding(65, False))print(caught_speeding(65, True))这也是另一个错误的示范。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:55
阅读量:95
阅读量:53
阅读量:33
阅读量:73