lst=["koala", "cat", "fox", "panda", "chipmunk", "sloth", "penguin", "dolphin"]
for x in lst:
print(x)
koala cat fox panda chipmunk sloth penguin dolphin
lst=["Sam", "Lisa", "Micha", "Dave", "Wyatt", "Emma", "Sage"]
for x in lst:
print(x)
Sam Lisa Micha Dave Wyatt Emma Sage
str="Antarctica"
for x in str:
print(x)
A n t a r c t i c a
str="Civilization"
c=0
for i in str:
c=c+1
print(c)
12
lst1=["Phil", "Oz", "Seuss", "Dre"]
lst2=["Dr."]
for x in lst1:
for y in lst2:
print(y, x)
Dr. Phil Dr. Oz Dr. Seuss Dr. Dre
Write a for loop which appends the square of each number to the new list.
lst1=[3, 7, 6, 8, 9, 11, 15, 25]
lst2=[9, 49, 36, 64, 81, 121, 225, 625]
lst1.append(lst2)
print(lst1)
[3, 7, 6, 8, 9, 11, 15, 25, [9, 49, 36, 64, 81, 121, 225, 625]]
lst1=[111, 32, -9, -45, -17, 9, 85, -10]
lst2=[111, 32, 9, 45, 17, 9, 85, 10]
for x in lst2:
print(x)
111 32 9 45 17 9 85 10
lst1=[3.14, 66, "Teddy Bear", True, [], {}]
lst2=[3.14, 66, "Teddy Bear", True, [], {}]
for x in lst1:
print(x)
for y in lst2:
print(y)
3.14 66 Teddy Bear True [] {} 3.14 66 Teddy Bear True [] {}