## DEV Community

Nuriddin152

Posted on • Updated on

# Masalalar

list = [3, 6, 9, 12, 15, 18, 20]
list2 = [4, 8, 12, 16, 20, 24, 28]
res = list()
odd_elelements = list[1::2]
print('Element at odd-indeks positsions from list one')
print(odd_elements)

even_elements = list[0::2]
print("even_elements at even-indeks posiysion from list two")
print(even_elements)

print('Priting final third list')
res.extend(odd_elements)
res.extend(even_elements)
print(res)

# revers() - bu funksiya biz kiritgan sonlarni tesgarisiga ogirib beradi va ekranga chiqaradi

list1 = [100, 200, 300, 400, 500]
list1.reverse()
print(list1)

# -1 salbiy kesishdan foydalanish.Shunda biz kiritgan sonlarni teskarisiga ogirib beradi va ekranga chiqaradi

list1 = (300, 400, 500, 600, 700)
list1 = list1[::-1]
print(list1)

tuple1 = (10, 20, 30, 40, 50)
tuple1 = tuple[::-1]

tuple = ("orange",[10, 20, 30],(5, 15, 25))
print(tuple)
print(tuple[1])
print(tuple[2])
print(tuple[1][1])

tuple1 = (11, 22, 33, 44, 55, 66)
tuple2 = tuple1
print(tuple2[3])
print(tuple2[4])
tuple1 = tuple2[3::-1]
print(tuple1)

x = range(6)

print(type(x))

# dict ga mashq

x = {"name": "John", 'age':36}

print(type(x))

# set ga mashq

x = ({"Apple", "banana", "cherry"})

print(x)

print(type(x))

# frozenset ga mashq

x = frozenset({"Apple", "Apple", "Cherry"})

print(x)

print(type(x))

x = True

print(x)

print(type(x))

x = b"Hello"

print(x)

print(type(x))