1 Get Start With Python
1.1 What is Coding?
- Coding is like giving instructions to a computer in a language it understands.
- Coding is super fun!
- You can tell the computer what to do.
- You can create your own games!
- Coding helps you use computers to solve problems.
- Learning to code is a great skill for everyone, especially kids.
- Coding can also help you get a cool job in the future
1.2 Why Python?
- Python is a real programming language, not just a toy like Scratch.
- Python is easy to read and write, almost like English!
- Python is one of the most popular and growing language.
-
Check the TIOBE index, which is a monthly updated index of popularity of programming languages.
- See the growth rate on Stack Overflow.
- Python is also very popular on GitHub programming-languages. (top10 usage and top10 languages)
- Check out Google Trends to see how popular Python is.
-
- Python is perfect for beginners and non-professional programmers.
- Great for small projects.
- Easier to use than languages like C++, C#, or Java.
1.3 Get Start with Python
1.3.1 Install Python
- Go to the Python download page, download, and install Python 3.1x or newer.
- Read the installation document to learn how to install Python in windows , in Mac.
- Check if Python is installed by opening a command prompt or terminal and typing
python
.[!NOTE]
- For windows,open command line:
win + r
and typecmd
to open the command line; for Mac, open terminal. - type
python --version
and press enter. You should see the version number printed on the screen. - type
python
and press enter. - If you see something like this, it means Python is installed:
- input
3+4
and press enter, you should see the result7
printed on the screen. - type
exit()
and press enter to exit the Python shell.
- For windows,open command line:
1.3.2 Install a Python Editor
There are many Python editors available, but here are a few popular ones:
- Python IDLE
- IDLE comes with Python. Open it by searching for “IDLE” in the Start menu.
- Learn how to use IDLE.
- PyCharm Edu
- PyCharm Edu is a special editor to help you learn Python.
- Download PyCharm Edu.
- VsCode
- VsCode is a powerful editor for many programming languages.
- Download VsCode.
- Follow this guide to install Python Extensions in VsCode.
- Get started with Python in VsCode here.
- Try VsCode online (new).
In this guide, we will use VsCode. Because it is easy to use and has many features, and its support not only for Python but also for other languages.
1.4 Your first python code
-
Hello World Example
# hello_world.py print("Hello world!") name = input("What is your name?\n") print("Hi,", name)
Try it out! Write this code in your editor and see what happens.