Python Lab Work 4,8,9,10
Python Lab Work 4,8,9,10
Anjika Rastogi
2024/848
Question 4
Question 8
return sum
print("The series is:")
result = sum(n)
print("Sum of the series: ",result )
Question9
if X.islower():
print('The characters are in lowercase')
else:
print('The characters are combination of upper and lower case')
Question 10
even_l=[]
odd_l=[]
for i in range(1,21):
if i%2==0:
even_l.append(i)
else:
odd_l.append(i)
print(odd_l)
print(even_l)
print(odd_l+even_l)
print(odd_l*2)
print(3 in even_l)
print(even_l is odd_l)
del even_l[2]
even_l.clear()
print(odd_l.count(2))
l=[]
l=odd_l.copy()
odd_l.extend(l)
odd_l.pop(3)
odd_l.insert(1,5)
odd_l.remove(7)
odd_l.reverse()