Sitemap
Dimterion

Dimterion

Hi. I’m Dmitrii. I'm interested in programming and new technologies and write about it every Friday.

Python Concepts, Methods, and Functions

3 min readNov 13, 2026

--

Title: Python Concepts, Methods, and Functions.

Let’s talk about some main concepts, methods, and functions in the Python programming language.

Previously, I’ve talked about some of the Python basics. Now we can dive a little bit deeper and explore a few additional details about the language.

Python Concepts, Methods, and Functions Examples

Concepts

Python is an object-oriented programming language, which means it is based around objects that can contain data and code that manipulates the data.

Object is an instance of a class (a building block).

Class bundles data and functionality together and defines a type of object. It can also have methods that can be used to perform various actions.

Method is a function that belongs to a class and performs certain actions or operations.

Dot notation is used to access the methods and attributes that belong to a class instance.

Some common built-in types in Python include integers, floats, strings, Booleans, lists, dictionaries, tuples, sets, frozensets, and ranges. There is also a special value None that shows the absence of a value (its type is NoneType).

Get Dimterion’s stories in your inbox

Join Medium for free to get updates from this writer.

Attributes are values associated with an object or class. They are referenced by name using dot notation.

Methods and Functions Examples

# Checking a type of a string assigned to a variable 
# (using built-in type function)
a_string = "This is a string."
print(type(a_string))
# Output
# <class 'str'>
# Switching the case with built-in swapcase() method
loud = "LEARN PYTHON!"
quiet = loud.swapcase()
print(quiet)
# Output
# learn python!

# There are also separate lower() and upper() methods
# Replacing letters with built-in replace() method
typos = "len and en"
fixed = typos.replace("en", "earn")
print(fixed)
# Output
# learn and earn
# Splitting a string into two strings with built-in split() method
to_do_things = "read remember repeat"
print(to_do_things.split())
# Output
# ['read', 'remember', 'repeat']

Using Libraries

You can also install various Python libraries to perform more complex tasks or add functionality to your project. We can take a look at pandas data analysis library for a quick example (this is a bit of an extra and not strictly necessary example for the current post, but let’s just give it a brief look).

Note: The following are the steps for VS Code on Windows. You can find more info in pandas library documentation.

These steps can be completed in VS Code’s terminal, from the project folder:

# Create a virtual environment in the folder containing your .py file
py -m venv .venv

# Activate the virtual environment
.\.venv\Scripts\Activate
# Or more explicit for PowerShell
.\.venv\Scripts\Activate.ps1

# Install pandas locally
python -m pip install pandas

We can then import the pandas library into our file and use it to create a DataFrame:

# Create the `weekdays` DataFrame
import pandas as pd
data = [
["Monday", "Start week", 1],
["Tuesday", "Project 1", 2],
["Wednesday", "Project 2", 3],
["Thursday", "Review", 4],
["Friday", "Final review", 5],
["Saturday", "Chores", 6],
["Sunday", "Rest", 7],
]
cols = ["Day", "Task", "ID"]
weekdays = pd.DataFrame(data, columns=cols)

# Display the `weekdays` dataframe
print(weekdays)
# Output
# Day Task ID
# 0 Monday Start week 1
# 1 Tuesday Project 1 2
# 2 Wednesday Project 2 3
# 3 Thursday Review 4
# 4 Friday Final review 5
# 5 Saturday Chores 6
# 6 Sunday Rest 7

# Use the shape dataframe attribute to check the number of rows and columns
print(weekdays.shape)
# Output
# (7, 3)

# Use the DataFrame's columns attribute to check its column names
print(weekdays.columns)
# Output
# Index(['Day', 'Task', 'ID'], dtype='str')
# Displayed dtype can vary based on pandas version

These were some of the basic concepts of the Python programming language, a few examples of its functions and methods, and one possible way to use a third-party library. I intentionally kept the text rather short to demonstrate the main concepts. Hopefully, this was helpful.

Thank you for reading.

--

--

Dimterion

Written by Dimterion

Hi. I’m Dmitrii. I'm interested in programming and new technologies and write about it every Friday.