Python Introduction and Core Basics
Learn what Python is, why it is popular, how to set it up, and how to write your first practical Python programs.
Inside this chapter
- What Python Is and Why It Is So Popular
- Where Python Is Used in Real Projects
- Installing Python and Running Programs
- Your First Python Program
- Variables and Naming Rules
- Comments and Basic Input
Series navigation
Study the chapters in order for the most natural learning path. Use the navigation at the bottom of each page to move chapter by chapter.
What Python Is and Why It Is So Popular
Python is a high-level, interpreted, general-purpose programming language known for readability and simplicity. It is used in web development, automation, scripting, data science, machine learning, testing, cybersecurity, desktop tools, education, and backend systems.
Students often begin with Python because its syntax is less cluttered than many other languages. You can focus on the logic of programming instead of spending all your energy on punctuation and boilerplate.
- Readable and beginner-friendly syntax
- Huge ecosystem of libraries and frameworks
- Strong support for automation and scripting
- Excellent for data science and machine learning
- Widely used in both startups and large companies
Where Python Is Used in Real Projects
| Area | Typical Python Use |
|---|---|
| Web Development | Building backend applications and APIs |
| Automation | File processing, report generation, data movement |
| Data Science | Analysis, modeling, visualization |
| Testing | Automated unit tests and integration tests |
| DevOps | Deployment scripts and tooling |
| Education | Teaching programming fundamentals |
Python is often chosen because it helps teams prototype quickly and still scale into real applications when designed carefully.
Installing Python and Running Programs
To begin, install Python and verify it from the command line.
python --version
# or on some systems
python3 --version
You can run Python in multiple ways:
- Interactive shell for quick experimentation
- Standalone `.py` files for scripts and programs
- Jupyter Notebook for educational or data-focused work
# Run a script
python hello.py Your First Python Program
print("Hello, Python!")
This may look simple, but it introduces a very important idea: code is a set of instructions that the interpreter executes line by line.
name = "Riya"
age = 21
print("Name:", name)
print("Age:", age) Variables and Naming Rules
A variable stores a value that can be reused later in the program. Python does not require you to declare a variable type before assigning a value.
city = "Kolkata"
temperature = 32
is_raining = False
- Variable names can contain letters, digits, and underscores
- They cannot start with a digit
- They should be meaningful and readable
- Use `snake_case` for normal Python variable naming
Comments and Basic Input
Comments help explain what code is doing. Input lets programs receive values from users.
# This is a comment
name = input("Enter your name: ")
print("Welcome,", name)