Python is a versatile and widely-known programming language often taught in introductory college-level courses. It is “widely used in web applications, software development, data science, … machine learning”, and automation (AWS). This makes Python programming a great skill to have if you are interested in mathematics, data analytics, software engineering, and beyond. Furthermore, one of the primary reasons for Python’s “surge in popularity has been due partly to its clear and concise syntax, which enhances readability” (Munro). Unlike other programming languages that may contain confusing keywords or strange formatting, Python is generally cleaner and easier to read. Overall, if you are unfamiliar with Python, it is a good idea to get a brief overview of the language before diving right into learning it.
How is Python Used?
There are many ways that Python is used in the world of programming. Python is often used “on a server to create web applications, …alongside software to create workflows, … to handle big data and perform complex mathematics, … for rapid prototyping, or for production-ready software development”, for database connection and file reading/writing, and for many more purposes (W3Schools). Fortunately, Python is a relatively easy-to-learn language, which is likely one of the many reasons it is a frequently-used language in a variety of fields.
Amazon Web Services outlines several benefits of using Python:
Benefits of Python include:
Developers can easily read and understand a Python program because it has basic, English-like syntax.
Python makes developers more productive because they can write a Python program using fewer lines of code compared to many other languages.
Python has a large standard library that contains reusable codes for almost any task. As a result, developers do not have to write code from scratch.
Developers can easily use Python with other popular programming languages such as Java, C, and C++.
The active Python community includes millions of supportive developers around the globe. If you face an issue, you can get quick support from the community.
Plenty of helpful resources are available on the internet if you want to learn Python. For example, you can easily find videos, tutorials, documentation, and developer guides.
AWS
Brief History of Python
Python was first created by Guido Van Rossum, a computer programmer from the Netherlands; Van Rossum started creating Python “in 1989 at Centrum Wiskunde & Informatica (CWI), initially as a hobby project to stay busy during Christmastime” (AWS). Van Rossum decided to create Python due to his frustrations “with the limitations of the programming language ABC” (Munro). The new programming language was then released in 1991 (W3Schools). Interestingly, Python was named not after the snake, but instead “after the British television series Monty Python’s Flying Circus” (Munro).
There have been three major versions of Python released so far: Python 1.0, Python 2.0, and the most recent, Python 3.0. Python 3.0 was released “[o]n December 3, 2008… [and] included features such as the print function and more support for number division and error handling” (AWS). Interestingly, “Python 3.0 is not backward-compatible with earlier versions” of the programming language (Munro). Python’s popularity has continued to grow since its release, and, “[by] the early 2020s[,] Python had become one of the most extensively used programming languages worldwide” (Munro).
Notable Features of Python
Aside from its easy-to-read syntax and versatility, there are many other features that make Python a great programming language. Three of the most notable features of Python are that it is dynamically-typed, primarily object-oriented, and that spacing and indentation matters more in Python than other programming languages.
Dynamically-Typed
Generally, all programming languages can be sorted into two broad categories based on how variables are handled throughout the language: static typing and dynamic typing. Technologically speaking, “dynamically-typed languages perform type checking at runtime, while statically typed languages perform type checking at compile time” (Oracle). Additionally, “statically-typed languages require you to declare the data types of your variables before you use them, while dynamically-typed languages do not” (Oracle). This means that, when creating variables in a dynamically-typed language, a programmer does not need to specify what type of data the variable holds; instead, the program determines the data type based on whatever data is assigned to the variable as the program is running. For example, a programmer can simply state x = 2 in a program, and the software will automatically detect that x contains an integer value. In a statically-typed language, programmers must specify the type of data that variables are meant to hold since the data types must be determined before the program is able to run. For example, a programmer must state that x is an integer-holding variable before it can be assigned a value of 2. Python is a dynamically-typed language, which means that it will automatically try to detect the data type of variables as it is running.
As a result of dynamic typing, Python programs can be written more quickly than programs written in statically-typed languages since variable types do not have to be declared (AWS). Furthermore, dynamic typing allows for more flexibility when coding (Oracle). For example, a Python programmer can state that x = 5 and then later reassign x to be equal to a string of letters such as “FIVE”.
Of course, this flexibility comes at a cost. Programs “written in dynamically-typed languages… can compile even if they contain errors that will prevent the script from running properly (if at all)” (Oracle). Since a variable’s data type is not checked until the program is actually running, a Python program is still able to run even if the variables containing data of one type are supposed to be used as if they were another type. For example, say a Python programmer has a program that tests whether a variable, x, is divisible evenly by 2. Say the programmer assigns x = 5 but then later reassigns x to be equal to “Name” instead. Whenever Python tries to divide “Name” by 2, an error may occur since “Name” is not an integer value.
Primarily Object-Oriented
Python is a versatile programming language; it is primarily object-oriented and “considers everything to be an object, but it also supports other types of programming such as structured and functional programming” (AWS). An object-oriented programming language provides for the creation of abstract classes that contain their own variables and functions. Object-oriented languages, such as Python, “package data and the operations on them so that only the operations are publicly accessible and internal details of the data structures are hidden” (Hemmendinger). These “packages”, referred to as objects, are then able to be utilized throughout a program.
For example, say we have a class “Vehicle”. There are fundamental parts of vehicles that the majority of vehicles share: tires, doors, an engine, the ability to drive forward, the ability to stop, the ability to turn, etc. One could create a Vehicle object from this Vehicle class to represent one specific Instance of a vehicle. Imagine this like a blueprint used to create the basic model of a vehicle: we need it to have a number of tires, a number of doors, an engine, and the ability to move around. So, we could create an Instance of Vehicle with two tires, no doors, an engine, and the ability to move around. This would be a motorcycle. We could also make a Vehicle with four wheels, four doors, an engine, etc.; this would be a car.
Finally, we can Extend the Vehicle Class to be more specific. While an 18-wheel semi-trailer truck, a 2-door sedan, and a motorcycle are all Vehicles, they all have some unique characteristics. The semi-trailer truck has the ability to hitch up a trailer, the motorcycle has handlebars instead of a steering wheel, and perhaps our sedan is manual and not automatic. So, we could extend Vehicle into three new Classes: Semitrailer_Truck, Motorcycle, and Car. All three of these new classes would have the same traits as the Vehicle class as well as their own unique traits.
This is how object-oriented programming works in a nutshell; programmers create (or extend) these Classes, and then use these Classes to create Instances (otherwise known as Objects) that can be used to hold data and perform certain functions.
Santiago Sanchez
However, Python does allow for other types of programming as well, such as functional and procedural programming. With functional programming, the programmer “uses sets of functions and commands to complete actions” (Preston). This is, in some ways, similar to how object-oriented programming works (except instead of objects being created to manage data, it is simply sets of functions that perform certain tasks). Procedural programming is just as similar, except instead of using mathematical functions, it is groups of defined procedures. Overall, it is “a relatively simple approach to computer programming. This is why many developers start working with procedural programming languages, as they provide a foundation for coding that the developer can apply as they learn other languages, such as an object-oriented language” (Preston). Thus, being able to use Python for both procedural programming and object-oriented programming makes it a good language to start with.
Spacing & Indentation Matters
A rather unique feature of Python is its required usage of spacing and indentation throughout the code. In other languages, like Java, it usually does not matter how many spaces are between lines of code, nor how much (or how little) a line of code is indented; it will run the same no matter what. With Python, however, proper spacing and indentation is required. This is because, “[u]nlike other programming languages, Python doesn’t use curly brackets. Instead, it uses indentation” to show which lines of code are nested within others (AWS).
For example, while these two snippets of Python code may look the same, they will produce different outputs!
#The output of this program will be 25
sum = 0
currentNum = 0
numbers = [1, 3, 5, 7, 9]
for x in numbers:
currentNum = x
#Because the below line of code is indented, it is included in the for loop.
#Thus, the numbers are added to sum each time the loop executes.
sum = sum + currentNum
print(sum)
#The final output of this program will be 9
sum = 0
currentNum = 0
numbers = [1, 3, 5, 7, 9]
for x in numbers:
currentNum = x
#because the below line of code was not indented, it was not included in the for loop.
#Thus, only the final number of the list, 9, is added to sum.
sum = sum + currentNum
print(sum)
W3Schools further explains some of the nuances of indentation and spacing in Python:
Python was designed for readability, and has some similarities to the English language with influence from mathematics.
Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.
Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.
W3Schools
Thus, when programming with Python, it is extremely important to make sure proper spacing and indentation are utilized!
Examples of Python Code
Below are some samples of Python code.
Printing the classic “Hello World!” message to console is as follows:
print("Hello World!")
Assigning a value to two variables then switching the values of these two variables is as follows:
a = 3
b = 5
c = a
a = b
b = c
Comments in Python look like the following:
#This is a python comment
For loops, while loops, and if/then statements look like the following in Python:
#FOR LOOP
greetings = ["Hello", "Hi", "Howdy"]
for x in greetings:
print(x)
#WHILE LOOP
x = 0
while x < 10:
print(x)
x = x + 1
#IF-THEN-ELSE STATEMENT
pigsFly = False
if pigsFly == True:
print("Wow, look! A flying pig!")
else:
print("Pigs can’t fly!")
Finally, this is how you can prompt a user for their name and then greet them in Python:
name = input("Enter your name:")
print("Hello, " + name + "!")
Resources & Further Reading
Amazon Web Services (AWS). “What Is Python? – Cloud Beginner’s Guide to Python – AWS.” Amazon Web Services, Inc., Amazon, aws.amazon.com/what-is/python/.
Hemmendinger, David. “Object-Oriented Programming | Computer Science.” Encyclopædia Britannica, 2019, www.britannica.com/technology/object-oriented-programming.
Munro, André. “Python | Computer Language | Britannica.” Www.britannica.com, Encyclopedia Britannica, 28 Oct. 2024, www.britannica.com/technology/Python-computer-language.
Oracle. “Dynamic Typing vs. Static Typing.” Docs.oracle.com, Oracle, Mar. 2015, docs.oracle.com/cd/E57471_01/bigData.100/extensions_bdd/src/cext_transform_typing.html.
Preston, Robert. “A Complete Guide to Procedural Programming Language.” Indeed Career Guide, Indeed, 11 Mar. 2023, www.indeed.com/career-advice/career-development/procedural-programming-language.
Sanchez, Santiago. “Language Overview: Java.” The H.A.C.K.E.R. Project, The H.A.C.K.E.R. Project, 28 Sept. 2023, thehackerproject.org/2023/09/28/language-overview-java/.
W3Schools. “Introduction to Python.” W3schools.com, Refsnes Data, 2019, www.w3schools.com/python/python_intro.asp.




Leave a comment