/**
 * Farmer has a list of crops cultivated on his farm. Each crop has a name and the profit earned from it.
 * The farmer wants to calculate the total profit earned from all the crops.
 * Implement the function 'calculateProfit' to calculate the total profit earned by the farmer.
 *
 * @param farmData A list containing the names of crops and their respective profits.
 *                 The structure of each element in the list is as follows: (cropName, profit).
 * @return The total profit earned by the farmer.
 *
 * Example:
 * val farmData = listOf(Pair("Wheat", 5000), Pair("Corn", 8000), Pair("Soybean", 6500))
 * calculateProfit(farmData)  => 19500
 */
fun calculateProfit(farmData: List<Pair<String, Int>>): Int {

    var totalProfit = 0

    // Iterate over each crop and add its profit to the total profit
    for (crop in farmData) {
        totalProfit += crop.second
    }

    return totalProfit
}
/**
 * Farmer has a list of crops cultivated on his farm. Each crop has a name and the profit earned from it.
 * The farmer wants to calculate the total profit earned from all the crops.
 * Implement the function 'calculateProfit' to calculate the total profit earned by the farmer.
 *
 * @param farmData A list containing the names of crops and their respective profits.
 *                 The structure of each element in the list is as follows: (cropName, profit).
 * @return The total profit earned by the farmer.
 *
 * Example:
 * val farmData = listOf(Pair("Wheat", 5000), Pair("Corn", 8000), Pair("Soybean", 6500))
 * calculateProfit(farmData)  => 19500
 */
fun calculateProfit(farmData: List<Pair<String, Int>>): Int {
/**
 * Farmer has a list of crops cultivated on his farm. Each crop has a name and the profit earned from it.
 * The farmer wants to calculate the total profit earned from all the crops.
 * Implement the function 'calculateProfit' to calculate the total profit earned by the farmer.
 *
 * @param farmData A list containing the names of crops and their respective profits.
 *                 The structure of each element in the list is as follows: (cropName, profit).
 * @return The total profit earned by the farmer.
 *
 * Example:
 * val farmData = listOf(Pair("Wheat", 5000), Pair("Corn", 8000), Pair("Soybean", 6500))
 * calculateProfit(farmData)  => 19500
 */
fun calculateProfit(farmData: List<Pair<String, Int>>): Int {

    var totalProfit = 0

    // Iterate over each crop and add its profit to the total profit
    for (crop in farmData) {
        totalProfit += crop.second
    }

    return totalProfit
}