It is passing this clause
PS: you should do this for boolean conditions:
Quote:2 is not less than or equal to 1, nor is 2 greater than or equal to 10, so it moves to the end of the function and returns None. Your else clause is pertaining to outside_mode being True which it is so it does not execute that. Control is flowing to the second if condition, then that nested if condition and fails, then it moves to line 10 and returns None because there is nothing else in the function. If you want the function to not be able to return None, then remove your else line, and dedent the return False back one indentation level. your two outer if condtions should also be if and elif. It is either one or the other, not both or neither.if n <= 1 or n >= 10:
PS: you should do this for boolean conditions:
def in1to10(n, outside_mode): if not outside_mode: #if outside_mode is False if n >= 1 and n <= 10: return True if outside_mode: #if outside_mode is True if n <= 1 or n >= 10: return True return False print(in1to10(2, True))
Recommended Tutorials: