DEV Community

Kailas Warade
Kailas Warade

Posted on

Python Basics: 10 Things Every Beginner Should Understand

*Python Basics: 10 Things Every Beginner Should Understand
*

When someone starts learning Python, the first question is usually:

“Where should I start?”

There are so many Python tutorials, courses and videos available that it is easy to get confused.

Should you learn variables first? Loops? Functions? Pandas? NumPy?

My suggestion is simple: don't try to learn everything together.

First, understand the basic ideas behind Python and write small programs. The advanced topics will become much easier later.

Here are 10 Python basics that I recommend every beginner understand.

  1. What can you do with Python?

Python is not only for beginners.

You can use it for many different types of work, including:

  • Data analysis
  • Data engineering
  • Automation
  • Web development
  • AI and machine learning
  • Scripting
  • Scientific computing

For example, even a small program can process a list of numbers:

numbers = [10, 20, 30, 40]

for number in numbers:
print(number)

It is a simple example, but it teaches you something important: how Python code is written and how a loop works.

  1. Python code is easy to read

Look at this example:

name = "John"
age = 25

print(name)
print(age)

You can understand what the program is doing without knowing a lot of programming terminology.

That's helpful when you are learning.

But don't confuse simple syntax with simple programming. As your programs become bigger, you still need to understand good programming practices.

  1. Python does not require you to declare variable types

In some programming languages, you have to specify the type of a variable.

Python usually doesn't require that.

age = 25
name = "John"
salary = 45000.50

Python knows that "age" is an integer, "name" is a string and "salary" is a float.

You can check the type yourself:

age = 25

print(type(age))

Output:

Now consider this:

age = "25"

Here, "age" contains a string, not an integer.

So this will not work as you might expect:

print(age + 5)

You will get a "TypeError".

This is why understanding Python data types is important, even when Python makes variable declaration easy.

  1. Don't ignore indentation

If you are coming from another programming language, Python indentation may take some time to get used to.

For example:

age = 20

if age >= 18:
print("You are an adult")

The spaces before "print()" are important.

They tell Python that the statement belongs to the "if" block.

So in Python, indentation is not just about making your code look clean. It is part of the syntax.

  1. A Python program can be just one file

You don't need a big project to start.

Create a file called "hello.py":

print("Hello, Python!")

Then run it from the command line:

python hello.py

That's it.

As you become comfortable, you can create scripts for real tasks.

For example:

  • Read a CSV file
  • Rename files
  • Generate a report
  • Check data
  • Move files from one folder to another

This is where Python starts becoming really useful.

  1. What is PIP?

You will probably hear the word PIP quite often when learning Python.

PIP is used to install Python packages.

For example, if you want to work with Pandas, you can install it using:

pip install pandas

Then you can use it in your program:

import pandas as pd

You don't have to write every feature yourself. Python has a huge collection of packages that you can use in your projects.

  1. Why do we need a virtual environment?

This is something beginners often skip.

Suppose you have two Python projects.

One project needs an older version of a package, while another project needs a newer version.

Installing everything in one common environment can create problems.

A virtual environment keeps the packages for a project separate.

For example:

python -m venv myenv

You can then activate the environment and install the packages needed for that particular project.

You may not need to worry about this for your first small Python program.

But if you start building real projects, learn virtual environments early.

  1. Python is very useful for working with data

If you are interested in data analytics or data engineering, you will come across Python quite often.

For example, Pandas can read a CSV file:

import pandas as pd

df = pd.read_csv("employees.csv")

print(df.head())

Now you have the data in a DataFrame.

You can then clean it, filter it, calculate values and transform it.

Some popular Python libraries for data work are:

  • NumPy
  • Pandas
  • Matplotlib

You don't need to learn all of them on day one.

Start with Python basics first.

  1. Python is great for automation

Think about a simple situation.

You receive 500 CSV files and need to perform the same operation on every file.

Doing it manually would take a lot of time.

A Python script can do the repetitive work for you.

Python can be used to:

  • Read multiple files
  • Combine CSV files
  • Rename files
  • Create reports
  • Move files
  • Check data
  • Perform repetitive tasks

This is one of the areas where even a small amount of Python knowledge can be useful in day-to-day work.

  1. Don't learn Python only by watching tutorials

This is probably the most important point.

You can watch a two-hour Python tutorial and feel like you understand everything.

Then you open your editor and suddenly don't know what to write.

That's normal.

The solution is to start writing small programs.

For example, try finding the largest number:

numbers = [10, 50, 30, 80, 40]

largest = numbers[0]

for number in numbers:
if number > largest:
largest = number

print(largest)

The answer is "80".

Now change the program yourself.

Try finding:

  • The smallest number
  • The second largest number
  • The sum of all numbers
  • The average
  • Numbers greater than 50
  • Duplicate values

Don't worry if your first attempt gives an error.

The error is part of learning Python.

What should you learn next?

After you are comfortable with these basics, move gradually to:

  • Strings
  • Lists
  • Tuples
  • Sets
  • Dictionaries
  • Conditions
  • Loops
  • Functions
  • Exception handling
  • File handling
  • Modules and packages
  • Object-oriented programming
  • NumPy
  • Pandas
  • Real Python projects

You don't have to finish all of these before writing projects.

In fact, writing small projects while learning is a much better way to remember what you learn.

One more Python resource

If you are learning Python for interviews or want a quick revision of the basics, I have also prepared a separate guide covering 20 common Python programming questions.

It covers topics such as Python installation, Python 2 vs Python 3, PIP, virtual environments, dynamic typing, Python scripts, indentation, data analysis, automation and Python's use in AI.

You can find it here:

"Introduction to Python Programming: Top 20 Questions Explained" (https://www.sankalandtech.com/Tutorials/Python/interview-questions/introduction-to-python-programming.html)

Final thought

Don't try to become an expert in Python in a few days.

Learn one concept.

Write some code.

Make a mistake.

Understand the error.

Try again.

Then move to the next concept.

If you do this regularly, Python will become much more comfortable over time.

And once your basics are strong, you can decide where you want to go next — data analytics, data engineering, automation, AI or machine learning.

Top comments (0)