diff --git a/_sources/chapters/module-2/025-conditional.ipynb b/_sources/chapters/module-2/025-conditional.ipynb index a015992..4a730ed 100644 --- a/_sources/chapters/module-2/025-conditional.ipynb +++ b/_sources/chapters/module-2/025-conditional.ipynb @@ -669,7 +669,7 @@ "metadata": {}, "source": [ "
\n", - "DANGER: Be careful with while loops, as they might be unending. For example:\n", + "DANGER: Be careful with while loops, as they might be unending. For example: \n", " \n", "while 1:\n", " print(\"This is so annoying\")\n", @@ -862,14 +862,14 @@ ":label: conditional1\n", "\n", "1 - Given z=4 write an \"if\" statement that evaluates if z is odd or even and then print z is even. \n", - "2 - Add an \"else\" statement to the previous code to print \"z is odd\". Try changing the value of z to see whether your code works or not.\n", + "2 - Add an \"else\" statement to the previous code to print \"z is odd\". Try changing the value of z to see whether your code works or not. \n", "3 - Inside either the \"if\" or \"else\", include a print statement giving the message of what number is being checked by the condition. (Hint: use string formatting for this). \n", "```" ] }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 40, "metadata": {}, "outputs": [], "source": [ diff --git a/chapters/module-2/025-conditional.html b/chapters/module-2/025-conditional.html index 519b235..54f11c7 100644 --- a/chapters/module-2/025-conditional.html +++ b/chapters/module-2/025-conditional.html @@ -774,7 +774,7 @@

for

While loops are when you don’t know how many interations it will take – you are depending on some condition to be met.

-DANGER: Be careful with while loops, as they might be unending. For example: +DANGER: Be careful with while loops, as they might be unending. For example: while 1: print("This is so annoying") @@ -909,7 +909,7 @@

Practice exercisesExercise 16

1 - Given z=4 write an “if” statement that evaluates if z is odd or even and then print z is even.
-2 - Add an “else” statement to the previous code to print “z is odd”. Try changing the value of z to see whether your code works or not. +2 - Add an “else” statement to the previous code to print “z is odd”. Try changing the value of z to see whether your code works or not.
3 - Inside either the “if” or “else”, include a print statement giving the message of what number is being checked by the condition. (Hint: use string formatting for this).