# Python program to demonstrate in-built poly- # morphic functions # len() being used for a string print(len("geeks")) # len() being used for a list print(len([10, 20, 30]))
Here is what the above code is Doing:
1. The first print statement calls the len() function on a string.
2. The second print statement calls the len() function on a list.
3. The output of both the print statements is the same.
4. This is because the len() function is polymorphic.
5. It can take multiple forms of input and return the length of the input.
6. This is the beauty of polymorphism.
7. It makes the code more readable and easier to understand.