Can You Compute?
  • HOME
    • Yr 6
    • Revision
    • Class of 2017
    • COVER LESSON FB
    • Yr 10: Program of Study 2016
    • Yr 11:Coming soon
    • Student Showcase
  • KS3
    • Term 6: Databases
    • Term 5 Scratch
    • Term 4 Websites
    • Term 3 Spreadsheets
    • Term 2: Binary & Algorithms
    • Term 1: Basics and Hardware
  • J277/01 NEW
    • EPIC FAILS
    • Intro Lessons
    • 1.1 System Architecture >
      • 1.1.1: The CPU
      • 1.1.1: Parts of the CPU
      • 1.1.2: The CPU in action
      • CPU Recap Lesson
      • Little Man Computer
      • 1.1.3: Embedded Systems
      • RISC & CISC
      • End of Unit Exam
    • 1.2 Memory and Storage >
      • 1.2.1: Primary Storage (Memory)
      • Intro to Units of Memory
      • 1.2.2 Secondary Storage
      • How stuff works
    • 1.2.3 Units & Data Capacity
    • 1.2.4 Data Storage >
      • 1.2.4 Binary Conversion
      • 1.2.4 Binary Addition
      • L4: Hexadecimal
      • L5: Recap
      • L6: Characters
      • L7: Images
      • L8: SenseHAT images
      • L9: Sound & Sampling
      • L10: Code Sound
      • L11: Compression Part 1
      • L12: Compression Part 2 >
        • Compression
      • What do you know?
  • J276/02 old
    • Unit 2 Overview
    • 2.1 Algorithms >
      • L1: Intro to Algorithms
      • L2: The Knight's Tour
      • L3: Bresenham
      • L4: Searching Algorithms
      • L5: Bubble Sort
      • L6: Insertion Sort
      • L7: Merge
      • L8: Sorting Recap
      • L9: Creating Algorithms
      • L10: Pseudocode
      • L11: Interpreting Algorithms
      • L12: End of Unit Test
    • 2.2 Programming Techniques >
      • Coding Intro
      • L1: Programming Concepts
      • L2: Sequence, Selection & Iteration
      • L3: SSI Practice
      • L4: String Manipulation
      • L5: Secret Codes
      • L6: File Handling
      • L7: Use of records to store data
      • L8: SQL
      • L9: SQL Python
      • L10 ,11, 12: Arrays
      • L13: Functions
      • L14: Data Types
      • L15: Casting
      • L16 -17: Test and Code
    • 2.3 Robust Programs >
      • L1 : Defensive Design
      • L2 : Testing Programs
    • 2.4 Computational Logic >
      • L1: Comp. Logic 1
      • L2: Comp. Logic 2
      • L3: Operators (Python)
    • 2.5 Translators & Language >
      • L1: Types of Languages
      • L2: Translators
  • Yr 9
    • Year End Examination
    • iMedia 5: Comics
    • iMedia 4: School Brochure
    • iMedia 3: Presentations
    • iMedia 2: Review and Mail Merge
    • iMedia 1: IT Letter Writing
    • L10: Intro to iMedia
    • L9 Building a Computer
    • L8: Buying a House
    • L7: Logic Gates
    • L6: Binary
    • L5: CS Alan Turing
    • L4: Spreadsheets
    • L3: JS in an Hour!
    • L2: Intro to Coding
    • L1: CS Compression
  • Py
    • Coding Concepts
    • Writing your first Program
    • Python Pages
    • Python Playground
    • Strings
    • Python Operators
    • Functions
    • Conditions
    • Try and Except
    • Break and Continue
    • Odd codes
  • Py +
    • Looping
    • Why does my code not work?
    • Errors
    • Validation
    • Lists
    • Lists again
    • Looking for data in String
    • Writing to Files
    • Read, Write & Sorting Data
  • CODING
    • Magic Python
    • Alan Turing
    • Brian the Turtle
    • Grade Calculator
    • Nested IF Hotels
    • Vending Machine
    • A Looping Menu
    • For
    • Christmas Coding
    • JS in an Hour!
    • CSS + HTML
    • Medical Claims
    • Hour of Code 2015
  • Contact
    • Dictionaries - coming soon
    • L2:
  • Squid Game
  • Reflectico

