in_3050¶
Given 2 int values, return true if they are both in the range 30..40 inclusive, or they are both in the range 40..50 inclusive.
in_3050(30, 31) -> true
in_3050(30, 41) -> false
in_3050(40, 50) -> true
This exercise was taken from codingbat.com and has been adapted for the Python language. There are many great programming exercises there, but the majority are created for Java.
Starter Code¶
def in_3050(a: int, b: int) -> bool:
pass
result = in_3050(30, 31)
print(result)
Tests¶
from main import in_3050
def test_in_3050_1():
assert in_3050(30, 31) == True
def test_in_3050_2():
assert in_3050(30, 41) == False
def test_in_3050_3():
assert in_3050(40, 50) == True
def test_in_3050_4():
assert in_3050(40, 51) == False
def test_in_3050_5():
assert in_3050(39, 50) == False
def test_in_3050_6():
assert in_3050(50, 39) == False
def test_in_3050_7():
assert in_3050(40, 39) == True
def test_in_3050_8():
assert in_3050(49, 48) == True
def test_in_3050_9():
assert in_3050(50, 40) == True
def test_in_3050_10():
assert in_3050(50, 51) == False
def test_in_3050_11():
assert in_3050(35, 36) == True
def test_in_3050_12():
assert in_3050(35, 45) == False