How to install Python on Windows

First, download Python:



Unless you use some sort of integrated development environment, you will end up typing Windows commands into what is variously referred to as a “DOS window” or “Command prompt window”. Usually you can create such a window from your Start menu; under Windows 7 the menu selection is Start ‣ Programs ‣ Accessories ‣ Command Prompt. You should be able to recognize when you have started such a window because you will see a Windows “command prompt”, which usually looks like this:


The letter may be different, and there might be other things after it, so you might just as easily see something like:


depending on how your computer has been set up and what else you have recently done with it. Once you have started such a window, you are well on the way to running Python programs.

You need to realize that your Python scripts have to be processed by another program called the Python interpreter. The interpreter reads your script, compiles it into bytecodes, and then executes the bytecodes to run your program. So, how do you arrange for the interpreter to handle your Python?

First, you need to make sure that your command window recognises the word “python” as an instruction to start the interpreter. If you have opened a command window, you should try entering the command python and hitting return.:

C:\Users\YourName> python


HelloYou have started the interpreter in “interactive mode”. That means you can enter Python statements or expressions interactively and have them executed or evaluated while you wait. This is one of Python’s strongest features. Check it by entering a few expressions of your choice and seeing the results:

>>> print ("Hello")
>>>print ("Hello" * 3)

Common Commands:
– Clear screen:
import os

Return the sum of a and b
Return the difference between a and b
Return the product of a and b
Return the result of dividing a and b
If a and b are integers, this result will be an integer, and represent the number of times
b fits into a
Return the value of a divided by b as a double (decimal)
Return the value of a raised to the b
Return the value of a raised to the b divided by c
a += b
Changes a to the value of a + b. This is equivalent to a = a + b
Return the ith item in a list named list1
Return the length (the number of items) of an object.
The argument may be a sequence (string, tuple or list) or a mapping (dictionary).

Common mathematical functions in Python from
Returns e**x.
math.log(x[, base])
With one argument, return the natural logarithm of x (to base e).
With two arguments, return the logarithm of x to the given base, calculated as
Analysis of Python Script Activity—Common Python Commands Sheet 2
Return the base-10 logarithm of x. This is usually more accurate than log(x, 10)
math.pow(x, y)
Return x raised to the power y. Exceptional cases follow Annex ‘F’ of the C99 standard as
far as possible. In particular, pow(1.0, x) and pow(x, 0.0) always return 1.0, even when x
is a zero or a NaN. If both x and y are finite, x is negative, and y is not an integer then
pow(x, y) is undefined, and raises ValueError.
Unlike the built-in ** operator, math.pow() converts both its arguments to type float.
Use ** or the built-in pow() function for computing exact integer powers.

Return the square root of x.
Return the arc cosine of x, in radians.
Return the arc sine of x, in radians.
Return the arc tangent of x, in radians.
math.atan2(y, x)
Return atan(y / x), in radians. The result is between -pi and pi. The vector in the plane
from the origin to point (x, y) makes this angle with the positive X axis. The point of
atan2() is that the signs of both inputs are known to it, so it can compute the correct
quadrant for the angle. For example, atan(1) and atan2(1, 1) are both pi/4, but atan2(-1,
-1) is -3*pi/4.
Return the cosine of x radians.
Return the sine of x radians.
Return the tangent of x radians.
The mathematical constant π = 3.141592…, to available precision.
The mathematical constant e = 2.718281…, to available precision.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s