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

Lesson Video

13

Lesson Tasks

  • Watch the Lesson video
    Make notes on your notes sheet.
  • Read the lesson notes
    Make notes on your notes sheet.
  • Complete the learning activities
    Make any notes on your notes sheet.
  • Check the Learning outcomes
    Update your learning objectives

What do I need to Learn?

I need to learn how to obtain user input from the keyboard.
I need to learn how to output data and information from a program to the computer display.

Key Terms

Input Output Type conversion

Input - Output

In python we use built in functions to help us with our input and output. The function we use to output to the screen is print() and the function we use to get input from the keyboard is input().

Let us look at the the output method print() first.

Input Output diagram

Flight Path

Challenges - OUTPUT


  • 1

    Say 'Hello World' instead of 'Hi'
    Complete the challenge below

...In order to display text output in python you need to surround your message in quotation marks. The print function also needs your output to be surrounded with brackets.

print(" ")

  • 2

    New Line
    Complete the challenge below

  • 3

    Another newline format
    Complete the challenge below

...Any line of code that starts with a # is a comment: it doesn’t affect how the program runs, it’s just there to help explain what the code does.


  • 4

    Debugging
    Complete the challenge below
  • Hint - Check the brackets and quotation marks.

    Your code won’t run at all until you’ve fixed all of the errors: You need to fix all the lines of code even before the first line will run.

    Python is case sensitive: be careful with CAPITAL LETTERS and lowercase letters


  • 5

    Extension Challenge
    Complete one or all of the extension challenges below

Click on the Lesson Resources activity for some ASCII art examples


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().

Input Output diagram

Flight Path

Challenges - x <- USERINPUT


  • 1

    Getting a user's input.
    Complete the challenge below

...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 .

x = input(" ")

  • 2

    More input.
    Complete the challenge below

  • 3

    Display address details.
    Complete the challenge below

  • 4

    Using Numbers.
    Complete the challenge below

...If we want to use numbers in our code we have to change the user input to the data type of the number we want to use.

For example if the type of number we want to use is a whole number then we convert the input using the int() function.

However if the type of number we want to use was a decimal number then we convert the input using the float() function.

x = int(input(" "))

  • 5

    Converting Numbers.
    Complete the challenge below

  • 6

    Some maths
    Complete the challenge below

  • 7

    Extension Challenge
    Complete the Python Input/Output Extension Challenge below
  • Write your own piece of code in python it can be anything you want from what you have learned so far.

Update your objectives

control