Introduction to Python programming for KS3

Slides:



Advertisements
Similar presentations
Programming in python Lesson 2.
Advertisements

Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
By Ella Marks n/ImageDisplay/1/18/10 Clipart.
An Introduction to Textual Programming
Introduction to Python
A First Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington Credits: a significant part of.
Python Programming Using Variables and input. Objectives We’re learning to make use of if statements to enable code to ask questions. Outcomes Build an.
General Programming Introduction to Computing Science and Programming I.
Python Programming Introduction to programming using python.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Do it now activity Last term we learnt about how data is represented in a computer and about how to identify different volumes of data. How many bits in.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Type accurately challenge! This is a starter activity and should take 2 minutes [ slide 1 ] 1.Can you type out the code in Code Box 2.1 with no errors.
PROGRAMMING In Lesson 2. STARTER ACTIVITY Complete the starter activity in your python folder – lesson 2 Now we will see how you got on and update your.
Python Programming Using Variables and input. Objectives We’re learning to use basic knowledge of variables combined with user input. Outcomes Continue.
Maths in Python [ slide 5 ] 1.Copy the table 2.Race a friend with a calculator to see whether Python is faster than a calculator: a) 5 * 6.5 = b)7 / 3.
PROGRAMMING In. Objectives  We’re learning to develop basic code with the use of the correct syntax and variables. Outcomes  Explain what syntax is.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
A First Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington Credits: a significant part of.
BTEC Unit 06 – Lesson 06 Evidencing P3 Mr C Johnston ICT Teacher
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Introduction to Text Based Coding. We’re learning to explore how text based programming works You will display and enter text into a window You will use.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
COMPUTER PROGRAMMING Year 9 – lesson 1. Objective and Outcome Teaching Objective We are going to look at how to construct a computer program. We will.
Introducing Python 3 Introduction to Python. Introduction to Python L1 Introducing Python 3 Learning Objectives Know what Python is and some of the applications.
Learning to use a ‘For Loop’ and a ‘Variable’. Learning Objective To use a ‘For’ loop to build shapes within your program Use a variable to detect input.
Introducing Python Introduction to Python.
Introduction to Computing Science and Programming I
Writing algorithms Introduction to Python.
3.1 Fundamentals of algorithms
Task Analysis of a Ham, Cheese and Tomato Sandwich
Data Types Variables are used in programs to store items of data e.g a name, a high score, an exam mark. The data stored in a variable is entered from.
Python Let’s get started!.
Introduction to Python
Principles of Programming I (CIE 105)
Lesson 1 An Introduction
Can you pick 3 errors from this
Variables, Expressions, and IO
To write a Python program, you first need to open Pyscripter
Explain what touch develop is to your students:
Learning to Program in Python
Completing the tasks for A452 with….
Learning to Program in Python
Fill the screen challenge!
Explain what touch develop is to your students:
Programming In Lesson 3.
Learning Outcomes –Lesson 4
Teaching London Computing
ARRAYS 1 GCSE COMPUTER SCIENCE.
Hello World! Syntax.
Explain what touch develop is to your students:
Explain what touch develop is to your students:
Explain what touch develop is to your students:
Lesson 2 Get Started with Python – Post-Installation – Use the GUI.
ICT Programming Lesson 1:
Explain what touch develop is to your students:
Programming In Lesson 4.
Beginning Python Programming
Introduction to Python
Python 3 Mr. Husch.
How to organise your code
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Do it now – PAGE 3 You will find your do it now task in your workbook – look for the start button! Thursday, 23 May 2019.
Explain what touch develop is to your students:
Starter Which of these inventions is: Used most by people in Britain
What you need to do… Drag the pieces of code into the correct order like you can see in the EXAMPLE below. print ( “ int input ) = + Hello world chr ord.
Hardware is… Software is…
Python Creating a calculator.
Presentation transcript:

Introduction to Python programming for KS3

Learning Objectives: We’re learning to develop our understanding of python programming through the following techniques: Syntax Errors Variable names Comments

Making a sandwich: You may remember that programming is sequential…. Eat the sandwich Close the sandwich Sprinkle the cheese Put the two slides of bread on a plate Grate the cheese Cut the sandwich Spread the butter You may remember that programming is sequential…. Put these in the correct order, your teacher may get you to make the sandwich If you want to, you can get your students to make the sandwich using bread and cheese, you could buy pre-grated cheese and let them eat the sandwiches afterwards. Demonstrate the point of programming being carried out in a sequence. Demonstrate the importance of putting things in the correct order. If they’re not in the correct order, you have a logic error. Correct order: 1- Put the two slices of bread on a plate 2 – Spread the margarine / butter 3 – Grate the cheese 4 – Sprinkle the cheese on the bread 5 – Close the sandwich 6 – Cut the sandwich 7 – Eat the sandwich

Logical Errors: 1- Put the two slices of bread on a plate 2 – Spread the margarine / butter 3 – Grate the cheese 4 – Sprinkle the cheese on the bread 5 – Close the sandwich 6 – Cut the sandwich 7 – Eat the sandwich Remember that programs should be put in the correct order. If they’re not in the correct order, we can have something called a logic error. Talk to your students about possible errors that will have occurred. Why do they happen? What do you think would happen if this was a real life piece of code?

What is a program? Open up python IDE and type in the following: Print (“hello world”) What happens, when you press enter?

What is a program? Open up python IDE and type in the following: Print (“hello world”) What happens, when you press enter?

What is a program? Open up python IDE and type in the following: 5 + 9 What happens, when you press enter?

What is a program? Open up python IDE and type in the following: 5 + 9 What happens, when you press enter?

Syntax Errors Within python, there are a number of operators and functions which are built into the language. You’ve just seen how it can handle number, do any other operators work? How do we subtract, divide or multiply. You give it a try! Try printing other phrases, do they work? Extension: - Now type out: print (hello world) What happens?

Syntax Errors Extension: - Now type out: print (hello world) What happens? SYNTAX ERROR Like with English, programming languages have their own check similar to a grammar check. When you run code it checks to see whether it is in the form for the computer to compute. If you do not do this the computer throws out an error like above.

Using Variables Variables are like a bucket, they’re used to store a number, data, text or image. You can empty it or refill it as many times as you like. For example, to create a variable in python we might do the following: Studentname = (“James”) This now means that the word James is stored in student name. You can even print it to the screen by doing. Print (Studentname).

Using Variables You can do the same with numbers, for example: Print (Number3)

Combine variables You can do the same with numbers, for example: Using number3 you can combine your sentence with the text you stored in your variable. You could do the same with names or other values. Notice the Comma separating it.

Using Variables / Syntax Independent Task Using what you have learnt see if you can print screen and evidence the following for your teacher. You should evidence this by taking screen shots. Show a syntax error and annotate it to explain it. Show how to print text or numbers. Show how to carry out calculations with numbers. Show use of variables through either calculation or text. See if you can make a sentence with the use of two variables. Extension Leading into next weeks lesson, you will have to know about different types of variables and data types. See if you can research the types available and examples of their use. You could really extend yourself by trying some of the code…