⚡0 XP🔥0

Introduction to Python

Lesson 1 of 33 ⏱ 4 min read ✎ 2 exercises ❓ 5-question quiz ▶ Runs Python

What Python is, why it is so popular, where it is used, and your very first Python program.

What is Python?#

Python is a popular, general-purpose programming language. A programming language is a way to give instructions to a computer. Python is famous because its code looks almost like plain English, so it is one of the easiest languages to learn - and also one of the most powerful.

Python was created by Guido van Rossum and first released in 1991. The name comes from the British comedy show Monty Python's Flying Circus, not from the snake.

Here is a complete Python program:

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

That's it - one line. In languages like C or Java, the same program needs 5-7 lines.

Why learn Python?#

Reason What it means for you
Easy to read and write Fewer lines, simple syntax, less confusion for beginners
Huge demand in jobs Used in AI, data science, web, automation, testing, cloud
Free and open source Download and use it anywhere at no cost
Large library ecosystem Ready-made packages for almost everything (pandas, django, numpy...)
Cross-platform The same code runs on Windows, macOS and Linux
Big community Millions of developers, tutorials and answers online

Where is Python used?#

  • Artificial Intelligence & Machine Learning - ChatGPT-style tools, image recognition (libraries: TensorFlow, PyTorch, scikit-learn)
  • Data Science & Analytics - analysing sales, Excel automation, charts (pandas, matplotlib)
  • Web Development - backend of websites and apps (Django, Flask, FastAPI)
  • Automation & Scripting - renaming 1,000 files, sending reports, filling forms
  • Software Testing - automated testing tools (Selenium, pytest)
  • Desktop apps, games, IoT - Tkinter, Pygame, Raspberry Pi
Did you know?

Companies like Google, Netflix, Instagram, Spotify and NASA use Python in their products.

Key features of Python#

1. High-level language#

You don't manage memory or hardware details. You focus on what to do, not how the computer does it.

2. Interpreted#

Python code is run line by line by a program called the Python interpreter. You don't need a separate "compile" step. If there is an error on line 5, lines 1-4 still run first.

3. Dynamically typed#

You don't declare the type of a variable. Python figures it out:

age = 21          # Python knows this is a whole number (int)
name = "Riya"     # Python knows this is text (str)

4. Indentation-based#

Python uses spaces at the start of a line (indentation) to group code, instead of { } braces. You will learn this in the next lessons.

हिंदी में समझें

Interpreted का मतलब है कि Python आपका कोड एक-एक लाइन करके पढ़ता है और तुरंत चलाता है - जैसे कोई अनुवादक (translator) एक-एक वाक्य का अनुवाद साथ-साथ करता है।

Dynamically typed का मतलब है कि आपको पहले से बताना नहीं पड़ता कि variable में नंबर रखेंगे या टेक्स्ट। आप सिर्फ age = 21 लिखते हैं, और Python खुद समझ जाता है कि यह नंबर है।

How a Python program runs#

  1. You write code in a file ending with .py, for example hello.py.
  2. You run it with the command python hello.py.
  3. The interpreter reads the code, converts it to bytecode, and executes it.
  4. You see the output (or an error message that tells you what went wrong).

Your first program - try it!#

Every lesson on Vindhyaedu has a Try it Yourself editor. Change the code and press Run. Python runs right inside your browser - nothing to install.

▶ Try it YourselfPython
Ctrl + Enter to run

print() is a built-in function - it displays whatever you put inside the brackets. Text must be inside quotes ("..." or '...'). Numbers don't need quotes:

▶ Try it YourselfPython
Ctrl + Enter to run

Notice that print(10 + 5) prints 15 - Python calculates the answer first, then prints it.

Common Mistake

Python is case-sensitive. print works, but Print or PRINT gives an error: NameError: name 'Print' is not defined. Also, quotes must match: "Hello' is an error.

Summary#

  • Python is a high-level, interpreted, dynamically typed, general-purpose language.
  • It was created by Guido van Rossum (1991) and is used in AI, data, web, automation and more.
  • print() shows output. Text goes inside quotes; numbers and calculations don't need quotes.
  • Python is case-sensitive and uses indentation to structure code.

In the next lesson you will install Python on your own computer and run your first .py file.

Practice Exercises

Write your code, then press Check. Your program is tested automatically.

1

Your first program

Write a program that prints exactly Hello, Python!

Expected output:
Hello, Python!
2

Introduce yourself

Print these three lines exactly:

Welcome to Vindhyaedu
I am learning Python
Let's start!
Expected output:
Welcome to Vindhyaedu
I am learning Python
Let's start!

Quick Quiz

Q1.

Python is a ___ language.

Q2.

Who created Python?

Q3.

Which function displays output on the screen?

Q4.

Which of these is NOT a common use of Python?

Q5.

What does "Python is dynamically typed" mean?