Logical AND in Python

Sometimes it may be necessary to compose a complex condition. For this, you can use the operator and, which specifies the simultaneity of conditions.

Let us have a variable tst:

pythontst = 5

Let's check if it is greater than zero and at the same time less than 10:

pythonif tst > 0 and tst < 10:
  print('+++')
else:
  print('---')

Conditions can be imposed not on one variable, but on different ones. Let's create a condition that must be satisfied if the variable tst1 is equal to 2 and simultaneously if the variable tst2 is equal to 3:

pythontst1 = 2
tst2 = 3

if tst1 == 2 and tst2 == 3:
  print('+++')
else:
  print('---')
Задание 1

Given a variable:

pythontst = -3

Check that it is greater than zero and less than 5.

Задание 2

Given a variable:

pythontst = 21

Check that it is greater than or equal to 10 and less than or equal to 20.

Задание 3

Two variables are given:

pythontst1 = 6
tst2 = 10

Check that the first variable is less than 8 and the second is greater than or equal to 10.

Задание 4

The following code is given:

pythontst1 = 'abcde'
tst2 = list(tst1)

if len(tst1) >= 5 and len(tst2) < 8:
  print('+++')
else:
  print('---')

Tell me what will be output to the console.