Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Python program that implements the algorithm given below. This program takes xy coordinates and the capacity of two tanks. Finds whether both tanks
Write a Python program that implements the algorithm given below. This program takes xy 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,y2) and capacity of second tank c2 4) Check whether the tanks are closer than 1km: call function: isCloser(x1.y1.x2,y2) 5) If Yes, find total capacity: call function: totcap=sum(c1.c2) 6) print totcap 7)end Function isCloser(x1,y1,x2,42) 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started