首页 > 解决方案 > 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

解决方案


python one-liners的时间:

do_bears_play = lambda t, is_summer: 60 <= t <= (100 if is_summer else 90)

推荐阅读