Namozov Nodirbek niyozovich


cost=int(input("summani kiriting= " ))


Download 0.88 Mb.
bet3/3
Sana12.02.2023
Hajmi0.88 Mb.
#1191334
1   2   3
Bog'liq
Dars Mashg\'uloti if-elif-else

cost=int(input("summani kiriting= " ))


Aksiya doirasida if elif else funksiyasini qo’llab dastur tuzaylik
  • cost=int(input("summani kiriting= " ))
  • if cost<1000:
  • print("Chegirma yoq")
  • elif cost<2000:
  • print("chegirma 2%")
  • elif cost<5000:
  • print("Chegirma 5%")
  • else:
  • print("Chegirma 10%")

Random-TASODIFIY randint-tasodifiy haqiqiy son


B o'zgaruvchisi raqamlarni o'z ichiga olmaydi, shuning uchun uni taqqoslash mumkin emas.
b=print(random. randint(1, 10)) ------> bunday holda, faqat ekranda chiqish jarayoni bo'ladi, lekin tayinlanmaydi
import random b=print(random.randint(1,10)) a=int(input()) if b==a: print("siz yutdingiz") else: print("siz yutkazdingiz")
Siz = input("Dars o'tishimni Xoxlaysizmi: ") if Siz == "Ha": print("Ismingiz nima ") elif Siz == “ha": print("Ismingiz nima ") else: print("Unda nimaga kelding")
a = input(“Ismingizni kiriting: ") b = “Dasturchi! " if a == "Nodirshox": print("Assalomu alaykum,", b) else: print("Assalomu alaykum,", a, end="!")
Darsimizga oid misollar

https://www.programiz.com/python-programming/if-elif-else

var1 = 1+2j

var1 = 1+2j

if (type(var1) == int):

print("Type of the variable is Integer")

elif (type(var1) == float):

print("Type of the variable is Float")

elif (type(var1) == complex):

print("Type of the variable is Complex")

elif (type(var1) == bool):

print("Type of the variable is Bool")

elif (type(var1) == str):

print("Type of the variable is String")

elif (type(var1) == tuple):

print("Type of the variable is Tuple")

elif (type(var1) == dict):

print("Type of the variable is Dictionaries")

elif (type(var1) == list):

print("Type of the variable is List")

else:


https://www.w3resource.com/python/python-if-else-statements.php
Download 0.88 Mb.

Do'stlaringiz bilan baham:
1   2   3




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