Ask Question
11 March, 14:22

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.

+1
Answers (1)
  1. 11 March, 15:13
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers