print("element at odd -index positions fromarks=float(input("enter marks:"))
print("\n")
print("student marks:",marks)
print("type is :",type(marks))
list1=[1,3,5,7,11,13,17,19,23,31,41]
list2=[2,4,6,8,10,12,14,16,18,20,22]
print("toq sonlar:",list1[0:7])
print("juft sonlar:",list2[0:7])
list1=[1,3,5,7,11,13,17,19,23,31,41]
list2=[2,4,6,8,10,12,14,16,18,20,22]
res=list()
odd_elements=list1[1::2]m list one ")
print(odd_elements)
even_elements=list2[0::2]
print("element at even -index positions from list two")
print(even_elements)
print("printing final third list")
res.extend(odd_elements)
res.extend(even_elements)
print(res)
solution1
revers()- bu fundsiy biza kiritgan sonlarnni teskarisiga ugirib beradi.
list1=[100,200,300,400,500]
list1.reverse() #reverse teskarisiga qilish
print(list1)
solution2
-1 salbiy kesish dan foydalanish shunda biza kiritgan sonlarnni teskarisiga ugirib beradi va edranga chiqarib beradi .
list1=[300,400,500,600,700]
list1=list1[0::1]
print(list1)#chiqadi 300 , 400.
list1=(300,400,500,600,700)
list1=list1[0::-1]
print(list1)
tuple1=("orange",[10,20,30],[5,15,25])
print(tuple1)
print(tuple1[0])
print(tuple1[1])
print(tuple1[2])
print(tuple1[1][1])#hozir bu holatda 20 soni ekranga chiqadi .
tuple1=(11,22,33,44,55,66)
print(tuple1[3])# chiqadi 44
print(tuple1[4])# chiqadi 55
print(tuple1[3])
list1.reverse()
print(list1[3::-1])
print(tuple(2))
Top comments (0)