E
Engineering , 17.02.2022 23:04

One lap around a standard high-school running track is exactly 0.25 miles. Write the function miles_to_laps() that takes a number of miles as an argument and returns the number of laps. Complete the program to output the number of laps. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'.format(your_value)) Ex: If the input is: 1.5 the output is: 6.00 Ex: If the input is: 2.2 the output is: 8.80 Your program must define and call the following function: def miles_to_laps(user_miles)

Step-by-step answers

answer
Answered by a new expert

def miles_to_laps(user_miles):

return user_miles/0.25

if __name__ == '__main__':

miles = float(input(""))

lap = miles_to_laps(miles)

print("%.2f"%lap)

Explanation:

because it works.

Show answers
answer
Answered by a new expert

Java.

Explanation:

import java.util.Scanner;

public class MyClass {

   static void miles_to_laps(float miles) {

       double laps = miles/0.25;

       System.out.printf("Number of laps: %s", String.format("%.2f", laps));

   }

   public static void main(String args[]) {

       System.out.print("Enter miles: ");

       Scanner input = new Scanner(System.in);

       float miles = input.nextFloat();

       if (miles < 0) {

           System.out.println("Invalid input");

       }

       else

           miles_to_laps(miles);

   }

}

I have used the Scanner library for user input.

Show answers

Other questions on the subject: Engineering

E
Engineering, 17.02.2022 20:43
2. student organizations sometimes require transportation for off-campus activities, and school policy requires students to be over 23 years old to serve as transport. lael wants to determine how many of the active students will be eligible to transport other group members. in cell j2, enter a formula using the if function as follows to determine if kay colbert can serve as authorized
Answers: 0
E
Engineering, 28.11.2020 22:27
A 02-series single-row deep-groove ball bearing with a 65-mm bore (see Tables 11–1 and 11–2 for specifications) is loaded with a 3-kN axial load and a 7-kN radial load. The outer ring rotates at 500 rev/min. (a) Determine the equivalent radial load that will be experienced by this particular bearing. (b) Determine whether this bearing should be expected to carry this load with a
Answers: 0
E
Engineering, 08.01.2022 03:11
As part of their extensive kitchen remodel, the lees told their electrical contractors that they would need plenty of outlets for their many appliances. The contractors knew that they would need to install small appliance branch circuits using what kind of wire and circuit breaker?
Answers: 0
E
Engineering, 11.06.2021 01:03
Construct a 4K X 16 memory using 1K X 8 memory?
Answers: 0

Popular questions today:

B
Biology, 24.10.2021 21:28