Notes – Introduction to Python
What is Python?
Python is a high-level, interpreted programming language known for its simplicity and readability. It is widely used in various domains, including:
- Web Development
- Data Science
- Machine Learning & AI
- Automation & Scripting
- Game Development
- Cybersecurity
Why Learn Python?
Python is popular because of:
- Easy to Learn – Simple syntax similar to English.
- Versatile – Can be used for web, data, AI, and more.
- Large Community – Millions of developers worldwide.
- Extensive Libraries – Built-in modules for faster development.
- Cross-Platform – Works on Windows, macOS, and Linux.
Features of Python
| Feature | Description |
|---|---|
| Simple & Readable | Uses indentation instead of curly brackets {}. |
| Interpreted | No need to compile; executed line by line. |
| Dynamically Typed | No need to declare variable types. |
| Object-Oriented | Supports classes and objects. |
| Extensive Libraries | Includes libraries like NumPy, Pandas, and Django. |
Python vs Other Languages
| Feature | Python | Java | C++ |
|---|---|---|---|
| Syntax | Simple, easy to read | Verbose, requires semicolons | Complex syntax |
| Speed | Slower (interpreted) | Faster (compiled) | Faster (compiled) |
| Use Cases | AI, Web, Data Science | Enterprise, Web | Game Development, Performance Apps |
Where is Python Used?
- Google – Uses Python for AI and web services.
- Netflix – For recommendation algorithms.
- NASA – Space exploration and simulations.
- Instagram – Built using Python’s Django framework.
How to Install Python?
- Download Python from python.org
- Install it by following the setup wizard.
- Verify installation by running
python --versionin the terminal.
First Python Program
Here’s a simple Python program to print a message:
print("Hello, World!")
Explanation:
print()is a built-in function that displays output.- The text inside
""(quotes) is printed on the screen.
