Conceptually, one is the return value, one is the printout.
Difference One: Return is the end of the function is usually placed in the end, when you write back after the return of something is not performed the following
def Renshu (x, y): h=x+y print (h) return H print (' Hello word ') print (Renshu (3,7))
The result after execution is that Hello word does not execute. No error.
C:\Python34\python.exe c:/users/administrator/pycharmprojects/python/class/suibi.py
10
10
1 C:\Python34\python.exe c:/users/administrator/pycharmprojects/python/class/suibi.py 2 3 10
The difference two returns the result of return can be called in Don't go like do add
def ,y):
h=x+y
print (h)
return h
print ( ' hello word ')
print (Renshu (,7))
x= (Renshu (3, 7) +10
print (x)
Execution results are
C:\Python34\python.exe c:/users/administrator/pycharmprojects/python/class/suibi.py
10
10
10
20
Process finished with exit code 0
Print just prints no results
def Renshu (x, y):
H=x+y
Print (h)
Print (Renshu (3,7))
X= (Renshu (3,7)) +10
Print (x)
Error message
None
File "c:/users/administrator/pycharmprojects/python/class/suibi.py", line A, in <module>
10
X= (Renshu (3,7)) +10
typeerror:unsupported operand type (s) for +: ' Nonetype ' and ' int '
Process finished with exit code 1
About the difference between Python return and print