Raspberry_Pi_Education_Manual

Notes:

To make this program run, you can select “ Run Module ” from the editor’s Debug menu or simply press F5 and it will ask you to save before you can run. Press “ OK ” and then give your first program a name – we will call it “Factors.py”.

Note:  It is important to include the “.py” part of this name, so that Python can easily recognise this as a program it can interpret.

After you press “ Save ”, the program will run and you will see a lot of numbers display in the python shell. This is the result of your program, showing all the calculated factors.

>>> ============= RESTART ================ >>> 1 : 1

2 : 1 2 3 : 1 3 4 : 1 2 4 5 : 1 5 6 : 1 2 3 6 7 : 1 7 8 : 1 2 4 8 9 : 1 3 9

These are your factors for the first nine whole numbers.

The window on the right show the output of the Python code on the left.

Experiments in Python

81

Made with FlippingBook flipbook maker