no_23¶
Given an int list length 2, return true if it does not contain a 2 or 3.
no_23([4, 5]) -> true
no_23([4, 2]) -> false
no_23([3, 5]) -> false
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¶
from typing import List
def no_23(nums: List[int]) -> bool:
pass
result = no_23([4, 5])
print(result)
Tests¶
from main import no_23
def test_no_23_1():
assert no_23([4, 5]) == True
def test_no_23_2():
assert no_23([4, 2]) == False
def test_no_23_3():
assert no_23([3, 5]) == False
def test_no_23_4():
assert no_23([1, 9]) == True
def test_no_23_5():
assert no_23([2, 9]) == False
def test_no_23_6():
assert no_23([1, 3]) == False
def test_no_23_7():
assert no_23([1, 1]) == True
def test_no_23_8():
assert no_23([2, 2]) == False
def test_no_23_9():
assert no_23([3, 3]) == False
def test_no_23_10():
assert no_23([7, 8]) == True
def test_no_23_11():
assert no_23([8, 7]) == True