[Answered ]-Python won't assign the right value in simple "if" statement

2👍

It may be that you are not converting passenger_number to an integer so the comparison operators are comparing between a string and an integer.

>>> "5" < 8
False
>>> "5" > 8
True

So try something like num_passengers = int(instance.passenger_number) and then do your comparisons against that instead.

Leave a comment