Challenge: Calculating the Speed of a Car
Swipe to start coding
If we have the amount of distance (distance) a car has traveled, and the time it took to to cover that distance (timeTaken), we can calculate the average speed that car had throughout the journey, using the formula:
Speed = Distance / Time Taken
Note
The distance is in meters, and the time is in seconds.
The given code uses the two variables, distance and timeTaken to calculate and show the speed of a car.
- Define a function called
calcSpeed. - Put the given code inside the
calcSpeedfunction. - Execute the
calcSpeedfunction twice.
Løsning
Takk for tilbakemeldingene dine!
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Fantastisk!
Completion rate forbedret til 1.33
Challenge: Calculating the Speed of a Car
Sveip for å vise menyen
Swipe to start coding
If we have the amount of distance (distance) a car has traveled, and the time it took to to cover that distance (timeTaken), we can calculate the average speed that car had throughout the journey, using the formula:
Speed = Distance / Time Taken
Note
The distance is in meters, and the time is in seconds.
The given code uses the two variables, distance and timeTaken to calculate and show the speed of a car.
- Define a function called
calcSpeed. - Put the given code inside the
calcSpeedfunction. - Execute the
calcSpeedfunction twice.
Løsning
Takk for tilbakemeldingene dine!
single