LEHETSÉGES FELTÉTELEK KIALAKÍTÁSA
a>b
c<b
a==b (egyenlő)
a!=b (nem egyenlő
Tartomány kizárása
(a<0) or (a>10)
Zárt tartomány
(a >5) and (a<10)
Lehet így is: if 5<a<10:
True and True (Eredmény: True)
False or True (Eredmény: True)
ADATVIZSGÁLAT1
a = 200
b = 33
if b > a:
print("b nagyobb a")
else:
print("b nem nagyobb a")
ADATVIZSGÁLAT2
a = 200
b = 33
if b > a:
print("b nagyobb a")
elif a == b:
print("a és b azonos")
else:
print("a nagyobb b")
ADATVIZSGÁLAT3 (Zárt tartomány)
a = int(input(’kérek egy számot:’ )
if a > 9 and a<100:
print(’A szám kétjegyű’)
ADATVIZSGÁLAT4 (Nyílt tartomány)
a = int(input(’kérek egy évszámot:’ )
if a <1949 or a>1945:
print(’Az esemény nem a második világháborúban történt’)
ADATVIZSGÁLAT5 (in operátor)
animals = ["dog", "lion", "cat"]
if "lion" in animals:
print('Yes lion')
if 'tiger' not in animals:
print('No tiger')
is feltétel
a = [1, 2, 3]
b = [1, 2, 3]
if a is b:
print("Același obiect")
else:
print("Obiecte diferite")
is not feltétel
valoare = 10
if valoare is not None:
print("Variabila are o valoare")
else:
print("Variabila este None")
x