/**
 * Simulate an athlete's performance and calculate average speed.
 */
fun athletePerformance() {

    val totalDistance = 5000.0  // in meters
    val totalTime = 30.0  // in minutes
    val lapDistance = totalDistance / 10
    val lapTime = totalTime / 10

    // Use a loop to execute the block of code 10 times.
    for (lap in 1..10) {
        val lapStartTime = (lap - 1) * lapTime
        val lapEndTime = lap * lapTime
        val lapSpeed = calculateAverageSpeed(lapDistance, lapTime)

        if (lapSpeed >= 15) {  // Adjust the condition based on the required average speed
            // Print the lap's information if the lap speed is greater or equal to 15 m/s
            println("Lap $lap: Distance: $lapDistance m, Time: $lapStartTime-$lapEndTime min, Speed: $lapSpeed")
        }
    }
}

fun calculateAverageSpeed(distance: Double, time: Double): Double {
    return distance / time
}
/**
 * Simulate an athlete's performance and calculate average speed.
 */
fun athletePerformance() {
/**
 * Simulate an athlete's performance and calculate average speed.
 */
fun athletePerformance() {

    val totalDistance = 5000.0  // in meters
    val totalTime = 30.0  // in minutes
    val lapDistance = totalDistance / 10
    val lapTime = totalTime / 10

    // Use a loop to execute the block of code 10 times.
    for (lap in 1..10) {
        val lapStartTime = (lap - 1) * lapTime
        val lapEndTime = lap * lapTime
        val lapSpeed = calculateAverageSpeed(lapDistance, lapTime)

        if (lapSpeed >= 15) {  // Adjust the condition based on the required average speed
            // Print the lap's information if the lap speed is greater or equal to 15 m/s
            println("Lap $lap: Distance: $lapDistance m, Time: $lapStartTime-$lapEndTime min, Speed: $lapSpeed")
        }
    }
}

fun calculateAverageSpeed(distance: Double, time: Double): Double {
    return distance / time
}