Skip to main content

Command Palette

Search for a command to run...

Python Basics for Absolute Beginners

Updated
12 min read
Python Basics for Absolute Beginners
P
Python • AI • Linux • Web Development Building projects and documenting my learning journey

Everything you need to start writing Python code today — no experience needed


By Prakash Gangurde | Technical Content Creator | AI • Python • Linux


Introduction

Python is one of the most popular programming languages in the world — and also one of the easiest to learn.

It powers artificial intelligence, web applications, data science, automation, and cybersecurity tools. Companies like Google, Instagram, NASA, and Netflix use Python every single day. Yet the syntax is so simple that a complete beginner can write a working program in under five minutes.

I am a final-year BCA student who has been learning Python, and in this article I am sharing exactly what helped me understand the fundamentals. By the end of this guide, you will understand what Python is, how to install it, and how to write your very first programs — even if you have never written a single line of code before.

No prior experience is needed. Let's begin.



What Is Python and Why Should You Learn It?

Python is a general-purpose, high-level programming language created by Guido van Rossum and first released in 1991. The name comes not from the snake, but from the British comedy show Monty Python's Flying Circus — which tells you a lot about the fun spirit behind the language.

What makes Python special is how closely it reads like plain English. Compare this to other languages like C or Java, which have complex syntax and strict rules. Python removes most of that complexity so you can focus on solving problems rather than fighting the language itself.

What is Python used for?

  • Artificial Intelligence and Machine Learning — libraries like TensorFlow and PyTorch

  • Data Science and Analysis — libraries like Pandas and NumPy

  • Web Development — frameworks like Django and Flask

  • Automation and Scripting — automating repetitive tasks

  • Cybersecurity — writing tools and scripts for ethical hacking

  • Game Development — using libraries like Pygame

Why learn Python specifically?

  • It has the largest beginner community of any programming language

  • There are more free tutorials, courses, and resources for Python than almost anything else

  • It is consistently the among the most in-demand languages, especially in AI, data science, and automation in job postings for data science, AI, and software development

  • You can go from beginner to building real projects faster than with most other languages

If you are a student and you could only learn one programming language, Python is the right choice.


How to Install Python

Before writing any code, you need Python installed on your computer. This takes about five minutes.

Step 1 — Download Python

Go to the official website: python.org

Click on Downloads and download the latest version of Python 3 (any version starting with 3 is fine — for example, Python 3.12).

Step 2 — Install Python

Run the installer file you downloaded.

Important: On the first screen of the installer, check the box that says "Add Python to PATH" before clicking Install. If you skip this step, Python will not work correctly from the terminal.

Step 3 — Verify the installation

Open your terminal (Command Prompt on Windows, Terminal on Mac or Linux) and type:

python --version

"On Linux/macOS if this doesn't work, try python3 --version"

You should see something like:

Python 3.12.0

If you see a version number, Python is installed correctly. Congratulations.

Step 4 — Choose a code editor

You need a place to write your Python code. I recommend Visual Studio Code (VS Code) — it is free, lightweight, and used by professional developers worldwide.

Download it here: code.visualstudio.com

After installing VS Code, install the Python extension from the Extensions panel (Ctrl+Shift+X), search for "Python", and install the one by Microsoft.

Alternative — No installation needed

If you do not want to install anything right now, you can use Replit — a free online editor where you can write and run Python code directly in your browser. This is a great option to get started immediately.


Your First Python Program — Hello, World!

Every programmer's journey begins with the same program. It is a tradition.

Open VS Code, create a new file called hello.py, and type the following:

print("Hello, World!")

Now run the file. In VS Code, right-click the file and select "Run Python File in Terminal", or open the terminal and type:

python hello.py

You will see this output:

Hello, World!

That is it. You just wrote and ran your first Python program.

Let's understand what happened. print() is a function — a built-in command that tells Python to display something on the screen. Whatever you put inside the parentheses and quotation marks is what gets printed.

Try changing the message:

print("My name is Prakash and I am learning Python!")

Run it again. Python will print exactly what you wrote. Simple, clean, and powerful.


Variables and Data Types

A variable is like a labelled box. You store a value inside it and give it a name so you can use it later.

In Python, creating a variable is as simple as writing:

name = "Prakash"

Here, name is the variable. "Prakash" is the value stored inside it. The = sign assigns the value to the variable.

The four basic data types

Python has four basic types of data you will use constantly:

name = "Prakash Gangurde"    # String  — text, always inside quotes
age = 21                      # Integer — whole numbers
gpa = 8.5                     # Float   — decimal numbers
is_student = True             # Boolean — only True or False

Let's print all of them:

print(name)
print(age)
print(gpa)
print(is_student)

Output:

Prakash Gangurde
21
8.5
True

Checking the type of a variable

Python has a built-in function called type() that tells you what kind of data a variable holds:

print(type(name))        # <class 'str'>
print(type(age))         # <class 'int'>
print(type(gpa))         # <class 'float'>
print(type(is_student))  # <class 'bool'>

This is useful when you are debugging and want to understand what kind of value you are working with.

Variable naming rules

  • Variable names cannot have spaces — use underscores instead: first_name

  • They cannot start with a number: 2name is invalid, name2 is fine

  • They are case-sensitive: Name and name are two different variables

  • Use descriptive names: student_age is better than x

  • Python programmers typically use ****snake_case for variable names.


