Similarly to strings pythons list data type has many useful methods that we can implement. The two that I am going to show you here are .count() & .find(). These methods also work on strings!
- .count(): will count how many times a certain element appears.
- .find(): will find the first occurrence of an item and return its index.
Problem: we would like to check the validity of an email address. For our purposes it is valid if it contains one "@", has length >= 5 and ends with a ".com"