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

Lesson Video

13

Lesson Tasks

  • Watch the Lesson video
    Make notes if needed.
  • Open your Learning Journal
    Complete Task 1 in your Learning Journal
  • Complete the learning activities
    Make sure you complete the book tasks in your Unit Booklet
  • Complete End of Task Assessment
    Update your learning objectives

What do I need to Learn?

0 results forGuest
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

Task 1 - Getting organised - notes? Click to see more


Task 1: Fill in the heading.

Open your cornell notes word document, if you would rather fill it in by hand then feel free to print it out. Fill in the video title and the topic at the top of the page. See example below.

Open a Cornell notes sheet by clicking on the image below.

Avatar

Remember good notes allow students to help each other problem solve

Good notes will help you organise and process data and information

Cornell notes help you retain and recall information by having three different ways/sections where you process the information.

Note taking is a way of helping you to remember things you would otherwise forget. It also stimulates our critical thinking skills.

Remember! whenever you see the notes icon this means the information is important and you should write it down on your notes sheet.


Task 2 - Input Output Click to see more

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

Reading: Input/Output

Open your student workbook at page 57 read through the notes for a better understanding.


Task 3 - Challenges output Click to see more

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

  • 1

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

  • 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

Task 4 - Finding Errors(Debugging) Click to see more

Sometimes when your program does not work it is often the case that you have made a syntax error. Syntax errors are typographical mistakes that the programmer has made. When the code get translated for the computer to understand you will get an error message. Sometimes the message is useful, sometimes it is not!

When you are writing programs especially as they get more complex it is very difficult to not to make syntax errors (i do it all the time), so it is good to be able to understand the error messages so you can fix it yourself. As you get more experienced you will learn to interpret the error messages more easily and quickly.

Common Errors

    Forgotten bracket: - You get the message “invalid syntax” in a pop up box along with the line after the line with the error being highlighted in red.
    Forgotten speech mark: - You get the message “EOL while scanning string literal” in a pop up box along with the line of the error being highlighted in red.
    Name Error: - You get the message “Name error” when you mispell a function namelike I have done with print as you can see in the message below.


Copy the code below into a new python file and save it as "debugging"

Try and fix all the errors so that the code works

print("Hello Everyone)
print("This is a poem")

print(Once there was a little boy,)
print(With curly hair and pleasant eye—")
Print("A boy who always told the truth,")
print(And never, never told a lie.")

Print("And when he trotted off to school,")
pint("The children all about would cry,")
PRINT("There goes the curly-headed boy—")
print(The "boy that never tells a lie.")


Add #comments at the end of each line where there is an error, stating what type of error it was.




Task 5 - User Input 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().

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.

Task 6 - Update Objectives 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 obtain user input from the keyboard.

  • I have a basic understanding of how I can obtain user input from the keyboard. with a little help from my teacher
  • I can show my teacher that I can obtain user input from the keyboard. without their help.
  • I can obtain user input from the keyboard. 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

Task 7 - End of Task Assessment Click to see more