What is Print and Return Function and difference between them in Python

Publicado el: 04 enero 2024
en el canal de: Learn Now - Your Learning Partner
58
1

What are functions?
Think of functions like mini-programs within your main program. They encapsulate specific tasks, allowing you to reuse code and keep your program organized and efficient. Imagine a chef following a recipe. Each step in the recipe can be seen as a function, performing specific actions like chopping vegetables or preheating the oven.

What is print?
print is a built-in function in Python that displays text to the console. It's like the chef announcing their progress, saying "Vegetables chopped!" or "Oven preheated!". print doesn't affect the flow of your program; it simply outputs information for you to see.

What is return?
return is another built-in function, but it plays a different role. It allows a function to send back a value after completing its task. Imagine the chef handing you a delicious plate of food after following the recipe. The return statement is like the chef handing you the completed dish, allowing you to use its value (the delicious food) elsewhere in your program.


En esta página del sitio puede ver el video en línea What is Print and Return Function and difference between them in Python de Duración hora minuto segunda en buena calidad , que subió el usuario Learn Now - Your Learning Partner 04 enero 2024, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 58 veces y le gustó 1 a los espectadores. Disfruta viendo!