Python is a widely used general-purpose, high-level programming language.Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages such as C.The language provides constructs intended to enable clear programs on both a small and large scale.
# apt-get install python3
# vim ami.py (enter the python script)
print “Hello, World!\n”
:wq
for excecution
#python3 ami.py
Output
Hello ,world
Related Entry
Use a text editor such as vi, gedit or any other text editor. Create a program file called hello.py:
$ vi hello.py
Now type the following program:
#!/usr/bin/python # My first python program print "Hello, World!\n"
Save and close the file. Type the following command to set permission:
$ chmod +x hello.py
To run a program, enter:
$ ./hello.py
Python one liner
You can also execute python from the command line as shown below. This will print Hello World!.
$ python -c 'print "Hello World!"'
Python was conceived in the late 1980sand its implementation was started in December 1989 by Guido van Rossum
How to start creating webpage using python?
1. install cherrypy
#sudo apt-get install cherrypy3
2. save this as helloworld.py
Code:
import cherrypy class HelloWorld(object): def index(self): return "Hello World!" index.exposed = True cherrypy.quickstart(HelloWorld())
3. then run helloworld.py!
4.then go to http://localhost:8080
what programming language to learn first.
If you are going to college then you don’t need to worry too much about this question. The college will pretty much pick a language for you (e.g., some start with C,
some with Python, some with Java and soon).
If you are going to learn programming by yourself, at least initially, then you need to think twice before making your decision, because the language choice will certainly affect your progress, and if you pick the
wrong one you might lose motivation along the way.
After some days researching I decided that Python was the right choice for me. The reasons for going with Python as a first
language were:
Python is a very high level language, which means it comes with a lot of functions and
abstractions out of the box. This means you can spend more time thinking about programming logic and algorithms, and less time thinking about correct syntax.
Python is a general-purpose language, which means you can use it to create virtually any type of program or software, from web scripts to games. This means you
should be able to use it to code projects you are actually interested in.
Python is an interpreted language, which means you won’t need to waste time learning how to compile code. You simply
downloaded an integrated development environment (IDE), write your code and press “Run.”
There is a huge amount of programming books, videos and courses online that use Python as their language choice.
Python is used in the real world as well. Some very large companies like Google and Facebook use it on my parts of their platforms and products. looking back I still think that starting with Python was a smart choice. It’s like learning to drive first (i.e., coding in Python)
and only then taking a look at the engine under the hood to understand how the machine actually works (i.e., coding in C or
even Assembly if you want to get close to the iron).
I don’t think Python is the absolute best language to learn first, though. It depends on your goals. If you are planning to make a living writing code (either for you or for someone else) then I believe starting with Python is a great idea. After you know the
basics of programming logic and algorithms you can start using lower level languages like C, and after that you can start using
Object Oriented ones like C++ or Java (technically Python also offers object orientation, but I wouldn’t play with that if you are just getting started).
If you have a narrower plan, you probably should start with a language more specific to the problems you want to solve.
Related Topic :
https://amitlyblog.wordpress.com/2014/08/07/installing-django-on-ubuntu-12-04/