coding concepts

​Sequencing

When writing a computer program it is important to ensure that each line of code is in the correct order.  

Imagine making a cup of tea and putting the cold water into the cup before it has boiled and then adding the milk and then a tea bag.  Each stage is an individual instruction but they are out of sequence and therefore result in the incorrect outcome, a cold cup of tea.  

Sequencing applies when creating your program, for example, a picture has to be taken with the camera before it can be saved to a file.   Otherwise the program would produce an error and fail.  You will use sequencing in all the projects.

Variables 

Objects, like people have a name that can be used to identify or refer to them, for example the make of a car, the name of your child or the name of the company that provides your Gas.  

In programming a variable is a label or name used to refer to value, data, or text that is stored. Although the label stays the same the value it stores can vary, it can change.  Consider a variable called ‘gas company’ this contains the name of the company supplying your gas, but, you can switch company and therefore the name stored could also change.  

In a computer game a variable is used to store the player's current score.  As you progress in the game your score changes and goes up or down.  Each time it changes, the new value needs to be stored in the the variable.  All the projects will use variables and teach you more about them.

Selection

Selection is also used with the options you are presented with at a cash machine.  For example 'Do you want to see your balance?', How much do you want to withdraw? Do you want another service?  The program then responds in an appropriate way dependent on the choice that you make. 

Computers execute instructions in the order they're written. Sometimes, you won't always want the computer to do exactly the same thing each time. You can tell the computer to select what to do based on, say, the value stored in a variable.

For example at the end of a game you may be asked if you want to play again, if you answer Yes the game begins if you answer No then the program quits.  If a player’s score is higher that the current high score, then set the player's score to be the new high score and ask for their name,  else do nothing.

Data Types

Computers have their own method of storing lots of different types of data, they cannot distinguish between numbers, letters or symbols so we program it with what type of ‘data’ is being used or entered.   

integer - a whole number
floating point  - a decimal
text -  a letter or character
boolean - a Yes or No value or True or False
 
This allows a program to determine the possible values for that data type and the operations that can be done on values of that type.  If you win a game it may ask you for your player’s name, this is usually a ‘text’ data type which tells the program to accept letters between a and z.  When asked if ‘you want save you work’ makes use of a Boolean value, yes or no. 

You will use data types in project ..

Functions

If you listed all the stages involved in brushing your teeth you could probably write a list of 30 plus instructions.  Pick up the toothpaste, hold the lid, unscrew the lid and so on.  It would become very tedious and time consuming if you had to tell your child all these instructions every time you wanted them to brush their teeth.  Instead you say ‘brush your teeth.   This is a function, a phrase that holds all the instructions to brush your teeth. 

In programming functions are used to save time repeating longer lines of code.  In a computer game when you press the run button your player will run.  This takes several lines of code to perform the movement.  Within the program is a function called run.  

Within the ‘run’ function will be stored the lines of code which enable the program to control player to run.p.  A function means you can use a few words to ‘call’ a much longer set of code anywhere in the program.  Functions are used in all the programs.

Repetition

In a program you will want a particular action or event to keep happening or repeating, this is called a loop.

A loop is a sequence of instructions repeated until until a certain condition is reached. A player continues to play the game until their lives reach zero, then the loop stops and the game ends.  

