0
What is the using of "return" in python
I'm confused whit thé using of return
9 odpowiedzi
+ 6
yes, but if you assign that function to a variable like this.
x = return_func()
it's the same as
x = print("hello world")
which you dont want.
+ 5
return is typically use to "return" value from a function.
def return_func():
return "hello world"
print(return_func())
x = return_func()
print(x)
Output:
hello world
hello world
no code will be executed after the return statement, so be aware
+ 4
None is like null in c++ or js, it means to be "no value"
+ 4
I mean , "None in python" is like "null in c++ or js"
+ 3
yves houedande if you didn't return anything, the returned value will be None
0
Ok so
If i do
Def return_func():
Print("Hello World")
Output:
Hello World
0
What is none exactly
0
Ok thanks,but is it the same int Python language
0
Okay