Huzuridagi fiskal instituti


Download 162.91 Kb.
Sana28.12.2022
Hajmi162.91 Kb.
#1024809
Bog'liq
Hamzayev Mirkomil 1-labaratoriya


O’ZBEKISTON RESPUBLIKASI DAVLAT SOLIQ QO’MITASI
HUZURIDAGI FISKAL INSTITUTI

Buxgalteriya va iqtisodiyot fakulteti
Matematika va axborot texnologiyalari” kafedrasi

Ma’lumotlar tuzilmasi va algoritmi” fanidan


1 – Labaratoriya ishi




Bajardi: Hamzayev Mirkomil
Qabul qildi: Yusupova Zaynabxon
Guruh: RI-01-21
8-variant
Dastur sharti:
Kiritilgan sonlar ichida kattasini olib tashlash.

Dastur kodi:


class Queue:
def __init__(self):
self.a=[]
def push(self,k):
self.a.append(k)
def pop(self):
t=self.a.pop(0)
return t
def top(self):
return self.a[0]
def size(self):
return len(self.a)
def isEmpty(self):
if (len(self.a)==0):
return True
else:
return False
def print(self):
print(self.a)
nav1=Queue()
n=int(input("n="))
for i in range(n):
p=int(input("son="))
nav1.push(p)
print("Bosh holat=")
nav1.print()
a=nav1.top()
n=nav1.size()
for i in range(n):
b=nav1.pop()
if aa=b
nav1.push(b)
for i in range(n):
b=nav1.pop()
if a==b:
pass
else:
nav1.push(b)
nav1.print()

Natija:


n=4
son=1
son=2
son=3
son=4
dastlabgi holat:
[1, 2, 3, 4]
natija:
[1, 2, 3]

NATIJA:

Download 162.91 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling