+ 2
What is the deifference between return and print statement in python?
2 Answers
+ 3
You can use return value as assignments, but you can't use print as assignments.
For example, we now have 2 functions, printSquare() and returnSquare(), you can see the difference by their names.
#print the square of 10
print(returnSquare(10))
printSquare(10)
#Assign a variable to the square of 10
Carrie = returnSquare(10)
#You can't use printSquare() to assign a variable.
+ 1
return doesn't output anything on the screen, it just transports a value out of a function to the place where it was called.