Robotics & Artificial Intelligence
Write a Python program to add all the elements of the list.
Python List Manipulation
2 Likes
Answer
numbers = [2, 3, 4, 5, 7]
total = 0
for i in numbers:
total = total + i
print("Sum of elements:", total)Output
Sum of elements: 21
Answered By
1 Like
Related Questions
Write a Python program to search an element in the list.
Write a Python program to generate the square of all the elements of a list.
Write a program in Python to create a list of your classmates containing their names and roll numbers. Access the roll number of the student whose name is stored at 2nd index.
Find out one situation where lists are not suitable but the tuples are suitable.