Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0e76f4f

Browse filesBrowse files
authored
Fix exercises on control flow (empa-scientific-it#115).
1 parent af22df4 commit 0e76f4f
Copy full SHA for 0e76f4f

File tree

Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed

‎control_flow.ipynb

Copy file name to clipboardExpand all lines: control_flow.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@
535535
"id": "692f608f-2e79-4ad4-9a3d-ec9625941f81",
536536
"metadata": {},
537537
"source": [
538-
"#### 4. Write a Python program that takes an integer and divides it until the result is no longer an even number"
538+
"#### 4. Write a Python program that takes an integer and divides it by 2 until the result is no longer an even number"
539539
]
540540
},
541541
{

‎tutorial/tests/test_control_flow.py

Copy file name to clipboardExpand all lines: tutorial/tests/test_control_flow.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def test_indexed_string(string: str, function_to_test) -> None:
4848

4949
def reference_range_of_nums(start: int, end: int) -> list[int]:
5050
"""Reference solution warm-up 2"""
51-
return list(range(start, end + 1, (1 if start < end else -1)))
51+
step = 1 if start < end else -1
52+
return list(range(start, end + step, step))
5253

5354

5455
@pytest.mark.parametrize(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.