/**
 * Given a list of actors and an index, delete the actor at the specified index from the list.
 *
 * @param actors a list of actor names (tuple)
 * @param index an integer representing the index of the actor to be deleted
 * @return The updated list of actors after deleting the actor
 *
 * Example:
 * deleteActor(listOf(Pair("Tom Hanks", 63), Pair("Meryl Streep", 71), Pair("Leonardo DiCaprio", 45)), 1)
 * Output: [('Tom Hanks', 63), ('Leonardo DiCaprio', 45)]
 */
fun deleteActor(actors: List<Pair<String, Int>>, index: Int): List<Pair<String, Int>> {

    if (index < 0 || index >= actors.size) {
        return listOf() // Return an empty list for invalid index
    }

    // Convert to mutable list for deletion
    val mutableActors = actors.toMutableList()
    mutableActors.removeAt(index)

    return mutableActors.toList() // Convert back to immutable list and return
}
/**
 * Given a list of actors and an index, delete the actor at the specified index from the list.
 *
 * @param actors a list of actor names (tuple)
 * @param index an integer representing the index of the actor to be deleted
 * @return The updated list of actors after deleting the actor
 *
 * Example:
 * deleteActor(listOf(Pair("Tom Hanks", 63), Pair("Meryl Streep", 71), Pair("Leonardo DiCaprio", 45)), 1)
 * Output: [('Tom Hanks', 63), ('Leonardo DiCaprio', 45)]
 */
fun deleteActor(actors: List<Pair<String, Int>>, index: Int): List<Pair<String, Int>> {
/**
 * Given a list of actors and an index, delete the actor at the specified index from the list.
 *
 * @param actors a list of actor names (tuple)
 * @param index an integer representing the index of the actor to be deleted
 * @return The updated list of actors after deleting the actor
 *
 * Example:
 * deleteActor(listOf(Pair("Tom Hanks", 63), Pair("Meryl Streep", 71), Pair("Leonardo DiCaprio", 45)), 1)
 * Output: [('Tom Hanks', 63), ('Leonardo DiCaprio', 45)]
 */
fun deleteActor(actors: List<Pair<String, Int>>, index: Int): List<Pair<String, Int>> {

    if (index < 0 || index >= actors.size) {
        return listOf() // Return an empty list for invalid index
    }

    // Convert to mutable list for deletion
    val mutableActors = actors.toMutableList()
    mutableActors.removeAt(index)

    return mutableActors.toList() // Convert back to immutable list and return
}