ACTIVITY 18 / 50
Try as many times as you needStation controller
Let’s understand
Combine input, comparison and branching into a small program. Predict the answer before running it. Test ordinary values and boundaries, such as exactly the energy required.
Listen to the explanation
Example
# input → condition → resultRead energy and cost. If there is enough energy, print what remains. Otherwise print STOP.
I need a hint
Compare energy >= cost, then subtract cost in that branch.
How to find an error
- Read the last line of the error message.
- Find the indicated line. Check quotes, parentheses and indentation.
- Change one thing and run again.
main.py
4 spaces
Your draft stays in this browser.
Result
PythonYour program’s output will appear here. Click Run.
Мой профиль