Logical OR in Python

Logical OR requires at least one condition to be met. Such a condition can be written using the operator or.

Let us have two variables:

pythontst1 = 10
tst2 = -5

Let's write down the condition - if the variable tst1 is greater than 0 or the variable tst2 is greater than 0, then '+++' will be output to the console:

pythonif tst1 > 0 or tst2 > 0:
  print('+++') # this will work
else:
  print('---')
Задание 1

Given variables:

pythontst1 = -1
tst2 = 4

Check that the variable tst1 is equal to or less than 1, and the variable tst2 is greater than or equal to 3.

Задание 2

Without running the code, determine what will be output to the console:

pythontst1 = -10;
tst2 = -10;

if tst1 >= 0 or tst2 >= 0:
  print('+++');
else:
  print('---');
}
Задание 3

Without running the code, determine what will be output to the console:

pythontst1 = 0;
tst2 = 0;

if tst1 >= 0 or tst2 >= 0:
  print('+++');
else:
  print('---');
Задание 4

Without running the code, determine what will be output to the console:

pythontst1 = 0;
tst2 = 5;

if tst1 >= 0 or tst2 >= 0:
  print('+++');
else:
  print('---');
Задание 5

Without running the code, determine what will be output to the console:

pythontst1 = 5;
tst2 = 5;

if tst1 >= 0 or tst2 >= 0:
  print('+++');
else:
  print('---');
Задание 6

Without running the code, determine what will be output to the console:

pythontst1 = -5;
tst2 = 15;

if tst1 >= 0 or tst1 >= 0:
  print('+++');
else:
  print('---');
Задание 7

Without running the code, determine what will be output to the console:

pythontst = 1;

if tst == 0 or tst == 1:
  print('+++');
else:
  print('---');
Задание 8

Without running the code, determine what will be output to the console:

pythontst = 2;

if tst == 0 or tst == 1:
  print('+++');
else:
  print('---');
Задание 9

Without running the code, determine what will be output to the console:

pythontst = 2;

if tst == 0 or tst == 1 or tst == 2:
  print('+++');
else:
  print('---');