-5

I am learning Python and trying to understand the following if statement. May I know what does it mean?

if 2 < a < b: do something.

Thank you!

1 Answers1

0

An if statement is a check of a condition and if this condition is true it will execute the code after the : .

In this case the Code prior to your line should have two variables a and b which both contain numbers.

If a is greater value than 2 and b is an even greater value than a, for example a is 3 and b is 4, or a is 10 and b is 200, the following Code will be executed. „Do something“ is just a place holder for the code that should be executed.

The best for you would be to search and read about if and if else statements for python to find some real life examples.

Holger
  • 356
  • 4
  • 11