Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bootcamp/core/student_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def count_substring(string, substring):
left_bound = i
right_bound = i + substring_length
candidate_substring = string[left_bound:right_bound]
if candidate_substring == substring:
if candidate_substring.lower() == substring.lower():
count += 1

return count
6 changes: 6 additions & 0 deletions bootcamp/core/tests/test_student_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def test_count_substring_single():

expected_count = 1
observed_count = count_substring(test_string, test_substring)
print("expect_count:", expected_count, "observed_count:", observed_count)
assert expected_count == observed_count


Expand All @@ -16,6 +17,7 @@ def test_count_substring_repeated():

expected_count = 2
observed_count = count_substring(test_string, test_substring)
print("expect_count:", expected_count, "observed_count:", observed_count)
assert expected_count == observed_count


Expand All @@ -25,4 +27,8 @@ def test_count_substring_none():

expected_count = 0
observed_count = count_substring(test_string, test_substring)
print("expect_count:", expected_count, "observed_count:", observed_count)
assert expected_count == observed_count

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


print(test_count_substring_single(), test_count_substring_repeated(), test_count_substring_none())