/**
 * Given a map containing the term numbers of U.S. Presidents as keys and their names as values,
 * returns whether or not a president served for a specific term.
 *
 * @param term an integer representing the term number
 * @param presidents a map containing the term numbers as keys and the names of the presidents as values
 * @return 'Yes' if there is a president who served for the given term, 'No' otherwise
 *
 * Example:
 * presidents = mapOf(1 to "George Washington", 2 to "John Adams", 3 to "Thomas Jefferson")
 * findPresident(5, presidents) // Output: 'No'
 * findPresident(2, presidents) // Output: 'Yes'
 */
fun findPresident(term: Int, presidents: Map<Int, String>): String {

    return if (term in presidents.keys && presidents[term] != null && presidents[term] != "") {
        "Yes"
    } else {
        "No"
    }
}
/**
 * Given a map containing the term numbers of U.S. Presidents as keys and their names as values,
 * returns whether or not a president served for a specific term.
 *
 * @param term an integer representing the term number
 * @param presidents a map containing the term numbers as keys and the names of the presidents as values
 * @return 'Yes' if there is a president who served for the given term, 'No' otherwise
 *
 * Example:
 * presidents = mapOf(1 to "George Washington", 2 to "John Adams", 3 to "Thomas Jefferson")
 * findPresident(5, presidents) // Output: 'No'
 * findPresident(2, presidents) // Output: 'Yes'
 */
fun findPresident(term: Int, presidents: Map<Int, String>): String {
/**
 * Given a map containing the term numbers of U.S. Presidents as keys and their names as values,
 * returns whether or not a president served for a specific term.
 *
 * @param term an integer representing the term number
 * @param presidents a map containing the term numbers as keys and the names of the presidents as values
 * @return 'Yes' if there is a president who served for the given term, 'No' otherwise
 *
 * Example:
 * presidents = mapOf(1 to "George Washington", 2 to "John Adams", 3 to "Thomas Jefferson")
 * findPresident(5, presidents) // Output: 'No'
 * findPresident(2, presidents) // Output: 'Yes'
 */
fun findPresident(term: Int, presidents: Map<Int, String>): String {

    return if (term in presidents.keys && presidents[term] != null && presidents[term] != "") {
        "Yes"
    } else {
        "No"
    }
}