Program to return Smaller list Elements in Python

In the previous article we discussed handling of slicing on tuples, strings and lists in python. Now let us explore how we can handle a problem related to list concept. We need to write a function that takes a list as input, also takes a value for ‘x’ as input. The function should return all … Read more

Program to separate Even and Odd List Elements

In the previous article we explored how we could write a function to return the smaller elements from a list. Now we will apply similar logic to write a function to separate even and odd list elements. We are given a list, we need to write a function that takes the list as argument and … Read more

Count Distinct Elements in a List in Python

In the previous article we discussed how to to obtain the average/mean of a given list, now we will see how we can write a program to Count Distinct Elements in a List in Python. Suppose we are given a list L=[10,20,10,30,30,20], we see that there some of the elements occur multiple times within the … Read more