dev-resources.site
for different kinds of informations.
Getting Started with Python: Installing Python and Writing Your First Program (Day 2 of 100 Days of Python)
In the last blog, we talked about how a programmer is someone who writes a series of steps (called a program) for a computer to follow. Today, we'll dive deeper into different types of software and create our first Python program.
Program vs Software
Before learning about different types of software, let's first understand what software is. Simply put, software is a collection of programs, data, and instructions that work together. For example, a railway ticket booking system is software because it includes different programs that handle tickets and data for trains and passengers.
Types of Software
System Software
System software manages hardware and allows users to run applications. Examples include operating systems like Windows and MacOS, as well as utilities like calculators or terminals. Think of it as the software that makes your computer run.
Application Software
Application software helps users complete specific tasks. Any software you directly use on your computer—like Chrome, Excel, WhatsApp, or Instagram—is application software. These can be grouped into different categories, like:
- Productivity Software: word, powerpoint, excel etc,
- Web Browsers: Google Chrome, Microsoft Edge, Mozilla Firefox etc.
- Multimedia Software: VLC Media Player, Adobe Premier Pro, Adobe Photoshop etc.
- Communication Software: Outlook, WhatsApp etc.
and many more...
Installing Python
Before we start coding in Python, we need to install it. Here's how you can do that (we’ll be using MacOS, but Windows users can follow similar steps with slight changes):
Step 1: Go to python.org and download Python by clicking the yellow button (the version might differ, but that’s okay).
Step 2: Once downloaded, run the installer and follow the steps.
Step 3: For Windows, during installation, make sure to check the "Add Python to PATH" option.
Step 4: After installing, open the terminal (or command prompt for Windows) and type:
For MacOS/Linux:
python3 --version
For Windows:
python --version
In both the cases, the output (based on version) should look something like this
Python 3.11.5
This confirm the successful download and installation of python, If you still have issues with download, you can checkout this video I made some time back (at the top of the blog), regarding the same.
Installing Visual Studio Code
We will also install another software, named visual studio code (short form vscode) to write the Python code. The installation process is very simple.
Step 1: Go to https://code.visualstudio.com and click on the download button (based on your operating system).
Step 2: Wait for the download to complete, and go through the installation wizard (just keep clicking on next, no need to change the default configuration).
Step 3: To confirm installation, check for Visual Studio Code installed in your applications on your system.
Writing our first program
Now, let’s write the famous "Hello, World" program. This simple program is a rite of passage for every new programmer.
- Open VSCode, click 'File' > 'Open Folder,' and choose an empty folder (or create a new one named "First Program").
- On the left panel, click the file+ icon to create a new file and name it main.py.
- In the file, type or copy the following code:
print("Hello World")
This program simply instructs the computer to display the text "Hello World" on the console. To run, first click on Ctrl + S (or Cmd + S for MacOS) and simply open the terminal from vscode through the terminal option in title bar. Once done, type the following command:
For Windows:
python main.py
For MacOS:
python3 main.py
The program should give an output like this.
Hello World
Congratulations! you just created your first python in Python. And with this, we can end this blog.
Homework Assignment: Customize your program
A little homework assignment for you all, try to change this program to print "Hello" and your name (like "Hello John Doe").
Looking Forward
For the next blog, we will dive deep in some terminologies related to Python programming (and programming in general) and create much more interesting programs.
Featured ones: