import pytest def count_odd_numbers(a: list): return len(list(filter(lambda x: (x % 2 != 0), a))) def test_count_odd_numbers(): list_to_check = [1, 10, 5, 2, 8] print(f"The odd numbers amount is:{count_odd_numbers(list_to_check)}") assert count_odd_numbers(list_to_check) == 2
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter