#For loop:for loop executes set of stmts for every element of collection object.
#All the stmts within the for loop should follow the indentation
x=[10,20,30,40,50]
for p in x:
print(p)
for p in x:
print(p,end= ” “)
#Printing a msg for multiple times using for loop
x=[10,20,30,40,50]
for p in x:
print("Good Evening!!!")
#To print a msg for multiple times using for loop
x=[10,20,30,40,50]
for p in x:
print("Good Morning!!!")
#To square each element of a list
x=[10,20,30,40,50]
for p in x:
print(p*p) #or print(p**2)
#To compute the sum of list elements
x=[10,20,30,40,50]
sum1=0
for p in x:
sum1=sum1+p
print("sum=",sum1)
#For loop on a string
x="python"
for p in x:
print(p)
#printing each character for 3 times
for p in x:
print(p*3)
#Printing a msg for multiple times
for p in x:
print("Good Evening!!!")