Computer Science, asked by arunyes2004, 3 months ago

write a python program to find sum of list values without using built in functions​

Answers

Answered by VanjaraTanvi
5

Answer:

# Python program to find sum of elements in list

total = 0

# creating a list

list1 = [11, 5, 17, 18, 23]

# Iterate each element in list

# and add them in variale total

for ele in range(0, len(list1)):

total = total + list1[ele]

# printing total value

print("Sum of all elements in given list: ", total)

Output

Sum of all elements in given list: 74

Hope it helps you.

Pls mark as the brainliest answer

Answered by anindyaadhikari13
6

Required Answer:-

Question:

  • Write a Python program to find sum of list values without using built in functions.

Solution:

We will input each elements for the list and then add each values and store it in a variable. Finally, we will display the value.

As there are n elements, loop iterates n times.

Here comes the code.

l=[]

n,s=int(input("How many numbers - ")),0

for i in range(0,n):

x=int(input("Enter - "))

s+=x

l.append(x)

print("Given list: ",l)

print("Sum of all elements: ",s)

For verification, check out the attachment.

Attachments:
Similar questions