Title here
Summary here
Our first program will print the classic “hello world” message. Here’s the full source code.
if __name__ == "__main__":
print("hello world")To run the program, save the code in a hello_world.py file and use the python command.
$ python hello_world.py
hello worldSometimes we’ll want to create a standalone executable. While Python is an interpreted language, we can use tools like PyInstaller to package our scripts into executables.
First, install PyInstaller using pip:
$ pip install pyinstallerThen, package the script into an executable:
$ pyinstaller --onefile hello_world.py
$ ls dist/
hello_worldWe can then execute the built executable directly.
$ ./dist/hello_world
hello worldNow that we can run and build basic Python programs, let’s learn more about the language.