/**
 * Given a list of tuples, transform it using list comprehension and return a new list.
 *
 * Each tuple contains information about a journalist, where the first element is the name and the second element
 * is a list of articles they have written.
 *
 * Your task is to transform the data in such a way that you remove any journalist who has not written any articles and
 * only keep the names of the remaining journalists.
 *
 * Example:
 * Input: [('John', [1, 2, 3]), ('Alice', []), ('David', [4, 5]), ('Emily', [])]
 * Output: ['John', 'David']
 *
 * Complete the 'transformData' function to solve the exercise.
 */
fun transformData(data: List<Pair<String, List<Int>>>) : List<String> {

    return data.filter { it.second.isNotEmpty() }.map { it.first }
}
/**
 * Given a list of tuples, transform it using list comprehension and return a new list.
 *
 * Each tuple contains information about a journalist, where the first element is the name and the second element
 * is a list of articles they have written.
 *
 * Your task is to transform the data in such a way that you remove any journalist who has not written any articles and
 * only keep the names of the remaining journalists.
 *
 * Example:
 * Input: [('John', [1, 2, 3]), ('Alice', []), ('David', [4, 5]), ('Emily', [])]
 * Output: ['John', 'David']
 *
 * Complete the 'transformData' function to solve the exercise.
 */
fun transformData(data: List<Pair<String, List<Int>>>) : List<String> {
/**
 * Given a list of tuples, transform it using list comprehension and return a new list.
 *
 * Each tuple contains information about a journalist, where the first element is the name and the second element
 * is a list of articles they have written.
 *
 * Your task is to transform the data in such a way that you remove any journalist who has not written any articles and
 * only keep the names of the remaining journalists.
 *
 * Example:
 * Input: [('John', [1, 2, 3]), ('Alice', []), ('David', [4, 5]), ('Emily', [])]
 * Output: ['John', 'David']
 *
 * Complete the 'transformData' function to solve the exercise.
 */
fun transformData(data: List<Pair<String, List<Int>>>) : List<String> {

    return data.filter { it.second.isNotEmpty() }.map { it.first }
}