Ask Question
28 March, 07:47

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.

+5
Answers (1)
  1. 28 March, 08:37
    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?
Get 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 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