3/2/2021 Instructions | Assignment Module 4 | CS 116 Courseware | UW Online
A new course announcement has been posted. Click here to view the new announcement.
The site will be unavailable Mar 2, 2021 from 6:30 AM ET – 7:00 AM ET (Waterloo time) for scheduled maintenance.
Course Module 4: Lists Assignment Modul… Instructions
Instructions
Due date: Wednesday March 3rd, 2021 at 10:00am ET
This assignment covers everything up to and including Module 4.
Submission
All solutions must be submitted to MarkUs. No solutions will be accepted through email, even if you are having issues with MarkUs. If you are having issues with MarkUs, contact your instructor and/or MarkUs. Using MarkUs and your basic test results, verify that your les were properly submitted and are readable on MarkUs.
Style Guide
For full style marks, your program must follow the Style Guide.
https://online.cs.uwaterloo.ca/courses/course-v1:UW+CS116+2021_01/courseware/42d9be21ec8244f5a2a251ea657d69e5/9683588d0b2849079f8bfdb1f7f16768/1?activate_block_id=block-v1%3AUW… 1/3
3/2/2021 Instructions | Assignment Module 4 | CS 116 Courseware | UW Online
Natural numbers in this course begin at 0.
Required functions need all design recipe elements. Functions you de ne (e.g., helper functions) need all design recipe elements except for examples and tests.
Testing
Testing must be done using the check module.
When a function produces a oating point value, you must use check.within for your testing. Unless
told otherwise, use a tolerance of in your tests.
Test data for all questions will always meet the stated assumptions for consumed values.
Restrictions
Do not import any modules other than math and check. You are always allowed to de ne your own helper/wrapper functions, as long as they meet the assignment restrictions. Do not use Python constructs from later modules (e.g., dictionaries, loops (for or while or others), zip, functions with default parameters, sorted, anything with set or enumerators, ord, chr, try and except).
Do not mutate passed parameters unless otherwise told to.
Use only the functions and methods as follows: abs, len, max, min, sum and range
Any method or constant in the math module
Any basic arithmetic or comparison operations (+, -, *, /, //, %, **, <, <=, ==, != >, >=) Any basic logical operators (not, and, or)
These typecasting operators: int(), str(), float(), bool(), list(), and type()
if statements
https://online.cs.uwaterloo.ca/courses/course-v1:UW+CS116+2021_01/courseware/42d9be21ec8244f5a2a251ea657d69e5/9683588d0b2849079f8bfdb1f7f16768/1?activate_block_id=block-v1%3AUW… 2/3
10000.0
3/2/2021 Instructions | Assignment Module 4 | CS 116 Courseware | UW Online
String or list slicing and indexing as well as string or list operations using the operators above Any string or list methods (see additional notes below) and the in operator
input and print as well as the formatting parameter end and method format. Note that all prompts must match exactly in order to obtain marks so ensure that you do not alter these prompts.
Recursion
Abstract List Functions map and filter and the keyword lambda
Read each question carefully for additional restrictions.
Additional Notes
While you may use global constants in your solutions, do not use global variables for anything other than testing.
The solutions you submit must be entirely your own work. Do not look up either full or partial solutions on the Internet or in printed sources.
String methods include: (‘capitalize’, ‘casefold’, ‘center’, ‘count’, ‘encode’, ‘endswith’, ‘expandtabs’, ‘find’, ‘format’, ‘format_map’, ‘index’, ‘isalnum’, ‘isalpha’, ‘isdecimal’, ‘isdigit’, ‘isidentifier’, ‘islower’, ‘isnumeric’, ‘isprintable’, ‘isspace’, ‘istitle’, ‘isupper’, ‘join’, ‘ljust’, ‘lower’, ‘lstrip’, ‘maketrans’, ‘partition’, ‘replace’, ‘rfind’, ‘rindex’, ‘rjust’, ‘rpartition’, ‘rsplit’, ‘rstrip’, ‘split’, ‘splitlines’, ‘startswith’, ‘strip’, ‘swapcase’, ‘title’, ‘translate’, ‘upper’, ‘zfill’)
List methods include: (‘append’, ‘clear’, ‘copy’, ‘count’, ‘extend’, ‘index’, ‘insert’, ‘pop’, ‘remove’, ‘reverse’, ‘sort’)
https://online.cs.uwaterloo.ca/courses/course-v1:UW+CS116+2021_01/courseware/42d9be21ec8244f5a2a251ea657d69e5/9683588d0b2849079f8bfdb1f7f16768/1?activate_block_id=block-v1%3AUW… 3/3