Introduction to Python Programming
Welcome back, aliens! My name is Wi D and in this series, we will be talking about
Python programming. In the previous lessons, we discussed what Python is and how to
install it on your machine. Now, it's time to dive into the actual coding.
Step 1: Opening Your IDE
Before we start with the actual code, we have to ask ourselves, why do we code? We live
in a world where everything is done with computers. If we want to talk to our computer,
we need to understand their language, which is binary code. However, it's not exactly
possible to talk to a computer in binary code. So, we created programming languages,
like Python, to bridge the gap between human and computer languages.
To start coding in Python, we need to open our Integrated Development Environment
(IDE). In this tutorial, we will be using IDLE, which is one of the easiest IDEs to use.
Basic Operations in Python
Let's start with some basic operations. We will be using the Python interpreter to execute
our code. We will try out addition, subtraction, multiplication, and division.
Addition: To add two numbers, we use the '+' symbol. For example, 2+3=5.
Subtraction: To subtract two numbers, we use the '-' symbol. For example, 9-8=1.
Multiplication: To multiply two numbers, we use the '*' symbol. For example, 4*6=24.
Division: To divide two numbers, we use the '/' symbol. For example, 8/4=2.0. Note that
this gives us a float value.
We can also use brackets to group our operations. For example, (8+9)-10=7.
We can also use exponentiation to find the power of a number. To do this, we use the
double asterisk '**' symbol. For example, 2**3=8.
Python Fundamentals
Printing Paths
When printing paths like "C:/docs/naveen", we need to escape special characters like the
forward slash (/) and the backslash (\) by using a backslash before them. Otherwise,
Python may interpret them as new lines.
Welcome back, aliens! My name is Wi D and in this series, we will be talking about
Python programming. In the previous lessons, we discussed what Python is and how to
install it on your machine. Now, it's time to dive into the actual coding.
Step 1: Opening Your IDE
Before we start with the actual code, we have to ask ourselves, why do we code? We live
in a world where everything is done with computers. If we want to talk to our computer,
we need to understand their language, which is binary code. However, it's not exactly
possible to talk to a computer in binary code. So, we created programming languages,
like Python, to bridge the gap between human and computer languages.
To start coding in Python, we need to open our Integrated Development Environment
(IDE). In this tutorial, we will be using IDLE, which is one of the easiest IDEs to use.
Basic Operations in Python
Let's start with some basic operations. We will be using the Python interpreter to execute
our code. We will try out addition, subtraction, multiplication, and division.
Addition: To add two numbers, we use the '+' symbol. For example, 2+3=5.
Subtraction: To subtract two numbers, we use the '-' symbol. For example, 9-8=1.
Multiplication: To multiply two numbers, we use the '*' symbol. For example, 4*6=24.
Division: To divide two numbers, we use the '/' symbol. For example, 8/4=2.0. Note that
this gives us a float value.
We can also use brackets to group our operations. For example, (8+9)-10=7.
We can also use exponentiation to find the power of a number. To do this, we use the
double asterisk '**' symbol. For example, 2**3=8.
Python Fundamentals
Printing Paths
When printing paths like "C:/docs/naveen", we need to escape special characters like the
forward slash (/) and the backslash (\) by using a backslash before them. Otherwise,
Python may interpret them as new lines.