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
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1EP550rwXw3BeQPnN-kCr1a9a2insR3TnZOx-g2BjwVpQpHaPuikd2T6VT5d7zmFQ3bzzHpUpohLUjBUZ2E7x5SjCWLfVnw5yKjT7PAuaLmMNpO6S2jC47kfpBgc8Ny0PzcgPtFDOdpE/s1600/1.png)
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