if else haqida
iamafruz777
Posted on April 5, 2023
Assalamu aleykum hurmatli dasturchi bugun siz bilan Python dasturlash tilida if else haqida ko'rib chiqamiz
Python dasturlash tilida if .. else
(shart amall) xaqida gaplashamiz
Python dasturlash tilida matematika mantiqiy amallarni qo'llab quvatlaydi.
If
sozi ingliz tilidan "agar" deb tarjima qilinadi va deyarli barcha dasturlash tillarida shartlarni yozish uchun foydaniladi.
Else
ingliz tilidan "aks xolda" deb tarjima qilinadi if qismi bajarilmaganda else qismi ichidagi kod bajariladi
misol uchun:
Teng:
a===b
Teng emas:
a!=b
Kamroq
: a<b
Kichik yoki teng:
a <=b
katta:
a > b
Katta yoki teng:
a >= b
Keling endi misollar koramiz:
a = 5
b = 6
if a > b:
print("A katta b dan")
else:
print("A kichkina b dan")
Natija:
A kichkina b dan chiqadi
Va keling yana bitta misol koramiz:
a = 16
a = 16
if a==b & a==b:
print("A teng b ga ")
else:
print("A teng emas b ga")
Natija:
A teng b ga
Posted on April 5, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024
November 30, 2024