Executing Python codes on Linux Command Line

We have seen how to execute Python codes on Windows IDLE editor. This is a small post about executing python codes on Linux Operating System’s Terminal. We will be using the GNU Nano editor for this purpose.

  1. Type “Terminal” in the Search Box on the top left corner. Click on Terminal.screenshot-from-2018-04-09-09-53-25.png
  2. The terminal window appears .
  3. Type ‘nano (program name).py’ and press Enter.
  4. This takes you to the editor screen. Here is where you type your code.screenshot-from-2018-04-09-09-56-41-e1523248023267.png
  5. After the code is typed you can exit editor by pressing Ctrl+X.
  6. To execute your code, enter ‘python (program name).py’ and press Enter.
  7. The output will be displayed as “hello”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: