Programming Techniques

Slides:



Advertisements
Similar presentations
Early Math Counting & Skip Counting. Early Math “0” – see the number Counting & Skip Counting.
Advertisements

CMPS 1371 Introduction to Computing for Engineers
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Looping Exercises Deciding Which Loop to Use At this.
Control Structures Session 03 Mata kuliah: M0874 – Programming II Tahun: 2010.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
1 Loops. 2 Topics The while Loop Program Versatility Sentinel Values and Priming Reads Checking User Input Using a while Loop Counter-Controlled (Definite)
Chapter 5 Loops. Overview u Loop Statement Syntax  Loop Statement Structure: while, for, do-while u Count-Controlled Loops u Nested Loops u Loop Testing.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
CMSC 104, Lecture 171 More Loops Topics l Counter-Controlled (Definite) Repetition l Event-Controlled (Indefinite) Repetition l for Loops l do-while Loops.
CMP-MX21: Lecture 5 Repetitions Steve Hordley. Overview 1. Repetition using the do-while construct 2. Repetition using the while construct 3. Repetition.
CMSC 104, Version 9/011 More Loops Topics Counter-Controlled (Definite) Repetition Event-Controlled (Indefinite) Repetition for Loops do-while Loops Choosing.
CSC 1051 M.A. Papalaskari, Villanova University Repetition CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing.
PYTHON WHILE LOOPS. What you know While something is true, repeat your action(s) Example: While you are not facing a wall, walk forward While you are.
Next Week… Quiz 2 next week: –All Python –Up to this Friday’s lecture: Expressions Console I/O Conditionals while Loops Assignment 2 (due Feb. 12) topics:
Loop. 3.1Introduction to Repetition Structures Loop – a block of code that, under certain conditions will be executed repeatedly. Do Prompt for and input.
Chapter 4: Looping Structures LECTURER : MRS ROHANI HASSAN
Repetitive Structures
Chapter 6: Loops.
REPETITION CONTROL STRUCTURE
Objectives – Multiplication & Division
Repetition Structures Chapter 9
C++ Programming: CS150 For.
Control Statements: Part 2
Chapter 5: Control Structure
Chapter 5: Repetition Structures
CiS 260: App Dev I Chapter 4: Control Structures II.
Control Structures Combine individual statements into a single logical unit with one entry point and one exit point. Used to regulate the flow of execution.
2008/10/22: Lecture 12 CMSC 104, Section 0101 John Y. Park
Starter Write a program that asks the user if it is raining today.
Lecture 4B More Repetition Richard Gesick
Control Structures Combine individual statements into a single logical unit with one entry point and one exit point. Used to regulate the flow of execution.
Chapter 4 Control structures and Loops
CISC101 Reminders Quiz 1 grading underway Next Quiz, next week.
Chapter 6 Repetition Objectives ❏ To understand basic loop concepts:
Control Structure Senior Lecturer
Alice in Action with Java
Structured Program Development in C
2008/10/22: Lecture 12 CMSC 104, Section 0101 John Y. Park
Chapter 6: Repetition Structures
Chapter 5: Repetition Structures
Chapter 4 Loops While loop The for loop do… while break and continue
Iteration: Beyond the Basic PERFORM
LOOPS BY: LAUREN & ROMEO.
Chapter 5 Loops.
Chapter 5 Loops Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.
CS2011 Introduction to Programming I Loop Statements (II)
Lab5 PROGRAMMING 1 Loop chapter4.
Module 4 Loops and Repetition 2/1/2019 CSE 1321 Module 4.
UMBC CMSC 104 – Section 01, Fall 2016
Building Java Programs
More Loops Topics Counter-Controlled (Definite) Repetition
Chapter 4: Repetition Structures: Looping
More Loops Topics Counter-Controlled (Definite) Repetition
Introduction to Computer Science
CISC101 Reminders Quiz 1 marking underway.
Rate of Change The rate of change is the change in y-values over the change in x-values.
More Loops Topics Counter-Controlled (Definite) Repetition
Loops.
Building Java Programs
More Loops Topics Counter-Controlled (Definite) Repetition
More Loops Topics Counter-Controlled (Definite) Repetition
Python While Loops.
More Loops Topics Counter-Controlled (Definite) Repetition
Programming Fundamental
More Loops Topics Counter-Controlled (Definite) Repetition
Module 4 Loops and Repetition 9/19/2019 CSE 1321 Module 4.
Programming Techniques
Programming Techniques
Programming Techniques
Presentation transcript:

Programming Techniques Keywords While, For, Counter, Condition, Boolean, Iteration, Break, Nested iteration, Exit condition, Stepping, Increment/decrement, Larger/Greater, Greater or Equal, Smaller or Equal Programming Techniques Iteration

BEGINNER: Recognise the two common types of iteration. Big Picture Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Computers are good at performing repetitive tasks without human supervision. For example, we can ask a computer to count up to 20,000 (or count down), additionally, we can ask the computer to count while skipping every 2nd or third number and display these numbers doubled on the screen. What repetitive tasks can you name in your life that you wish would just be done automatically by a helper robot? How will the robot know when to stop/task is complete? Starter activity

Looping in a Low Level Language Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

FOR COUNTER (Counter-controlled) Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

BEGINNER: Recognise the two common types of iteration. Exiting FOR Loop Early Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

FOR COUNTER (Counter-controlled) Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

Counter used in calculations Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

Counter used in calculations Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

Loops and Prime Numbers Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Try out this code: Starter activity How does the for loop work in this example?

BEGINNER: Recognise the two common types of iteration. Stepping Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

Backward-flowing Iteration Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

WHILE (Condition-controlled) Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

Conditional Loops for Validation Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

BEGINNER: Recognise the two common types of iteration. While for Searching Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

BEGINNER: Recognise the two common types of iteration. While for Searching Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

BEGINNER: Recognise the two common types of iteration. Test out this code: Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Starter activity

BEGINNER: Recognise the two common types of iteration. Task Objectives BEGINNER: Recognise the two common types of iteration. ADVANCED: Be able to rewrite any FOR loop as a WHILE loop, and some WHILE loops as FOR loops. EXPERT: Understand when to use iteration, including nested iteration, stepping and backward-flowing iteration. Write a program that uses nested iteration to output a 4 x 4 times table. Starter activity