Print vs Return in Functions in Python - Python Tutorials

preview_player
Показать описание
In this Python tutorial - we will understand the difference between print and return.
Print just gives us a value which we cannot use in any different function or is immutable.
Whereas return gives the value which can be used and modified in different functions as well.

Рекомендации по теме
Комментарии
Автор

So return function means we can store a function in a variable for further use, correct me bro if I am wrong

spaceembassy
Автор

def add(a, b):
print(a+b)
print(add(10, 23)/3)
Output: 33

def add(a, b):
return a+b
print(add(10, 23)/3)
Output : 11
Why?

abdullahalmahfuz
join shbcf.ru