2022-10-11 19:27:51 +00:00
|
|
|
def intersects(a1, b1, a2, b2):
|
2023-05-16 20:00:37 +00:00
|
|
|
assert a1 <= b1 and a2 <= b2, "Os intervalos não são válidos."
|
|
|
|
return a1 <= b2 and a2 <= b1
|
2022-10-11 19:27:51 +00:00
|
|
|
|
|
|
|
|
2023-05-16 20:00:37 +00:00
|
|
|
def main():
|
|
|
|
a1 = float(input("a1: "))
|
|
|
|
b1 = float(input("b1: "))
|
|
|
|
a2 = float(input("a2: "))
|
|
|
|
b2 = float(input("b2: "))
|
2022-10-11 19:27:51 +00:00
|
|
|
|
2023-05-16 20:00:37 +00:00
|
|
|
try:
|
|
|
|
print(intersects(a1, b1, a2, b2))
|
|
|
|
except AssertionError as e:
|
|
|
|
print(e)
|
|
|
|
|
|
|
|
|
|
|
|
main()
|