When i use print and return ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

When i use print and return ?

Print vs return

7th Aug 2022, 7:24 PM
Ismail Backach
Ismail Backach - avatar
2 Answers
+ 7
print function is used to print something on console return is used to return something back to the function so that we can use that returned value to print or to pass on another function to use it. For example: def getSum(): a = 4 b = 6 return a + b total = getSum() print (total)
7th Aug 2022, 7:43 PM
A͢J
A͢J - avatar