Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Commit ec166d0

Browse files
committed
Make the test pass.
1 parent d610695 commit ec166d0

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

python/selfie-lib/selfie_lib/ned.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
def fizzbuzz(n):
2-
fizzbuzz_results = ""
3-
for i in range(1, n):
2+
fizzbuzz_results = []
3+
for i in range(1, n + 1):
44
if i % 3 == 0 and i % 5 == 0:
5-
fizzbuzz_results += "FizzBuzz"
5+
fizzbuzz_results.append("FizzBuzz")
66
elif i % 3 == 0:
7-
fizzbuzz_results += "Fizz"
7+
fizzbuzz_results.append("Fizz")
88
elif i % 5 == 0:
9-
fizzbuzz_results += "Buzz"
9+
fizzbuzz_results.append("Buzz")
1010
else:
11-
fizzbuzz_results += f"{i}"
11+
fizzbuzz_results.append(f"{i}")
12+
return fizzbuzz_results

python/selfie-lib/tests/ned_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
def test_fizzbuzz():
44
# Test the function with a small number to keep the test simple
55
result = fizzbuzz(15)
6-
expected_result = "\n".join([
6+
expected_result = [
77
"1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz",
88
"11", "Fizz", "13", "14", "FizzBuzz"
9-
])
9+
]
1010
assert result == expected_result

0 commit comments

Comments
 (0)