# Seznamy (16 B) def test_list(num_list, k): pass # Řetězce (16 B) def text_test(text1, text2, n): pass # Čísla (14 B) def find_nums(n, lst): pass # Tabulka (16 B) def letter_table(lst): pass # Práce se seznamem slov (18 B) def remove_third_letter(words): pass # Datové struktury (20 B) def list_students(bonus_string): pass # ===== TEST FUNCTIONS BELOW ===== def test1(): print() print("== TESTS FOR test_list ==") print() print(f"Should be 20 -> {test_list([1, 4, 10, 20], 18)}") print(f"Should be 20 -> {test_list([1, 4, 10, 20], 15)}") print(f"Should be -1 -> {test_list([-1, -3, 1, 3], -2)}") def test2(): print() print("== TESTS FOR text_test ==") print() print(f"Should be True -> {text_test('ovce', 'ovoce', 1)}") print(f"Should be False -> {text_test('pes', 'prase', 1)}") print(f"Should be False -> {text_test('pes', 'pes', 0)}") print(f"Should be True -> {text_test('aBcd', 'aaaBcd', 2)}") print(f"Should be False -> {text_test('aBcD', 'aaBccD', 2)}") def test3(): print() print("== TESTS FOR find_nums ==") print() print("Next two lines should be equal!") print(f"Yours: {find_nums(20, [2])}") print(f"Should be: 2 12") print("Next two lines should be equal!") print(f"Yours: {find_nums(1000, [1, 2, 3])}") print(f"Should be: 123 132 213 231 312 321") print("Next two lines should be equal!") print(f"Yours: {find_nums(60, [5])}") print(f"Should be: 5 15 25 35 45 50 51 52 53 54 55 56 57 58 59") print("Next two lines should be equal!") print(f"Yours: {find_nums(130, [1, 2])}") print(f"Should be: 12 21 102 112 120 121 122 123 124 125 126 127 128 129") def test4(): print() print("== TESTS FOR letter_table ==") print() print("Following tables should be equal") print("Yours:") letter_table(["A", "B", "C", "D"]) print("Should be:") print( """A A A A A B A B A B C A A B C D """ ) print("Following tables should be equal") print("Yours:") letter_table(["0", "1", "2", "3"]) print("Should be:") print( """0 0 0 0 0 1 0 1 0 1 2 0 0 1 2 3 """ ) print("Following tables should be equal") print("Yours:") letter_table(["5", "4", "3", "2", "1", "0"]) print("Should be:") print( """5 5 5 5 5 5 5 4 5 4 5 4 5 4 3 5 4 3 5 4 3 2 5 4 5 4 3 2 1 5 5 4 3 2 1 0 """ ) print("Following tables should be equal") print("Yours:") letter_table(["A", "B"]) print("Should be:") print( """A A A B """ ) def test5(): print() print("== TESTS FOR remove_third_letter ==") print() words = ["apple", "banana", "xy", "abcdef", "a"] remove_third_letter(words) print("Next two lines should be equal!") print(f"Yours: {words}") print(f"Should be: ['aple', 'baana', 'XXX', 'abdef', 'XXX']") words = ["a", "ab", "abc", "abcd", "abcef"] remove_third_letter(words) print("Next two lines should be equal!") print(f"Yours: {words}") print(f"Should be: ['XXX', 'XXX', 'ab', 'abd', 'abef']") words = ["a", "ab", "abc", "abcd", "abcef"] remove_third_letter(words) remove_third_letter(words) print("Next two lines should be equal!") print(f"Yours: {words}") print(f"Should be: ['XX', 'XX', 'XXX', 'ab', 'abf']") def test6(): print() print("== TESTS FOR list_students ==") print() print(f"Next two outputs should be equal") print("Yours:") list_students("Petr:3,Pavel:5,Jana:8,Petr:4,Martina:3") print() print("Should be:") print( """Martina 3 Pavel 5 Petr 7 Jana 8 """ ) print(f"Next two outputs should be equal") print("Yours:") list_students("Petr:3,Pavel:5,Jana:8,Petr:4,Martina:3") print() print("Should be:") print( """Jan 3 Pavel 8 Petra 9 """ ) # ===== END OF TEST FUNCTIONS ===== # Uncomment a test you want! # test1() # test2() # test3() # test4() # test5() # test6()