Tashkent university of information technologies named after muhammad al-khwarizmi data structure and algorithms



Download 158,05 Kb.
Sana02.07.2022
Hajmi158,05 Kb.
#731336
Bog'liq
labaratory 1. MTA

    Bu sahifa navigatsiya:
  • Theme

MINISTRY OF DEVELOPMENT OF INFORMATION TECHNOLOGIES AND COMMUNICATIONS OF THE REPUBLIC OF UZBEKISTAN


TASHKENT UNIVERSITY OF INFORMATION TECHNOLOGIES NAMED AFTER MUHAMMAD AL-KHWARIZMI

DATA STRUCTURE AND ALGORITHMS


LABORATORY WORK №1

Done by the student of 716-20 group Jo’raqulov Iftixor


Checked by Zarina Ildarovna

LABORATORY WORK №1


Theme: The study of static data structures.
Aim: Become skilled at programming static data structures.
Variant-1

  1. Task 1: There is an array of size N and integers K and L (1 < K ≤ L ≤ N). Find the arithmetical mean of all elements of the array except the elements with numbers K to L inclusive.

def solve_task(a, k, l):


n = len(a)
summa = 0
count= 0
for index, value in enumerate(a):
if not (index >= k and index <= l):
summa += value
count += 1
return summa // count
a = [1,2,3,4,5,6]
print(solve_task(a, 2, 4))

Task 2: A string is given, consisting of Russian words separated by spaces (one or more). Find the number of words in the string.

def solve_task2(s):


flag = ' '
number_of_words = 0
for i in s:
if i == flag:
number_of_words += 1
return number_of_words + 1
s = "привет мир, я закончил 1-задачу"
print(solve_task2(s))

Download 158,05 Kb.

Do'stlaringiz bilan baham:




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish