/**
 * This function finds the farmers whose age is within the specified range using a tuple and while loop.
 *
 * @param farmers A list of tuples containing the name and age of farmers.
 * @return A list of farmers whose age is within the specified range.
 */
fun findTuples(farmers: List<Pair<String, Int>>): List<Pair<String, Int>> {

    // Create an empty list to store the selected farmers
    val selectedFarmers = mutableListOf<Pair<String, Int>>()

    // Prompt the user to enter the range of ages
    print("Enter the start age: ")
    val startAge = readLine()!!.toInt()
    print("Enter the end age: ")
    val endAge = readLine()!!.toInt()

    // Iterate through each farmer in the farmers list
    var i = 0
    while (i < farmers.size) {
        val farmer = farmers[i]

        // Check if the farmer's age is within the specified range
        if (startAge <= farmer.second && farmer.second <= endAge) {
            // Add the farmer to the selected farmers list
            selectedFarmers.add(farmer)
        }

        // Increment the index
        i++
    }

    return selectedFarmers
}
/**
 * This function finds the farmers whose age is within the specified range using a tuple and while loop.
 *
 * @param farmers A list of tuples containing the name and age of farmers.
 * @return A list of farmers whose age is within the specified range.
 */
fun findTuples(farmers: List<Pair<String, Int>>): List<Pair<String, Int>> {
/**
 * This function finds the farmers whose age is within the specified range using a tuple and while loop.
 *
 * @param farmers A list of tuples containing the name and age of farmers.
 * @return A list of farmers whose age is within the specified range.
 */
fun findTuples(farmers: List<Pair<String, Int>>): List<Pair<String, Int>> {

    // Create an empty list to store the selected farmers
    val selectedFarmers = mutableListOf<Pair<String, Int>>()

    // Prompt the user to enter the range of ages
    print("Enter the start age: ")
    val startAge = readLine()!!.toInt()
    print("Enter the end age: ")
    val endAge = readLine()!!.toInt()

    // Iterate through each farmer in the farmers list
    var i = 0
    while (i < farmers.size) {
        val farmer = farmers[i]

        // Check if the farmer's age is within the specified range
        if (startAge <= farmer.second && farmer.second <= endAge) {
            // Add the farmer to the selected farmers list
            selectedFarmers.add(farmer)
        }

        // Increment the index
        i++
    }

    return selectedFarmers
}