- Create a Python Script: Write your Python code in a file and save it with .py extension. For example, you can create a file named hello_world.py and add the following code /* print(“Hello, World!”) */
- Open a Terminal: Open a terminal or command prompt on your computer.
- Navigate to the Script’s Directory: Navigate to python file directory using the cd command.
- Run the Python Script: Once you are in the correct directory, run the Python script using the python command followed by the script’s filename If you are using Python 3, you might need to use python3.
- View the Output: After running the script, you should see the output printed to the terminal or command prompt
Python File Format | .py Extension