Ask Question
4 October, 01:42

Write a function named "higher_lower" that takes an int as a parameter and returns "higher" if 14 is greater than the input and "lower" if 14 is less than the input, and "correct" if 14 is equal to the input.

+2
Answers (1)
  1. 4 October, 04:45
    0
    Following are the program in python language for the above question:

    Explanation:

    Program:

    def higher_lower (value) : #function definition.

    if (value<14) : #if condition for 14 is greator than the input.

    return "higher"

    elif (value==14) : #else if condition for 14 is equal to the input.

    return "correct"

    else:# else condition.

    return "lower"

    return_value = higher_lower (int (input ("Enter the integer value: "))) #take the value from the user and call the function.

    print (return_value) # print the returned value.

    Output:

    If the user gives the input as 4, it will prints higher. If the user gives the input 15, it will prints lower.

    Code Explanation:

    The above code is in python language, In which the first line will instruct the user, take the input and pass to the function after converting it into an integer. Then the first line of the function is used to check the value is less than 14 or not. Then the else if condition checks that the value is equal to 14 or not. Then the else condition will be true if the value is greater than 14.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a function named "higher_lower" that takes an int as a parameter and returns "higher" if 14 is greater than the input and "lower" if ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers