Python Step First: First step of Python program by Akhter Naseeb

Python Step First: First step of Python program by Akhter Naseeb

Author:Akhter, Naseeb
Language: eng
Format: epub
Publisher: Naseeb Akhter
Published: 2022-06-06T00:00:00+00:00


Multiple calls to a function are a very efficient way of working. In the function, the code for describing a pet is written only once. Then, if you wish to describe a new pet, you simply call the function with the information for the new pet. Even if the code for describing a pet expanded to five lines, calling the function again would allow you to describe a new pet in just one line.

Return values

A function's output doesn't always have to be displayed directly. It can instead process data and then return a value or group of values. The value the function returns is called a return value. The return statements takes a value from inside a function and sends it back to the line that call the function.

Example 1.

def username(first_name, last_name):

"""Return a full name"""

full_name = f"{first_name} {last_name}"

return full_name.title()

author = username('naseeb','akhter')

print(author)

Output:

Naseeb Akhter



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.