Print vs Return - Python (What's the Difference?)

preview_player
Показать описание
This video will explain the difference between print and return in functions in Python! Also, if the pace of the video is too slow for you, make the playback speed larger than 1! If anything in this video was unclear please let me know in the comments and I'll try and clear it up!
Рекомендации по теме
Комментарии
Автор

RETURN function Used Only Inside The User Defined Function.
PRINT function On Both Inside And Outside The User Defined Function.

MohammedIsmail-qbpj
Автор

Major differences:

print is a function you call. Calling print will immediately make your program write out text for you to see. Use print when you want to show a value to a human.

return is a keyword. When a return statement is reached, Python will stop the execution of the current function, sending a value out to where the function was called. Use return when you want to send a value from one point in your code to another.

Using return changes the flow of the program. Using print does not.

arjungoalset
Автор

return = you can store it in a variable e.g x = returnFunction(a)
print = you can't store it in a variable, it will just print your output

orion_
Автор

There are lots of new programmers that dont know the difference between a function and a procedure, it was something pretty basic when you learnt to program in C as the difference there was very clear, but in object oriented programming the difference can be fuzzy if you dont know the depth of it.

Very helpful video :D

Oscar-iuzi
Автор

Thanks for information. I searched the difference between "return" and "print" in Turkish sources and i realized that there is no information about it in my own country. Your video was very radiant.

raidein
Автор

The best short programming lesson I've ever seen. You are the best ♥

anselmosistale
Автор

The last part of the explanation was like icing on the cake.
I can't thank you enough.
print ("Subscribed your channel...eagerly waiting for new uploads")

shashwattripathi
Автор

Thank you for your great work, Now I really understand what is the use of return, as a beginner these type of explanations is must needed, soon You will get high reach one day, stay positive ✌😁

yuvaraj
Автор

I understand 50 percent because of video and remaining 50 percent because of comments

spaceembassy
Автор

Thank you so much! I was confused on this topic but you cleared it up. Earned my sub!

coderhaseen
Автор

What you explained was very clear and to the point, thanks a lot.

I have one doubt.
>>x=2
>>x
O/P:- 2
>>print(x)
O/P:- 2

1) Writing a variable prints it on console.
2) Using print() Funcn to print variable also prints it.

How the 1st is different from 2nd.

>>a="Your good explainer"
>>a
O/P:- 'Your good explainer'

>>print(a)
O/P:- Your good explainer

Hoping a reply from you soon,
Thanks.

vivekkhatri
Автор

That was very well explained! Thank you!

VanSolo
Автор

Simple and very understandable. Thanks a lot.

And by the way, you have a beautiful voice too :)

randomshadow
Автор

It was very helpful. Thank you so much

sudhanshudeore
Автор

thanks for explaining, finally i know the difference, lol i was using print all the time, subscribed

glassy
Автор

return let’s you do more math stuff on the return after it’s spit out of the function. Print doesn’t let you do any further math stuff on the result.

gabehcuodsuoitneterp
Автор

You smashed with the explanation! Thank you so much :)

renyirish
Автор

Thank you very much for the explanation! really clear

juancamilorozojimenez
Автор

thanks, this was the explanation I was looking for!

aamu
Автор

Awesome explanation, cleared my doubt.

aaryanjaiswal