Lesson 01: Introduction - CodeAcademy-Online/python-level-1 GitHub Wiki
What is Python? 🐍
Python is a computer programming language often used to build websites and software, automate tasks, and conduct data analysis. Python is a general-purpose language, meaning it can be used to create a variety of different programs and isn’t specialized for any specific problems.
Python is a dynamically typed language. What is dynamic? We don't have to declare the type of variable while assigning a value to a variable in Python. Other languages like C, C++, Java, etc.., there is a strict declaration of variables before assigning values to them.
Python doesn't have any problem even if we don't declare the type of variable. It states the kind of variable in the runtime of the program. So, Python is a dynamically typed language.
⬇️ Download Python
https://www.python.org/downloads/release/python-3913/
❗ The Phyton version
of 3.9.13 will be used throughout this course.
⬇️ Download VSCode
https://code.visualstudio.com/download
In this course teachers will be using VScode
(or PyCharm
) , you can use whatever tooling you like, it is up to developer to decide what tools to use especially for IDE. However for beginners we strictly recommend to use the same setup.
Things to do:
- setup python with VSCode
💻 First program
Traditionally first program every programmer writes is printing out "Hello, World" in the terminal. Let's do the same thing.
code:
print("Hello, World")
Congratulations you now speak Python! Lets dive in!
Python operators
Python has a lot of tools that are already in place for you to use. Today we will start with Operators
.
Operators
are simply actions similar to actions in you everyday calculator.
Operator | Name | Example |
---|---|---|
+ | Addition | x + y |
- | Subtraction | x - y |
* | Multiplication | x * y |
/ | Division | x / y |
% | Modulus | x % y |
** | Exponentiation | x ** y |
// | Floor Division | x // y |
Let's try them out:
10 + 10
# Output : 20
10 - 5
# Output : 5
10 % 3
# Output : 1
5 ** 3
# Output : 125
20 // 4
# Output : 5
Are the results understandable? If not raise discussion in class.
Excercise:
🧠
- Make sure you the IDE is ready.
- Try the operations yourself.