Python Practical 1
Python Practical 1
History of Python
● Created by: Guido van Rossum in 1989, officially released in 1991.
● Developed as a successor to the ABC programming language, with an emphasis on
simplicity and extensibility.
● Open-source and community-driven, maintained by the Python Software
Foundation.
● Key milestones:
○ Python 1.0 (1994) – First official release.
○ Python 2.0 (2000) – Introduced garbage collection and list comprehensions.
○ Python 3.0 (2008) – Major changes for better Unicode support and modern
features.
○ Python 3.x updates – Continuous improvements with better performance and
features.
Compiler
● Translates the entire source code into machine code before execution.
● Faster execution as the program runs in machine language.
● Errors are displayed after compilation.
● Examples: C, C++, Java (JIT Compilation), Go.
Interpreter
Python uses an interpreter called CPython but also supports JIT compilation in PyPy.
3. Applications of Python
Python is used in almost every field:
✔ Web Development
✔ Game Development
● Library: Pygame
● Example: Civilization IV used Python for AI scripting.
4. Python Versions
IDE
PyCharm
VS Code
Jupyter Notebook
IDLE
Spyder
Thonny
6. Features of Python
● Compared to other languages like Java or C++, Python requires less code to
achieve the same result.
Interpreted Language:
Dynamically Typed
x = 10 # x is an integer
x = "Hello" # x is now a string (no error)
● This makes Python more flexible but can lead to runtime errors if not managed
properly.
Cross-Platform Compatibility
● Python code runs on Windows, macOS, Linux, and even mobile devices.
● Write code once, run it anywhere (WORA – Write Once, Run Anywhere).
● Python is the most popular language for AI & ML due to libraries like:
✔ NumPy (Numerical computing)
✔ Pandas (Data analysis)
✔ Matplotlib & Seaborn (Data visualization)
✔ Scikit-learn (Machine learning)
✔ TensorFlow & PyTorch (Deep learning)
x = 10 # Integer
📌 Procedural Programming
● Definition: Follows a step-by-step procedure (sequence of functions).
● Focus: On functions rather than data.
● Data Handling: Separate from functions.
● Security: Less secure, as data is accessible globally.
● Code Reusability: Harder to reuse code.
● Example Languages: C, Pascal, Python (supports both).