Define a function running_total(n) using a while loop that starts count at 1 and total at 0
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Define a function running_total(n) using a while loop that starts count at 1 and total at 0. While count <= n, add count to total and increment count. Return total. Print running_total(10).
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.