Noisy Parrot
Programs often need to check two conditions at once: an event happened, and the timing is bad. Write a function parrot_trouble that takes the boolean flag talking and the hour hour from 0 to 23. Return True if the parrot is talking before 7 in the morning or after 20 in the evening. If the parrot is quiet or the time is acceptable, return False.
Примеры
Ввод
True, 6Вывод
TrueВвод
True, 7Вывод
FalseВвод
False, 6Вывод
FalseНужно реализовать
def parrot_trouble(talking: bool, hour: int) -> bool:
Теги
math
Kirjaudu sisään nähdäksesi palautushistorian
Kirjaudu sisäänKirjaudu sisään käyttääksesi tekoälymentoria
Kirjaudu sisäänVisible tests
1
Input
True, 6Expected
True2
Input
True, 7Expected
False3
Input
False, 6Expected
False4
Input
True, 21Expected
True5
Input
True, 20Expected
False6
Input
True, 999999Expected
TrueFocus radio
Paused · SomaFM · Fluid