3

I am writing some python code in PyCharm. It is giving me a warning when I write the following test.

            return factor >= 1.0 and factor <= 2.0

Information on the warning says it is showing because the comparison can be simplified. Is there a better way of writing this comparison. An image showing the warning

Charitoo
  • 1,814
  • 17
  • 21

1 Answers1

6
return 1 <= factor <= 2

This will eliminate that, as it's combining the two comparisons.

Jake Conway
  • 901
  • 16
  • 25