{ "metadata": { "kernelspec": { "name": "python", "display_name": "Python (Pyodide)", "language": "python" }, "language_info": { "codemirror_mode": { "name": "python", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8" } }, "nbformat_minor": 5, "nbformat": 4, "cells": [ { "id": "fee14c77-0da3-4682-bd7c-852301bfda1c", "cell_type": "markdown", "source": "

Year 7 - Autumn 2 - Lesson 4 - Selection

", "metadata": {} }, { "id": "907f623c-09b4-41ce-afea-6baff7e16ebb", "cell_type": "markdown", "source": "

(A) Fix the Code Below

\n\n

\nThe code in the next cell is not working correctly.\n

\n\n

Your task:

\n\n
    \n
  1. Read the code carefully to understand what it is trying to do.
  2. \n
  3. Identify the error(s) — this might be a syntax issue (where code doesn't follow the rules of Python).
  4. \n
  5. Fix the code so that it runs without errors and produces the correct output.
  6. \n
  7. When you're done, add a short comment explaining what you changed and why.
  8. \n
\n\n
\n 💡 Hint: Run the code first to see the error message — it will often guide you to the problem.\n

", "metadata": {} }, { "id": "215f334f-96d9-431e-bba7-e58081e405ed", "cell_type": "code", "source": "Name = input(\"Hello, what is your name\")\nprint(\"Hello {name}\")\n\ncolour = input(\"What is your favourite colour\")\nprint(f\"I really like {colour} as well \n\n#---->\n# Write a comment about what you have done below \n# Make sure comment lines begin with a # symbol\n\n\n\n", "metadata": { "trusted": true }, "outputs": [], "execution_count": null }, { "id": "5e6d0794-6414-41ec-bcc1-95a7946813bf", "cell_type": "markdown", "source": "

(B) Working With Selection

\n\n

\nIn the cell below, you will write some code that results in either of two outcomes\n

\n\n

Your task:

\n\n
    \n
  1. Your teacher will now demonstrate how to work with selection (IF and ELSE)
  2. \n
  3. This allows for the program to test a condition
  4. \n
  5. If the condition is true, one set of outcomes occurs; if it is false, another set of outcomes occurs
  6. \n
\n\n
\n 💡 Code along with your teacher: Then test to see what happens when you input different answers\n

", "metadata": {} }, { "id": "041e4377-2c81-4112-a35a-fe95cbdd7c2f", "cell_type": "code", "source": "# (B) Complete your code in this box\n\n\n", "metadata": { "trusted": true }, "outputs": [], "execution_count": 1 }, { "id": "5c9c1f31-a82f-4703-8304-59615860fd89", "cell_type": "markdown", "source": "

(C) Develop Your Quiz

\n\n

\nIn the cell below, you will write a quiz in Python\n

\n\n

Your task:

\n\n
    \n
  1. Questions will be based on a topic of your choosing
  2. \n
  3. When the user answers correctly, give them a positive response
  4. \n
  5. When the user answers incorrectly, give them a helpful response
  6. \n
\n\n
\n 💡 Remember to test each question with both correct and incorrect answers.\n

", "metadata": {} }, { "id": "15b8faf8-42a9-405a-b7fe-37e432e30c1a", "cell_type": "code", "source": "# Quiz\n\n\n\n", "metadata": { "trusted": true }, "outputs": [], "execution_count": null }, { "id": "cac16680-36d9-4abc-82e1-17d1981b4734", "cell_type": "markdown", "source": "

Extension

\n\n
    \n
  1. You will find a set of additional challenges on OneNote
  2. \n\n 💡 Remember to try different things out before asking for help.\n

", "metadata": {} } ] }