What is the reason behind having return after defining a function? Please explain in non coding terms. I am trying to understand why to do return and what it actually does instead of just being told to do it.
            Asked
            
        
        
            Active
            
        
            Viewed 37 times
        
    1 Answers
0
            
            
        return just simple makes the function give that thing as the value of something, demo:
def f():
    return 'Hello World'
And then you do:
variable=f()
Then now:
print(variable)
Is gonna be:
Hello World
OTOH, print just does this:
def f():
    print('Hello World')
Now:
f()
Is:
Hello World
But:
print(f())
Is:
Hello World
None
And if you do:
variable=f()
print(variable.lower())
The first one will work with .lower() to make it lowercase, but print doesn't, instead, does an error.
 
    
    
        U13-Forward
        
- 69,221
- 14
- 89
- 114
