Skip to main content

Cambridge IGCSE & O Level Computer Science Programming Book for Python Sample

Page 25

We are working with Cambridge Assessment International Education towards endorsement of this title. Any references or material related to answers, grades, papers or examinations are based on the opinion of the author(s). 1  Python 3

SUMMARY Python 3 is a loosely typed programming language that is designed to encourage easily read code. Python 3 comes with a simple Integrated Development Environment called IDLE. There are many other IDEs available, such as Thonny and Wing IDE 101, both of which are specifically designed for students.

LE

There are three main styles of programming in Python 3: •

interactive mode: quick tests and trials that can be programmed in the Python shell

script mode: text-based scripts that can be saved so that your applications can be reused

GUI applications: full, visually rich applications that can be produced in script mode.

As well as the basic programming commands available in Python, there is a large library of specialist modules that come with Python and can be imported into your programs such as the turtle and tkinter modules.

END-OF-CHAPTER TASKS

P

1 In your preferred IDE, write a text-based program that asks users to input their age and then their name. Your program should then output a phrase similar to: ‘Hi Vipul. You are 16.’

M

2 Write a turtle program that draws the house shown here:

TIP Don’t forget the main turtle commands are all listed in Appendix 1 at the end of the book.

S

A

3 Write a turtle program that draws a regular pentagon with sides of length 100 pixels.

13 Original material © Cambridge University Press 2021. This material is not final and is subject to further changes prior to publication.


Turn static files into dynamic content formats.

Create a flipbook
Cambridge IGCSE & O Level Computer Science Programming Book for Python Sample by Cambridge International Education - Issuu