1. A function is a block of code that performs a specific task when the function is called (invoked). You can use functions to make your code reusable, better organized, and more readable. Functions can have parameters and return values.
Lists
1. The list is a type of data in Python used to store multiple objects. It is an ordered and mutable collection of comma-separated items between square brackets, e.g.:
Loops
1. There are two types of loops in Python: while
and for
:
Conditionals
1. The comparison (otherwise known as relational) operators are used to compare values. The table below illustrates how the comparison operators work, assuming that x = 0
, y = 1
, and z = 0
:
Input() function
1. The print()
function sends data to the console, while the input()
function gets data from the console.