for i in range(1, 5):
print(i)
else:
print('The for loop is over')
for i in range(1, 5,1):
print(i)
else:
print('The for loop is over')
for i in range(1, 5,2):
print(i)
else:
print('The for loop is over')
for i in range(0, 5,1):
x=i*2+1
print(x)
for i in range(0, 3,1):
for j in range(0,3,1):
print(i,j)
x=[1,2,9,2,3]
len(x)
x[0]
x[4]
x[5]
for i in range(len(x)):
print(x[i])
type(x)
type(x[0])
y=[2.3,'a',9,'salam',3]
for i in range(len(y)):
print(y[i])
type(y[0])
type(y[3])
z=[]
len(z)
for i in range(0,5,1):
z.append(i)
z
len(z)
mat1=[[1,2,3],[3,4,5],[6,7,8]]
mat1
mat1[1][1]
for i in range(len(mat1)):
print(mat1[i])
a=3.1
f=1
if type(a)==type(1):
for i in range(1,a+1,1):
f=f*i
print(f)
else:
print("error! the input number should be integer!")
l1=[1,'a',3,6]
for i in l1:
print(i)
l1=[1,3,5,6]
l2=[9,7,2,5]
l3=[]
l4=[]
l5=[]
for i in range(len(l1)):
l3.append(l1[i]+l2[i])
l4.append(l1[i]-l2[i])
l5.append(l1[i]*l2[i])
l3
l4
l5
l3
list0=[[1,2,3,4,5],[9,5,7,1],[0,2]]
for i in range(len(list0)):
for j in range(len(list0[i])):
print(list0[i][j])
l_test=[0,9,2,3,6,8,7]
for i in range(1,len(l_test),2):
print(l_test[i])