Introduction to Python Programming

C. Oscar Lawshea
BitWise Tech Tips
Published in
4 min readApr 24, 2023

Welcome and congrats on taking your first steps to learning software coding. In this tutorial, you will learn the basics of programming using Python. This intro is not about just teaching you Python, its primary goal is to teach you the core concepts of programming which can be applied to all coding technologies. Since you are here, I assume you already have a goal in mind which programming will help you reach; whether it be an app you want to build or a tech career you want to pursue. Final word; throughout this journey there will be moments where you may become frustrated. Don’t be discouraged, learning to code is a roller-coaster ride of highs and lows. What’s most important is persistence and consistency; it may sometimes seem impossible but even a drop of water can punch a hole through solid stone over time. Let’s dive in…

Note: If you haven’t already, please take a look at my first post on installing Python.

What is programming / coding? Simply, you are writing a set of instructions for a computer to follow in order to complete a task. So, programmers / coders are instruction writers for computers…Boom, demystified. We are going to practice writing various kinds of instructions using Python syntax.

For your first program, we are going to write some simple code which will instruct the computer to print “Hello World!” Open up command prompt in administrator mode then type the command to open the Python shell:

Now, type:

greeting = “Hello world!”

print(greeting)

now press enter and you should get this output below:

Pretty simple huh? Let’s break down what you have just written:

1. A string variable is a variable that “holds” a string data. A variable is a named unit which can be assigned a value; this value can change during the program’s execution hence the name. A programmer can name a variable anything he or she likes as long as the variable’s name describes the data / value type it “holds”. In our case, the greeting variable holds a string value / data type. As you see we named the variable greeting because this will give an indication to any programmer who reads your code what type of data this variable will contain.

2. In Python and programming in general, you can recognize a string by any value surrounded by single or double quotation marks like the message our greeting variable holds in the image above, “Hello world!”.

Question: Is this, (“123456”), a string?

Note: There are many different data types in Python besides string. Examples are integers(1, 2, 3,…), floating integers(1.0, 2.0, 3.0,…) and many more.

3. Print is a built-in Python function is a block of code that processes data when it is called; with our Hello world! program, the print() function was called on our greeting variable. The variable was then passed into the print() function as an argument and processed to output the message in our greeting. There are many built-in functions in Python; However by the end of this tutorial series, you will be able to define and create your own functions. Read more about Python functions here and here.

Note: This program structure is called a Sequential Program; After you press enter, the execution of this code began at the greeting variable continuing down line by line until it reaches the final instruction line, which in our case is print(). Finally the output (your greeting) is displayed on the screen. This code structure is common in programming; when you start to read more code you will often see this structure throughout a program. It’s a very simple, straight forward coding method and the simplest on to learn.

So far, we have been using the shell to write and run basic code we will never need to use again. However, you will eventually write code (Functions, classes etc.) that you will want to use again in other programs. This is where code editors like Notepad++ and IDE’s (Integrated Development Environments) like PyCharm. I will be doing examples of reusable code using Notepad++ in the next tutorial and throughout the series; You can still follow along with any tool you choose be it an IDE or Editor. This brings us to the end of this tutorial, I hope it was simple, useful and that you know understand what programming is and how the basics work. If you’re ready, head on over to the next tutorial; Data Structures — Part One

Challenge

Practice makes perfect, I challenge you to use the concepts you’ve just learned to print another message. Make the program as complex as you dare; use multiple variables to hold different messages then print them. Bonus: you can use commas to pass multiple arguments to the Print() function; Ex, print(varibale1, variable2).

--

--

C. Oscar Lawshea
BitWise Tech Tips

I enjoy all science, and learning new tech skills. When I'm not blogging or tinkering with computers; I'm video/pc gaming, watching movies or being a gym bro.