Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 1.18 KB

File metadata and controls

42 lines (28 loc) · 1.18 KB

Open in GitHub Codespaces

Python Prep

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.

Exercise 1

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.

Exercise 2

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.

Exercise 3

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.

License

Released under the Apache License 2.0. See LICENSE file.