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

Python - input

What am I Learning today?

I am learning how to explain how to assign user input to a variable
I am learning how to store input from the user and use it in my code

Knowledge Organiser

×

Lesson

Task 1 - Getting Organised - PowerPoint Click to see more

  1. Set your Learning Objectives to red.

  2. We are going to save all of our work for this topic into a PowerPoint like we did in our assessment.

  3. To download the PowerPoint by clicking on the image below


  4. Save your PowerPoint as 'Programming 1'

If for any reason you cannot open Thonny then click on the link below to use an online version of Python called CodeSkulptor3. Just be aware that the lessons are based upon using python in Thonny however the code will be exactly the same.


Task 2 - Getting Organised - Python Click to see more

Choose your Python

  • You have two python options for completing todays lesson.

  • Option 1

    Thonny

    In class we are going to be using the Python tool called 'Thonny' This is an app on your computer so search for it in the search bar

    Option 2

    CodeSkulptor3

    If for any reason you cannot open Thonny then click on the link below to use an online version of Python called CodeSkulptor3. Just be aware that the lessons are based upon using python in Thonny however the code will be exactly the same.


    Task 3 - 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:
  • player = input("What is your player name? ")
    print("Hi" , player)
    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 4 - 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 your gamer tage: ")
    print("gamer tage =" , x)
    1. Copy the code above into your python window.

    2. Run the code.

    Activity 2

    1. Change the variable into something more suitable than x?
    2. Change Line 2 to say more than just word =
    3. Add in all of the data and variables connected with a player in gamers revenge

    In your Powerpoint put a screenshot of your code.



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

  • Task 5 - Different types Click to see more

    Let's try getting the user to input a number in python.

  • Here is the code for you:
  • number1 = input("Please enter a number: ")
    number2 = input("Please enter another number: ")
    print("The Sum of the two numbers = " , number1 + number2)
    1. Copy the code above into your python window.

    2. Save the code name as 'input3'.

    3. Run the code.

    You should see this

    Activity 3

    There is a problem with our answer, it should not be 83, it should be 11?

    1. Fix the code so that it prints out the correct sum of 11
    2. It has got something to do with changing data types, so check last weeks lesson.

    Click here to check your answer: Answer

    In your Powerpoint put a screenshot of your code.



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

  • Task 6 - Creating a calculator Click to see more

    Now that we can get the user to input values and turn them into numbers we could create a simple calculator program.

    It might start something like this:

    print("** Multiplication program **")
    number1 = input("Please enter a number to multiply: ")
    number2 = input("Please enter another number to multiply: ")

    These are the symbols we use in python for multiply and divide * = Multiply and / = divide. You can find the * symbol above the number 8 on your keyboard and the / above the ?

    Activity 4

    1. Can you finish the above code off?
    2. Can you make a program that does division or subtraction?

    Explain your answers in your Powerpoint next to a screenshot of your code



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

  • Task 7 - 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 explain how to assign user input to a variable

    • I have a basic understanding of how I can explain how to assign user input to a variable with a little help from my teacher
    • I can show my teacher that I can explain how to assign user input to a variable without their help.
    • I can explain how to 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-p

    Student_Comment_4 not found

    Task Notes/Comments - Add here Click to see more

    Comments/Notes

    Copyright © 2013 - 2026 LearnITwithMrC