How to start

The first Python program

The first program is one line. Name the file salam.py. Inside it write print("Hello"). That prints Hello on the screen.

Python has to be installed on the computer. Take it from python.org. After it is installed, open the terminal. Go to the folder where the file sits and write python salam.py.

If python is not found, the install did not add the path. Open the installer again and choose to add the path. You do not need another editor. One text file is enough.

  • On Windows the command can also be py salam.py.
  • The file must end in .py. A .txt file will not run.
  • The quote must be straight: "Hello". A curved quote counts as a mistake.
  • The second line can be name = "Nibras". Then print(name).
  • If an error comes out, read the last line. The line number is written there.
  • Do not open a big project. Stay with one file until it runs.

If the program writes nothing, there is no print. A Python file does not open a window by itself.

Related guides

About this tool

This page is designed for beginners taking their first steps in programming. It explains how to write and run your first code using a simple text file without opening any complex projects. The main goal is to show users how basic commands operate on a computer.

People need these basics when starting to write code for the first time. The guide covers installing the software, opening the terminal, running the script, and getting results. Following basic rules helps avoid mistakes and achieve success right away.

How to use it

  1. Install Python on the computer and ensure the path is added.
  2. Create a text file named salam.py and write print("Hello") inside.
  3. Open the terminal and navigate to the folder where the file sits.
  4. Run the program by typing python salam.py.

Common uses

Frequently asked questions

What should the file extension be?

The file must end in .py. A .txt file will not run, so ensure the proper extension is used.

What if Python is not found?

If python is not found, the install did not add the path. Open the installer again and choose to add the path.

Why does the program write nothing?

If the program writes nothing, there is no print command included in the file.