/**
 * This exercise combines string formatting and slicing a list.
 * The function takes a list of historian names, a start index, and an end index.
 * It formats the names of historians using string formatting and returns a sliced list of formatted names.
 *
 * @param names A list of historian names (string)
 * @param startIndex The start index position for slicing (integer)
 * @param endIndex The end index position for slicing (integer)
 * @return A sliced list of formatted historian names (string)
 *
 * Example:
 * val names = listOf("Herodotus", "Thucydides", "Livy", "Herodian", "Tacitus", "Suetonius")
 * val startIndex = 1
 * val endIndex = 4
 * formatAndSlice(names, startIndex, endIndex) -> listOf("Formatted Thucydides", "Formatted Livy", "Formatted Herodian")
 */
fun formatAndSlice(names: List<String>, startIndex: Int, endIndex: Int): List<String> {

    val formattedNames = names.map { "Formatted $it" }  // Format historian names
    val slicedNames = formattedNames.subList(startIndex, endIndex)  // Slice the formatted names list
    return slicedNames
}
/**
 * This exercise combines string formatting and slicing a list.
 * The function takes a list of historian names, a start index, and an end index.
 * It formats the names of historians using string formatting and returns a sliced list of formatted names.
 *
 * @param names A list of historian names (string)
 * @param startIndex The start index position for slicing (integer)
 * @param endIndex The end index position for slicing (integer)
 * @return A sliced list of formatted historian names (string)
 *
 * Example:
 * val names = listOf("Herodotus", "Thucydides", "Livy", "Herodian", "Tacitus", "Suetonius")
 * val startIndex = 1
 * val endIndex = 4
 * formatAndSlice(names, startIndex, endIndex) -> listOf("Formatted Thucydides", "Formatted Livy", "Formatted Herodian")
 */
fun formatAndSlice(names: List<String>, startIndex: Int, endIndex: Int): List<String> {
/**
 * This exercise combines string formatting and slicing a list.
 * The function takes a list of historian names, a start index, and an end index.
 * It formats the names of historians using string formatting and returns a sliced list of formatted names.
 *
 * @param names A list of historian names (string)
 * @param startIndex The start index position for slicing (integer)
 * @param endIndex The end index position for slicing (integer)
 * @return A sliced list of formatted historian names (string)
 *
 * Example:
 * val names = listOf("Herodotus", "Thucydides", "Livy", "Herodian", "Tacitus", "Suetonius")
 * val startIndex = 1
 * val endIndex = 4
 * formatAndSlice(names, startIndex, endIndex) -> listOf("Formatted Thucydides", "Formatted Livy", "Formatted Herodian")
 */
fun formatAndSlice(names: List<String>, startIndex: Int, endIndex: Int): List<String> {

    val formattedNames = names.map { "Formatted $it" }  // Format historian names
    val slicedNames = formattedNames.subList(startIndex, endIndex)  // Slice the formatted names list
    return slicedNames
}