[text] car travelling from pint A to point B

Viewer

copydownloadembedprintName: car travelling from pint A to point B
  1. # Define the starting point (point A) and destination (point B)
  2. point_a = (0, 0)
  3. point_b = (100, 200)
  4.  
  5. # Define the speed of the car in miles per hour
  6. speed = 50
  7.  
  8. # Calculate the distance between point A and point B
  9. distance = ((point_b[0] - point_a[0]) ** 2 + (point_b[1] - point_a[1]) ** 2) ** 0.5
  10.  
  11. # Calculate the time it will take the car to travel from point A to point B
  12. time = distance / speed
  13.  
  14. # Print the time it will take the car to travel from point A to point B
  15. print("The car will take {:.2f} hours to travel from point A to point B.".format(time))
  16.  

Editor

You can edit this paste and save as new:


File Description
  • car travelling from pint A to point B
  • Paste Code
  • 23 Mar-2023
  • 577 Bytes
You can Share it: