Skip to content

Commit 2ca2a5a

Browse files
committed
Updated excercise 03
1 parent 48147f2 commit 2ca2a5a

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎exercises/foundations/03_math_and_comparisons/solution/math_and_comparisons_solution.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
## Divide a and b
1414
division = a / b
1515

16+
# Use f-string to print out the data crunched
17+
# Needs to be in this format:
18+
# A: <a> B: <b> -> +: <addition>, -: <substraction>, *: <multiplication>, /: <division>
19+
formatted_string = f"A: {a} B: {b} -> +: {addition}, -: {substraction}, *: {multiplication}, /: {division}"
20+
print(formatted_string)
21+
1622

1723
# Add these two strings together to variable `concated_name`
1824
f_name = "Jane"

‎exercises/foundations/03_math_and_comparisons/solution/test_math_and_comparisons_solution.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ def test_basic_math(run_script, expect_variables):
55
{"addition": 15, "substraction": -5, "multiplication": 50, "division": 0.5},
66
)
77

8+
def test_fstring()
9+
810

911
def test_string_concat(run_script, expect_variables):
1012
_, namespace = run_script("math_and_comparisons_solution.py")

0 commit comments

Comments
 (0)