GCSE Computing: Programming www.computerscienceuk.com GCSE Programming Remembering Python.

Slides:



Advertisements
Similar presentations
VARIABLES AND DEBUGGING Beginning Programming. Assignment Statements  Used to hold values in a variable  Calculates a result and stores it in a variable.
Advertisements

Python November 14, Unit 7. Python Hello world, in class.
Mark Dixon, SoCCE SOFT 131Page 1 05 – Information Processing: Data-types, Variables, Operators & Functions.
Computing Theory: BBC Basic Coding Year 11. Lesson Objective You will: Be able to define what BBC basic is Be able to annotate BBC basic code Be able.
Sequencing Miss Regan. Blood Hound  Does anyone know what the Bloodhound project is?  Video 1 Video 1  Video 2 Video 2  Link to website Link to website.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
Storing data Getting data out Data types Ruby as a foundation Program Variables Click icon to hear comments (the download may take a minute)
The Scratch Calculator You are all going to be real computer programmers!!!
From Scratch to Python Learn to program like the big boys / girls!
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
An Introduction to Textual Programming
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
An Overview of Programming in Python CSC 161: The Art of Programming Prof. Henry Kautz 9/9/2009 Slides stolen shamelessly from Dr. Mark Goadrich, Centenary.
Agenda  Commenting  Inputting Data from Keyboard (scanf)  Arithmetic Operators  ( ) * / + - %  Order of Operations  Mixing Different Numeric Data.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Learning the skills for programming Advanced Visual Programming.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Lesson 4 Using Variables in Python – Creating a Simple ChatBot Program.
Lesson 6. Python 3.3 Objectives. In this lesson students will learn how to output data to the screen and request input from the user. Students will also.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
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.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Debugging, Escape Command, More Math. It’s your birthday!  Write a program that asks the user for their name and their age.  Figure out what their birth.
COIT29222 Structured Programming 1 COIT29222-Structured Programming Lecture Week 02  Reading: Textbook(4 th Ed.), Chapter 2 Textbook (6 th Ed.), Chapters.
Using variable Variables are used to store values.
Data Types and Conversions, Input from the Keyboard CS303E: Elements of Computers and Programming.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
GCSE Computing: Programming GCSE Programming Remembering Python.
NAME Python Programming Workbook Select a Lesson:
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Data Types and Conversions, Input from the Keyboard If you can't write it down in English, you can't code it. -- Peter Halpern If you lie to the computer,
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.
Introduction to Programming Python Lab 5: Strings and Output 05 February PythonLab5 lecture slides.ppt Ping Brennan
COMPUTER PROGRAMMING Year 9 – Unit 9.04 Week 3. Open the Python INTERPRETER Can you use the interpreter to solve these maths problems? 156 add
Learning Objective To be able to… Understand flow chart symbols Complete and correct flow chart algorithms Create a program based on a flow chart.
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.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Input, Output and Variables GCSE Computer Science – Python.
GCSE COMPUTER SCIENCE Practical Programming using Python Lesson 4 - Selection.
Numbers and arithmetic
GCSE COMPUTER SCIENCE Practical Programming using Python
what is computer programming?
Numbers and Arithmetic
Lesson 1 - Sequencing.
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.
Data Types and Conversions, Input from the Keyboard
Formatting Output.
Lesson 1 An Introduction
IF statements.
Variables, Expressions, and IO
Lesson 3 - Repetition.
To write a Python program, you first need to open Pyscripter
Computational Thinking
Computational Thinking
Iterations Programming Condition Controlled Loops (WHILE Loop)
Print slides for students reference
Language Basics.
Introduction to TouchDevelop
Feedback Pace Different ideas for delivery Debugging strategies
Inputs and Variables Programming Guides.
Introduction to Python
Data Types and Maths Programming Guides.
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.
GCSE Computing Mini Assignment.
Presentation transcript:

GCSE Computing: Programming GCSE Programming Remembering Python

GCSE Computing: Programming Activity 1 What do you see? What do you think is happening? What do you imagine could happen with this program? 3 mins

GCSE Computing: Programming Remembering how to program in Python How do we output text onto the screen? print (“Hello World”) Demonstration Time! Learning Objectives: Remember the following Programming Skills: - Outputting text to the screen -Storing inputted data into a variable -Working with numbers -Making Decisions (IF-ELSE)

