0% found this document useful (0 votes)
9 views3 pages

Python Introduction

Python is a high-level programming language created in 1991, known for its simple syntax and versatility in various fields such as web development and data analysis. The document explains the 'Hello World' program and emphasizes the importance of consistent indentation in Python code. Errors can occur if indentation levels are inconsistent within the same block, leading to IndentationErrors.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Python Introduction

Python is a high-level programming language created in 1991, known for its simple syntax and versatility in various fields such as web development and data analysis. The document explains the 'Hello World' program and emphasizes the importance of consistent indentation in Python code. Errors can occur if indentation levels are inconsistent within the same block, leading to IndentationErrors.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python Introduction

Last Updated : 7 Jan, 2026




Python is a high-level programming language known for its


simple and readable syntax. It was created in 1991 by
Guido van Rossum to make programming easy to learn and
use.
 It allows writing programs with fewer lines of code,
improving readability.
 It automatically detects variable types at runtime,
eliminating the need for explicit declarations.
 It is used in web development, data analysis,
automation, and many other fields.
 It supports object-oriented, functional, and procedural
programming styles.

Understanding Hello World Program in


Python
# This is a comment. It will not be executed.
print("Hello, World!")

Output:

Hello, World!

How does this work:


 print() is a built-in Python function that instructs the
computer to display text on the screen.
 "Hello, World!" is a string, which is a sequence of text. In
Python, strings are enclosed in quotes (either single ' or
double ").

Indentation in Python
In Python, Indentation is used to define blocks of code. It
indicates to the Python interpreter that a group of
statements belongs to the same block. All statements with
the same level of indentation are treated as part of the
same code block. Indentation is created using whitespace
at the beginning of each line, and the commonly accepted
convention is to use four spaces per indentation level.

print("I have no Indentation ")


print("I have tab Indentation ")

Output:

ERROR!
Traceback (most recent call last):
File "<[Link]>", line 2
print("I have tab Indentation ")
IndentationError: unexpected indent
Explanation:
 The first print statement has no indentation, so it is
correctly executed.
 The second print statement has tab indentation, but it
doesn't belong to a new block of code. Python expects
the indentation level to be consistent within the same
block. This inconsistency causes an IndentationError.

You might also like