Functions

A function is a block of reusable code that performs a certain task. In this page, we will take two examples of functions.


One example of a function is the print() function which can displays information when entered into the parentheses, such as print("Hello World") will give Hello World. It can also accept more expressions as parameters, separated by commas, such as print("Dingus", "Shabingus").


Another example of a function is the upper() function for strings. It is used to capitalize all the letters in a string, such as 'dingus'.upper() will give the string "DINGUS".

1 comment:

  1. print() is also a function.
    The print() function prints the specified message to the screen.
    Please mention it as an example as well.

    ReplyDelete