-
More Data Structures
-
Programming On A Machine
-
Files
-
Exercises
The Python program
In the browser, to run code we type it into the input box and press the Run Code
button
To run the same code on a machine, we first create a file with a name that ends in .py
.
For example, hello.py
.
Then we open the file and type in the code that we normally type into the text box.
print("hello")
Then we save this file.
In the terminal, we then type the following:
python3 hello.py
It should print out hello
to the terminal.
In this case python3
is the Python program not the language. It is able to read a file of code and convert it into instructions the computer can understand.
Then it makes the computer execute those instructions.
The results of a program and any print statements appear in the terminal.