Skip to content

Commit 08ae172

Browse files
committed
Initial course creation commit DataCamp
0 parents  commit 08ae172

File tree

6 files changed

+244
-0
lines changed

6 files changed

+244
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_STORE
2+
.cache
3+
.ipynb_checkpoints
4+
.spyderproject

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# DataCamp Template Course
2+
<a href=https://www.datacamp.com/teach/repositories/59983274/go target="_blank"><img src="https://s3.amazonaws.com/assets.datacamp.com/img/github/content-engineering-repos/course_button.png" width="150"></a>
3+
<a href=http://localhost:3001/teach/repositories target="_blank"><img src="https://s3.amazonaws.com/assets.datacamp.com/img/github/content-engineering-repos/dashboard_button.png" width="150"></a>
4+
5+
This an automatically generated <a href=https://www.datacamp.com target="_blank">DataCamp</a> course. Use it as a reference to create your own interactive course.
6+
7+
Changes you make to this GitHub repository are automatically reflected in the linked DataCamp course. This means that you can enjoy all the advantages of version control, collaboration, issue handling ... of GitHub.
8+
9+
## Workflow
10+
11+
1. Edit the markdown and yml files in this repository. You can use GitHub's online editor or use <a href=https://git-scm.com/ target="_blank">git</a> locally and push your changes.
12+
2. Check out your build attempts on the <a href=http://localhost:3001/teach/repositories target="_blank">Teach Dashboard</a>.
13+
3. Check out your automatically updated <a href=https://www.datacamp.com/teach/repositories/59983274/go target="_blank">course on DataCamp</a>
14+
15+
## Getting Started
16+
17+
A DataCamp course consists of two types of files:
18+
19+
- `course.yml`, a <a href=http://docs.ansible.com/ansible/YAMLSyntax.html target="_blank">YAML-formatted file</a> that's prepopulated with some general course information.
20+
- `chapterX.md`, a markdown file with:
21+
- a YAML header containing chapter information.
22+
- markdown chunks representing DataCamp Exercises.
23+
24+
To learn more about the structure of a DataCamp course, check out the <a href=http://localhost:3001/teach/documentation#tab_course_structure target="_blank">documentation</a>.
25+
26+
Every DataCamp exercise consists of different parts, read up about them <a href=http://localhost:3001/teach/documentation#tab_code_exercises target="_blank">here</a>. A very important part about DataCamp exercises is to provide automated personalized feedback to students. In R, these so-called Submission Correctness Tests (SCTs) are written with the <a href=https://github.com/datacamp/testwhat target="_blank">`testwhat`</a> package. SCTs for Python exercises are coded up with <a href=https://github.com/datacamp/pythonwhat target="_blank">`pythonwhat`</a>. Check out the GitHub repositories' wiki pages for more information and examples.
27+
28+
## Want to learn more?
29+
- Check out the <a href=http://localhost:3001/teach/documentation target="_blank">DataCamp Teach documentation</a>.
30+
- Check out DataCamp's blog posts:
31+
- <a href=https://www.datacamp.com/community/blog/create-your-own-r-tutorials-with-github-datacamp target="_blank">Create a course with DataCamp Teach</a>
32+
- <a href=https://www.datacamp.com/community/blog/create-your-own-r-tutorials-with-github-datacamp target="_blank">Interpreting DataCamp Teach's build attempts</a>.
33+
34+
*Happy teaching!*

chapter1.md

+198
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
---
2+
title : Insert the chapter title here
3+
description : Insert the chapter description here
4+
attachments :
5+
slides_link : https://s3.amazonaws.com/assets.datacamp.com/course/teach/slides_example.pdf
6+
7+
--- type:VideoExercise lang:python xp:50 skills:1
8+
## Analyze movie ratings
9+
10+
*** =video_link
11+
//player.vimeo.com/video/154783078
12+
13+
--- type:MultipleChoiceExercise lang:python xp:50 skills:1
14+
## A really bad movie
15+
16+
Have a look at the plot that showed up in the viewer to the right. Which type of movies have the worst rating assigned to them?
17+
18+
*** =instructions
19+
- Long movies, clearly
20+
- Short movies, clearly
21+
- Long movies, but the correlation seems weak
22+
- Short movies, but the correlation seems weak
23+
24+
*** =hint
25+
Have a look at the plot. Do you see a trend in the dots?
26+
27+
*** =pre_exercise_code
28+
```{r}
29+
# The pre exercise code runs code to initialize the user's workspace. You can use it for several things:
30+
31+
# 1. Pre-load packages, so that users don't have to do this manually.
32+
import pandas as pd
33+
import matplotlib.pyplot as plt
34+
35+
# 2. Preload a dataset. The code below will read the csv that is stored at the URL's location.
36+
# The movies variable will be available in the user's console.
37+
movies = pd.read_csv("http://s3.amazonaws.com/assets.datacamp.com/course/introduction_to_r/movies.csv")
38+
39+
# 3. Create a plot in the viewer, that students can check out while reading the exercise
40+
plt.scatter(movies.runtime, movies.rating)
41+
plt.show()
42+
```
43+
44+
*** =sct
45+
```{r}
46+
# The sct section defines the Submission Correctness Tests (SCTs) used to
47+
# evaluate the student's response. All functions used here are defined in the
48+
# pythonwhat Python package
49+
50+
msg_bad = "That is not correct!"
51+
msg_success = "Exactly! The correlation is very weak though."
52+
53+
# Use test_mc() to grade multiple choice exercises.
54+
# Pass the correct option (Action, option 2 in the instructions) to correct.
55+
# Pass the feedback messages, both positive and negative, to feedback_msgs in the appropriate order.
56+
test_mc(4, [msg_bad, msg_bad, msg_bad, msg_success])
57+
```
58+
59+
--- type:MultipleChoiceExercise lang:python xp:50 skills:1
60+
## A really bad movie
61+
62+
Have a look at the plot that showed up in the viewer to the right. Which type of movies have the worst rating assigned to them?
63+
64+
*** =instructions
65+
- Long movies, clearly
66+
- Short movies, clearly
67+
- Long movies, but the correlation seems weak
68+
- Short movies, but the correlation seems weak
69+
70+
*** =hint
71+
Have a look at the plot. Do you see a trend in the dots?
72+
73+
*** =pre_exercise_code
74+
```{python}
75+
# The pre exercise code runs code to initialize the user's workspace. You can use it for several things:
76+
77+
# 1. Pre-load packages, so that users don't have to do this manually.
78+
import pandas as pd
79+
import matplotlib.pyplot as plt
80+
81+
# 2. Preload a dataset. The code below will read the csv that is stored at the URL's location.
82+
# The movies variable will be available in the user's console.
83+
movies = pd.read_csv("http://s3.amazonaws.com/assets.datacamp.com/course/introduction_to_r/movies.csv")
84+
85+
# 3. Create a plot in the viewer, that students can check out while reading the exercise
86+
plt.scatter(movies.runtime, movies.rating)
87+
plt.show()
88+
```
89+
90+
*** =sct
91+
```{python}
92+
# The sct section defines the Submission Correctness Tests (SCTs) used to
93+
# evaluate the student's response. All functions used here are defined in the
94+
# pythonwhat Python package
95+
96+
msg_bad = "That is not correct!"
97+
msg_success = "Exactly! The correlation is very weak though."
98+
99+
# Use test_mc() to grade multiple choice exercises.
100+
# Pass the correct option (option 4 in the instructions) to correct.
101+
# Pass the feedback messages, both positive and negative, to feedback_msgs in the appropriate order.
102+
test_mc(4, [msg_bad, msg_bad, msg_bad, msg_success])
103+
```
104+
105+
--- type:NormalExercise lang:python xp:100 skills:1
106+
## Plot the movies yourself
107+
108+
Do you remember the plot of the last exercise? Let's make an even cooler plot!
109+
110+
A dataset of movies, `movies`, is available in the workspace.
111+
112+
*** =instructions
113+
- The first function, `np.unique()`, uses the `unique()` function of the `numpy` package to get integer values for the movie genres. You don't have to change this code, just have a look!
114+
- Import `pyplot` in the `matplotlib` package. Set an alias for this import: `plt`.
115+
- Use `plt.scatter()` to plot `movies.runtime` onto the x-axis, `movies.rating` onto the y-axis and use `ints` for the color of the dots. You should use the first and second positional argument, and the `c` keyword.
116+
- Show the plot using `plt.show()`.
117+
118+
*** =hint
119+
- You don't have to program anything for the first instruction, just take a look at the first line of code.
120+
- Use `import ___ as ___` to import `matplotlib.pyplot` as `plt`.
121+
- Use `plt.scatter(___, ___, c = ___)` for the third instruction.
122+
- You'll always have to type in `plt.show()` to show the plot you created.
123+
124+
*** =pre_exercise_code
125+
```{python}
126+
# The pre exercise code runs code to initialize the user's workspace. You can use it for several things:
127+
128+
# 1. Preload a dataset. The code below will read the csv that is stored at the URL's location.
129+
# The movies variable will be available in the user's console.
130+
import pandas as pd
131+
movies = pd.read_csv("http://s3.amazonaws.com/assets.datacamp.com/course/introduction_to_r/movies.csv")
132+
133+
# 2. Preload a package
134+
import numpy as np
135+
```
136+
137+
*** =sample_code
138+
```{python}
139+
# Get integer values for genres
140+
_, ints = np.unique(movies.genre, return_inverse = True)
141+
142+
# Import matplotlib.pyplot
143+
144+
145+
# Make a scatter plot: runtime on x-axis, rating on y-axis and set c to ints
146+
147+
148+
# Show the plot
149+
150+
```
151+
152+
*** =solution
153+
```{python}
154+
# Get integer values for genres
155+
_, ints = np.unique(movies.genre, return_inverse = True)
156+
157+
# Import matplotlib.pyplot
158+
import matplotlib.pyplot as plt
159+
160+
# Make a scatter plot: runtime on x-axis, rating on y-axis and set c to ints
161+
plt.scatter(movies.runtime, movies.rating, c=ints)
162+
163+
# Show the plot
164+
plt.show()
165+
```
166+
167+
*** =sct
168+
```{python}
169+
# The sct section defines the Submission Correctness Tests (SCTs) used to
170+
# evaluate the student's response. All functions used here are defined in the
171+
# pythonwhat Python package. Documentation can also be found at github.com/datacamp/pythonwhat/wiki
172+
173+
# Check if the student changed the np.unique() call
174+
# If it's not called, we know the student removed the call.
175+
# If it's called incorrectly, we know the student changed the call.
176+
test_function("numpy.unique",
177+
not_called_msg = "Don't remove the call of `np.unique` to define `ints`.",
178+
incorrect_msg = "Don't change the call of `np.unique` to define `ints`.")
179+
# Check if the student removed the ints object
180+
test_object("ints",
181+
undefined_msg = "Don't remove the definition of the predefined `ints` object.",
182+
incorrect_msg = "Don't change the definition of the predefined `ints` object.")
183+
184+
# Check if the student imported matplotlib.pyplot like the solution
185+
# Let automatic feedback message generation handle the feedback messages
186+
test_import("matplotlib.pyplot", same_as = True)
187+
188+
# Check whether the student used the scatter() function correctly
189+
# If it's used, but incorrectly, tell them to check the instructions again
190+
test_function("matplotlib.pyplot.scatter",
191+
incorrect_msg = "You didn't use `plt.scatter()` correctly, have another look at the instructions.")
192+
193+
# Check if the student called the show() function
194+
# Let automatic feedback message generation handle all feedback messages
195+
test_function("matplotlib.pyplot.show")
196+
197+
success_msg("Great work!")
198+
```

course.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
title : Template Python DataCamp Course
2+
author_field : kunalj101
3+
description : This is an automatically generated demo course which will help you on your way to create an awesome DataCamp course.
4+
author_bio : kunalj101 is an awesome DataCamp course creator.<br>You can tell something about yourself <strong>here</strong>.
5+
university : DataCamp
6+
difficulty_level : 2
7+
time_needed : 1 hour
8+
programming_language : python

img/author_image.png

8.66 KB
Loading

img/shield_image.png

164 KB
Loading

0 commit comments

Comments
 (0)