Bu darsda mantiqiy operatorlarning ilg'or usullarini o'rganamiz:
# Murakkab ifoda
a = True
b = False
c = True
# Qiyin o'qiladigan ifoda
natija1 = not (a and b) or (c and not b)
# Bosqichma-bosqich yozish (tushunarli)
ab = a and b # True and False → False
not_ab = not ab # not False → True
not_b = not b # not False → True
c_and_not_b = c and not_b # True and True → True
natija2 = not_ab or c_and_not_b # True or True → True
print(f"Natija 1: {natija1}") # True
print(f"Natija 2: {natija2}") # TrueBu matematik qonunlar mantiqiy ifodalarni soddalashtirishda yordam beradi:
1-qonun: not (A and B) = (not A) or (not B)
a = True
b = False
# Birinchi usul
natija1 = not (a and b)
# Ikkinchi usul (De Morgan)
natija2 = (not a) or (not b)
print(f"Natija 1: {natija1}") # True
print(f"Natija 2: {natija2}") # True (bir xil)2-qonun: not (A or B) = (not A) and (not B)
a = True
b = False
# Birinchi usul
natija1 = not (a or b)
# Ikkinchi usul (De Morgan)
natija2 = (not a) and (not b)
print(f"Natija 1: {natija1}") # False
print(f"Natija 2: {natija2}") # False (bir xil)Murakkab mantiqiy ifodalar
Maktab o'quvchisining imtihon natijasi haqida qaror qabul qiling:
Berilgan ma'lumotlar:
Shartlar:
Natijani quyidagi formatda chiqaring:
Barcha fanlar yetarli: True
Mukammal natija bor: False
O'rtacha ball yetarli: True
Imtihon topshirdi: False