a.Consider the following two assignments: devices = ['phone', 'television', 'desktop computer'] devices[2] = 'laptop computer' Draw (or
Question:
a.Consider the following two assignments:
- devices = ['phone', 'television', 'desktop computer']
- devices[2] = 'laptop computer'
Draw (or describe) the objects and labels that the Python interpreter creates in response to the first assignment.
Then draw (or describe) the objects and labels that results from carrying out the second assignment immediately after the first assignment.
Include your drawings or text descriptions in the solution document.
b.Imagine that a tile manufacturer has commissioned you to solve the following problem. Given an order of tiles, compute the total weight of the tiles in that order (in grams).
The tile manufacturer receives orders that specify:
- the number of tiles that are required
- the surface dimensions (in cm) of the tiles in this order. For instance, the order may specify tiles with a surface of 10 cm by 20 cm. All tiles in an order have the same surface dimensions (and the tile depth or thickness is the same for all tiles and can be ignored).
Assume that a tile with a surface of 1 cm by 1 cm weighs 10 grams.
In answer to this question you will need to decompose the problem, write an algorithm, and implement the algorithm as a single python function that returns the total weight of the tiles given a specific order.
- i.Include your initial decomposition of the problem in your solution document.
- ii.Include the algorithm for solving the problem in your solution document.
iii.Provide a Python function that implements the algorithm. Follow the instructions above for submitting code.
Your answer must be a translation of your algorithm from part b (ii), otherwise no marks will be awarded.