Computer Science LearnITWithMrC ⛯ Year 7 Year 8 Year 9 GCSE
Responsive image

Input

What am I Learning today?

I am learning how to assign user input to a variable

Knowledge Organiser

×

Lesson

Task 1 - Getting Organised - PowerPoint Click to see more

  1. Set your Learning Objectives to red.

  2. Open your PowerPoint from last lesson.

If you need to download a copy of thePowerPoint Click here and open Task 1.

Copy this "Input Cheat sheet" into your PowerPoint.

Flight Path

Task 2 - User Input - Python Click to see more

User Input

In python if you want the user to input data into the program, you can use the input()function, this is another built in functions to help us put data into our program.

Let us now look at the the input method input().

Let's start with a simple input and create it in python.

  • Here is the code for you:
  • name = input("What is your name? ")
    print("Hi" , name)
    1. Copy the code above into your python window.

    2. Save the file name as input.

    3. Run the code.

    You should see this



    Activity 1

    1. Change Line 5 to say something instead of Hi
    2. Can you ask a different question and output a different answer?

    In your Powerpoint put a screenshot of your code with an explanation of what it does.



  • When you are finished don't forget to save your your powerpoint

  • Task 3 - Some practice Click to see more

    ...In order to get user input in python you need to use the input() function. This puts a prompt onto the screen to allow the user to enter data. If you want to use the data in your program you have to store it in a variable . The print function can then use the variable to output our user input to the screen .



    Let's try another simple input and create it in python.

  • Here is the code for you:
  • x = input("Please enter a word: ")
    print("word =" , x)
    1. Copy the code above into your python window.

    2. Save the file name as 'input2'.

    3. Run the code.

    You should see this

    Activity 2

    1. Change the variable into something more suitable than x?
    2. Change Line 2 to say more than just word =

    In your Powerpoint put a screenshot of your code.



  • When you are finished don't forget to save your your powerpoint

  • Task 4 - Starting Your adventure Click to see more

    Python Text Adventure Task

    Overall objective: In this task, you will use your knowledge of Python's input, print, and variables to create an exciting introduction for a text adventure game using Thonny. You will also save your Python file onto your OneDrive school account as "MyTextAdventure.py."

    Part 1: Crafting a Captivating Introduction

    Objective: In this task, you will initially focus on using your creative writing skills to craft a captivating introduction for a text adventure game. Once you've completed the introduction, you can further extend the task by incorporating variables and input to create an interactive text adventure game.

    1. Imagine you are the storyteller, and you are about to take your players on an exciting journey. Your task is to create a written introduction that will draw them into the world of your text adventure.
    2. Start by brainstorming ideas for your adventure's setting and theme. Is it a mysterious castle, a deep-space expedition, a jungle adventure, or something entirely unique? Think about what will intrigue and excite your players.
    3. Use vivid and descriptive language to paint a picture of the world your players will enter. Describe the surroundings, the atmosphere, and any important details that will immerse them in the story.
    4. Introduce the main plot or problem that the player will face. What is their quest or mission? Why is it important? Build anticipation and curiosity by providing a tantalizing hint of what's to come.
    5. Create a sense of suspense or excitement. Leave the player wanting more by ending your introduction with a cliffhanger or a call to action. For example, you can ask them to "press 'Start' to begin their adventure."
    6. Write and revise your introduction until you're satisfied with its creativity and impact. You can seek feedback from others to make it even better.
    7. Once your introduction is complete, save as your usernamein the following folder
      • Year 8 Common Area
      • You can Save here
      • Computer Science
      • Your class 8G?
      • Term 3 - Text adventure
      .

    Creating writing introduction example

    You stand at the edge of a dense, ancient forest, its towering trees shrouded in mist that dances in the pale moonlight. The air is thick with the earthy scent of moss and the distant murmur of a hidden stream. Before you lies a forgotten path, overgrown with ivy and covered in fallen leaves, disappearing into the heart of the woods. It beckons you with an eerie allure, promising secrets and treasures untold. But be warned, brave adventurer, for this forest holds mysteries of both wonder and peril. Will you:

    • 1. Venture Deeper: Venture deeper into the forest, following the winding path, driven by curiosity and the promise of adventure?
    • 2. Seek Shelter: Turn back and seek shelter for the night, sensing the dangers lurking within the darkness?
    • 3. Light a Torch: Light a torch and cautiously explore the immediate surroundings, wary of the unknown dangers that may lie nearby?

    Part 2: Creating your Text Adventure in python

    1. Open your Python development environment (e.g., Thonny).
    2. Create a new Python file (e.g., "text_adventure_game.py").
    3. Use Python to implement your captivating introduction into the game by using a print statement. After the introduction, give the player choices that will affect the story's progression.
    4. After your introduction try including variables to store player information (e.g., name, score) and input statements to interact with the player.
    5. Use input to collect the answer to the players choice
    6. Save your Python file. Select "File" > "Save As" from the Thonny menu.
    7. Choose your OneDrive school account as the location to save the file. Navigate to your OneDrive folder and create a new folder if needed. Name the file "MyTextAdventure.py" (note the ".py" extension).
    8. Save the file in your OneDrive folder.
    9. Finally, test your introduction by running your Python program within Thonny. Make sure it welcomes the player, sets the scene, and waits for their response before proceeding to the actual game.

    Tips:

    • For the creative writing part, let your imagination run wild! Experiment with different ideas and themes.
    • For the Python extension, consider using variables to store player-related information and input statements to gather player choices.
    • Read your introduction aloud to ensure it flows smoothly and creates the desired atmosphere.
    • Engage the player's senses by describing sights, sounds, and emotions.
    • Consider the target audience and adjust your writing style accordingly.

    Once you've completed both parts of this task, you will have crafted a captivating introduction and created an interactive text adventure game, showcasing your creative writing skills and your ability to use variables and input in Python.


  • When you are finished don't forget to save your your powerpoint

  • Task 5 - Lesson review Click to see more

    Summing it all up

    Lets look at the learning outcomes and decide which one best describes our current level of understanding :

    Tick the one you feel is closest to your level

    Learning Outcomes I need to learn how to assign user input to a variable

    • I have a basic understanding of how I can assign user input to a variable with a little help from my teacher
    • I can show my teacher that I can assign user input to a variable without their help.
    • I can assign user input to a variable independently and I can also explain it to others and can complete any extension tasks I am given.

    🠜 Now update your learning objectivesClick on the Assessment image

    My Notes: Coding-p1

    Student_Comment_3 not found

    Task Notes/Comments - Add here Click to see more

    Comments/Notes

    Copyright © 2013 - 2025 LearnITwithMrC