Exercise 19

Write a Python algorithm that lists the strings that make up the list

l = ["laptop", "iphone", "tablet", "printer", "Ipad"]

by indicating the length of each string.

Solution

l = ["laptop", "iphone", "tablet", "printer", "Ipad"]
#browse through all items in the list l
for x in l:
print(x, " is in list l, its length is: ", len(x))
Younes Derfoufi
my-courses.net

Leave a Reply