Editing Community Data Science Course (Spring 2023)/Week 4 coding challenges

From CommunityData

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 11: Line 11:
First, let's work through a few examples from the [http://www.boredapi.com/ Bored API]. In order to answer these, you'll need access to the API activity endpoint (https://www.boredapi.com/api/activity) and the documentation at http://www.boredapi.com/. My strong advice is to start building your work off the code I did in class which is in the [https://github.com/kayleachampion/spr23_CDSW/blob/main/curriculum/week4/week4_lecture_part_1_bored_api.ipynb week 4 lecture part 1Jupyter notebook].
First, let's work through a few examples from the [http://www.boredapi.com/ Bored API]. In order to answer these, you'll need access to the API activity endpoint (https://www.boredapi.com/api/activity) and the documentation at http://www.boredapi.com/. My strong advice is to start building your work off the code I did in class which is in the [https://github.com/kayleachampion/spr23_CDSW/blob/main/curriculum/week4/week4_lecture_part_1_bored_api.ipynb week 4 lecture part 1Jupyter notebook].


# Write some Python code to use the API to get an activity that I could do with my partner. Turn the data from the API into a sentence that tells me the activity, its accessibility, and its price. (Note: this used to say "free activity"; we removed that because it's more boring that way.)
# Write some Python code to use the API to get a free activity that I could do with my partner. Turn the data from the API into a sentence that tells me the activity, its accessibility, and its price.
## Extend that code so that it gets me 5 activities and have it write a nicely formatted output.
## Extend that code so that it gets me 5 activities and have it write a nicely formatted output.
# First, get a totally random activity from the API. Print it out, along with its activity type. Now get me another activity that's of the same type as the first random activity. Print it out too, plus its activity type (to check that they're the same).
# First, get a totally random activity from the API. Print it out, along with its activity type. Now get me another activity that's of the same type as the first random activity. Print it out too, plus its activity type (to check that they're the same).
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see CommunityData:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)