mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): use output test for bill splitter step 4 print hint (#67444)
This commit is contained in:
+10
-3
@@ -43,9 +43,16 @@ You should print the string `Total bill so far:` followed by a space and the val
|
||||
```js
|
||||
({
|
||||
test: () => runPython(`
|
||||
sol1 = "print('Total bill so far:', running_total)"
|
||||
sol2 = "print(f'Total bill so far: {running_total}')"
|
||||
assert _Node(_code).has_call(sol1) or _Node(_code).has_call(sol2)`)
|
||||
import io, contextlib
|
||||
|
||||
_expected = f"Total bill so far: {37.89 + 57.34 + 39.39 + 64.21}"
|
||||
|
||||
buffer = io.StringIO()
|
||||
with contextlib.redirect_stdout(buffer):
|
||||
exec(_code)
|
||||
|
||||
assert _expected in buffer.getvalue()
|
||||
`)
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user