Introduction to Computer Science

Slides:



Advertisements
Similar presentations
Chapter 4: Control Structures I (Selection)
Advertisements

Looping Structures: Do Loops
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
CS0004: Introduction to Programming Repetition – Do Loops.
CHAPTER 5: LOOP STRUCTURES Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
Iteration Statements Lather Rinse Repeat. Three Iteration Statements For Each For Next While.
Chapter 2: Algorithm Discovery and Design
Repetition Statements repeat block of code until a condition is satisfied also called loops Java supports 3 kinds of loops: while statement – repeats a.
INTRODUCTION TO PYTHON PART 3 - LOOPS AND CONDITIONAL LOGIC CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
COMPE 111 Introduction to Computer Engineering Programming in Python Atılım University
COMP 1001: Introduction to Computers for Arts and Social Sciences Programming in Scratch Monday, May 16, 2011.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 5 Control Structures: Loops 5.1 The while Loop The while loop is probably the most frequently used loop construct. The while loop is a conditional.
CPS120 Introduction to Computer Science Iteration (Looping)
COMPUTER PROGRAMMING. Iteration structures (loops) There may be a situation when you need to execute a block of code several number of times. In general,
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 5: Introduction to C: More Control Flow.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
CPS120 Introduction to Computer Science Iteration (Looping)
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
Repetition Intro to Computer Science CS1510 Dr. Sarah Diesburg.
Chapter 7: Repetition Structure (Loop) Department of Computer Science Foundation Year Program Umm Alqura University, Makkah Computer Programming Skills.
P ROGRAMMING L OGIC GWDA123 Sharon Kaitner, M.Ed. Winter 2015: Week 2.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Control Structures WHILE Statement Looping. S E Q C E N U E REPITITION …a step or sequence of steps that are repeated until some condition is satisfied.
Loops causes program to execute the certain block of code repeatedly until some conditions are satisfied. Suppose you want to execute some code/s 10 times.
Computer Programming -1-
CS 106 Introduction to Computer Science I 02 / 15 / 2008 Instructor: Michael Eckmann.
Chapter 6: Loops.
Chapter 4 Repetition Statements (loops)
Scratch: iteration / repetition / loops
Warm-up Program Use the same method as your first fortune cookie project and write a program that reads in a string from the user and, at random, will.
Transition to Code Upsorn Praphamontripong CS 1110
Think What will be the output?
Chapter 5: Repetition Structures
CiS 260: App Dev I Chapter 4: Control Structures II.
Repetition: the for loop
Chapter 5 Structures.
The Linux Command Line Chapter 29
LESSON 11 – WHILE LOOPS UNIT 5 – 1/10/17.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Chapter 4 LOOPS © Bobby Hoggard, Department of Computer Science, East Carolina University / These slides may not be used or duplicated without permission.
Loop Control Structure.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Introduction to pseudocode
Chapter 6: Repetition Structures
Chapter 5: Repetition Structures
Repetition Structures
Iteration Implemented through loop constructs (e.g., in C++)
LabVIEW.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Programs as Directions
Computer Science Core Concepts
A LESSON IN LOOPING What is a loop?
FLUENCY WITH INFORMATION TECNOLOGY
Introduction to Computer Science
Repetition Statements (Loops) - 2
Repetition: the for loop
Introduction to Computer Science
Statements in C Programming
Repetition Structures
Types of loops definite loop: A loop that executes a known number of times. Examples: Repeat these statements 10 times. Repeat these statements k times.
LOOPING STRUCTURE Chapter - 7 Padasalai
How to allow the program to know when to stop a loop.
Iteration – While Loops
Introduction to Python
Presentation transcript:

Introduction to Computer Science Programming with Python

Loops & Iteration Chapter 5

Loops & Iteration This is where we ask the computer to perform repetitive tasks Computers are very fast at executing tasks, so why not ask them to do repeated tasks for us Loops & Iteration are extremely significant in most programming language This is a concept in all programming languages Syntax is very similar to other programming languages Remember, if the concept is understood, it is always easy to pick up syntax and migrate to other programming languages or learn other programming languages

Next iteration Get out

Continue and Break Continue does not stop the loop, it takes you to the next iteration and skips any line that is in the loop after continue Break terminates the loop completely, and executed the next code that is outside the loop block

While Loops While loops are sort of indefinite, you can construct them cleverly While loops keeps on repeating until a condition becomes false