========================================================================
a=[10,20,30]
b=[40,50,60]
print(a,b)
[10, 20, 30] [40, 50, 60]
a+b
[10, 20, 30, 40, 50, 60]
a*3
[10, 20, 30, 10, 20, 30, 10, 20, 30]
len(a)
3
min(a)
10
max(a)
30
sum(a)
60
10 in a
True
50 in a
False
60 in a
False
60 in b
True
a=[10,20,30]
for i in a:
print(i)
10
20
30
a=[10,20,30]
for i in range(len(a)):
print(a[i])
10
20
30
========================================================================
Program 1
l1=[1, 2, 3, 4]
l2=[5, 6, 7, 8]
print("tuple repeatation: ",l1*2)
print("=============")
l2=[5, 6, 7, 8]
print("tuple repeatation: ",l1*2)
print("=============")
print("tuple concatination: ",l1+l2)
print("=============")
print("tuple membership")
print (2 in l1)
print("=============")
print("tuple iteration")
for i in l1:
print(i)
print("=============")
print("lenght of tuple: ", len(l1))
print("=============")
OUTPUT:
tuple repeatation: [1, 2, 3, 4, 1, 2, 3, 4]
=============
tuple concatination: [1, 2, 3, 4, 5, 6, 7, 8]
=============
tuple membership
True
=============
tuple iteration
1
2
3
4
=============
lenght of tuple: 4
=============
========================================================================
Program 2
l1=[1,2,3,4,5]
l2=[5,6,7,8]
l2=[5,6,7,8]
len(l1)
5
len(l2)
4
max(l1)
5
min(l1)
1