Dasturlash texnologiyasi


Download 175.52 Kb.
Sana23.08.2023
Hajmi175.52 Kb.
#1669661
Bog'liq
rustamov S


TOSHKENT DAVLAT IQTISODIYOT UNIVERSITETI SAMARQAND FILIALI


“Dasturlash texnologiyasi” fanidan



Mustaqil ishi


Bajardi: Rustamov S
Tekshirdi: Anarbayeva F


SAMARQAND-202
4. Berilgan satrdan dastlabki 2 va oxirgi 2 ta belgidan iborat satrni olish uchun Python dasturini yozing. Agar satr uzumligi 2 dan kichik bo’lsa, bo’sh satr qaytarsin.
satr = str(input("satrni kriting:"))

if len(satr) < 3:


print("")
else:
print(satr[0], satr[1], satr[-1], satr[-2])

2. Pythonda float tipidagi berilgan sonning musbat, manfiy yoki nol ekanligini tekshirish dasturini yozing


JAVOB:
a = float(input("sonni kiriting:"))
if a > 0:
print('soningiz musbat')
elif a < 0:
print('soningiz manfiy')
else:
print('soningiz 0 ga teng.')


Download 175.52 Kb.

Do'stlaringiz bilan baham:




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