Ask 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 14 is less than the input, and "correct" if 14 is equal to the input.

+4
Answers (1)
  1. 6 June, 08:09
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers