Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
104 views

Python Homework 2

Uploaded by

klarnissa15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views

Python Homework 2

Uploaded by

klarnissa15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Homework 2 Data types and arithmetic

Introduction to Python

Homework 2: Data types and arithmetic


1. Complete the crossword using the clues below
1

1 2 2

2 1

3
3
1

4 5 6
4 6

[10]
Across
3. This data type can hold any type of data, eg 0123abCD~@
4. These is used to store temporary data to be used within the program
7. This will help the programmer understand what’s going on in the program
8. A data type used to hold whole numbers
9. Useful code built into the programming language so you don't have to write it yourself

Down
1. A term for one program instruction followed by another
2. A data type for decimal numbers
3. There are three types of programming constructs; this one asks a question and
depending on the answer, the program takes one of two courses of action
5. Up or down, depends on what the next digit in the number is
6. A term used to to mean “find errors in the program code”

2. Write Python code to allow a user to enter the number of bus tickets required. The user
is then asked to enter the price of a bus ticket. Calculate and print the total cost. Ask the
user to enter the amount of money offered, calculate and print the change, in the format

Change from £nn.nn is £mm.nn [5]

(Don’t worry if the amount is printed as, for example, £4.8 instead of £4.80. Formatting
output requires further programming!)

[Total 15 marks]

You might also like