4 Major Ways To Write And Execute Python Programs

Hello Pythonistas Welcome back!

Today we will explore 4 ways to execute python programs that you write…

Without further ado let’s get started.

IDLE in Interactive Mode

  • First, type IDLE in your Windows/mac search bar.
  • search results for idle
  • You’ll see this app popping up open it.
  • Python idle in interactive mode
  • Here, you can start typing your python code.

The thing with using IDLE this way to execute Python programs is that the code is executed line by line😑. For example, if you type 1+1 in IDLE and press enter it will immediately give 2 as output in the next line.

It’s good👍 and useful when you want to test some line of code or debug it but not👎 when you are creating an app, software, or machine learning algorithm.

Another problem is that you cannot save the code you have written here.🤯

Moving on to IDLE in script mode.

IDLE in Script Mode

The first two✌ steps are the same as the above one.

  • When the IDLE opens up you need to go to the File option on the top left corner.
  • And then you need to either select the
    • new file option(to create a new file) or
    • the open file option(to open an existing file).
  • Start typing code here.

The good🙂 thing about using the script mode is that you can save the files📃 and the code doesn’t execute line by line.

But here’s a problem❌ it doesn’t autocomplete your code by giving you suggestions💡 or providing any other features or facilities.

Sounds boring🥱?

To me too, so, let’s see what the last development environment has to offer.

Coding in Visual Studio Code – most preferred

This one is my personal favorite🤩.

Coding in code editors, as they provide numerous facilities to make your life as a programmer easier.

You’ll be able to appreciate them once you start programming.

You must be wondering🤔 why Visual Studio Code? If you want to that click here.

You can also use other code editors like pycharm or Thonny. (thonny is good for visualizing the code it’s useful for debugging.)

To be able to use it:

  • You first need to install it on your system.
  • Then open VS Code.
  • Go to extensions(the four squares, second last option on the left) and install the python extension.
  • Then, just create a folder, and then open that folder in VS Code.
  • Now click on the new file icon and type the new file’s name, for example, “first.py”.
  • ❗Make sure it ends with a “.py”.
vs code

That’s it now start typing your code and you can run it using the run button on the top left. And you are done.

Execute Python Programs on Android Devices

My personal favorite when it comes to coding on the Android system is the Pydroid app. I have been using it for quite a long and the workflow is satisfying.

I suggest you try out multiple options like Sololearn, QPython, Repl.it, and a lot more. Try and choose what you like the most.

None of them have sponsored me (I wish they did) in any way I am saying this from my personal experience.

Using any of these apps or online platforms is quite straightforward.

  • Just install/open them,
  • Start typing, and when you are done
  • Hit that run button.

And you are done.

This is the easiest👌 possible way. However, there are some limitations🤏 to using it on your Android device.

But you’ll not be facing any problems until you work with some library it doesn’t support.

Comment below suggestions if there and tell me whether you liked it or not.

See you in the next post till then have a great time.👋😊

Leave a Reply