Monday, May 13, 2013

Python - Part 1

Install Python and run the Python Shell.

The command line offers the functionality that you can directly input the arithmetic calculations and string inputs. For example, type "3<4" and get the "True" results.
Another example, type
>>> three = str('3')
The results will be '3' if you type three

There are also other special arithmetic calculations apart from normal add, subtract, multiplication, and division such as // (integer division), not (as opposed to), and (both statement has to be in order to get "True"), or (either one of the statement is true to make the result "True"), etc.

Now consider
>>> num = int(input('give me a number'))
if you input number like 500, the num can be compared as a number.
>>> num2 = 400
>>> num > num2
True


No comments:

Post a Comment