Skip to content

PyWariors/Python-Tuts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Functions in python.

What are Functions?

Functions are a convenient way to divide your code into useful blocks, allowing us to order our code, make it more readable, debuggable, reuse it and save some time. Also functions are a key way to define interfaces so programmers can share their code. How do you write functions in Python? As we have seen on previous tutorials, Python makes use of blocks. The function is defined followed by an indented block. A block is a area of code of written in the format of: block_head: 1st block line 2nd block line ...

sample function definition

def my_function(): print "Hello From My Function!"

How do you call functions in Python?

Simply write the function's name followed by (), placing any required arguments within the brackets. For example, lets call the functions written above (in the previous example): def my_function(): print "Hello From My Function!" my_function() Copy

Releases

No releases published

Packages

No packages published