Introduction

Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability.

It supports multiple programming paradigms, including structured, object-oriented, and functional programming.

print("Hello, World!")
Variables

Variables are containers for storing data values. Python has no command for declaring a variable upfront.

A variable is created the moment you first assign a value to it. This makes the syntax very fast to write.

x = 5 y = "John"
Data Types

Variables can store data of different types, and different types can do different things seamlessly.

Python has the following data types built-in by default:

You can get the data type of any object by using the type() function.

print(type(x))
Loops

Python has two primitive loop commands that control flow.

These are the while loops and for loops.

With the while loop we can execute a set of statements as long as a condition is true.

while i < 6: print(i)
Functions

A function is a block of code which only runs when it is called directly.

You can pass data, known as parameters, into a function for it to process.

In Python a function is defined using the def keyword.

def my_function(): print("Hello from a function")