In: Computer Science
N=float(input("Enter Value of N: ")) #taking input for N
M=float(input("Enter Value of M: ")) #taking input for M
X=float(input("Enter Value of X: ")) #taking input for X
Y=float(input("Enter Value of Y: ")) #taking input for Y
if N>M:
length=N
breadth=M
else:
length=M
breadth=N
print(f"minimum distance is: {min(X,Y,breadth-X,length-Y)}") #min function will return the min of all the numbers
you can copy paste the following code::
N=float(input("Enter Value of N: ")) #taking input for N
M=float(input("Enter Value of M: ")) #taking input for M
X=float(input("Enter Value of X: ")) #taking input for X
Y=float(input("Enter Value of Y: ")) #taking input for Y
if N>M:
length=N
breadth=M
else:
length=M
breadth=N
print(f"minimum distance is: {min(X,Y,breadth-X,length-Y)}") #min function will return the min of all the numbers