As a prerequisite to CS 205, you need basic programming skills. This is critical, as we will not spend much time on learning programming in CS 205. Instead, we will focus on big ideas and using programming to accomplish those big ideas.
This activity is a refresher on your programming skills and a sort of "prerequisite test". While you can (and should!) use Google as a refresher, if you're not comfortable with the concepts you find on Google on how to get this done you will struggle when you have to apply this type of programming to real problems. This is more of a "prerequisite test" for you than for CS 205.
A new directory has been created on the release git repository,
which you should complete this assignment in. To merge this into
your repository, navigate to your workbook directory using a
command line and run the following
commands:
git fetch release
git merge release/activity0 master -m "merge"
Upon success, you will now have an activity0 directory in your workbook folder. Make sure you do all of your work for this assignment within this new directory.
For this assignment, create a new file in the activity0 directory in your workbook directory. You can call it anything you would like, though it must be inside of the activity0 directory to get graded.
Using any programming language you want (ideally the programming language you are most comfortable in), write a function that takes two arguments:
This function should return true
if the average of the numbers
in the list is greater than the number; otherwise, return false
.
In this assignment, you do not need to worry about edge cases, floating point precision issues, or anything beyond finding an average, comparing it, and returning the correct value. You can give the function any name.
If your function is named isAvgGreaterThan
, it should produce
the following results for the following function calls:
isAvgGreaterThan( [1, 2], 3 )
false
,
since the average of [1, 2] is 1.5, which is not greater than 3.
isAvgGreaterThan( [9.5, 10.5], 1 )
true
,
since the average of [9.5, 10.5] is 10, which is greater than 1.
isAvgGreaterThan( [1, 2, 3, 4, 5], 0 )
true
,
since the average of [1, 2, 3, 4, 5] is 3, which is greater than 0.
This activity is submitted digitally via git. View detailed submission instructions here.