Nearby lessons

1 of 159

Python - Introduction

📌 What You Will Learn
  • Understand what Python is and why it is popular
  • Learn the history of Python and how it got its name
  • Know the main uses and applications of Python
  • Understand where Python fits among other programming languages

What is Python?

Python is a programming language that you can use to tell the computer what to do.

Think of it like this — if English is a language you use to talk to people, Python is a language you use to talk to computers.

Key Point: Python is one of the easiest programming languages to learn. It reads almost like English.

Python is called a high-level language because it is very close to human language. You don't need to worry about the complex stuff — Python handles it for you.

Here are some quick facts about Python:

  • It is free to use — anyone can download and install it
  • It is cross-platform — it works on Windows, macOS, and Linux
  • It is open-source — a big community of developers maintains it
  • It is used by Google, Microsoft, NASA and many other big companies

Why Should You Learn Python?

You might be thinking — why should I learn Python when there are many other languages?

Here is the simple answer — Python is the easiest language to start with, and you can build almost anything with it.

Reason 1: Easy to read and write

Python code looks very similar to English. You can read it and understand what it does, even if you are just starting.

Key Point: Python was designed to be read easily. This is why it is called a "beginner-friendly" language.

Reason 2: Less code means more productivity

In other languages, you might need 10 lines to do something. In Python, you can do it in 2 or 3 lines. This saves you a lot of time.

Reason 3: Huge demand in the job market

Companies like Google, Netflix, Instagram, Dropbox, and Spotify use Python. If you know Python, there are many job opportunities.

Reason 4: Used in exciting fields

You can use Python for:

  • Web development (Django, Flask)
  • Data Science and Machine Learning (Pandas, TensorFlow)
  • Automation and scripting
  • Game development
  • Artificial Intelligence (AI)
Key Point: Python is the #1 language for Data Science and AI. If you are interested in these fields, Python is the best choice.

A Short History of Python

Python was created by Guido van Rossum and first released in 1991. It was named after the British comedy series "Monty Python's Flying Circus."

Key milestones:

  • 1991 — Python 0.9.0 released with classes, exception handling, and functions
  • 2000 — Python 2.0 added list comprehensions and garbage collection
  • 2008 — Python 3.0 released with major improvements and breaking changes
  • 2020 — Python 2 reached end of life; Python 3 is now the standard

For the full version timeline, visit Python Versions.

Where Can You Use Python?

Python is one of the most versatile programming languages. It is used across many industries and domains:

  • Web Development — Backend APIs, full-stack apps (Django, Flask)
  • Data Science & Analytics — Data cleaning, visualization, reporting
  • Machine Learning & AI — TensorFlow, PyTorch, scikit-learn
  • Automation & Scripting — Task automation, web scraping
  • Game Development — Pygame, game logic scripting
  • Desktop Applications — GUI tools with Tkinter, PyQt

For a full breakdown of Python's real-world applications, visit Python Applications.

Python vs Other Languages

Let us compare Python with other popular languages so you can understand why Python is a great choice:

FeaturePythonJavaC++
Ease of LearningVery EasyModerateHard
Lines of CodeFewMoreMore
ReadabilityExcellentGoodLow
Data ScienceBestModerateLimited
Web DevelopmentYes (Django)Yes (Spring)Limited
SpeedModerateFastVery Fast
Key Point: Python is not the fastest language, but it is the fastest to learn and the fastest to write code in.

How Python Works

When you write a Python program, you save it in a file with the .py extension.

Then you ask Python to run it. Python reads your code, converts it into a language the computer understands (called bytecode), and then executes it.

Here is the simple flow:

You write → Python reads → Computer runs

Key Point: You do not need to compile Python manually. Just write the code and run it — Python handles the rest.

Your First Python Program

Let us write a simple Python program and see what happens.

Open your editor (VS Code, PyCharm, or IDLE) and type this:

🐍Code Cell
1print("Hello, World!")
Output
Hello, World!

How Does This Program Work?

Let us break it down line by line:

  • print() — This is a built-in function in Python. It tells the computer to show something on the screen.
  • "Hello, World!" — This is the text inside quotes. It is a string — which is just a piece of text.
  • When you run the program, Python prints the text to the output screen.
Quick Check: What will happen if you write print("Python is fun")?
Try it yourself!

Python File Types

You will work with two types of Python files:

File TypeExtensionPurpose
Source Code.pyWhere you write your program
Compiled Bytecode.pycPython converts .py to this for faster execution
Key Point: You always write .py files. Python automatically creates .pyc files behind the scenes — you don't need to worry about them.

Where Can You Write Python Code?

You can write Python code in any text editor. But using a good editor makes coding much easier. Here are some popular options:

Editor / IDEBest ForFree?
VS CodeGeneral purpose, very popularYes
PyCharmProfessional Python developmentCommunity: Yes / Pro: Paid
ThonnyBeginners learning PythonYes
Jupyter NotebookData Science, learningYes
IDLEComes with PythonYes
Key Point: If you are just starting, use VS Code or Thonny. They are free and easy to set up.

Summary

Let us quickly recap what we learned in this lesson:

  • Python is a free, open-source programming language
  • It was created by Guido van Rossum in 1989
  • The name comes from "Monty Python's Flying Circus" — not the snake
  • Python is used for web apps, data science, AI, automation, and more
  • Python files use the .py extension
  • You can write Python code in VS Code, PyCharm, Thonny, or IDLE
📝 Key Takeaways
  • Python is a free, open-source, easy-to-learn programming language
  • Python reads almost like English — a great first language for beginners
  • It works on Windows, macOS, and Linux — truly cross-platform
  • Python files use the .py extension
  • The name "Python" comes from a comedy show, not the snake

🧠 Test Your Knowledge

3 Questions
Progress: 0 / 3