mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
1.3 KiB
1.3 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6977a4306bb3e856690a4890 | Step 6 | 20 | step-6 |
--description--
Now that you have calculated the tip, you need to add it to your running_total to find the final bill amount.
Use the += operator to add the value of tip to your running_total. Finally, use print() to display the string Total with tip: followed by a space and the value of running_total.
--hints--
You should use the += operator to add the value of tip to your running_total.
({
test: () => assert(runPython(`
_Node(_code).has_stmt('running_total += tip')
`))
})
You should print the string Total with tip: followed by a space and the running_total variable.
({
test: () => assert(runPython(`
_Node(_code).has_call("print('Total with tip:', running_total)") or _Node(_code).has_call("print(f'Total with tip: {running_total}')")`))
})
--seed--
--seed-contents--
running_total = 0
num_of_friends = 4
appetizers = 37.89
main_courses = 57.34
desserts = 39.39
drinks = 64.21
running_total += appetizers + main_courses + desserts + drinks
print('Total bill so far:', running_total)
tip = running_total * 0.25
print('Tip amount:', tip)
--fcc-editable-region--
--fcc-editable-region--