"""
Final Exam

Term: 2020 Summer
Course: STEM1402 PYTHON II-1

Ken

"""

"""
1.  (4)
Use lists when you need to create a list you might want to modify in the future.
For example, a list can be used to store all the return values of a function
in order to find their average using a list method.
Like this:
f
    

Use tuples when you need to create a list you won't need to modify,
like the days of the week.
(missing: ordered features)

2. 
Use a set in order to use set methods such as union and intersection
when all you need is no repetition and don't need it to be ordered.

Use a dictionary to store values according to keys. 
For example, storing the birthday of each of your friends using their name as
the key.


3. 
No, it is better to convert them to fixed point numbers or integers. 
Floating numbers are imprecise because they are made by converting binomial
numbers to decimal numbers. Many of them might not be exactly what you think, 
they might have an insignificant difference that however will be detected
by comparisons. Depending on how you got a value, what you believe to be 1
might not be equal to 1.


4. (4)
A lambda function is a function that can only have one expression. 
Contrarily to the body of a normal function which can have as many expressions
as desired, the lambda function takes in the arguments and the result of the
expression is returned.
(missing: anonymous, can be passed into a function as a parameter)

5. 
A multi-module program has multiple modules, which means that 
multiple .py files are used.

A multi-package program has multiple packages, which means that multiple
directories, which store modules, are used.


6. 
A recursive function is a function that calls itself.
The drawback of a recursive function is that depending on the program,
after a couple of iterations it might become very resource-demanding to run.


7. 
A magic number or magic value is one that is used only once and inexplicably. 
We should avoid writing them because it is easy to get confused by what it
means and why it is there.
To solve the issue of using it, use a variable to which it is assigned.


8. (3)
The quality of programs is affected by:
- its readability, following the style guide,
- its understandability, using comments,
- its conciseness, simple solutions to complex problems,
- its performance, is the program doing its job in an effective manner.


9. (3)
To make a software, you first need to find all that you need to do and
separate the software into different tasks.
Then, work on each task individually, writing comments on code that might
be confusing. 
When the software is done, you need to white box test it then black box test
it.


10. 
Following the official style guide will make the program easy to comprehend.
- Stay consistent, but change it using your own judgement.
- Following naming conventions.
- Using comme5nts when code is confusing.
- Make blank lines in your code when needed to separate different parts.
- Separate your program into different parts, like a library of variables, 
the defining of the functions, etc.
- In docstrings, make a brief description of the program. 

















"""