Beginner’s Guide to Python – Prerequisite for Mastering Machine Learning
About Lesson

In Python, every programming statement is written as a line of code. Python uses indentation to define code blocks, such as those within loops, functions, and conditional statements. This makes Python code easy to read and understand.

Here’s an example of a simple Python program that prints “Hello, World!”:

python
print("Hello, World!")

In this example, print() is a built-in Python function used to display output. The text "Hello, World!" is enclosed in double quotes to indicate that it is a string.

Python supports various data types, including integers, floats, strings, booleans, and more. Here are some examples:

python
# Integer
x = 10

# Float
y = 3.14

# String
name = "Alice"

# Boolean
is_true = True

Python also supports arithmetic operations such as addition, subtraction, multiplication, and division. For example:

python
# Addition
result = 10 + 5
# Subtraction
result = 10 - 5
# Multiplication
result = 10 * 5
# Division
result = 10 / 5

These are just some of the basics of Python syntax and data types. In the next chapter, we’ll explore variables and operators in more detail.

Join the conversation