✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
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
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!