1

I'm learning python so I may get my foot in the door for a programming career. I'm using the gedit text editor to write the code, however I don't know how to execute the code on ubuntu. If anyone is able to help, I would greatly appreciate as much help as I'm able to get.

Kaz Wolfe
  • 34,122
  • 21
  • 114
  • 172

1 Answers1

4

Open a terminal by pressing CtrlAltT. If you remember where you saved the Python code file (say as first.py in the Desktop folder), use the following command to run it:

python2 ~/Desktop/first.py

If you're using Python 3.X replace python2 with python3 in the above command. On Ubuntu, python2 and python are the same, but it's always good practice to explicitly specify which version you're using.

You can also simply run python2 or python3 to get to an interactive shell. Another option is to use IPython Notebooks.

muru
  • 197,895
  • 55
  • 485
  • 740