How to Develop simple Python code and execute in MacOS?

How to Develop simple Python code and execute in MacOS?

To execute Python code, Python should be installed.

1. Install Python in MacOS. Use https://www.infallibletechie.com/2023/03/how-to-install-python-in-macos.html for steps and installation guide. To execute Python code, Python should be installed.

2. Create a file with the following code. The extension of the file should be .py. We can use any Text Editor. Please don’t save the file with the extension txt. The extension of the file should be .py.

Sample Code:

print( 'Hello' );
print( 'Welcome to InfallibleTechie Videos' );

3. Use the command “python3 Filename.py” to run the Python code.

Leave a Reply