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

Publicado em: 04 Janeiro 2024
no 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.


Nesta página do site você pode assistir ao vídeo on-line What is Print and Return Function and difference between them in Python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Learn Now - Your Learning Partner 04 Janeiro 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 58 vezes e gostou 1 espectadores. Boa visualização!