how to compile and run python program in Linux
In this tutorial blog we will learn how to compile and run python program in Linux. Learning python programming on Linux terminal is a fun. Let us follow instructions as below.
Install python in Ubuntu
- Open Linux terminal and type “sudo apt-get install python” command. it will install python in your ubuntu machine.
- Open sample.py using vi editor.
- Write below python code and save it.
#!/usr/bin/python a = 2 b = 3 c = a + b print "Hello Foo sum of a nd b is" print c
- Make sample.py executable using command “chmod +x sample.py”
- Run using command “python sample.py” the output should be as below
Hello Foo sum of a nd b is 5