Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the difference between python calling function and printing function

Shulou Source: shulou.com Published: 2022-06-03 03:04:38 09月17日 Update

This article introduces the relevant knowledge of "what is the difference between python calling function and printing function". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. When you call a function that returns something, you should assign a variable to the function call to store the return value.

Call the function and ignore its return value, or if you store the return value in a variable, you can print it, record it, or pass it to the arguments of another function.

2. In the case of a print function call, the returned value does not need to be stored and printed directly.

Example

Def get_favorite_food (): food = input ("What's your favorite food?") Return 'Your favorite food' +' + food +'+'is readybirds' Result = get_favorite_food () print (result) "what's the difference between a python calling function and a print function"? thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Functions storage content variables situations more knowledge practicality learning next things parameters dilemmas examples reality articles cases editing websites industries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Technology macOS Docker vpn