Computer Science, asked by boinem532, 9 months ago

What is the answer to 1.8 code practice on Edhesive?

Answers

Answered by padmapadma29814
62

Answer:

The answer to 1.8 code practice on Edhesive.

Answered by Tulsi4890
0

Here is the solution for the 1.8 code practice in Edhesive:

  • Start by initializing a variable "total" to 0.
  • Then, create a for loop to iterate through the elements in the list "numbers".
  • Inside the for loop, add the current element to the "total".
  • After the loop, print the total.
  • Here is the code implementation:

numbers = [1, 2, 3, 4, 5]

total = 0

for num in numbers:

total += num

print(total)

The code initializes a variable "total" to 0 and then loops through the elements in the list "numbers".

In each iteration, the current element is added to the "total". After the loop, the final value of "total" is printed which is the sum of all elements in the list.

To learn more about Edhesive from the given link.

https://brainly.in/question/3016346

#SPJ3

Similar questions