Functions: Exercise 1 - Submission: A4 - Ex1.py 20 Points
Functions: Exercise 1 - Submission: A4 - Ex1.py 20 Points
2023, 11:30 am
Functions
Solve the following exercises and upload your solutions to Moodle until the specified due date. Make
sure to use the exact filenames that are specified for each individual exercise. Unless explicitly stated
otherwise, you can assume correct user input and correct arguments. You are not allowed to use
any concepts and modules that have not yet been presented in the lecture.
1
Programming in Python I Assignment 4 – Due: 08.11.2023, 11:30 am
2
Programming in Python I Assignment 4 – Due: 08.11.2023, 11:30 am
Hints:
• Make sure to return the grade and not the percentage points.
• Check that your solution is able to handle None anywhere in the parameters.
3
Programming in Python I Assignment 4 – Due: 08.11.2023, 11:30 am
Table 4: Example function calls and results (results might differ slightly because of floating point
arithmetic.
Hints:
• As mentioned above, the rounded results might not be exactly precise due to floating point
arithmetic. For example, round_(777.777, 1) might result in 777.8 or 777.8000000000001
(or comparable numbers), depending on the implementation. Both results are fine.
• The module operator % might be useful to solve the task. For example, some_float % 1 will
return the fractional part of some floating point number, or some_float % 0.1 the fractional
part starting at the second decimal place. As mentioned above, the results obtained from the
module operation might not be precise because how floating point arithmetic works, which is
okay.
4
Programming in Python I Assignment 4 – Due: 08.11.2023, 11:30 am
Table 5: Example function calls and results, given some_list = [1, 3, 0, 4, 5].