The most commonly used loops are WHILE and FOR loops.  A WHILE loop repeats while a certain condition is met for example WHILE you are pressing the jump button make the player jump.  A FOR loop repeats a specific set of instructions for a set number of times.  If you had a 4 player game and the game ended a FOR loop could be used to calculate the scores and rank the players.  The FOR loop would run four times since there are 4 players
Powered by Create your own unique website with customizable templates.
  • HOME
    • Yr 6
    • Revision
    • Class of 2017
    • COVER LESSON FB
    • Yr 10: Program of Study 2016
    • Yr 11:Coming soon
    • Student Showcase
  • KS3
    • Term 6: Databases
    • Term 5 Scratch
    • Term 4 Websites
    • Term 3 Spreadsheets
    • Term 2: Binary & Algorithms
    • Term 1: Basics and Hardware
  • J277/01 NEW
    • EPIC FAILS
    • Intro Lessons
    • 1.1 System Architecture >
      • 1.1.1: The CPU
      • 1.1.1: Parts of the CPU
      • 1.1.2: The CPU in action
      • CPU Recap Lesson
      • Little Man Computer
      • 1.1.3: Embedded Systems
      • RISC & CISC
      • End of Unit Exam
    • 1.2 Memory and Storage >
      • 1.2.1: Primary Storage (Memory)
      • Intro to Units of Memory
      • 1.2.2 Secondary Storage
      • How stuff works
    • 1.2.3 Units & Data Capacity
    • 1.2.4 Data Storage >
      • 1.2.4 Binary Conversion
      • 1.2.4 Binary Addition
      • L4: Hexadecimal
      • L5: Recap
      • L6: Characters
      • L7: Images
      • L8: SenseHAT images
      • L9: Sound & Sampling
      • L10: Code Sound
      • L11: Compression Part 1
      • L12: Compression Part 2 >
        • Compression
      • What do you know?
  • J276/02 old
    • Unit 2 Overview
    • 2.1 Algorithms >
      • L1: Intro to Algorithms
      • L2: The Knight's Tour
      • L3: Bresenham
      • L4: Searching Algorithms
      • L5: Bubble Sort
      • L6: Insertion Sort
      • L7: Merge
      • L8: Sorting Recap
      • L9: Creating Algorithms
      • L10: Pseudocode
      • L11: Interpreting Algorithms
      • L12: End of Unit Test
    • 2.2 Programming Techniques >
      • Coding Intro
      • L1: Programming Concepts
      • L2: Sequence, Selection & Iteration
      • L3: SSI Practice
      • L4: String Manipulation
      • L5: Secret Codes
      • L6: File Handling
      • L7: Use of records to store data
      • L8: SQL
      • L9: SQL Python
      • L10 ,11, 12: Arrays
      • L13: Functions
      • L14: Data Types
      • L15: Casting
      • L16 -17: Test and Code
    • 2.3 Robust Programs >
      • L1 : Defensive Design
      • L2 : Testing Programs
    • 2.4 Computational Logic >
      • L1: Comp. Logic 1
      • L2: Comp. Logic 2
      • L3: Operators (Python)
    • 2.5 Translators & Language >
      • L1: Types of Languages
      • L2: Translators
  • Yr 9
    • Year End Examination
    • iMedia 5: Comics
    • iMedia 4: School Brochure
    • iMedia 3: Presentations
    • iMedia 2: Review and Mail Merge
    • iMedia 1: IT Letter Writing
    • L10: Intro to iMedia
    • L9 Building a Computer
    • L8: Buying a House
    • L7: Logic Gates
    • L6: Binary
    • L5: CS Alan Turing
    • L4: Spreadsheets
    • L3: JS in an Hour!
    • L2: Intro to Coding
    • L1: CS Compression
  • Py
    • Coding Concepts
    • Writing your first Program
    • Python Pages
    • Python Playground
    • Strings
    • Python Operators
    • Functions
    • Conditions
    • Try and Except
    • Break and Continue
    • Odd codes
  • Py +
    • Looping
    • Why does my code not work?
    • Errors
    • Validation
    • Lists
    • Lists again
    • Looking for data in String
    • Writing to Files
    • Read, Write & Sorting Data
  • CODING
    • Magic Python
    • Alan Turing
    • Brian the Turtle
    • Grade Calculator
    • Nested IF Hotels
    • Vending Machine
    • A Looping Menu
    • For
    • Christmas Coding
    • JS in an Hour!
    • CSS + HTML
    • Medical Claims
    • Hour of Code 2015
  • Contact
    • Dictionaries - coming soon
    • L2:
  • Squid Game
  • Reflectico