Welcome to Intro to Programming. If you are a student in the class, the first thing you need to do (and which we should have done in class) is set up your GitHub account.
Once you have a GitHub account, click “Log in to GitHub” below to proceed.
If you don’t have a GitHub account yet, please create one and then log in here for further instructions.
Congratulations! You have successfully connected this app to GitHub. However you are not yet a member of the GitHub organization for this class, something Mr. Seibel needs to set up for you.
This is your GitHub profile URL:
Click the clipboard icon to copy it and then submit it at this form so he can add you.
Congratulations! You have successfully connected this app to GitHub. And it looks like you have an invitation to join the GitHub organization for this class. You need to accept that invitation before you can proceed. The invite should be sent to whatever email you used when you created your GitHub account.
I see you are logged into GitHub and a member of the berkeley-high-cs GitHub organization. However there seems to have been some problem finishing the setup for your account. Please let Mr. Seibel know.
This is a tool for the Intro to Programming class at Berkeley High School. It is intended to provide a simple environment for experimenting with Javascript without all the complexities of a full development environment such as ReplIt or Glitch which we may use later in the year.
It is also designed to take advantage of the browser’s ability to run Javascript natively. It does not need access to a server to run code making in extremely responsive even if the Wifi is flaking out.
Finally, under the covers it is saving work to a GitHub repository in a very simplified workflow that does not depend on immediately learning any git commands. Code written in this environment for each assignment is saved to a directory and branch specific to that assignment each time it is saved. Thus when the assignment is done, it is easy to go to GitHub and create a PR containing just the work on that assignment which can then be commented on and worked on further before it is turned in and merged to main.
You're all set! You don't need to worry about this yet but we have successfully created a GitHub repository for your work:
You can get to it any time by clicking on your GitHub username at the top-right of the screen.
Compute the nth factorial number which is defined as the product of the integers from 0 to N, inclusive except that the 0th factorial is 1.
Compute the nth triangular number which is defined as the sum of the integers from 0 to N, inclusive.
Compute the nth element of the Fibonacci sequence, 0, 1, 1, 2, 3, 5, 8, etc. After the first two items, 0 and 1, each item in the sequence is the sum of the two previous items.
Compute the greatest common divisor (GCD) of A and B using the fact that the GCD of A and B, is A if B is 0 and otherwise is the GCD of B and A % B
Given an array of numbers, return the sum of the numbers.
Takes two arguments, an array, and a value and returns true if the value is in the array.
A function that takes a string argument and returns the string reversed.
["A function of two arguments, a tree and a function. Trees are made
up of objects with left
and
right
properties and leaf values that can be anything.
The function isLeaf
, which is already defined for you,
will tell you whether a given object is the leaf of a tree.","Return
a new tree with the same structure as the original but with each
leaf replaced with the result of calling the passed in function with
the old leaf value as an argument. For instance","treeMap({left: 10, right: 20}, (x) => x * 2)
","should return","{ left: 20, right: 40}
."]
["A function of two arguments, a number specifying an amount of
money in cents, and an array listing the value in cents of different
coins. For instance the amount might be 100
and the
coins [1, 5, 10, 25, 50]
representing the US coins up
to the half-dollar.","Returns the number of ways of making the given
amount using any number of the given kinds of coins. For instance,
for the amount 10
it should return
4
because we can make ten cents with either ten
pennies, five penies and a nickle, two nickles, or a dime. Note that
order doesn't matter so five penies and a nickle is the same as a
nickle and five pennies.","This is an extra challenging problem. If
you want a hint ask me; I have a few."]
For all the functions in this assignment I want you to write a
recursive function. For functions the recurse on arrays, you may
want to use the fact that xs.slice(1)
returns an array
consisting of all but the first element of xs
. E.g.
[2, 3, 5, 7, 11].slice(1)
evaluates to a new array
[3, 5, 7, 11]