diff --git a/lecture1/lecture.ipynb b/lecture1/lecture.ipynb
index 6d7bbab..ec98800 100644
--- a/lecture1/lecture.ipynb
+++ b/lecture1/lecture.ipynb
@@ -3,9 +3,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"from lecture import *"
@@ -110,7 +108,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "fragment"
}
@@ -183,7 +180,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "subslide"
}
@@ -233,7 +229,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "fragment"
}
@@ -276,7 +271,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "fragment"
}
@@ -335,9 +329,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"grade = ok.grade('question-1_2')"
@@ -361,7 +353,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "fragment"
}
@@ -397,7 +388,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "fragment"
}
@@ -446,13 +436,13 @@
"# import pi from Python's math library\n",
"from math import pi\n",
"\n",
- "density = 1.2 # units of kg m^{−3}$\n",
- "ball_radius = 0.11 # m\n",
- "A = pi*ball_radius # Cross sectional area of a sphere\n",
- "mass = 0.43 # kg\n",
- "C_D = 0.2 # Drag coefficient\n",
+ "density = 1.2 # units of kg m^{−3}$\n",
+ "ball_radius = 0.11 # m\n",
+ "A = pi*ball_radius**2 # Cross sectional area of a sphere\n",
+ "mass = 0.43 # kg\n",
+ "C_D = 0.2 # Drag coefficient\n",
"\n",
- "V = 50.8 # m/s (fastest recorded speed of football)\n",
+ "V = 50.8 # m/s (fastest recorded speed of football)\n",
"\n",
"# Uncomment and complete the following code.\n",
"# F_d = \n",
@@ -465,9 +455,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"grade = ok.grade('question-1_3')"
@@ -530,9 +518,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"grade = ok.grade('question-1_4')"
@@ -558,7 +544,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "fragment"
}
@@ -585,7 +570,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "fragment"
}
@@ -612,7 +596,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "fragment"
}
@@ -639,7 +622,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"slideshow": {
"slide_type": "fragment"
}
@@ -687,9 +669,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"grade = ok.grade('question-1_5')"
@@ -734,9 +714,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"grade = ok.grade('question-1_6')"
@@ -808,9 +786,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"print(\"Ball height: %g meters.\"%ball_height(5, 0.6))"
@@ -828,9 +804,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Function to compute height of ball.\n",
@@ -899,9 +873,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"def somefunc(arg1, arg2, kwarg1=True, kwarg2=0):\n",
@@ -913,9 +885,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"somefunc(\"Hello\", [1,2], kwarg1=\"Hi\")"
@@ -924,9 +894,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"somefunc(\"Hello\", [1,2], kwarg2=\"Hi\")"
@@ -935,9 +903,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"somefunc(\"Hello\", [1,2], kwarg2=\"Hi\", kwarg1=6)"
@@ -953,9 +919,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"somefunc(kwarg2=\"Hello\", arg1=\"Hi\", kwarg1=6, arg2=[2])"
@@ -988,9 +952,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"ok.grade('question-1_7')"
@@ -1000,7 +962,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Exercice 1.8: How to cook the perfect egg\n",
+ "## Exercice 1.8 (\\*\\*\\*): How to cook the perfect egg\n",
"\n",
"You just started University and moved away from home. You're trying to impress your new flatmates by cooking brunch. Write a python script to help you cook the perfect eggs! \n",
"\n",
@@ -1019,9 +981,11 @@
"* $Tw$ temperature of the boiling water (in C degrees) \n",
"* $T0$ is the initial temeprature of the egg (in C degrees), before being put in the water.\n",
"\n",
- "Write a function that returns the time `t` needed for the egg to cook, knowing that `Tw` = 100$^\\circ$ C, `M` = 50 g, `rho` = 1.038 gcm$^{−3}$, `c` = 3.7 Jg$^{−1}$K$^{−1}$, and `K` = 5.4 · 10$^{−3}$Wcm$^{−1}$K$^{−1}$. Find `t` for an egg taken from the fridge (`T0` = 4 C) and for one at room temperature (`T0` = 20 C). \n",
+ "Write a function that returns the time `t` needed for the egg to cook for a given `T0`, knowing that `Tw` = 100$^\\circ$ C, `M` = 50 g, `rho` = 1.038 gcm$^{−3}$, `c` = 3.7 Jg$^{−1}$K$^{−1}$, and `K` = 5.4 · 10$^{−3}$Wcm$^{−1}$K$^{−1}$. `Ty` = 70 $^\\circ$ C. for a perfect soft boiled egg. All these quantities should be passed as keyword arguments, with the specified default values.\n",
+ "\n",
+ "Find `t` for an egg taken from the fridge (`T0` = 4 C) and for one at room temperature (`T0` = 20 C). \n",
"\n",
- "Hint: You do not need to do any unit conversion. `Ty` = 70 $^\\circ$ C. for a perfect soft boiled egg. "
+ "Hint: You do not need to do any unit conversion. "
]
},
{
@@ -1044,9 +1008,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"ok.grade('question-1_8')"
@@ -1056,7 +1018,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Exercice 1.9: Kepler's third law\n",
+ "## Exercice 1.9 (\\*\\*\\*): Kepler's third law\n",
"\n",
"You were selected to be the next astronaut to go to Mars. Congratulations! \n",
"\n",
@@ -1092,22 +1054,23 @@
"source": [
"# Uncomment and complete this code - keep the names the same for testing purposes. \n",
"\n",
- "#from math import pi, sqrt\n",
+ "# from ... import ...\n",
"\n",
- "#def period(a, G=6.67*10**-11, m1=6*10**24 , m2=2*10**30):\n",
+ "# def period(a, G=6.67*10**-11, m1=6*10**24 , m2=2*10**30):\n",
"# ...\n",
"# \n",
- "# return P_mars, P_earth, birthdays\n",
+ "# return P_mars, P_earth\n",
+ "\n",
+ "# P_mars, P_earth = period(1.5*10**11)\n",
+ "# birthdays = ...\n",
"\n",
- "#print(period(1.5*10**11))"
+ "# print(\"Periods: \", period(1.5*10**11), \", birthdays: \", birthdays)"
]
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"ok.grade('question-1_9')"
@@ -1116,9 +1079,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
" ok.score()"
diff --git a/lecture1/tests/question-1_8.py b/lecture1/tests/question-1_8.py
index a54572e..e16a14d 100644
--- a/lecture1/tests/question-1_8.py
+++ b/lecture1/tests/question-1_8.py
@@ -11,6 +11,14 @@
""",
'hidden': False,
'locked': False
+ },
+ {
+ 'code': r"""
+ >>> np.allclose( perfect_egg(20), 259.342856)
+ True
+ """,
+ 'hidden': False,
+ 'locked': False
}
],
'scored': True,
diff --git a/lecture1/tests/question-1_9.py b/lecture1/tests/question-1_9.py
index 231fb2d..791d74d 100644
--- a/lecture1/tests/question-1_9.py
+++ b/lecture1/tests/question-1_9.py
@@ -6,7 +6,15 @@
'cases': [
{
'code': r"""
- >>> np.allclose( period(1.5*10**11), [58059817.3950661, 31603718.929927427, 18.3711978719333])
+ >>> np.allclose( period(1.5*10**11), [58059817.3950661, 31603718.929927427])
+ True
+ """,
+ 'hidden': False,
+ 'locked': False
+ },
+ {
+ 'code': r"""
+ >>> np.isclose( birthdays, 18.37119787)
True
""",
'hidden': False,