Python Len Exercises

Let’s check out some exercises that will help understand len() function better.

Exercise 10-a

Using len() function find out how many items are in the list.

You can pass your object’s name inside len() function:


answer_1 = len(lst)

Exercise 10-b

len() function can also tell the length of a string.

Find out the length of the string given below.


msg_length = len(msg)