Thursday, July 22, 2021

Python 102: Functions

 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

HTML 101: Form

  I believe that everyone who has made use of the internet knows what a form is but in case you don't know, a form is a way of receiving...