Mastery 07 – Calling functions

The Python programming language comes with a variety of build-in functions. Some functions are part of the base language and others require you to import from python modules.

Calling a function
To call a function, use the function name followed by parenthesis:
input()

Calling a function with parameters
Parameters are specified after the function name, inside the parentheses. Parameters are separated with a comma:
print("Hello World", "Tomer")

Calling a function that requires to import from python modules
To import a moudle, we use the import statement. Then to call the function we use the syntax: module_name.function_name.
import math
print(math.sqrt(9))

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website at WordPress.com
Get started
%d bloggers like this: