Do it now activity Correct the 8 syntax errors: Age = input(“How old are you?” If age = 10 Print(You are 10”) else: print(“You are not 10”)

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 5 Selection Statements Animated Version.
Chapter 4 - Control Statements
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 5 Selection Statements.
Selection (decision) control structure Learning objective
Programming in python Lesson 2.
Overview Program flow Decision / branching / selection structures True & False in Python Comparison operators & Boolean expressions if … if … else if …
Selection Statements choice of one among several blocks of code Java supports 3 kinds of selection statements: if statement – selects one block or leaves.
Chapter 61 Flags A flag is a variable that keeps track of whether a certain situation has occurred. The data type most suited to flags is Boolean.
Making Decisions In Python
Python Control of Flow.
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.
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.
Visual C# 2005 Decision Structures. Visual C# Objectives Understand decision making Learn how to make decisions using the if statement Learn how.
Chapter 4: Making Decisions. Understanding Logic-Planning Tools and Decision Making Pseudocode – A tool that helps programmers plan a program’s logic.
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.
1 2.2 Selection Logical Operators. 2 Learning Objectives Explain how the logical operator AND Boolean statements works.
B065: PROGRAMMING OPERATORS AND SELECTION 2. Starter  What do each of the following mean? Write an example of how each could be used. Symbol = <
1. We’ve learned that our programs are read by the compiler in order, from top to bottom, just as they are written The order of statement execution is.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
26/10/ Selection Nested If structures & Complex Multiple Conditions.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
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.
Python Mini-Course University of Oklahoma Department of Psychology Day 2 – Lesson 7 Conditionals and Loops 4/18/09 Python Mini-Course: Day 2 - Lesson 7.
Programming with Microsoft Visual Basic th Edition
Decision Making CMSC 201. Overview Today we will learn about: Boolean expressions Decision making.
1 Week 5 More on the Selection Structure. 2 Nested, If/ElseIf/Else, and Case Selection Structures Lesson A Objectives After completing this lesson, you.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
8. DECISION STRUCTURES Rocky K. C. Chang October 18, 2015 (Adapted from John Zelle’s slides)
Decision Making CMSC 201 Chang (rev ).
The If Statement There are no switch statements in Python. You need to use just if statements. There are no switch statements in Python. You need to use.
3.1.3 Program Flow control Structured programming – SELECTION in greater detail.
Python Lesson 2.
GCSE Computing#BristolMet Session Objectives #23 MUST understand what is meant by the programming term iteration SHOULD describe methods of looping used.
Control Structures If Else Statement. S E S Q C E N U …consecutive steps (or groups of steps) processed one after another in the order that they arise.
Control Flow (Python) Dr. José M. Reyes Álamo. 2 Control Flow Sequential statements Decision statements Repetition statements (loops)
Chapter Five More on the Selection Structure Programming with Microsoft Visual Basic th Edition.
PROGRAMMING In Lesson 6. RECAP  Discuss with the person next to you...  what you have enjoyed about python programming  What you have found difficult.
Control Flow (Python) Dr. José M. Reyes Álamo. 2 Control Flow Sequential statements Decision statements Repetition statements (loops)
PYTHON IF-STATEMENTS. What you know If something is true, then something happens Example If you heat water to 100 degrees Celsius, then it boils If it.
PYTHON PROGRAMMING Year 9. Objective and Outcome Teaching Objective Today we will look at conditional statements in order to understand how programs can.
Control Flow (Python) Dr. José M. Reyes Álamo.
Lesson Objectives Aims To be able to write an algorithm in Pseudo Code
Do it now activity Last lesson we used Flowol to create a solution to a problem a computer could solve. Identify what each symbol does:
Selection and Python Syntax
C-Language Lecture By B.S.S.Tejesh, S.Neeraja
Javascript Conditionals.
Do it now activity Green pen activity in books.
Lesson Outcomes Be able to identify differentiate between types of error in programs Be able to interpret error messages and identify, locate.
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
CSc 110, Autumn 2016 Lecture 9: input; if/else
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Chapter 8: More on the Repetition Structure
Visual Basic – Decision Statements
Comparing Strings Strings can be compared using the == and != operators String comparisons are case sensitive Strings can be compared using >, =, and.
CS 1111 Introduction to Programming Spring 2019
Adding Intelligence Check for the presence or absence of a condition in the environment Take the appropriate actions Involves making a choice (to do or.
Topics The if Statement The if-else Statement Comparing Strings
PYTHON: BUILDING BLOCKS Sequencing & Selection
Boolean Expressions to Make Comparisons
CS2011 Introduction to Programming I Selections (I)
Programming In Lesson 4.
Do it now activity Go to: ASandA2ict.weebly.com
Do it now activity Log onto the computer.
Hint idea 2 Split into shorter tasks like this.
Creating your game.
CMPT 120 Lecture 13 – Unit 2 – Cryptography and Encryption –
Creating behaviours: MOVEMENT
Presentation transcript:

Do it now activity Correct the 8 syntax errors: Age = input(“How old are you?” If age = 10 Print(You are 10”) else: print(“You are not 10”)

Homework Pseudocode You will be given a home learning sheet to complete for homework this term. Complete challenge 2 Your teacher will explain what you need to do. Due:

Understand how to use nested if statements in your programming

1.Use nested if, elif, else function 2.Correctly identify the flow of data through a program

ALL (Level 4) I know the difference between, and appropriately I can use if and if, then and else statements. MOST (Level 5) I can use a range of operators and expressions e.g. Boolean, and applies them in the context of program control. SOME (Level 6) I can use nested selection statements. By the end of this lesson you will be able to....

1.Use nested if, elif, else function 2.Correctly identify the flow of data through a program Nested Selection statement If Else Elif Condition Boolean Negation New Learning Can you identify who did the crime?

New Learning Download and investigate the program called ‘nested selection statements’ from   Term 4  Lesson 5 1.Use nested if, elif, else function 2.Correctly identify the flow of data through a program Nested Selection statement If Else Elif Condition Boolean Negation

Independent task Can you adapt the code to: Check if the user has entered a correct username and password? Username = Dsmith Password = teapot Can you use negation for this? 1.Use nested if, elif, else function 2.Correctly identify the flow of data through a program Nested Selection statement If Else Elif Condition Boolean Negation

Independent task You can use and to check if more than one statement is true ie if name == “Dave” and age == 12: Can you use this in your program? 1.Use nested if, elif, else function 2.Correctly identify the flow of data through a program Nested Selection statement If Else Elif Condition Boolean Negation

Copy Keyword Nesting: When control structures are inserted within other control structures. Copy Keyword 1.Use nested if, elif, else function 2.Correctly identify the flow of data through a program Nested Selection statement If Else Elif Condition Boolean Negation

1.Why did you need to create a nested selection statement for this task? 2.Why did you need to create an else statement that was outside of the nesting? Talk task 1.Use nested if, elif, else function 2.Correctly identify the flow of data through a program Nested Selection statement If Else Elif Condition Boolean Negation

Plenary Three stars and a wish. 1.Use nested if, elif, else function 2.Correctly identify the flow of data through a program Nested Selection statement If Else Elif Condition Boolean Negation

ALL (Level 4) Explain the difference between, and appropriately I can use if and if, then and else statements. MOST (Level 5) Use a range of operators and expressions e.g. Boolean, and applies them in the context of program control. SOME (Level 6) Use nested selection statements. I can....