Created
August 5, 2015 18:40
-
-
Save nikhilRP/91b762ebac8795f8fb05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test_data = [(50, 150), (100, 200), (150, 250), (99, 201), (100, 201), (201, 300), (98, 99)] | |
def main(): | |
# view region | |
start = 100 | |
end = 200 | |
print "View region: start - " + str(start) + " end - " + str(end) | |
print "Method 1 - Nikhil" | |
for data in test_data: | |
if data[1] >= start and data[0] <= end: | |
print str(data) + " overlaps" | |
else: | |
print str(data) + " doesn't overlap" | |
print "Method 2 - Frank and Eric" | |
for data in test_data: | |
if (start <= data[0] and end > data[0]) or (start < data[1] and end >= data[1]): | |
print str(data) + " overlaps" | |
else: | |
print str(data) + " doesn't overlap" | |
if __name__ == '__main__': | |
main() |
Author
nikhilRP
commented
Aug 5, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment