Python-courses-python-exercises

Execise 1

write python algorithm to display all element of given list by two differents way

Solution

# dfine a some list
L = ["laptop" , "ipad" , "iphone" , "tablet" , "printer"]

# First method
print("---------------nFirst methodn-------------")
for x in L:
print(x)

# second method
print("---------------nSecond methodn-------------")
n = len(L)
for i in range(0, n):
print(L[i])

Younes Derfoufi
my-courses.net

Leave a Reply