The Centripetal Force formula is given as: (m*v*v)/r >>> round(centripetal(15.5,-30,10),2) 1395.0 >>> round(centripetal(10,15,5),2) 450.0 >>> round(centripetal(20,-50,15),2) 3333.33 >>> round(centripetal(12.25,40,25),2) 784.0 >>> round(centripetal(50,100,50)
(mass: float, velocity: float, radius: float)
| 22 | |
| 23 | |
| 24 | def centripetal(mass: float, velocity: float, radius: float) -> float: |
| 25 | """ |
| 26 | The Centripetal Force formula is given as: (m*v*v)/r |
| 27 | |
| 28 | >>> round(centripetal(15.5,-30,10),2) |
| 29 | 1395.0 |
| 30 | >>> round(centripetal(10,15,5),2) |
| 31 | 450.0 |
| 32 | >>> round(centripetal(20,-50,15),2) |
| 33 | 3333.33 |
| 34 | >>> round(centripetal(12.25,40,25),2) |
| 35 | 784.0 |
| 36 | >>> round(centripetal(50,100,50),2) |
| 37 | 10000.0 |
| 38 | """ |
| 39 | if mass < 0: |
| 40 | raise ValueError("The mass of the body cannot be negative") |
| 41 | if radius <= 0: |
| 42 | raise ValueError("The radius is always a positive non zero integer") |
| 43 | return (mass * (velocity) ** 2) / radius |
| 44 | |
| 45 | |
| 46 | if __name__ == "__main__": |
nothing calls this directly
no outgoing calls
no test coverage detected