Double Comparisons in Python

In Python, you can use double comparisons, where you write comparison operators on the left and right sides of a variable.

Let us have a variable tst:

pythontst = 3

Let's do a double comparison for her:

pythonif 2 < tst < 10:
  print('+++')
else:
  print('---')
Задание 1

Given a variable:

pythontst = 15

Check that it is greater than 10 and less than 20.

Задание 2

Given a variable:

pythontst = -5

Check that it is less than 0 and greater than -10 or greater than -8 and less than 30.

Задание 3

Given a list:

pythontst = ['a', 'b', 'c', 'd', 'e']

Check that its length is less than 6 and greater than 0.