0% found this document useful (0 votes)
7 views4 pages

UNIT-I 01 Introduction To Python

Python is a high-level, interpreted programming language created by Guido van Rossum in 1991, known for its simplicity and versatility. It supports multiple programming paradigms, uses a hybrid approach with both a compiler and an interpreter, and is widely used in various fields such as data science, web development, and automation. To get started with Python, users can check for installation, write simple scripts, and utilize IDLE for coding and debugging.

Uploaded by

einzzig
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)
7 views4 pages

UNIT-I 01 Introduction To Python

Python is a high-level, interpreted programming language created by Guido van Rossum in 1991, known for its simplicity and versatility. It supports multiple programming paradigms, uses a hybrid approach with both a compiler and an interpreter, and is widely used in various fields such as data science, web development, and automation. To get started with Python, users can check for installation, write simple scripts, and utilize IDLE for coding and debugging.

Uploaded by

einzzig
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

Introduction to Python

Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.

Python is a high-level, interpreted, general-purpose programming language. It is widely recognized for its
simplicity, readability, and versatile "batteries-included" approach.

As of 2026, Python can be classified by several distinct characteristics:

1. Multi-Paradigm Support

Python is not limited to a single coding style; it allows developers to choose the best approach for a specific
task:

 Object-Oriented (OOP): Focuses on "objects" that contain both data and functions.

 Procedural: Follows a sequential step-by-step approach.

 Functional: Treats computation as the evaluation of mathematical functions.

2. Execution Type

 Interpreted: Python code is executed line-by-line by an interpreter rather than being compiled into
machine code all at once. This makes it highly portable across different platforms (Windows, macOS,
Linux) and allows for fast prototyping.

3. Typing System

 Dynamically Typed: You do not need to declare a variable's data type (like integer or string)
beforehand; the interpreter determines the type at runtime.

 Strongly Typed: It forbids operations that are poorly defined, such as adding a string to a number,
which helps catch errors early.

4. General-Purpose Use

Python is "general-purpose" because it can be used for a vast range of industries and tasks, including:

 Data Science & AI: Dominates the field due to libraries like Pandas and TensorFlow.

 Web Development: Powers the backend of major sites using frameworks like Django and Flask.

 Automation & Scripting: Widely used to automate repetitive daily tasks.

 Software Testing: Used for writing automated test cases.

5. Level of Abstraction
 High-Level: Python uses English-like syntax and handles complex background tasks (like memory
management) automatically, allowing developers to focus on solving problems rather than computer
hardware details.

Use of compiler and an interpreter in python


Python is a hybrid language that uses both a compiler and an interpreter, though it is most commonly
categorized as an interpreted language because the compilation step is automated and hidden from the user.

Here is how the process works as of 2026:

1. The Compilation Phase (Source to Bytecode)

When you run a Python script, it is first automatically processed by a built-in compiler.

 Action: The compiler translates your high-level source code (.py file) into an intermediate format
called bytecode.

 Storage: This bytecode is often stored in a folder named __pycache__ as .pyc files.

 Purpose: Bytecode is platform-independent and easier for the computer to process than raw text.

2. The Interpretation Phase (Bytecode to Execution)

After the code is compiled into bytecode, the Python Virtual Machine (PVM)—the interpreter—takes over.

 Action: The interpreter reads the bytecode and executes it line-by-line.

 Translation: It translates the bytecode into machine-specific instructions that your computer's CPU can
understand at runtime.

Key Differences at a Glance

Feature Python Approach

Traditional Compiler (e.g., C++) Translates the whole program into machine
code before execution.

Traditional Interpreter (e.g., Executes the source code directly line-by-line without an
Basic) intermediate step.

Python Compiles to bytecode first, then interprets that bytecode at


runtime.
Summary: Python is technically a compiled-interpreted language. It uses a compiler to prepare the code and
an interpreter to run it, providing a balance between portability and ease of development.

Python Install
However, if you want to run Python on your own computer, follow the instructions below.

Many Windows PCs and Mac computers already have Python pre-installed.

To check if Python is installed on Windows, search in the start bar for Python or run the following on the
Command Line ([Link]):

C:\Users\Your Name>python –version

To check if you have python installed on a Linux or Mac, then on linux open the command line or on Mac open
the Terminal and type:

python –version

If Python is not installed on your computer, you can download it for free from the official
website: [Link]

Python Quick Start


Python is an interpreted programming language, this means that as a developer you write Python (.py) files in
a text editor and then put those files into the python interpreter to be executed.

Let's write our first Python file, which can be done in any text editor. Write the following a line of code and
save it as [Link]

print("Hello, World!")

Open your command line, navigate to the directory where you saved your file, and run:

C:\Users\Your Name>python [Link]

Python Version
To check the Python version of the editor, you can find it by importing the sys module:

import sys
print([Link])

The Python Command Line


To test a short amount of code in python sometimes it is quickest and easiest not to write the code in a file.
This is made possible because Python can be run as a command line itself.

Type the following on the Windows, Mac or Linux command line:

C:\Users\Your Name>python

Or, if the "python" command did not work, you can try "py":

C:\Users\Your Name>py

From there you can write any python code, including our hello world example from earlier in the tutorial:

>>> print("Hello, World!")

Whenever you are done in the python command line, you can simply type the following to quit the python
command line interface:

exit()

Python IDLE
IDLE stands for the Integrated Development and Learning Environment. It is a simple Integrated Development
Environment (IDE) that is bundled by default with the standard Python installation, making it particularly
suitable for beginners and educational purposes.

IDLE is designed to be lightweight and user-friendly, offering essential features for writing, running, and
debugging Python code.

Run Python IDLE


Press windows button (for Windows OS) and search IDLE and click it to run.

Run Online Python IDLE


[Link]

You might also like