A function is a group of related statements that carry out a specific task when called.
Its syntax is :
"def" marks the start of the function, colons(:) are used to mark the end of a header. You call the function by using this syntax below
Arguments(args)
These are information's passed into the functions in the parentheses.
Usually when declaring a function, you are expected to list the amount of arguments you wish to pass. But when you are unsure, you can make use of *args. This allows you to accept multiple inputs.
Just like modulus, there are two types of functions:
- built in
- user defined


No comments:
Post a Comment