Greater Than and Less Than Operators in Python

To compare two values, the following operators are used: greater than >, greater than or equal to >=, less than <, less than or equal to <=.

Let us have a variable tst:

pythontst = 3

Let's find out if the value of this variable is greater than zero:

pythonif tst > 0:
  print('+++') # this will work
else:
  print('---')

Now let's change the value of the variable to negative:

pythontst = -3

if tst > 0:
  print('+++')
else:
  print('---') # will this work

Now let the value of the variable be 0. In this case, the block else will be executed:

pythontst = 0

if tst > 0:
  print('+++')
else:
  print('---') # will this work

Let's change the condition to greater than or equal to:

pythonif tst >= 0:
  print('+++') # this will work
else:
  print('---')

If you change the condition to less than or equal, the first block will also work:

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

Given a variable:

pythontst = 5

Check that it is greater than 10.

Задание 2

Check that the variable tst is less than 10.

Задание 3

Check that the variable tst is greater than or equal to 5.

Задание 4

Check that the variable tst is less than or equal to -5.

Задание 5

Given a variable:

pythontst = 5

Check that it is greater than 10.

Задание 6

The following code is given:

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

Set the variable age to a number with your age. Tell me what is printed to the console.