/**
 * A function that takes a list of distances and times and calculates the average velocity.
 *
 * @param distances A list of distances traveled in meters.
 * @param times A list of corresponding time periods in seconds.
 * @return The average velocity in meters per second.
 */
fun calculateAverageVelocity(distances: List<Double>, times: List<Double>): Double {

    var totalDistance = 0.0
    var totalTime = 0.0

    for ((distance, time) in distances.zip(times)) {
        totalDistance += distance
        totalTime += time
    }

    val averageVelocity = totalDistance / totalTime
    return averageVelocity
}

// Exercise
// As an Aerospace Engineer, you have data for the distances traveled and the times taken for multiple flights.
// You need to find the average velocity for each flight.

// Given data for 3 flights:
val flight1Distances = listOf(2000.0, 3000.0, 4000.0)  // in meters
val flight1Times = listOf(120.0, 130.0, 150.0)  // in seconds

val flight2Distances = listOf(1500.0, 2500.0, 3500.0)  // in meters
val flight2Times = listOf(100.0, 110.0, 120.0)  // in seconds
/**
 * A function that takes a list of distances and times and calculates the average velocity.
 *
 * @param distances A list of distances traveled in meters.
 * @param times A list of corresponding time periods in seconds.
 * @return The average velocity in meters per second.
 */
fun calculateAverageVelocity(distances: List<Double>, times: List<Double>): Double {
/**
 * A function that takes a list of distances and times and calculates the average velocity.
 *
 * @param distances A list of distances traveled in meters.
 * @param times A list of corresponding time periods in seconds.
 * @return The average velocity in meters per second.
 */
fun calculateAverageVelocity(distances: List<Double>, times: List<Double>): Double {

    var totalDistance = 0.0
    var totalTime = 0.0

    for ((distance, time) in distances.zip(times)) {
        totalDistance += distance
        totalTime += time
    }

    val averageVelocity = totalDistance / totalTime
    return averageVelocity
}

// Exercise
// As an Aerospace Engineer, you have data for the distances traveled and the times taken for multiple flights.
// You need to find the average velocity for each flight.

// Given data for 3 flights:
val flight1Distances = listOf(2000.0, 3000.0, 4000.0)  // in meters
val flight1Times = listOf(120.0, 130.0, 150.0)  // in seconds

val flight2Distances = listOf(1500.0, 2500.0, 3500.0)  // in meters
val flight2Times = listOf(100.0, 110.0, 120.0)  // in seconds