Description
The goal of this assignment is to learn and practice (via programming) the concepts that we
have learned so far: numbers, algebraic expressions, boolean expressions, strings, operations
on strings, type conversion, variables, use of Python’s builtin functions including input and
output functions, designing your own functions, documenting your own functions via
docstrings, and testing your functions. Before you can start this assignment, you need to know
how to use a (IDLE’s) text editor to edit python modules (i.e. files) as well as how to use
python shell interactively to test your code. If you have no idea how to do these things
watching video of the 2nd and 3rd lecture, for example, will help. Submit your assignment by
the deadline via Brightspace (as instructed and practiced in the first lab.) You can make
multiple submissions, but only the last submission before the deadline will be graded. What
needs to be submitted is explained next.
IMPORTANT NOTE for this and future assignments:
Your grade will partially be determined by automatic (unit) tests that will test your functions.
All the specified requirements below are mandatory (including function names, and the
behaviour implied by examples in Section 2). Any requirement that is specified and not met
may/will result in deduction of points. Your 3 tests will be graded in similar way.
The assignment has 13 programming questions (in Section 1 below). Each question asks you to
design one function. Put all these functions (for all the questions below) in ONE file only,
called a1_xxxxxx.py (where xxxxxx is replaced with your student number). Within this file,
a1_xxxxxx.py, separate your answers (i.e. code) to each question with a comment that looks
like this:
###################################################################
# Question X
###################################################################
To have an idea on what this file a1_xxxxxx.py should look like, I included with this
assignment a solution to an nonexistent assignment. You can view this mockup solution by
opening the included file called a1_mockup_assignment_solution.py
In addition to a1_xxxxxx.py you must submit two more files called a1_xxxxxx.txt and
declaration-YOUR-FULL-NAME.txt What should be in those files is explained below. Put all
these three required documents into a folder called a1_xxxxxx where you changed xxxxxx to
your student number, zip that folder (do not use rar compression format) and submit it as
explained in Lab 1. Submit that compressed folder by the deadline via Brightspace.
About declaration-YOUR-FULL-NAME.txt file:
It needs to be a plane text file and it must contain references to any code you used that you
did not write yourself, including any code you got from a friend, internet, social media/
forums (including Stack Overflow and discord) or any other source or person. The only
exclusion from that rule is the code that we did in class or as part of the lab work and code
from official python.org documentation. So here is what needs to be written in that file. In
every question where you used code from somebody else, you must write:
1. question number
2. copy-pasted parts of the code that were written by somebody else. That includes the code
you found/were-given that you then slightly modified.
3. whose code it is: name of a person or place on internet/book where you found it.
While you may not get points for that part of the question, you will not be in position of
being accused of plagiarism.
You have an option not to include this file, however not including declaration-YOUR-FULLNAME.txt will be taken as you declaring that all the code in the assignment was written by
you. Any student caught in plagiarism will receive zero for the whole assignment and will be
reported to the dean. Finally showing/giving any part of your assignment code to a friend also
constitute plagiarism and the same penalties will apply.
Your program must run without syntax errors. In particular, when grading your assignment, TAs
will first open your file a1_xxxxxx.py with IDLE and press Run Module. If pressing Run Module
causes any syntax error, the grade for the whole assignment will be zero.
Furthermore, for each of the functions below, I have provided one or two tests to test your
functions with. For example, you should test question 1 by making function call f_to_k(90)
in the Python shell. To obtain a partial mark your function may not necessarily give the
correct answer on these tests. But if your function gives any kind of python error when run on
the tests provided below, that question will be marked with zero points.
After reading each of these questions once, go to the Section 2: “Testing your code” below
and see what the output of your function should give. In that section, you can find a couple of
function calls and the required results for each question. Studying these example function
calls will help you a lot to understand what each individual question requires, or rather what
its function should do.
To determine your grade, your functions will be tested both with examples provided in
Section 2: “Testin