GCSE Computing: Programming Remembering how to program in Python On your whiteboards write the code to display a message of your choice. Lets mark each others… print command word? Brackets used? Speech marks around text? Learning Objectives: Remember the following Programming Skills: - Outputting text to the screen -Storing inputted data into a variable -Working with numbers -Making Decisions (IF-ELSE)

GCSE Computing: Programming Remembering how to program in Python Learning Objectives: Remember the following Programming Skills: -Outputting text to the screen - Storing inputted data into a variable -Working with numbers -Making Decisions (IF-ELSE) How do we ask the user for an input and store what they type in? variable = input (“What is your name?”) Demonstration Time!

GCSE Computing: Programming Remembering how to program in Python Learning Objectives: Remember the following Programming Skills: -Outputting text to the screen - Storing inputted data into a variable -Working with numbers -Making Decisions (IF-ELSE) On your whiteboards write the code which displays the question “what is your age?” and stores the number that is to be entered in a variable called “age”. Lets mark each others… age = variable assignment? input(“what is your age?”) command?

GCSE Computing: Programming Remembering how to program in Python Learning Objectives: Remember the following Programming Skills: -Outputting text to the screen - Storing inputted data into a variable -Working with numbers -Making Decisions (IF-ELSE) Data Types and Arithmetic What different types of data are there? String This means any keyboard character (letters, numbers symbols) Integer This means any whole number. If the computer knows the data is an integer it can do maths with the data Real This means any decimal (fractional) number

GCSE Computing: Programming The need to tell the computer what data type the variable will store Computers store values in variables In order for the computer to understand our inputs, it needs to know what type of data our input is. If a variable is to hold a word, we must tell the computer that the variable is to contain a string. If a variable is to hold a whole number, we must tell the computer that the variable is to contain an integer – so it can do calculations. If we don’t do this the program will not work. Variable Mr Wickins 30 CSUK

GCSE Computing: Programming Doing Arithmetic If we want our program to work with numbers we must tell the program that certain variables will hold numbers. When we input a number into our program var1 = input(“please enter a number”) python automatically sets the variable as a string (a word, for example twenty instead of 20 ) If we want to do maths with the ‘inputs’ we need to tell the computer that it’s a number (integer)

GCSE Computing: Programming Converting Data Types To do this we need to convert the variable to an ‘integer’ or ‘real’ data type. Above you can see that two numbers have been entered and stored in variables num1 and num2. As python stores inputs as strings we need to convert these variables into integers.

GCSE Computing: Programming What’s going on? Variable 29 Variable Twenty Nine 29 Mr Int. Num1 Twenty Nine I’m telling the computer that this variable contains a number not a word!

GCSE Computing: Programming Once they have been converted we’re ready to do maths! Num1 Five Num2 Nine Num1 Five Num2 Nine Answer 14 Answer 14

GCSE Computing: Programming Remembering how to program in Python Learning Objectives: Remember the following Programming Skills: -Outputting text to the screen - Storing inputted data into a variable -Working with numbers -Making Decisions (IF-ELSE) On your whiteboards write the code which will ask the user for 2 numbers, convert them to integers and then multiply them together before displaying the result. Lets mark each others… number[x] = input(“Enter a number”) X2? number[x] = int(“number[x]”) X2? answer = number1 * number 2 print(answer)

GCSE Computing: Programming Tasks Write a program that: 1)Displays a message of your choice to the screen 2)Asks the user for their favourite colour and then comments on the colour entered (for example, “**colour entered**, is a nice colour!” 3)Asks the user for their age and then displays what their age will be in 50 years. 4)Asks the user for the dimensions for a box and then works out its volume 5)Asks the user for their weekly pocket money, weekly phone bill, money spent on food each week and money spent on seeing friends each week. The program is to then display how much pocket money will be left when the week is over. #comment on your code!

GCSE Computing: Programming Commenting # Starting a line with a hash will turn your text into a comment. (It will be ignored by the program)

GCSE Computing: Programming Extension Read up on IF-ELSE statements Watch the video on the website Begin trying to solve / program the extension task (next slide)

GCSE Computing: Programming Extension and Next Week’s Task Guessing game Description The computer will pick a number between 1 and 100. (You can choose any high number you want.) The purpose of the game is to guess the number the computer picked in as few guesses as possible. Input The user will enter his or her guess until the correct number is guessed. Output The program will keep asking the user to guess until he or she gets the number correct. Then the program will print how many guesses were required. Sample session Time to play a guessing game. Enter a number between 1 and 100: 62 Too high. Try again: 32 Too low. Try again: 51 Too low. Try again: 56 Congratulations! You got it in 4 guesses.