✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Task 3: Range Function Practice
Objective: Use Python’s range() to control loops.
Instructions:
Write a Python function range_sum(n) that:
Uses a for loop and range() to add numbers from 0 up to n-1.
Modify the function to:
Use a while loop instead of a for loop.
Use a bottom-check loop (while True + break) structure to achieve the same.
Example Input:
n = 5
Expected Output:
Sum = 10
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!