Annotations are metadata tags that help define additional information to classes, interfaces, methods, or fields. Annotations don’t add extra implementation to the functional code. Although we can attach them to packages, classes, interfaces, methods, and fields, annotations by themselves have no effect on the execution of a program.

The built-in annotations such as @Override, @Deprecated, and @SuppressWarnings provide the interpreter, with the information related to the execution of code. For instance, @Override is used to instruct the interpreter that the annotated method is being overridden.

Annotations provide build-time/compile-time instructions to the interpreter that are used by software build tools for generating code. The compiler can use annotations to catch errors or suppress warnings. When someone looks at the code, annotations help make it readable and easy to understand. Annotations can be examined at runtime to run tests.

--

--

A bunch of statements that take inputs and perform specific computations to give output is called a function.

This helps in reducing the need to write the same code over and over again we can just call a function to get output for varying inputs depending on operations. Function in python avoids repetition.

Python already has a list of built-in functions.

Syntax of a Function

def function_name():

statements

def means the start of the function header, Function name is a name given to the function to identify it, the colon indicates the end of the function. Statements define the body.

Calling a Function

Using the function name after parentheses.

Example:

def Michael_scott():
print(“Dwight! ShutUp!”)

Michael_scott()

Output:

Dwight! ShutUp!

--

--