How can I set the value to test the function ? (like I’ve done in exercise 3)
just call the function and supply the arguments you want?
def distance_from_zero(num): if type(num) == int or type(num) == float: return abs(num) else: return "Nope"
Is the solution
When I call the function below it
I neither get an abs or Nope return in the console
if you want to print something, you should use the
OK, I see so even for the
else: return "Nope"
It needs to be printed ?
return hands data back to the caller, and i don’t think i need to explain
@lordcommandertd05365, unless your assignment specifically states that your function should print() something (or, if you are coding a script for yourself and you find yourself in need of some nicely formatted output, which can be obtained by means of a function specifically created for that purpose), you should generally view the output of your functions like this:
def my_function(a,b,c): # code here return some_answer print(my_function(3,4,5))