Let’s Learn Python #1
All you need to know to get started with Python
Do you want to start learning Python but can’t find free learning and practice resources? Look no further than this four-part series about the fundamentals of Python (complete with coding notebooks to get you started right away)!
In this article (part 1), we will be answering the following questions:
- What is programming?
- What is Python?
- What can I do with Python?
Let’s start!
What is programming?
In short, programming is solving problems using code.
Wow, Nyx. Surely, it’s not THAT simple!
Well, in a nutshell, programming is really just that! The nuance comes from the problems we seek to solve using code, be it in game development, web development, artificial intelligence, cryptocurrency, cybersecurity, and many other fields I can’t even think of right now! The nuance also comes from the solutions we devise to solve those problems.
If you think about programming in this manner, it no longer seems like some cryptic alien concept only geniuses are equipped to tackle. If you want to start programming, no one is there to stop you (except for yourself).
With that being said, what exactly is solving problems using code?
Well, that is writing instructions (the code) for computers to follow in order to help us solve the problems at hand!
Those instructions are what we call algorithms. So, the next time someone complains about the YouTube algorithm, you know that at its core, it’s just some code (albeit a smart one) that tells the YouTube platform (or the YouTube “computer”) what to do!
I bet one question pops up: what are algorithms made up of?
You’d be surprised to learn that, by the time you’re done with this series, you will be able to create your very own algorithm. Why? This is because algorithms can be constructed using simple coding concepts: variables, operators, functions, loops, and several other concepts I will cover in the future!
Believe it or not, 1 + 1 is an algorithm
Of course, programming has rules (and breaking those rules is such a common mishap that programmers make memes out of it). Those rules (called syntax) to programming are like grammar to English: they help us (and the computer) understand what someone is saying (or coding). If we break those rules, both humans and the computer you are coding with will let you know and force you to change your code!
Now that we have a common basic understanding of what programming is, let’s now talk about the programming language you clicked on this article to learn!
What is Python?
Python is my favourite language, and I believe I have alluded to my love for it in my latest article.
Why do I love Python? Well, that may be because it is an easy-to-learn but powerful programming language used by beginners and experts alike.
As mentioned in this article, Python is a versatile language perfect for anyone who is just starting their programming journeys. It is also a great language for real-world applications, especially for machine learning, data science, and other related fields. As such, the Python programming language is what I recommend you learning, hence this series!
What can I do with Python?
Since this series focuses on technical skills, I won’t be talking about the applications of Python. Instead, I’ll be talking about the must-know basic features of Python.
Basic data types
In most programming languages (including Python), there are data types we should be familiar with and will inevitably use. Namely, they are int
, str
, and bool
.
int
means integer. Integers are whole numbers like 23
, 0
, and -3
.
str
means string. Strings are basically text like "Hello World"
and "123"
.
bool
means boolean. Booleans are either True
or False
.
Of course, there are other data types in Python. However, these three will do for now!
Variables
Variables are made up of two parts: a name and a value.
A variable name can be anything you want, with some exceptions.
The value of a variable can be of any data type, including the three mentioned above.
Expressions
Expression are combinations of operands and operators.
For example, 2 * 5
(2 multiplied by 5) is an expression in which 2
and 5
are the operands and *
is the operator.
There is a concept called abstracting expressions. Basically, we abstract an expression by giving a name to the value of the expression, enabling us to reuse names instead of values, which is a cleaner way of coding.
Changing values
In programming, we can reassign variable names to new values. Take note, however, that when one variable is changed, another variable dependent on said variable may not be updated.
Lesson & Practice Notebooks
That’s all for this article! If you want to consolidate your learning by actually coding, follow these steps:
- Go to this GitHub repository
- Click the green
Code
button (refer to the image below) - Click
Download ZIP
(refer to the image below) - Open the downloaded
.zip
file - Find
Lesson 1.ipynb
andPractice 1.ipnyb
- Upload the files in 5. on Google Colab
- Start coding 🎉
Next up…
Hopefully, this article has helped you gain a better understanding of programming and the very basics of Python.
In the next article (part 2), we will be answering the following questions:
- What can I do with strings?
- What are conditionals?
- What are loops?
Make sure to follow me to not miss out on the next part of the Let’s Learn Python series!
Happy coding!