1👍
If you say feat_list() < 12
dand the value is 11.5, then its true, and execute the firt if
, but the next condition will be also true 11 < feat_list() <= 15
,
because 11.5, is between 11 and 15.
My point is… your first condition in your first if, is “containded” in the second condition of the elif:
12 is between 11 and 15, because 11 < 12 <= 15
, so, the first condition is wrong.
0👍
the elif
will only be evaluated when the if was not true.
So, if you want to check for 11 < feat_list() <= 15:
even if feat_list() < 12:
is true, use if
instead of elif
- Broken plotly installation impacts Django
- Django / WagtailCMS – get attribute (eg body text) of child page using get_context
- How combine (merge) several number of querysets?
- Django Model ValueError: too many values to unpack
0👍
In your example, the comparison ranges overlap between Silver and Gold packages (11-12). Also, you probably don’t want the Platinum package to be the “default” one (without check, provided it is the highest level). Maybe it would be more clear what the code is doing if you rewrote the comparison in the following style (pseudocode):
flist = feat_list()
# You can check the returned value here, ie. print(flist), and the value
# won't change before you're finished with the comparison.
if flist > 15:
#...Platinum processing...
elif flist > 11:
#...Gold processing...
else:
#...Silver processing...
- Cloning a div and changing the id's of all the elements of the cloned divs
- Django / Python – Date joined check
- Most efficient / proper way to give Json response in Django?
- Django / WagtailCMS – get attribute (eg body text) of child page using get_context