Python-da boyuk ve kicik operatorlari

Iki qiymetin bir-biri ile mueqayisesi ucun boyuk >, boyuk ve ya beraber >=, kicik <, kicik ve ya beraber <= operatorlarindan istifade olunur.

Elimizde tst deyisheni olsun:

pythontst = 3

Gelin bu deyishenin qiymetinin sifirdan boyuk olub-olmadigini yoxlayaq:

pythonif tst > 0:
  print('+++') # bu iwleyecek
else:
  print('---')

Indi deyishenin qiymetini menfi edek:

pythontst = -3

if tst > 0:
  print('+++')
else:
  print('---') # bu iwleyecek

Indi deyishenin qiymeti 0 olsun. Bu halda else bloku iwleyecek:

pythontst = 0

if tst > 0:
  print('+++')
else:
  print('---') # bu iwleyecek

Gelin sherti boyuk ve ya beraber edek:

pythonif tst >= 0:
  print('+++') # bu iwleyecek
else:
  print('---')

Sherti kicik ve ya beraber etsek, ilk blok yenə iwleyecek:

pythonif tst <= 0:
  print('+++') # bu iwleyecek
else:
  print('---')
Задание 1

Bir deyishen verilib:

pythontst = 5

Onun 10-dan boyuk oldugunu yoxlayin.

Задание 2

tst deyisheninin 10-dan kicik oldugunu yoxlayin.

Задание 3

tst deyisheninin 5-dan boyuk ve ya beraber oldugunu yoxlayin.

Задание 4

tst deyisheninin -5-dan kicik ve ya beraber oldugunu yoxlayin.

Задание 5

Bir deyishen verilib:

pythontst = 5

Onun 10-dan boyuk oldugunu yoxlayin.

Задание 6

Asagidaki kod verilib:

pythonif age >= 18:
  print('You have access to the site')
else:
  print('You do not have access to the site')

age deyishenine yawiniz uygun bir reqem teyin edin. Konsola neyin cap olundugunu deyin.