Tuesday, June 23, 2015

Python on the go

In Python, a simple “Hello, World!” program would look like this

 print 'Hello, World!'


In C, it will look like this














One can see how much simpler it is, to write certain programs in Python. 

What is in most programs are generally the same. They have the following:-


input: Input data from the keyboard, a file, or some other device. (eg. raw_input)
output: Display data on the screen or send data to a file or other device. (eg print)
math: Perform basic mathematical operations like addition and multiplication. (eg  +   -     *      /   and %)
conditional execution: Check for certain conditions and execute the appropriate code. (eg. if, elif, else)
repetition: Perform some action repeatedly. ( eg. for, while and  the process of recursion)





No comments:

Post a Comment