vgoliber / python-prep

Practice your Python skills with this review exercise.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python Prep

This set of exercises is to help review some of the basic Python skills required in our course.

To run your program at the command line, type:

python pythonprep.py

If you're running in the Leap IDE simply click the green triangle in the top right.

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.

About

Practice your Python skills with this review exercise.

License:Apache License 2.0


Languages

Language:Python 100.0%