Presentation is loading. Please wait.

Presentation is loading. Please wait.

OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 4: Writing programs.

Similar presentations


Presentation on theme: "OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 4: Writing programs."— Presentation transcript:

1 OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 4: Writing programs

2 OCR Computing GCSE © Hodder Education 2013 Slide 2 Python 4: Writing programs You can write programs with any text editor such as Notepad. It is easier to use an Integrated Development Environment like IDLE.

3 OCR Computing GCSE © Hodder Education 2013 Slide 3 Python 4: Writing programs IDLE looks a bit like the command line but it has a menu at the top. The first thing to do is to choose File – New Window

4 OCR Computing GCSE © Hodder Education 2013 Slide 4 Python 4: Writing programs We then get a window where we can write a program. It is called Untitled until we save it. Here is the traditional Hello World program. We have saved it as hello.py. The py extension is so that the Python interpreter will know it is a Python program.

5 OCR Computing GCSE © Hodder Education 2013 Slide 5 Python 4: Writing programs We run the program with the Run Module command on the menu, or we can press F5. Here is the output in the Python shell. It is also possible to run the program straight from the operating system.

6 OCR Computing GCSE © Hodder Education 2013 Slide 6 Python 4: Writing programs We should always annotate code. Anything after the # symbol on a line is ignored by the interpreter, but it can be useful for humans.

7 OCR Computing GCSE © Hodder Education 2013 Slide 7 Python 4: Writing programs Escape sequences help us to format output. Here is the output: \t inserts a tab space. \n inserts a new line.


Download ppt "OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 4: Writing programs."

Similar presentations


Ads by Google