Research task

Background

Python is a programming language and it was named after the BBC show “Monty Python’s Flying Circus” and don’t forget this has nothing to do with those scary reptiles.

Starter with discussions(15 minutes)

Q1)

a)Find a definition of what programming is

b)Give some examples of where / how programming is used:

Example: programming has helped to create self-driving cars. An example of this is the Google Drive which means as we get older, in the future, we will not have to worry about driving.

Answer:

Q2)

a)Give some examples of programming languages. At least 2 is required.

Answer:

Q3) Finally, this is probably the most important part of programming and it is called algorithm. I would like you to find out what an algorithm is.

Answer:

Programming task

Introduction

Learning to program takes a lot of time and effort but more importantly it should be fun. The best way to learn is to practise at home as well as at school.

Python is a procedural programming language which means that it will read the instructions step by step. This term is known as imperative programming language.

Task 1

For this lesson

  1. Open Google Chrome > Click Start > All programs > Google Chrome
  2. Note: it may crash so you may have to open it twice
  3. Once Google is open, copy the following link to the address bar

Output to the screen

It doesn’t matter what type of program you make, whether it is console or form based, you need to have some form of output for the user.

It is a tradition to always print hello world.

Code

Print(“Hello World”)

Print(“This is my first computer program”)

Print(“It is quite basic but it is a start”)

Tip

Challenge

  1. Change the program output so that it says Nice to meet you
  2. Write a program that will output text that will be similar to the example below
  3. Note: It must have a space and you need to find out how to do this

This is

a computer program

that prints on several lines

Hint: you will need to google how to add a line break but you can try using the print function

Variable and user input

We use variables in our programs to store data. Each variable is declared and it is given a name. The name is called an ID and it will be used to identify that particular variable. Each variable will store data and there are different types of data that we can store. For example, we can store the following data:

String: text

Integer: whole numbers

Real: decimal numbers

The good thin

In python we do not have to explicitly declare the data type like other programming language. It will work this out by itself when the program runs.

Things to remember about variables

  1. A variable can have numbers and letters
  2. A variable cannot start with a number
  3. A variable cannot have a space

Name = “Rob”

Age = “15”

Challenge

  1. Trying to print the message saying that rob is 15 years old

Hint: concatenation,

user input

  1. Asks for the first name and then a surname.
  2. Print the First name and then the second name
  3. On the next line print the second name and then the first name

Extension: The name may not have a space between first and second names,
can you work out how to add one?

Hint:

You need to search a function called input()

user input

  1. Create a program that will work out the average.
  2. The program should ask for 4 inputs
  3. Then these input should be added together
  4. Finally, they should be divided by 4 to get the average

Extension

Write a program that asks for the town you live in and then replies I love visiting [town

name]