Inside or Outside
Sometimes one flag completely changes the meaning of a range check: you either look inside the range or outside it. Write a function in1to10 that takes a number n and the boolean flag outside_mode. If outside_mode is False, return True when n is from 1 to 10 inclusive. If outside_mode is True, return True when n is less than or equal to 1 or greater than or equal to 10.
Примеры
Ввод
5, FalseВывод
TrueВвод
11, FalseВывод
FalseВвод
11, TrueВывод
TrueНужно реализовать
def in1to10(n: int, outside_mode: bool) -> bool:
Теги
math
Pieslēdzies, lai redzētu iesniegumu vēsturi
PieslēgtiesPieslēdzies, lai izmantotu AI mentoru
PieslēgtiesVisible tests
1
Input
5, FalseExpected
True2
Input
11, FalseExpected
False3
Input
11, TrueExpected
True4
Input
10, FalseExpected
True5
Input
10, TrueExpected
True6
Input
5, TrueExpected
FalseFocus radio
Paused · SomaFM · Fluid