Professional Documents
Culture Documents
Classroom Assessment 2: General Requirements
Classroom Assessment 2: General Requirements
Classroom Assessment 2: General Requirements
General requirements
You can work in any Python IDE (IDLE, PyCharm, Visual Studio Code, etc.)
Each of the two tasks has to be completed in a separate .py code file
Use functions to modularize your program whenever possible. In each task there has to be at
least two functions: input and process (exact names may differ depending on the task you are
given). To print out a list or a matrix, you can use the standard print function
Add protection against possible incorrect user input, so that the latter does not crash the
program
All solutions will be checked manually, therefore you have to provide informative messages
when interacting with the user, both when inputting data and when printing out results. E.g.
instead of printing just the value 10, output ’The sum of digits = 10’.
After completing the exercises, add them to a zip archive (only the two .py files) and upload
the archive to Canvas in the corresponding section
Topics
One-dimensional lists
Strings
1
Examples of tasks
1. Make a loop that requests strings from the user (the loop finishes when the user enters an
empty string). For each string, make a list of those of its letters that represent basic vowel
sounds of the English alphabet (a, e, i, o, u), and print it to the screen, e.g. ’hello’ → [’e’, ’o’]
2. Generate a random list of n integer numbers, each number should be in the range [a..b]. n,
a and b are requested from the user. Make a new list of numbers, which are symmetric (e.g.
131, 22, 919), i.e. read in the same way from left to right and from right to left.