We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00cfde2 commit e8804a9Copy full SHA for e8804a9
python_tests/test_1.py
@@ -5,6 +5,7 @@
5
def get_hello_world() -> str:
6
return "Hello, World!"
7
8
+
9
# Test Section
10
def test_hello_world():
11
expected_string = "Hello, World!"
python_tests/test_2.py
@@ -3,8 +3,7 @@
3
4
# Implementation
def get_even_numbers(n: int) -> []:
- even_number = lambda x: x % 2 == 0
- even_number_list = filter(even_number, range(1, n))
+ even_number_list = filter(lambda x: x % 2 == 0, range(1, n))
return list(even_number_list)
@@ -18,4 +17,4 @@ def test_even_numbers_10():
18
17
def test_even_numbers_20():
19
n = 20
20
expected_list = [2, 4, 6, 8, 10, 12, 14, 16, 18]
21
- assert get_even_numbers(n) == expected_list
+ assert get_even_numbers(n) == expected_list
python_tests/test_3.py
@@ -13,7 +13,7 @@ def get_fibonacci_recursive(n: int) -> int:
13
14
def get_fibonacci_iterative(n: int) -> int:
15
fibonacci_first, fibonacci_second = 0, 1
16
- for i in range(1, n+1):
+ for i in range(1, n+1):
fibonacci_first, fibonacci_second = fibonacci_second, fibonacci_first + fibonacci_second
return fibonacci_first
@@ -30,6 +30,7 @@ def test_fibonacci_recursive_bigger():
30
expected_value = 6765
31
assert get_fibonacci_recursive(n) == expected_value
32
33
34
def test_fibonacci_iterative_small():
35
n = 7
36
expected_value = 13
@@ -39,4 +40,4 @@ def test_fibonacci_iterative_small():
39
40
def test_fibonacci_iterative_bigger():
41
42
- assert get_fibonacci_iterative(n) == expected_value
43
+ assert get_fibonacci_iterative(n) == expected_value
python_tests/test_5.py
@@ -1,12 +1,14 @@
1
+# Task 5
2
+# Write a program to reverse a string
import pytest
-def reverse_string(input):
- if not input:
+def reverse_string(message):
+ if not message:
raise Exception("String cannot be empty")
- if not input.isascii():
+ if not message.isascii():
raise Exception("String cannot be digits or other special characters")
- tmp = input.split(" ")
+ tmp = message.split(" ")
12
return " ".join(tmp[::-1])
@@ -23,6 +25,6 @@ def test_reverse_string_empty():
23
25
24
26
27
def test_reverse_string_with_bool():
- input_string = True
28
+ message = True
29
with pytest.raises(Exception):
- reverse_string(input_string)
+ reverse_string(message)
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments