Flash Sale: Flat 70% + Addl. 25% Off on all Courses | Use Coupon DS25 in Checkout | Offer Expires InEnroll Now
Functions, like the one you defined in the last exercise perform an action but don't return a value. They are called void functions. You almost always want to do something with the result. For example, you might assign it to a variable or use it as part of an expression:
def void_function(number): num = number print(num)
Void functions might display something on the screen or have some other effect, but they don't have a return value. If you try to assign the result to a variable, you get a special value called
None is not the same as the string "None". It is a special value that has its own type:
Some of the functions, such as the math functions, return certain results.
def multiply(a, b): multiplication = a * b return multiplication multiplication_numbers = multiply(1,2)
This function when called returns the result of the multiplication of numbers
2 and stores it in the variable
new_functionthat takes an argument
numand returns its multiplication with π.
void_functionwhich takes two arguments
num2which makes the call to
new_functionwith an argument as
num1raised to the power of
void_functionprint the value returned by the call.
void_functionwith arguments as
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here