Introduction to Python Programming Video

Introduction to Python Programming

Jeremiah Taguta (BSc Computer Science, Masters in Information Systems)
Published on 15-03-2023
Python interpreter and IDE setup, identifiers, variables, and their declaration and data types.

Install Interpreter

First things first, Python is a high-level programming language. It is interpreted by a python interpreter. You can get the latest interpreter at

Once you download one specific to your computer operating system, install it and remember to add it to the path. To check if Python is installed, open the command line, type the below command, and press enter. Thus, you will see the installed Python version.

python --version


To create python scripts, you can use any text editor and save files with a .py extension. That way you can run it from the command line though I encourage you to make life easy for yourself by either using IDLE or Visual Studio Code among many existing IDEs. IDLE comes with a Python interpreter so search for it on your machine. Visual Studio Code is found at Download one suitable for your operating system and install it.

After installing your IDE, open it, create a new Python file, name it, ""

Type the following code,

print( "Hello, World" )

 Run it, and you will see the below output on the console. 

Hello, World

Congrats on your first program. Keep rolling! By the way, for now, we are writing console-based programs. As you go through the following sections of the article, write the code in the file you created above.

Press "Enter" to get to a new line where you can declare your variables.

Identifier vs Variable

Enough of the talk, let's dive into programming. As you code, you need to give different types of entities some names. The entities given identifiers can be variables functions, classes, and lists which we shall look at later. All these are objects. Having said this, identifiers must be meaningful.

A variable is a named memory location where a value is stored. It is a method of referring to a value stored in memory for later use in the program. When a variable is given a value, that value is stored in memory, and the identifier is used to refer to that memory location.

NB: We should store a value in a variable when we need to access or modify that value multiple times in our code, or when the value is complex and difficult to calculate or remember.

Many of the programs we develop are problem oriented. They are meant to solve problems. At some moments input data is given to the program through hard coding, i.e. programmer determines values in advance by creating variables assigned to values of many data types.

name = "James"
In the above example, the name is the identifier, and the value "James" is stored in the memory location associated with the variable name.

Rules for identifiers

  • They can include letters, numbers, and the underscore character. No special characters are allowed.
  • Spaces are not permitted.
  • Must not begin with a number.
  • Case sensitive; for example, age, Age and AGE are distinct.
Variable Declaration and Data Types

A data type is a type of data. E.g. String, Boolean, Float, and Integers among others. In Python, all these are objects but will talk later about that. Unlike other programming languages, python needs no type declarations. Python interpreter dynamically allocates objects or data types based on the value on the right side of the assignment operator.

An assignment operator, "=" is used to assign what is on the right of = to a variable name on the left of it. In Python Programming, variables are declared together with initialisation, where we assign values to variable names. Below are examples of declaring variables and assigning different data types to them.

NB: Only store values that you need to reuse in your program.

Integer (int): A whole number e.g.

age = 34

Float ( float): A real number or decimal value e.g.

height = 1.65

Boolean (bool): Values that represent either True or False e.g.

complete = True
finished = False
String (str): Sequences of characters enclosed in single or double quotes e.g.
message = "Hello World"

Anything in quotes is a string. e.g "1" , "[5,6,4]" . Though 1 and [5,6,7] are integers and lists respectively when put inside quotes they are taken literally as strings, not as their original data types outside quotes.  The brackets, and numbers in "[5,6,4]" just become elements of the string not related in any way.

List (list): Ordered sequences of elements, enclosed in square brackets and separated by commas e.g.
num_list =[1, 2, 3]
Tuple (tuple): These are similar to lists but immutable, meaning their elements cannot be modified after definition. They are enclosed in parentheses e.g.
num_turple =(1, 2, 3)
Set (set): Unordered collections of unique elements, enclosed in curly braces and separated by commas e.g.
num_set ={1, 2, 3}
Dictionary (dict): These are key-value pairs, enclosed in curly braces and separated by colons e.g.
person = {'name': 'Peter', 'age': 43, "job": "developer"}
Data destructuring
You may store data in variables using data destructuring as shown below. The first assigned value, i.e. "Chiredz" is stored in the city variable and 1 is stored in the code variable e.g.
city, code = "Chiredzi", 1
Overwriting variable values
Having assigned a 1 to code, assigning another value of 2 to code will overwrite the already stored value of 1 thus the value is lost and the new stored value is 2. Be careful and only do that if it's the intended behaviour. Don't worry about the print used below, it's used for displaying values on the console by default. I shall explain it later.
print("Code before overwrite", code)
code = 2
print("Code after overwrite", code)
NB: These are basic Python data types, there are more complex data types like queues, stacks, and more. Lists, tuples, and dictionaries can nest other data types.
Thanks for reading. If you have any questions, feel free to ask in the comments section, I'll gladly help. Check out my programming tutorials on YouTube and don't forget to subscribe, comment, like, and share on both YouTube and on this Blog. Lets code together!!!

194 Like

Drop your comment

© Copyright 2023 Jeremiah Taguta. All Rights Reserved.

Product of ‌

Jeremiah Taguta T/A Charis Technologies