Python Forum
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check matrix...
#4
Put the ranges in a list:
ranges=[(1,15) ,(16,30),(31,45),(46,60),(61,75)]
Then when you scan a line, you use the index of the item to retrieve the corresponding element in ranges and compare its value with the two limits.

An even more pythonic way is to:
 iterate lines
    zip(line,ranges)
    iterate result which are (line_item, (min,max)) and compare
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Messages In This Thread
Check matrix... - by jkk30 - Apr-12-2017, 04:45 AM
RE: Check matrix... - by micseydel - Apr-12-2017, 05:12 AM
RE: Check matrix... - by jkk30 - Apr-12-2017, 05:35 AM
RE: Check matrix... - by Ofnuts - Apr-12-2017, 08:02 AM
RE: Check matrix... - by jkk30 - Apr-13-2017, 07:59 AM
RE: Check matrix... - by Ofnuts - Apr-13-2017, 09:40 PM
RE: Check matrix... - by jkk30 - Apr-14-2017, 09:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  define a diagonal matrix from a matrix amalalaoui 1 2,372 May-15-2019, 01:12 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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