Python Homework 2
Python Homework 2
[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
1
(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]