Question: 3. Functions: Write a Python program that implements the algorithm given below. This program takes x,y coordinates and the capacity of two tanks. Finds whether
3. Functions: Write a Python program that implements the algorithm given below. This program takes x,y coordinates and the capacity of two tanks. Finds whether both tanks are within 1km range. If so, it finds the total capacity and prints it. Main program: 1) Start 2) Input location of first tank (x1.y1) and capacity of first tank c1 (You can take input separately as x1, y1 or like a tuple.) 3) Input location of second tank (x2,72) and capacity of second tank c2 4) Check whether the tanks are closer than 1km: call function: isCloser(x1,71,x2,72) 5) If Yes, find total capacity: call function: totcap=sum(c1,c2) 6) print totcap 7)end Function is closer(x1.y1,x2,y2) 1) 2) 3) 4) Start dist={(x1-x2)^2+(y1-y2)^2)^(0.5) if dist
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
