✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
Task 1: Looping and Accumulator Variable
Objective: Practice loop control and accumulator patterns using Python.
Instructions:
Write a Python function sum_list_elements(lst) that:
Takes a list of integers as input.
Returns the sum of all elements using a for loop and an accumulator variable.
Extend the function to count how many elements in the list are greater than 10 using a separate counter.
Example Input:
[3, 11, 15, 7, 2, 18]
Expected Output:
Sum: 56
Count of numbers > 10: 3
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!