Python Forum
Efficiency with regard to nested conditionals or and statements
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Efficiency with regard to nested conditionals or and statements
#7
(Apr-28-2022, 04:28 PM)Gribouillis Wrote: You could compute once for all
mtelb, mteub = mte * 30, (mte + 1) * 30 + 5
then use
if mtelb <= int(float(datalist[2])) < mteub: ...
The
if float(datalist[6]) % 10 == 0
is questionable because usually one does not compare equality of floating point values with 0. Is it really what you want?

Thanks for the suggestions.

In the last, I'm looking for multiples of 10. Is there a better way to evaluate that?
Reply


Messages In This Thread
RE: Efficiency with regard to nested conditionals or and statements - by Mark17 - Apr-28-2022, 04:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Doubt about conditionals in Python. Carmazum 6 1,723 Apr-01-2023, 12:01 AM
Last Post: Carmazum
  Numpy Structure and Efficiency garynewport 2 751 Oct-19-2022, 10:11 PM
Last Post: paul18fr
  conditionals based on data frame mbrown009 1 952 Aug-12-2022, 08:18 AM
Last Post: Larz60+
  Nested conditionals vs conditionals connected by operators dboxall123 8 3,203 Feb-18-2022, 09:34 PM
Last Post: dboxall123
  Nested Conditionals shen123 3 2,704 Jul-28-2021, 08:24 AM
Last Post: Yoriz
  How to use vectorization instead of for loop to improve efficiency in python? PJLEMZ 4 2,515 Feb-06-2021, 09:45 AM
Last Post: paul18fr
  Invalid syntax using conditionals if - else jperezqu 1 2,393 Jan-13-2021, 07:32 PM
Last Post: bowlofred
  conditionals with boolean logic?? ridgerunnersjw 3 2,059 Sep-26-2020, 02:13 PM
Last Post: deanhystad
  two conditionals with intermediate code Skaperen 5 2,905 Jul-12-2020, 07:18 PM
Last Post: Skaperen
  Conditionals, while loops, continue, break (PyBite 102) Drone4four 2 3,070 Jun-04-2020, 12:08 PM
Last Post: Drone4four

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020