These two operators able to look through the list in order to check whether a specific value is stored inside the list or not.
Consider the below snippet.
Output is
Simple Programs by using Lists
Output is 17.
If we try the above program in below way.
So, here we have a question which of these two actions consumes more computer resources - just one comparison, or slicing almost all of a list's elements?
Let’s find the location of a given element inside a list.
Output is
If we want to find how many same numbers in a given two sets of numbers, let’s consider the below snippets.
Output is 4.
This task is to write a program which removes all the number repetitions from the list. The goal is to have a list in which all the numbers appear not more than once.
Output is
Lists in Lists
No comments:
Post a Comment