answered 6 years ago
To check the type of l, you can type ?l. You will see that l is a generator, not a list object. Thus in order to compute its length (and do other list-specific operations) you must convert it to a list using list.
l
?l
list