/**
 * This function takes an athlete tuple and an index as arguments, and deletes the element at the given index in the tuple.
 *
 * Perform the following tasks:
 * 1. Convert the athlete tuple to a list.
 * 2. Delete the element at the specified index.
 * 3. Convert the modified list back to a tuple.
 * 4. Return the updated tuple.
 *
 * The index must be a valid index within the tuple, otherwise, the function should return null.
 *
 * Example:
 * athlete = listOf("John", "Doe", 25, "USA")
 * deleteTupleElement(athlete, 2) -> listOf("John", "Doe", "USA")
 */
fun deleteTupleElement(athlete: List<Any>, index: Int): List<Any>? {

    // Convert the list to a mutable list
    val athleteList = athlete.toMutableList()

    // Check if the index is valid
    if (index < 0 || index >= athleteList.size) {
        return null
    }

    // Delete the element at the specified index
    athleteList.removeAt(index)

    // Convert the modified list back to a list
    return athleteList.toList()
}
/**
 * This function takes an athlete tuple and an index as arguments, and deletes the element at the given index in the tuple.
 *
 * Perform the following tasks:
 * 1. Convert the athlete tuple to a list.
 * 2. Delete the element at the specified index.
 * 3. Convert the modified list back to a tuple.
 * 4. Return the updated tuple.
 *
 * The index must be a valid index within the tuple, otherwise, the function should return null.
 *
 * Example:
 * athlete = listOf("John", "Doe", 25, "USA")
 * deleteTupleElement(athlete, 2) -> listOf("John", "Doe", "USA")
 */
fun deleteTupleElement(athlete: List<Any>, index: Int): List<Any>? {
/**
 * This function takes an athlete tuple and an index as arguments, and deletes the element at the given index in the tuple.
 *
 * Perform the following tasks:
 * 1. Convert the athlete tuple to a list.
 * 2. Delete the element at the specified index.
 * 3. Convert the modified list back to a tuple.
 * 4. Return the updated tuple.
 *
 * The index must be a valid index within the tuple, otherwise, the function should return null.
 *
 * Example:
 * athlete = listOf("John", "Doe", 25, "USA")
 * deleteTupleElement(athlete, 2) -> listOf("John", "Doe", "USA")
 */
fun deleteTupleElement(athlete: List<Any>, index: Int): List<Any>? {

    // Convert the list to a mutable list
    val athleteList = athlete.toMutableList()

    // Check if the index is valid
    if (index < 0 || index >= athleteList.size) {
        return null
    }

    // Delete the element at the specified index
    athleteList.removeAt(index)

    // Convert the modified list back to a list
    return athleteList.toList()
}