Getting Input from the User

So far your programs have only displayed fixed text. Let's make them interactive.

Python has a built-in function called input() that lets the user type something, and your program can use that value.

name = input("What is your name? ")
print("Hello, " + name + "!")

When you run this, the program pauses and waits for you to type. After you press Enter, it prints your greeting.

Example:

What is your name? Prakash
Hello, Prakash!

A cleaner way — f-strings

Instead of joining strings with the + operator, Python has a much cleaner method called f-strings (formatted strings). You put an f before the quotation mark, and then use curly braces {} to insert variables directly:

name = input("What is your name? ")
age = input("How old are you? ")
print(f"Hello, {name}! You are {age} years old.")

Output:

Hello, Prakash! You are 21 years old.

F-strings are the modern and preferred way to format text in Python. Get comfortable with them early.


Arithmetic and Operators

Python can perform all standard mathematical operations. This makes it extremely useful for everything from simple calculations to complex data analysis.

a = 10
b = 3

print(a + b)    # Addition       → 13
print(a - b)    # Subtraction    → 7
print(a * b)    # Multiplication → 30
print(a / b)    # Division       → 3.3333...
print(a // b)   # Floor division → 3  (no decimal)
print(a % b)    # Modulo         → 1  (remainder)
print(a ** b)   # Exponent       → 1000 (10 to the power 3)

A practical example — simple calculator

Let's combine input and arithmetic to build a tiny calculator:

num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))

print(f"Addition:       {num1 + num2}")
print(f"Subtraction:    {num1 - num2}")
print(f"Multiplication: {num1 * num2}")
print(f"Division:       {num1 / num2}")

Notice we used float() to convert the input — because input() always returns text, and we need numbers to do math. This is called type conversion, and it is something you will use often.

"If you type letters instead of numbers, Python will raise a ValueError — we will cover error handling in a later article”

Try running this with different numbers. You have just built your first useful Python program.


Comments — How to Write Notes in Your Code

A comment is a line in your code that Python ignores completely. It is written for humans — for you, or anyone else reading your code — to explain what is happening.

In Python, comments start with the # symbol:

# This is a comment — Python will not run this line
print("This line will run")   # You can also add a comment at the end of a line

# Store the student's details
name = "Prakash"
age = 21

Get into the habit of writing comments. When you come back to your code after a few days, comments will remind you what each part does. When you share code on GitHub, comments help others understand your logic.


Putting It All Together — A Mini Student Profile Program

Let's combine everything you have learned into one small program:

# Student Profile Program
# Written by Prakash Gangurde

print("=== Student Profile Generator ===")
print()

# Get student information
name = input("Enter your name: ")
age = input("Enter your age: ")
course = input("Enter your course: ")
cgpa = float(input("Enter your CGPA: "))

# Display the profile
print()
print("====== YOUR PROFILE ======")
print(f"Name   : {name}")
print(f"Age    : {age} years")
print(f"Course : {course}")
print(f"CGPA   : {cgpa}")

# Check if CGPA is above average
if cgpa >= 7.0:
    print("Status : Good Standing ✓")
else:
    print("Status : Needs Improvement")

print("==========================")

Sample output:

=== Student Profile Generator ===

Enter your name: Prakash Gangurde
Enter your age: 21
Enter your course: BCA
Enter your CGPA: 8.5

====== YOUR PROFILE ======
Name   : Prakash Gangurde
Age    : 21 years
Course : BCA
CGPA   : 8.5
Status : Good Standing ✓
==========================

This program uses variables, input, f-strings, arithmetic, and even a preview of the if/else condition you will learn in the next article. Upload this to your GitHub — it is a real project.


What to Learn Next

You have covered the foundation. Here is what comes next in Python:

Topic What it does
If / Else conditions Make decisions in your code
Loops (for, while) Repeat actions automatically
Functions Organise and reuse your code
Lists and Dictionaries Store and manage collections of data
File Handling Read and write files
Libraries Use powerful tools others have built

Each of these topics will be covered in the next articles in this series. Follow me on Medium so you don't miss them.


Summary — What You Learned Today

In this article you covered:

  • ✅ What Python is and why it is the best first language to learn

  • ✅ How to install Python and set up VS Code

  • ✅ How to write and run your first program using print()

  • ✅ Variables and the four basic data types

  • ✅ Getting user input with input()

  • ✅ Formatting output with f-strings

  • ✅ Arithmetic operators and type conversion

  • ✅ Writing comments in your code

  • ✅ Building a complete mini project

Python takes consistent practice. Write at least 10–15 lines of code every day — even small programs — and you will be surprised how quickly it starts to feel natural.


All Code on GitHub

Every code example in this article is available in my GitHub repository. You can copy, run, and experiment with all of it:

GitHub : https://github.com/prakashgangurde-ux/python-basics

Let's Connect

If this article helped you, please give it a clap on Medium — it helps more beginners find it.

If any part was confusing or you have a question, drop it in the comments. I read and reply to every comment.

You can also find me on:


Next article: Python Functions Explained Simply — how to write reusable blocks of code that make your programs cleaner and more powerful.


Written by Prakash Gangurde — BCA Student | Technical Content Creator | AI • Python • Linux