I am very new to Python programming and have come across a problem statement i have no clue how to solve. I have four lines of input:
0 1
2 4
6 7
3 5
For accepting these 4 lines of input i can do the below:
for i in range(4):
a,b = list(map(int,input().split(' ')))
I am supposed to merge the intervals into(Output) :
0 1
2 5
6 7
Intervals (2,4) and (3,5) they should be merged into one (2,5).
I am not sure how should i go about this ?
Can someone help me in getting a direction?
Thanks in advance.
(2, 4), (3, 5) = (2, 5)could mean the min and max of the two sets. - chidimo(a, b )= min(min((2,4),(3, 5))), max(max((2,4),(3,5))). But there needs to be a more defined pattern. Perhaps more data would help in deciphering such a pattern - chidimo