+ 1
Why there is no output??
def multiply(x, y): return x * y a = 4 b = 7 operation = multiply print(operation(a, b)) #it retuns value but when we remove print means def multiply(x, y): return x * y a = 4 b = 7 operation = multiply operation(a, b) #then it shows no output
8 Answers
+ 1
Yes, but you rather print variables or the output of functions.
a = multiply(x,y)
print(a)
yields the same as
print(multiply(x,y))
In the second case, the output value is just stored temporarely
0
Well, the calculations happen as usual. But to show output, you need to print it of course.
0
#i am confused
def f():
print("@")
f()
#then it is returns '@' Matthias
0
Because you tell to print the string "@".
What is your intendet behavior?
Maybe you are confusing return and print?
0
Matthias
you mean to say that we have to use print to print any function
i understood thank you
0
Yes, Python won't print anything unless you tell it to. This allows you to do
a = multiply(x, y)
0
Vlad Serbu print(a)??
0
Matthias thanks