This set of exercises is to help review some of the basic Python skills required in our course.
There are three parts to this review assignment.
In exercise_1
, add up the numbers provided in the list S. This must be done
using a for-loop, and the sum should be returned by the function.
In exercise_2
, add up the numbers provided in the list S using at most two
lines of code. The sum should be returned by the function.
In exercise_3
, create a dictionary to store the values for the following list
of points when input to the function f(x,y) = 8x + 3y
. For example, if your
dictionary is called f
you should have an entry f[(0,0)] = 0
and an entry
f[(1,1)] = 11
, and so on. The dictionary should be returned by the function.
Points to include:
- (0, 0)
- (1, 1)
- (2, 2)
- (3, 3)
- (4, 4)
- (5, 5)
Hint: Consider using a for-loop to run through the list of points.
Released under the Apache License 2.0. See LICENSE file.