Python is a relatively new language which is both great for beginning programmers and a language really used in the world today. The following are its key ingredients:
1. On Windows, Select Start |
Programs | Python2.4 | IDLE
2. In the window that appears, you should see the python prompt >>>.
This is asking you to enter python commands. Type in the following to see
what happens (don't type the >>>):
>>> print 'hello'.
>>> print 3*6
>>> print 3/6
>>> print 3.0/6.0
>>> print 2+4*2
>>> print 'abc'+'def'
>>> first='david'
>>> last='wolber'
>>> print first+' '+last
>>> x = 5
>>> print x*7
>>> print 'x'*7
>>> grades=['a','b','c']
>>> grades[1]
>>> grades[2]=44
>>> list
>>> grades[3]=55
You can also write a program in a file and run the whole thing at
once. Select File | New Window. Then just enter some
python commands in the window and save the file with a ".py" extension, e.g., hello.py.
1. Create a new file and enter the following statements:
print "hello"
print "world"
name = "jive"
print name
2. Save the file as 'hello.py' in a subdirectory 'pythonCode' of your h: directory.
Run the program by selecting Run | Run Module.
The following should print:
hello
world
jive.