Fundamentals of programming in Python

Avinaba Mukherjee
5 min readDec 28, 2022

--

Python Logo

Studying Python programming is an ambitious, but it will also be very rewarding. In fact, it is an excellent decision that will open the doors of the world of job for you because, even more so today, many companies request the presence of a programming expert who can bring their online projects to life. It is a need that will undoubtedly increase in the coming years.

Python programming is complex, so you are not going to learn it just by reading a manual, since it requires in-depth study, with professionals who will teach you and guide you through its fascinating framework of syntax and variables. It is not extremely difficult, no, but it has its complexity.

Programming with Python

Having said the above, we will explain to you what programming with Python is. What does it consist of and what do you need to know about it before launching into its study? If you like programming, you will love doing it with Python. Let’s see.

To develop a software program or project you have to understand well what the logical sequence is. This is something that you have to have well outlined in your mind to understand and correctly apply this multi-paradigm language that is Python.

We are talking about a language that is interpreted, very dynamic and valid for many platforms. Furthermore, it can be used in a multitude of different projects because it supports object orientation. In short, it offers imperative and functional programming. It is interpreted, dynamically typed, and cross-platform.

This system works by sequence of blocks that are defined by means of code indentation. It has a very clean syntax and a large number of variables and options.

Python variables

One of the fundamental elements of the Python language are its variables. You have to master, from the beginning, what its variables are, what they are for and how they are applied. Let’s see a little bit about these Python variables.

Whole numbers or real numbers

First of all, you have to know that in Python programming there are different types of variables. On the one hand, we have the numbers, of which we can find mainly two classes: integers or real numbers.

Integers are called “int” while real numbers are called “float”. The separator that we will use will be the point. And we can know what variable we are facing by asking Python type.

Pic: www.freepik.com

text in quotes

On the other hand, we have the text, which will always be enclosed in single or double quotes, depending on whether the text occupies one or several lines. Its variables are called strings (str). If what you want is to join more than one text, you can do it by adding the + sign.

We have to make special mention of the “print” command, since thanks to it the program can communicate with us. You also have to know that, to join text with numbers, you need to transform that text into numbers, otherwise Python won’t know how to add it by itself.

Basic Python Syntax

The Python syntax is the first thing you should know to proceed with its handling. Specifically, this programming language allows you to work in two different ways.

On the one hand, we have the interactive mode. Here the order is executed in real time. You have to type “python” on the command line to activate the interpreter. From here, the orders can already be executed. “Print Hello, Python!” It is the most classic order that is used.

While in the other mode that you can use, the script mode, the first thing to do is to write the code before executing. In the script folder you have to place the command line and, from here, by means of the command “python scriptname.py.”, it is possible to execute.

Next, we also need to learn identifiers which, as the name suggests, help identify variables, classes, functions, objects, or modules. They are put with letters or with an underscore followed by a zero and several numbers or letters. Python uses uppercase as well as lowercase. But it does not understand characters like the following: @, $ or %.

The first letter of class names is capitalized. And underscore for private identifiers.

Apart are the reserved words, which are all in lower case. They are as follows: and, assert, break, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, in, is, lambda, not, or, pass, print, raise, return, try, while, with and yield.

Another programming element with Python are the lines, essential in its structure. if one is missing line or is blank, the program will not read it.

And finally, the comments and quotes. The first ones begin with the hash character (#). While for quotes we will use single or double quotes, although if the text is several lines long, we will place triple quotes.

Basic data types and operations

We understand by data type any variable that can be associated with a variable. It constitutes its class element, which defines what its properties are and what can be done with them.

There are different types, each with its own characteristics. For example, there are the basic ones that are Booleans, numbers and character strings. But there are also others that are sequences, maps, sets, iterators, classes, instances, and exceptions. And these same can be grouped generating new formations. Numeric types allow you to do arithmetic operations.

We also find other different types such as lists, tuples, sets and variables.

If you are interested in the world of big data, computing and computers, in addition to managing programming in Python, doing a certificate program will open the way for very interesting projects for your working life and your development as a professional.

--

--