Computer Science, asked by ssim, 8 months ago

write a python program , Where list ‘L’ passed as an argument and sum of all values which are ending with 3 from a list.

Answers

Answered by itzankit21
2

Answer:

Read input number asking for length of the list using input() or raw_input() .

Initialise an empty list lst = [] .

Read each number using a for loop .

In the for loop append each number to the list.

Now we use predefined function sum() to find the sum of all the elements in a list.

Print the result.

Answered by maniyachawla12
2

Answer:This may help you

Explanation:

Lists are just like dynamic sized arrays, declared in other languages (vector in C++ and ArrayList in Java). Lists need not be homogeneous always which makes it a most powerful tool in Python. A single list may contain DataTypes like Integers, Strings, as well as Objects. Lists are mutable, and hence, they can be altered even after their creation.

List in Python are ordered and have a definite count. The elements in a list are indexed according to a definite sequence and the indexing of a list is done with 0 being the first index. Each element in the list has its definite place in the list, which allows duplicating of elements in the list, with each element having its own distinct place and credibility.

NOTE:- Lists are a useful tool for preserving a sequence of data and further iterating over it.

Similar questions