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.txtfile will not run. - The quote must be straight:
"Hello". A curved quote counts as a mistake. - The second line can be
name = "Nibras". Thenprint(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.