0% found this document useful (0 votes)
27 views2 pages

Data Types and Programming Constructs

The document consists of a homework assignment focused on data types and arithmetic in programming. It includes a crossword puzzle with clues related to programming concepts and a task to write Python code for calculating the total cost of bus tickets and the change to be returned. The assignment is worth a total of 15 marks.

Uploaded by

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

Data Types and Programming Constructs

The document consists of a homework assignment focused on data types and arithmetic in programming. It includes a crossword puzzle with clues related to programming concepts and a task to write Python code for calculating the total cost of bus tickets and the change to be returned. The assignment is worth a total of 15 marks.

Uploaded by

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

Homework 2: Data types and arithmetic​ ​

1.​ Complete the crossword using the clues below

​ ​ [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 £[Link] is £[Link] ​ [5]

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]

You might also like