python - Can't solve this python problem I got error every time
问题描述
The Bears in Berlin spend most of the day playing. In particular, they play if the temperature is between 60 and 90 (inclusive). Unless it is summer, then the upper limit is 100 instead of 90. Given an int temperature and a boolean is_summer, return True if the Bears play and False otherwise. bear_play(70, False) → True bear_play(95, False) → False bear_play(95, True) → True
解决方案
python one-liners的时间:
do_bears_play = lambda t, is_summer: 60 <= t <= (100 if is_summer else 90)
推荐阅读
- macros - Notepad++:记录宏不会记住在列编辑器中执行的步骤
- memory - 为什么 Prometheus 会消耗这么多内存?
- javascript - 如何确保 JS websocket 的 onMessage() 甚至处理程序在处理新消息之前完成运行
- angular - 如何引用嵌套 FormGroup 中的 FormArray?
- java - 为 JAXB 类动态添加命名空间
- sql - JOIN 拉取的行数比预期的多 2 倍
- erlang - 在 Windows 10 上编译 Erlang OTP
- angular - Angular 6 - 从动态编译的 html 中获取元素
- orientdb - Gremlin:有没有办法根据字符串的索引找到字符?
- android - 回收器视图上的 ExitText 导致焦点问题并修复它会破坏键盘隐藏 EditTect 可见性