0% found this document useful (0 votes)
17 views12 pages

Y10 01 CT1 - Slides

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views12 pages

Y10 01 CT1 - Slides

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

Y10-01-CT1: Introduction to

programming
T10-01-CT1 Introduction to programming

Learning objectives

In this lesson we will:

• define the term 'program’


• use an Integrated Development Environment (IDE) to work
with a Python program
• use arithmetic operators
• use variables in algorithms and programs.

For more detail on this topic, and additional learner activities, refer to
Topic 1.1 of the student book.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

What are programs, and why do we need them?

Computers are deterministic machines.


This means they cannot guess, they only perform actions or
calculations exactly as they are programmed to do. There is no
randomness – the outcome of any instructions can be predicted.
Programs are the instructions given to computers to get them to
function. Without programs, computers as we know them would not
exist.
What are some examples of programs that you use?

operating system word processor games web browser

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

What does a program look like?


You use all sorts of programs every time you use a computer, but you
rarely get to see what they look like on the inside.
All programs, no matter how complex, are written by people using code.
There are hundreds of different ways to write programs. One of the main
distinctions between them is the programming language they are
written in.
There are lots of different programming languages.
Can you name any?

Python Java C++ C# Javascript Lua

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

Programming languages
In GCSE Computer Science we will learn to use a language called
Python.
It is written using a development environment such as IDLE or
PyCharm.
Python, like many languages, uses a set of special keywords along
with symbols and other punctuation marks. This is known as the
syntax of the language.
This is an example of a line of Python code:

print(“Hello World!”)

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

Doing calculations
One of the most common tasks we ask computers to do is to
complete calculations. These are the most common operations:

+ addition

- subtraction

/ division

* multiplication

% modulus (the remainder of a division)

// integer division (also known as Floor Division)

** exponentiation (to the power of)

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

BIDMAS

Python adheres to the same order of operations you use in


mathematics.

• Brackets
• Indices
• Division
• Multiplication
• Addition
• Subtraction

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

Worked example: practising calculations

You need to calculate the surface area of a cube.


How do you do this?

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

Traditional construction
You only need to know one number: the length of a side.
Let’s call this x
Is that a useful name for it?

sideLength

When you give a value a name, you are creating a variable.


You will use these all the time in programming so it’s important to
make sure that the names you choose make sense and are useful.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

Worked example: practising calculations


Surface area of the cube = sideLength × sideLength × 6

If the sideLength = 5
What is the surface area?

sideLength

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

Worked example: into code

How would we write a Python program to perform this calculation?


It might look something like this:

sideLength = 5
surfaceArea = sideLength ** 2 * 6

Notice the names of the variables. This is the same as


They are easy to read and make sideLength × sideLength
sense to any programmer who may
look at this code in the future. x ** 2 is x squared, which
Keep this in mind for your programs. is also x*x

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
T10-01-CT1 Introduction to programming

Wrap up: you have learned how to …

 Define the term 'program’.


• The instructions given to computers to get them to function.
 Use an Integrated Development Environment (IDE) to work with a Python program.
 Use arithmetic operators.
• Brackets – Indices – Division – Multiplication – Addition – Subtraction.
 Write a program to calculate the surface area of a cube.
 Use variables in algorithms and programs.
• Variables are named containers for values.
• Variable names should help make the logic clear.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy