diff --git a/koans/about_bool.py b/koans/about_bool.py index 65d65cd..4676180 100644 --- a/koans/about_bool.py +++ b/koans/about_bool.py @@ -32,7 +32,7 @@ def test_can_assign_bool_expressions_to_variable(): истинно выражение или ложно. """ a = 3 < 2 - assert a == _____ + assert a == False def test_assert_accepts_bool(): @@ -41,7 +41,7 @@ def test_assert_accepts_bool(): Если в bool записана истина, то всё работает. """ - a = 3 < __ # укажите любое число, чтобы в a было True + a = 3 < 5 # укажите любое число, чтобы в a было True assert a @@ -50,7 +50,7 @@ def test_can_use_not(): not превращает True в False, а False в True. """ a = True - assert not a == _____ + assert not a == False def test_can_use_equality_check(): @@ -59,7 +59,7 @@ def test_can_use_equality_check(): Иначе возвращает False. """ - assert 3 + 2 == 1 + __ + assert 3 + 2 == 1 + 4 def test_can_assign_equality_check_to_variable(): @@ -67,4 +67,4 @@ def test_can_assign_equality_check_to_variable(): Результат сравнения можно записывать в переменную. """ a = 3 + 2 == 1 + 4 - assert a == __ + assert a == True diff --git a/koans/about_compound_conditions.py b/koans/about_compound_conditions.py index c908ef1..53837a9 100644 --- a/koans/about_compound_conditions.py +++ b/koans/about_compound_conditions.py @@ -7,7 +7,7 @@ def test_and_returns_one_of_the_operands(): значение, а значение одного из операндов. """ r = 'a' and 'b' - assert r == _____ # попробуйте такие варианты: True, False, 'a', 'b' + assert r == 'b' # попробуйте такие варианты: True, False, 'a', 'b' def test_or_returns_one_of_the_operands(): @@ -16,7 +16,7 @@ def test_or_returns_one_of_the_operands(): значение, а значение одного из операндов. """ r = 'a' or 'b' - assert r == _____ # попробуйте такие варианты: True, False, 'a', 'b' + assert r == 'a' # попробуйте такие варианты: True, False, 'a', 'b' def test_and_returns_first_false_operand(): @@ -26,7 +26,7 @@ def test_and_returns_first_false_operand(): Ложью в Python являются 0, '', [], (), {} и None """ r = 'a' and '' and [] - assert r == _____ # попробуйте такие варианты: True, False, 'a', '', [] + assert r == '' # попробуйте такие варианты: True, False, 'a', '', [] def test_or_returns_last_false_operand_if_all_operands_are_false(): @@ -35,7 +35,7 @@ def test_or_returns_last_false_operand_if_all_operands_are_false(): последнее такое значение. """ r = '' or [] or {} - assert r == _____ # попробуйте такие варианты: True, False, '', [], {} + assert r == {} # попробуйте такие варианты: True, False, '', [], {} def test_python_supports_not_operator(): @@ -43,7 +43,7 @@ def test_python_supports_not_operator(): В Python есть логический оператор not """ y = False - assert not y == _____ # попробуйте такие варианты: True, False + assert not y == True # попробуйте такие варианты: True, False def test_and_has_higher_priority_then_or(): @@ -51,7 +51,7 @@ def test_and_has_higher_priority_then_or(): Оператор and имеет выше приоритет, чем or """ r = 'a' and 'b' or [] - assert r == _____ # попробуйте такие варианты: 'a', 'b', [], True, False + assert r == 'b' # попробуйте такие варианты: 'a', 'b', [], True, False def test_not_has_higher_priority_then_and(): @@ -59,7 +59,7 @@ def test_not_has_higher_priority_then_and(): Оператор and имеет выше приоритет, чем or """ r = not 'a' and 'b' or [] - assert r == _____ # попробуйте такие варианты: 'a', 'b', [], True, False + assert r == [] # попробуйте такие варианты: 'a', 'b', [], True, False def test_brackets_can_change_priority(): @@ -67,4 +67,4 @@ def test_brackets_can_change_priority(): Оператор and имеет выше приоритет, чем or """ r = '' and ([] or 'a') - assert r == _____ # попробуйте такие варианты: 'a', '', [], True, False + assert r == '' # попробуйте такие варианты: 'a', '', [], True, False diff --git a/koans/about_conditions.py b/koans/about_conditions.py index 0c79ffb..21231bf 100644 --- a/koans/about_conditions.py +++ b/koans/about_conditions.py @@ -9,7 +9,7 @@ def test_start_if(): выполняется следующий блок кода """ a = 0 # Учимся объявлять все переменные вначале функции - if ____: # попробуйте такие варианты: TRUE, true, True + if a == 0: # попробуйте такие варианты: TRUE, true, True a = 3 assert a == 3 @@ -19,7 +19,7 @@ def test_if_and_else(): Использование конструкции if и else """ a = None - if ____: # попробуйте такие варианты: FALSE, false, False + if False: # попробуйте такие варианты: FALSE, false, False a = 0 else: a = 1 @@ -34,7 +34,7 @@ def test_not_in_if(): или истиное в ложное """ a = "" - if not ____: + if not False: a = True else: a = False @@ -49,7 +49,7 @@ def test_two_if(): a = 0 if a == 0: a = 1 - if a != ____: + if a != 0: a = 42 assert a == 42 @@ -61,7 +61,7 @@ def test_elif(): a = 0 if a != 0: a = 1 - elif ____: + elif a == 0: a = 42 assert a == 42 @@ -71,9 +71,9 @@ def test_elif_and_else(): Исследуем работу else необходимо заполнить условия возле if и elif чтобы сработал else """ - if (3 > 2) == ____: + if (3 > 2) == False: a = None - elif 3 > 2 == ____: + elif 3 > 2 == True: a = None else: a = True @@ -86,5 +86,5 @@ def test_logic(): """ names = ['Вова', 'Леша', 'Лена', 'Света'] name = "Вова" - if __ in ____: + if name in names: assert True diff --git a/koans/about_dictionaries.py b/koans/about_dictionaries.py index f2b8dad..fad8efb 100644 --- a/koans/about_dictionaries.py +++ b/koans/about_dictionaries.py @@ -12,7 +12,7 @@ def test_create_dictionary_with_literal(): 'a': 1, 'b': 2 } - assert dict_comparator(d, _____) # попробуйте подстваить объект вида {key1: value1, key2: value2,...} + assert dict_comparator(d, {'a': 1, 'b': 2}) # попробуйте подстваить объект вида {key1: value1, key2: value2,...} def test_create_dictionary_with_constructor(): @@ -20,7 +20,7 @@ def test_create_dictionary_with_constructor(): Словарь в Python можно создать с помощью конструктора словаря """ d = dict(a=1, b=2) - assert dict_comparator(d, _____) + assert dict_comparator(d, dict(a=1, b=2)) def test_create_dictionary_with_list_of_tuples(): @@ -30,7 +30,7 @@ def test_create_dictionary_with_list_of_tuples(): list_of_tuples = [('a', 1), ('b', 2), ('c', 3)] d = dict(list_of_tuples) - assert dict_comparator(d, _____) + assert dict_comparator(d, dict(list_of_tuples)) def test_get_value_by_key(): @@ -41,7 +41,7 @@ def test_get_value_by_key(): 'a': 1, 'b': 2 } - assert d['a'] == _____ # попробуйте такие варианты: False, True, 1, 2 + assert d['a'] == 1 # попробуйте такие варианты: False, True, 1, 2 def test_add_key_and_value_to_dictionary(): @@ -54,7 +54,7 @@ def test_add_key_and_value_to_dictionary(): } d['c'] = 3 - assert dict_comparator(d, _____) + assert dict_comparator(d, {'a': 1,'b': 2, 'c': 3}) def test_if_existing_key_in_dict(): @@ -67,7 +67,7 @@ def test_if_existing_key_in_dict(): } var = 'a' in d - assert var == ___ # попробуйте такие варианты: False, True, 1, 2 + assert var == True # попробуйте такие варианты: False, True, 1, 2 def test_if_not_existing_key_in_dict(): @@ -80,7 +80,7 @@ def test_if_not_existing_key_in_dict(): } var = 'c' in d - assert var == ___ # попробуйте такие варианты: False, True, 1, 2 + assert var == False # попробуйте такие варианты: False, True, 1, 2 def test_get_method(): @@ -93,7 +93,7 @@ def test_get_method(): } var = d.get('c', 0) - assert var == ___ # попробуйте такие варианты: False, True, 1, 2, 0 + assert var == 0 # попробуйте такие варианты: False, True, 1, 2, 0 def test_get_method_default_value(): @@ -106,4 +106,4 @@ def test_get_method_default_value(): } var = d.get('c') - assert var == ___ # попробуйте такие варианты: False, True, 1, 2, 0, None \ No newline at end of file + assert var == None # попробуйте такие варианты: False, True, 1, 2, 0, None \ No newline at end of file diff --git a/koans/about_floats.py b/koans/about_floats.py index c155731..0374149 100644 --- a/koans/about_floats.py +++ b/koans/about_floats.py @@ -9,7 +9,7 @@ def test_can_sum_up(): Если использовать запятую, всё сломается. """ - assert 2.5 + 1.2 == __ + assert 2.5 + 1.2 == 3.7 def test_can_assign_to_variables(): @@ -18,7 +18,7 @@ def test_can_assign_to_variables(): """ a = 2.5 b = 3.8 - assert b - __ == a + assert b - 1.3 == a def test_can_remove_real_part(): @@ -26,7 +26,7 @@ def test_can_remove_real_part(): У вещественных чисел можно удалять дробную часть и превращать их в целые. """ a = 2.1 - assert int(a) == __ + assert int(a) == 2 def test_has_rounding_problems(): @@ -36,11 +36,11 @@ def test_has_rounding_problems(): Так работает из-за того, как числа представляются в памяти. """ a = 0.1 - assert a + 0.2 == __ # подсказка: тут будет не 0.3 + assert a + 0.2 == 0.30000000000000004 # подсказка: тут будет не 0.3 def test_can_miss_leading_zero(): """ Если у вещественного числа чцелая часть – ноль, то её можно не писать. """ - assert .5 * 2 == __ + assert .5 * 2 == 1.0 diff --git a/koans/about_for_loop.py b/koans/about_for_loop.py index fc05a5b..aff6c8f 100644 --- a/koans/about_for_loop.py +++ b/koans/about_for_loop.py @@ -22,7 +22,7 @@ def test_for_loop(): str1 = "Python" for letter in str1[2]: - assert letter == ___ + assert letter == 't' def test_for_loop_with_list(): @@ -37,7 +37,7 @@ def test_for_loop_with_list(): list1 = [5] for number in list1: - assert number == ___ + assert number == 5 def test_for_loop_with_range(): @@ -50,7 +50,7 @@ def test_for_loop_with_range(): for i in range(3): sum = sum + i - assert sum == ___ + assert sum == 3 def test_for_loop_with_specified_range(): @@ -64,7 +64,7 @@ def test_for_loop_with_specified_range(): for i in range(2, 5): sum = sum + i - assert sum == ___ + assert sum == 9 def test_for_loop_with_step_range(): @@ -79,7 +79,7 @@ def test_for_loop_with_step_range(): for i in range(3, 12, 3): sum = sum + i - assert sum == ___ + assert sum == 18 def test_for_loop_with_break(): @@ -93,7 +93,7 @@ def test_for_loop_with_break(): break sum = sum + i - assert sum == ___ + assert sum == 0 def test_for_loop_with_continue(): """ @@ -107,7 +107,7 @@ def test_for_loop_with_continue(): continue sum = sum + i - assert sum == ___ + assert sum == 13 def test_for_loop_with_enumerate(): """ @@ -124,10 +124,10 @@ def test_for_loop_with_enumerate(): list1 = ['Python'] for index, element in enumerate(list1): - assert index == ___, element == ____ + assert index == 0, element == 'P' -def test_for_loop_with_enumerate_start(): +def test_for_loop_with_enumerate_start(): """ По умолчанию нумерация индексов последовательности начинается с 0, то есть enumerate(iter) можно переписать как enumerate(iter, start=0). Можно поменять @@ -136,4 +136,4 @@ def test_for_loop_with_enumerate_start(): list1 = ['Python'] for index, element in enumerate(list1, start=1): - assert index == ___, element == ____ + assert index == 1, element == 'y' diff --git a/koans/about_format.py b/koans/about_format.py index 5a7c99b..4cc44fe 100644 --- a/koans/about_format.py +++ b/koans/about_format.py @@ -9,7 +9,7 @@ def test_format_simple(): str1 = 'Hello, {}! {}' str2 = str1.format('world', 123) - assert str2 == __ + assert str2 == 'Hello, world! 123' def test_format_indeces(): @@ -18,10 +18,10 @@ def test_format_indeces(): """ str1 = '{1} {0}'.format('a', 'b') - assert str1 == __ + assert str1 == 'b a' str1 = '{1} {0} {1}'.format('a', 'b') - assert str1 == __ + assert str1 == 'b a b' def test_format_named(): @@ -30,11 +30,11 @@ def test_format_named(): """ str1 = 'name: {name}, city: {place}'.format(name='John Smith', place='NY') - assert str1 == __ + assert str1 == 'name: John Smith, city: NY' person = {'name': 'John Smith', 'place': 'NY'} str1 = 'name: {name}, city: {place}'.format(**person) - assert str1 == __ + assert str1 == 'name: John Smith, city: NY' def test_format_attributes(): @@ -45,7 +45,7 @@ def test_format_attributes(): some_list = [3, 4, 5] some_dict = {'hello': 6} str1 = '{0[2]} {1[hello]}'.format(some_list, some_dict) - assert str1 == __ + assert str1 == '5 6' def test_format_float(): @@ -53,7 +53,7 @@ def test_format_float(): Можно управлять форматированием чисел с плавающей точкой """ str1 = '{0:.3f}'.format(2144.45464576583) - assert str1 == __ + assert str1 == '2144.455' def test_format_truncate_string(): @@ -61,7 +61,7 @@ def test_format_truncate_string(): Строки можно обрезать до нужной длины """ str1 = '{:.4}'.format('hello') - assert str1 == __ + assert str1 == 'hell' def test_format_align(): @@ -71,24 +71,24 @@ def test_format_align(): # по центру str1 = '{:^7}'.format('hello') - assert str1 == __ + assert str1 == ' hello ' str1 = '{:*^7}'.format('hello') - assert str1 == __ + assert str1 == '*hello*' # по левому краю str1 = '{:<7}'.format('hello') - assert str1 == __ + assert str1 == 'hello ' str1 = '{:*<7}'.format('hello') - assert str1 == __ + assert str1 == 'hello**' # по правому краю str1 = '{:>7}'.format('hello') - assert str1 == __ + assert str1 == ' hello' str1 = '{:*>7}'.format('hello') - assert str1 == __ + assert str1 == '**hello' def test_format_truncate_align(): @@ -96,7 +96,7 @@ def test_format_truncate_align(): Можно обрезать и дополнять одновременно """ str1 = '{:*^6.4}'.format('hello') - assert str1 == __ + assert str1 == '*hell*' def test_format_truncate_align_floats(): @@ -104,13 +104,13 @@ def test_format_truncate_align_floats(): Дополнять до нужной длины можно не только строки, но и числа """ str1 = '{:4d}'.format(42) - assert str1 == __ + assert str1 == ' 42' str1 = '{:04d}'.format(42) - assert str1 == __ + assert str1 == '0042' str1 = '{:07.3f}'.format(45.34354325) - assert str1 == __ + assert str1 == '045.344' def test_format_datetime(): @@ -121,7 +121,7 @@ def test_format_datetime(): from datetime import datetime str1 = '{:%Y-%m-%d %H:%M}'.format(datetime(2018, 2, 3, 16, 39)) - assert str1 == __ + assert str1 == '2018-02-03 16:39' def test_format_truncate_align_parametrized(): @@ -133,4 +133,4 @@ def test_format_truncate_align_parametrized(): total_len = 7 str1 = '{:{}{}.{after_dot}f}'.format(45.34354325, padding_number, total_len, after_dot=3) - assert str1 == __ + assert str1 == '045.344' diff --git a/koans/about_integers.py b/koans/about_integers.py index b3ccf48..33ff00b 100644 --- a/koans/about_integers.py +++ b/koans/about_integers.py @@ -6,7 +6,7 @@ def test_can_sum_up(): Целые числа можно складывать """ - assert 1 + 1 == __ # Вставьте вместо __ такое значение, чтобы оно совпадало с результатом выполнения 1 + 1 + assert 1 + 1 == 2 # Вставьте вместо __ такое значение, чтобы оно совпадало с результатом выполнения 1 + 1 def test_can_deduct(): @@ -14,7 +14,7 @@ def test_can_deduct(): Целые числа можно вычитать """ - assert 32 - 11 == __ + assert 32 - 11 == 21 def test_can_multiply(): @@ -22,7 +22,7 @@ def test_can_multiply(): Целые числа можно умножать """ - assert 8 * __ == 24 + assert 8 * 3 == 24 def test_can_divide(): @@ -32,7 +32,7 @@ def test_can_divide(): Обратите внимание, что в результате деления целых чисел можно получить вещественное число. """ - assert 5 / __ == 2.5 + assert 5 / 2 == 2.5 def test_assign_to_variables(): @@ -40,4 +40,4 @@ def test_assign_to_variables(): Целые числа можно записывать в переменные. """ x = 30 - assert x / 6 == __ + assert x / 6 == 5.0 diff --git a/koans/about_lists.py b/koans/about_lists.py index 1ff38d1..3d0feca 100644 --- a/koans/about_lists.py +++ b/koans/about_lists.py @@ -10,7 +10,7 @@ def test_create_list_with_literal(): my_list = ['Hello', 'world'] - assert my_list == ___ # попробуйте ввести такие варианты: list(), ['Hello', 'world'], {'Hello'} + assert my_list == ['Hello', 'world'] # попробуйте ввести такие варианты: list(), ['Hello', 'world'], {'Hello'} def test_create_list_with_constructor(): @@ -23,7 +23,7 @@ def test_create_list_with_constructor(): my_list = list('Hello, world!') - assert my_list == ___('Hello, world!') # попробуйте ввести такие варианты: dict, list, set + assert my_list == list('Hello, world!') # попробуйте ввести такие варианты: dict, list, set def test_list_index(): @@ -36,7 +36,7 @@ def test_list_index(): my_list = ['Hello', 'world', '!'] - assert my_list[2] == ___ + assert my_list[2] == '!' def test_add_item_to_list(): @@ -50,7 +50,7 @@ def test_add_item_to_list(): my_list = ['Hello', 'world'] my_list.append('!') - assert my_list == ___ # попробуйте ввести такие варианты: ['Hello world!'], ['Hello', 'world!'], ['Hello', 'world', '!'] + assert my_list == ['Hello', 'world', '!'] # попробуйте ввести такие варианты: ['Hello world!'], ['Hello', 'world!'], ['Hello', 'world', '!'] def test_operator_len(): @@ -62,7 +62,7 @@ def test_operator_len(): my_list = ['Learn', 'Python'] - list_len = ___ # попробуйте ввести такие варианты: 2, 3, 4 + list_len = 2 # попробуйте ввести такие варианты: 2, 3, 4 assert len(my_list) == list_len @@ -78,7 +78,7 @@ def test_remove_from_list(): my_list = ['Learn', 'Python', '!'] my_list.remove('!') - assert my_list == ___ + assert my_list == ['Learn', 'Python'] def test_lists_can_sum_up(): @@ -90,7 +90,7 @@ def test_lists_can_sum_up(): my_list = ['learn'] your_list = ['python'] - our_list = ___ # попробуйте ввести такие варианты: ['learnpython'], ['learn', 'python'], [['learn'], ['python']] + our_list = ['learn', 'python'] # попробуйте ввести такие варианты: ['learnpython'], ['learn', 'python'], [['learn'], ['python']] assert our_list == my_list + your_list @@ -109,4 +109,4 @@ def test_for_lists_loop(): my_list = ['Python'] for element in my_list: - assert element == ___ + assert element == 'Python' diff --git a/koans/about_set.py b/koans/about_set.py index ec6cc38..eb19b6b 100644 --- a/koans/about_set.py +++ b/koans/about_set.py @@ -11,7 +11,7 @@ def test_create(): P.S пустое множество невозможно создать как {}, так-как синтаксис совпадёт с созданием словаря. """ - my_set = ___ # попробуйте такие варианты: set(), {1, 2, 3}, {'qwerty'}, set((1, 2, 3)) + my_set = set((1, 2, 3)) # попробуйте такие варианты: set(), {1, 2, 3}, {'qwerty'}, set((1, 2, 3)) assert isinstance(my_set, set) @@ -23,7 +23,7 @@ def test_create_from_string(): >>> set('qwerty') == {'q', 'w', 'e', 'r', 't', 'y'} True """ - my_set = ___ # попробуйте такие варианты: set('Hello!'), set('Hello, world!') + my_set = set('Hello, world!') # попробуйте такие варианты: set('Hello!'), set('Hello, world!') assert {'H', 'e', 'l', 'o', 'w', 'r', 'd', '!', ',', ' '} == my_set @@ -31,7 +31,7 @@ def test_words_in_set(): """ Множества могут содержать не только цифры и буквы. """ - my_set = ___ # попробуйте такие варианты: {True, 'set', 2}, {'cow', 'fox', 'cat'} + my_set = {True, 'set', 2} # попробуйте такие варианты: {True, 'set', 2}, {'cow', 'fox', 'cat'} assert isinstance(my_set, set) @@ -42,7 +42,7 @@ def test_operator_len(): len({"Множество"}) """ my_set = {0, 1, 2, 3, 4, 5} - set_len = ___ # попробуйте такие варианты: 5, 6, 7 + set_len = 6 # попробуйте такие варианты: 5, 6, 7 assert len(my_set) == set_len @@ -53,7 +53,7 @@ def test_operator_in(): "Элемент" in {"Множество"} """ my_set = {'cow', 'fox', 'cat'} - current_element = ___ # попробуйте такие варианты: 'cow', 1, True + current_element = 'cow' # попробуйте такие варианты: 'cow', 1, True assert current_element in my_set @@ -66,7 +66,7 @@ def test_union(): set_A = {1, 2, 3, 4, 5} set_B = {4, 5, 6, 7, 8} set_union = set_A | set_B - assert set_union == ___ + assert set_union == {1, 2, 3, 4, 5, 6, 7, 8} def test_intersection(): @@ -78,7 +78,7 @@ def test_intersection(): set_A = {1, 2, 3, 4, 5} set_B = {4, 5, 6, 7, 8} set_intersection = set_A & set_B - assert set_intersection == ___ + assert set_intersection == {4, 5} def test_difference(): @@ -90,7 +90,7 @@ def test_difference(): set_A = {1, 2, 3, 4, 5} set_B = {4, 5, 6, 7, 8} set_difference = set_A - set_B - assert set_difference == ___ + assert set_difference == {1, 2, 3} def test_multi_difference(): @@ -103,7 +103,7 @@ def test_multi_difference(): set_B = {4, 5, 6, 7, 8} set_C = {1, 2} set_difference = set_A - set_B - set_C - assert set_difference == ___ + assert set_difference == {3} def test_duplicate_removal(): @@ -120,7 +120,7 @@ def test_duplicate_removal(): True """ my_duplicated_list = ['cow', 'cat', 'cat', 'dog', 'cat', 'cow'] - my_unique_list = ___ # исключите дубликаты вручную + my_unique_list = ['cow', 'cat', 'dog'] # исключите дубликаты вручную assert sorted(my_unique_list) == sorted(list(set(my_duplicated_list))) @@ -131,5 +131,5 @@ def test_list_in_set(): Если у типа нет функции, то при добавлении в множество будет вызванно исключение. """ - my_set = ___ # попробуйте такие варианты: {1, [1, 2, 3]}, {1, (1, 2, 3)}, {1, {'a': 1, 'b': 2}} + my_set = {1, (1, 2, 3)} # попробуйте такие варианты: {1, [1, 2, 3]}, {1, (1, 2, 3)}, {1, {'a': 1, 'b': 2}} assert isinstance(my_set, set) \ No newline at end of file diff --git a/koans/about_slices.py b/koans/about_slices.py index 2848963..d8ec216 100644 --- a/koans/about_slices.py +++ b/koans/about_slices.py @@ -8,7 +8,7 @@ def test_slice_with_index(): """ str1 = "Python anywhere" - assert str1[2] == ___ + assert str1[2] == 't' def test_slice_with_index_minus_one(): @@ -18,7 +18,7 @@ def test_slice_with_index_minus_one(): str1 = "Python anywhere" - assert str1[-1] == ___ + assert str1[-1] == 'e' def test_slice_with_negative_index(): @@ -29,7 +29,7 @@ def test_slice_with_negative_index(): str1 = "Python anywhere" - assert str1[-4] == ___ + assert str1[-4] == 'h' def test_slice_with_substring(): @@ -43,7 +43,7 @@ def test_slice_with_substring(): str1 = "Python anywhere" - assert str1[2:9] == ___ + assert str1[2:9] == 'thon an' def test_slice_with_diff_indexes(): @@ -53,7 +53,7 @@ def test_slice_with_diff_indexes(): str1 = "Python anywhere" - assert str1[1:-1] == ____ + assert str1[1:-1] == 'ython anywher' def test_slice_end_of_string(): @@ -63,7 +63,7 @@ def test_slice_end_of_string(): str1 = "Python anywhere" - assert str1[3:] == ___ + assert str1[3:] == 'hon anywhere' def test_slice_beginning_of_string(): @@ -74,7 +74,7 @@ def test_slice_beginning_of_string(): str1 = "Python anywhere" - assert str1[:5] == ___ + assert str1[:5] == 'Pytho' def test_slice_with_equal_substring(): @@ -84,7 +84,7 @@ def test_slice_with_equal_substring(): str1 = "Python anywhere" - assert str1[:] == ___ + assert str1[:] == 'Python anywhere' def test_slice_with_step(): @@ -97,7 +97,7 @@ def test_slice_with_step(): str1 = "Python anywhere" - assert str1[1:9:2] == ___ + assert str1[1:9:2] == 'yhna' def test_slice_string_backwards(): @@ -107,4 +107,4 @@ def test_slice_string_backwards(): str1 = "Python anywhere" - assert str1[::-1] == ___ + assert str1[::-1] == 'erehwyna nohtyP' diff --git a/koans/about_strings.py b/koans/about_strings.py index 004b886..146a95c 100644 --- a/koans/about_strings.py +++ b/koans/about_strings.py @@ -7,7 +7,7 @@ def test_string_indexes(): """ str1 = 'Hello, world!' - assert str1[5] == __ + assert str1[5] == ',' def test_string_slice(): @@ -16,7 +16,7 @@ def test_string_slice(): """ str1 = 'Hello, world!' - assert str1[5:9] == __ + assert str1[5:9] == ', wo' def test_string_for(): @@ -29,7 +29,7 @@ def test_string_for(): for symbol in str1: symbol_count += 1 - assert symbol_count == __ + assert symbol_count == 13 def test_string_add(): @@ -38,7 +38,7 @@ def test_string_add(): """ str1 = 'Hello, ' + 'world!' - assert str1 == __ + assert str1 == 'Hello, world!' def test_string_add_extra(): @@ -48,7 +48,7 @@ def test_string_add_extra(): str1 = 'Hello, ' str1 += 'world!' - assert str1 == __ + assert str1 == 'Hello, world!' def test_string_convert_int(): @@ -57,7 +57,7 @@ def test_string_convert_int(): """ str1 = str(123) - assert str1 == __ + assert str1 == '123' def test_string_add_int(): @@ -66,7 +66,7 @@ def test_string_add_int(): """ str1 = 'Hello, ' + str(123) - assert str1 == __ + assert str1 == 'Hello, 123' def test_string_len(): @@ -75,7 +75,7 @@ def test_string_len(): """ str1 = len('Hello, ') - assert str1 == __ + assert str1 == 7 def test_string_split(): @@ -85,7 +85,7 @@ def test_string_split(): str1 = 'Hello, world! Hello, everyone!' splited_str = str1.split(' ') - assert [__, __, __, __] == splited_str + assert ['Hello,', 'world!', 'Hello,', 'everyone!'] == splited_str def test_string_join(): @@ -94,7 +94,7 @@ def test_string_join(): """ str1 = '! '.join(['Hello', 'world', 'Hello', 'everyone']) - assert str1 == __ + assert str1 == 'Hello! world! Hello! everyone' def test_string_methods(): @@ -102,11 +102,11 @@ def test_string_methods(): У строки есть методы для приведения некоторых ее символов в разные регистры """ - assert __ == 'hello'.capitalize() - assert __ == 'hello'.upper() - assert __ == 'Hello World'.lower() - assert __ == 'hello world'.title() - assert __ == 'HeLlo wORld'.swapcase() + assert 'Hello' == 'hello'.capitalize() + assert 'HELLO' == 'hello'.upper() + assert 'hello world' == 'Hello World'.lower() + assert 'Hello World' == 'hello world'.title() + assert 'hElLO WorLD' == 'HeLlo wORld'.swapcase() def test_string_in(): @@ -118,7 +118,7 @@ def test_string_in(): find_in_str1 = 'world' in str1 - assert find_in_str1 == __ + assert find_in_str1 == True def test_string_format(): @@ -129,7 +129,7 @@ def test_string_format(): str1 = 'Hello, {}! {}' str2 = str1.format(123, 'Hello') - assert str2 == __ + assert str2 == 'Hello, 123! Hello' def test_string_empty(): @@ -141,10 +141,10 @@ def test_string_empty(): str3 = 'hello' empty_string = not str1 - assert empty_string == __ + assert empty_string == True empty_string = str1 or str2 or not str3 - assert empty_string == __ + assert empty_string == False def test_string_compare(): @@ -155,10 +155,10 @@ def test_string_compare(): str2 = 'Hello, ' + 'world!' string_compare = str1 == str2 - assert string_compare == __ + assert string_compare == True string_compare = 'AAA' < 'AAB' - assert string_compare == __ + assert string_compare == True string_compare = 'aAA' < 'AAB' - assert string_compare == __ + assert string_compare == False diff --git a/koans/about_variables.py b/koans/about_variables.py index 79667ac..cd363b8 100644 --- a/koans/about_variables.py +++ b/koans/about_variables.py @@ -9,7 +9,7 @@ def test_can_assign_to_variable(): """ a = 12 - assert a + 3 == __ + assert a + 3 == 15 def test_can_assign_different_types(): @@ -22,7 +22,7 @@ def test_can_assign_different_types(): a = 5.5 a = 'Hello' - assert a == __ + assert a == 'Hello' def test_variables_names_are_case_sensitive(): @@ -35,8 +35,8 @@ def test_variables_names_are_case_sensitive(): a = 12 A = 5.5 - assert a == __ - assert A == __ + assert a == 12 + assert A == 5.5 def test_variables_names_can_have_digits(): @@ -47,7 +47,7 @@ def test_variables_names_can_have_digits(): но может им заканчиваться или иметь число посередине. """ value2var = 22 - assert value2var / 2 == __ + assert value2var / 2 == 11.0 def test_variables_names_can_have_underscore(): @@ -58,4 +58,4 @@ def test_variables_names_can_have_underscore(): одно от другого. """ max_students_mount = 50 - assert max_students_mount / 10 == __ + assert max_students_mount / 10 == 5.0