Computer hardware review

  1. Think of three computers in your house that are not a smartphone, tablet, laptop or desktop computer.
  2. Think about the purpose of this computer.
  3. For example, a fridge might have a small computer that checks the temperature.

An introduction to programming

Learning Intentions

  • Understand why we learn to program

  • Understand how to develop and run a small program in Python

  • Understand basic input and output methods

Success Criteria

  • I am able to open Python IDLE and open and save code in it

  • I am able to read and implement some Python code

  • I am able to implement some Python code to display something on the screen

  • I am able to write Python code to read in text from the user

Why are we learning to code?

  • Learning to code is a great skill.
  • You can make money from learning to code in any job you go into, for instance if you work in finance you can write macros (which are code) to automate your work on occasion.
  • It's also a fundamental part of the National 4 and National 5 courses.
  • Learning to program computers will also improve your problem solving skills

Why learn to code?

What is a computer program?

A computer program is a collection of instructions that performs a specific task when executed by a computer. A computer requires programs to function. A computer program is usually written by a computer programmer in a programming language.

What is a computer program?

  • A computer program is a series of instructions that is designed to be carried out in a very specific order that tells the computer what to do.
  • A computer program is made up of statements that fit together with instructions.

What is a computer program?

  • Learning to program is now becoming more and more important in every field and can even be useful in admin jobs where writing a small program can automate a job.
  • Learning to program can also help you automate your life, say for instance you want to resize every picture on your computer.
  • Learning to program can help you find a job in the computing industry where you can get paid very well
  • Learning to program can help you create something amazing!

What is code?

$files = directory_list_files("/folder/images/")
$img = generate_image()
for each ($files as $file)
 $img->open($file)
 $img->transform_resize(600, 400)
 $img->save($file)
end for

What is code?

Instruction

$files = directory_list_files("/folder/images/")
$img = generate_image()
for each ($files as $file)
 $img->open($file)
 $img->transform_resize(600, 400)
 $img->save($file)
end for

What is code?

Statement

$files = directory_list_files("/folder/images/")
$img = generate_image()
for each ($files as $file)
 $img->open($file)
 $img->transform_resize(600, 400)
 $img->save($file)
end for

Introducing Python

Writing our first program

print("Hello World")

That’s all there is to this program!

😮

Python IDLE

  • When you've written your code in this new window, click on Run at the top and select Run Module. Alternatively, press F5.
  • Once IDLE opens, click on File and then click New.
Write your own ‘hello world’ program
Run your program
Change your program so that it says hello to the person who is sitting next to you.

Task

Display a person's name

  • Our next program will take in a persons name and display it. For this example we will use the input() function.

print("Please insert your name")
print("Hello there ", input())
  • Open the print.py file and run it
  • Attempt the worksheet (Worksheet 1). Save each task as a different file in your Python folder!
  • If you finish the above, look at the first example on the Python part of the Code Club website at codeclubprojects.org. You can use this to expand your knowledge above what we learn in school later on!

Task

Plenary

  1. Grade yourself on the lesson's success criteria.

  2. Colour in the box with the colour code shown to the right based on how well you think you’ve understood the concept. 

  • I am able to open Python IDLE and open and save code in it
  • I am able to read and implement some Python code
  • I am able to implement some Python code to display something on the screen
  • I am able to write Python code to read in text from the user
JB
6 Software Development : 1.1 An introduction to software development
© J Balfour
Tools