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.

Slides:



Advertisements
Similar presentations
Python - Selection Starter
Advertisements

Solving Equations A Solution
MONTEGO BAY HIGH SCHOOL INFORMATION TECHNOLOGY THE EXCEL IF FUNCTION.
Programming in python Lesson 2.
Solving Equations with the Variable on Both Sides Objectives: to solve equations with the variable on both sides.
Python Magic Select a Lesson: Why Learn to Code? Basic Python Syntax
S.Gast MIS Fall Solving Variable Equations A lesson by Mrs. Gast.
Ch 3.3 – Solving Multi-Step Equations
From Scratch to Python Learn to program like the big boys / girls!
Python Programming Introduction to programming using python.
Python – Making Decisions Lecture 02. Control Structures A program that only has one flow is useful but limited. We can use if statements to make these.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
CS 330 Programming Languages 11 / 21 / 2006 Instructor: Michael Eckmann.
Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website.
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.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #005 (April somthin, 2015)
1.4 Solving Equations ●A variable is a letter which represents an unknown number. Any letter can be used as a variable. ●An algebraic expression contains.
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 5: Working with Formulas and Functions Logical and 3D Formulas.
Scratch Programming Lesson 4 Question asking and answering.
Program #2 Cell Phone Usage ….Let’s start with understanding the problem!
The Properties of: By: Robert S..  There are many different properties of algebra, and in this slide show I will go over just a few.  Some of these.
Python Programming Using Variables and input. Objectives We’re learning to use basic knowledge of variables combined with user input. Outcomes Continue.
Python uses boolean variables to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Assignment statement: Assigns a value to a variable Variable must appear on the left side, value on the right side of the assignment operator Right side.
One step equations Add Subtract Multiply Divide  When we solve an equation, our goal is to isolate our variable by using our inverse operations.  What.
One-Step Equations I can show that solving an equation leads to finding the value that makes the equation true.
Conditionals Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignment? zPass by value limitations.
Multi-Step Equations This lesson will look at:
NAME Python Programming Workbook Select a Lesson:
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.
A Level Computing#BristolMet Session Objectives#U2 S3 MUST use/read programme flow charts accurately SHOULD adapt the calculator programme to include a.
Python Lesson 2.
Solve one step equations. You can add the same amount to both sides of an equation and the statement will remain true = = 9 x = y +
Have you ever seen these? NumberDateDescription of TransactionDebit (-)Credit (+)Balance Previous balance ? Deposit10-13 Direct Deposit- paycheck.
2.2 Solving Two- Step Equations. Solving Two Steps Equations 1. Use the Addition or Subtraction Property of Equality to get the term with a variable on.
Lesson 8.1. » A statement where two mathematical expressions are. » Think of an equation as a balance scale or teeter-totter. The left side must always.
PROGRAMMING In Lesson 6. RECAP  Discuss with the person next to you...  what you have enjoyed about python programming  What you have found difficult.
Programming In Python. Starter Using the internet… Find what a programming language is.
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.
Solving Algebraic Equations. Equality 3 = = = 7 For what value of x is: x + 4 = 7 true?
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
PYTHON PROGRAMMING Year 9. Objective and Outcome Teaching Objective Today we will look at conditional statements in order to understand how programs can.
CHAPTER 4 DECISIONS & LOOPS
INEQUALITIES.
Solving 2-Step Variable Equations
Solving EQUATIONS Lesson #2 created by: ms. Guarnieri
Warm up 11/1/ X ÷ 40.
Solving 1-Step Integer Equations
Solving 2-Step Variable Equations
Solving 2-Step Variable Equations
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Problem-Solving Steps Solve Problem-Solving Steps Solve
LO To assess my understanding of number skills
Ch 3.3 – Solving Multi-Step Equations
Programming In Lesson 3.
Learning Outcomes –Lesson 4
EQ: How do I solve an equation in one variable?
Solving Two-Step Equations Lesson 2-2 Learning goal.
Solving 2-Step Variable Equations
PYTHON: BUILDING BLOCKS Sequencing & Selection
Relational Operators.
Programming In Lesson 4.
Introduction to Python
Introduction to Python programming for KS3
Solving 2-Step Variable Equations
Solving Equations by 2-1 Adding or Subtracting Warm Up
Solving Linear Equations
Presentation transcript:

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 if statement Include commenting and syntax Continue the use of parameters

Function - Starter Write two functions: 1.Ask for input of two numbers and add them together. 2.Ask for your name and age using parameters.

Time to call the operator? Operators Before you can start learning about an IF STATEMENT you will need to know about operators. Operators help us compare or check values. We can add, divide and even use mathematical equations such as ‘to the power of’. The next slides will explain some of these.

Operators What you may need in an IF STATEMENT Most Used +Add to -Subtract *Multiply /Divide Comparisons != Not equal to > Greater than < Less than >= Greater than or equal to <=Less than or equal to & Logical and

What is an IF STATEMENT? An IF statement checks to see if a statement is true or false and then does one of two things depending on the result. It looks like this in Excel. =IF(Condition check,Do this if true, Do this if false) We’re not using Excel, we’re using python…. Lets break this down.

Building the If Statement? For this task, we’re going to start off by setting up a function and testing a name. Use this code.

Run the code? This is what should happen! See if you can write a Function with parameters in the statement. You have 5 minutes to complete this.

What Else? Have a look at this script…. Spot the difference from your previous code.

Lets get to work! You’ve seen how to build an if statement using text input. Lets build some functions with parameters and If Functions. Here is an example of one: - Spot anything new?

Tasks ? Write the following functions to use ifstatements, parameters and operators: 1.Test a number to see if it’s greater than or equal to 10 and display a message. 2.Test a name to see if it’s equal to ‘robert’ and say hello to that person. 3.Write a multiple if statemented function which includes a test for 2 different peoples names. 4.Extension – See if you can figure out how to test two different numbers within the function at the same time. Answer in Teacher Notes

Plenary Self Assessment: Your teacher has issued you with a self assessment sheet. You will have today’s objects and outcomes on it. Task Comment on the lesson. Talk about the positive experience you have had and talk about things you need a little more help on. If you managed to get onto the extension tasks, what have you found out?