Ask Question

The following statement calls a function named half, which returns a value that is half that of the argument. (Assume the number variable references a float value.) Write code for the function.

+4
Answers (1)
  1. 31 October, 04:40
    0
    The function definition to this question can be given as:

    def half (number) : #defining a function half and pass a variable number in function parameter

    return number/2 #returns value.

    data=half (12) #defining variable data that holds function return value

    print (data) #print value.

    Output:

    6.0

    Explanation:

    In the above python program, a function that is half is declare that includes a variable number in the function parameter. Inside the function, the parameter value that is number is divided by 2 and returns its value. In calling time a data variable is defined that holds the function half () value.

    In calling time function holds value that is "12" in its parameter and return a value that is "6.0".
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “The following statement calls a function named half, which returns a value that is half that of the argument. (Assume the number variable ...” 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