Gavin Restifo March 1, 2019 Today: Repetition Part 2 - For Loops

Slides:



Advertisements
Similar presentations
Looping Structures: Do Loops
Advertisements

Arko Barman COSC 6335 Data Mining University of Houston.
Arrays, Slices, and more. Structs  A struct is a collection of fields  The keyword type is used to declare the type of the struct  Syntax: type Vertex.
I210 review Fall 2011, IUB. Python is High-level programming –High-level versus machine language Interpreted Language –Interpreted versus compiled 2.
5-1 Flow of Control Recitation-01/25/2008  CS 180  Department of Computer Science  Purdue University.
Case, Arrays, and Structures. Summary Slide  Case Structure –Select Case - Numeric Value Example 1 –Select Case - String Value Example  Arrays –Declaring.
Python November 18, Unit 7. So Far We can get user input We can create variables We can convert values from one type to another using functions We can.
PHYS 2020 Making Choices; Arrays. Arrays  An array is very much like a matrix.  In the C language, an array is a collection of variables, all of the.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 7: Program flow control.
Python Control of Flow.
Chapter 2 Control. "The Practice of Computing Using Python", Punch & Enbody, Copyright © 2013 Pearson Education, Inc. Repetition, quick overview.
Iteration and Simple Menus Deterministic / Non-deterministic loops and simple menus.
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.
Programming in Java Unit 4. Learning outcome:  LO2: Be able to design Java solutions  LO3: Be able to implement Java solutions Assessment criteria:
Collecting Things Together - Lists 1. We’ve seen that Python can store things in memory and retrieve, using names. Sometime we want to store a bunch of.
Control Structures By Shyam Gurram. Control Structure In this chapter we have two different types of structures. Conditional Structure Iterative Control.
1 09/20/04CS150 Introduction to Computer Science 1 Let ’ s all Repeat Together.
ㅎㅎ logical operator if if else switch while do while for Third step for Learning C++ Programming Repetition Control Structures.
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,
For loops in programming Assumes you have seen assignment statements and print statements.
Unit 2 Expressions and variables; for loops Special thanks to Roy McElmurry, John Kurkowski, Scott Shawcroft, Ryan Tucker, Paul Beck for their work. Except.
CS105 Computer Programming PYTHON (based on CS 11 Python track: lecture 1, CALTECH)
Week 2 expressions, variables, for loops Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where otherwise.
Week 2 expressions, variables, for loops Special thanks to Scott Shawcroft, Ryan Tucker, Paul Beck, Hélène Martin, Kim Todd, John Kurkowski, and Marty.
ActionScript: For Loops, While Loops, Concatenation and Arrays MMP 220 Multimedia Programming This material was prepared for students in MMP220 Multimedia.
Loops CS 103 February 13, 2009 Author: Nate Hamm.
Attitude A simple recipe for success: Attitude A simple recipe for success: When you do an assignment - make sure you give it your best shot.
Python Basics  Functions  Loops  Recursion. Built-in functions >>> type (32) >>> int(‘32’) 32  From math >>>import math >>> degrees = 45 >>> radians.
CRE Programming Club - Class 4 Robert Eckstein and Robert Heard.
Introduction to Computing Using Python Repetition: the for loop  Execution control structures  for loop – iterating over a sequence  range() function.
Today… The for loop. Introducing the Turtle! Loops and Drawing. Winter 2016CISC101 - Prof. McLeod1.
Computer Program Flow Control structures determine the order of instruction execution: 1. sequential, where instructions are executed in order 2. conditional,
Python Flow of Control CS 4320, SPRING Iteration The ‘for’ loop is good for stepping through lists The code below will print each element in the.
Trace Tables In today’s lesson we will look at:
Loops in Java.
Scratch: iteration / repetition / loops
Naming Hurricanes_Atlantic Basin
Transition to Code Upsorn Praphamontripong CS 1110
Repetition: the for loop
Starter Write a program that asks the user if it is raining today.
Chapter 5 Structures.
Nate Brunelle Today: PyCharm
CMSC201 Computer Science I for Majors Lecture 12 – Tuples
Nate Brunelle Today: Repetition, Repetition
Unit 3 - The while Loop - Extending the Vic class - Examples
CISC101 Reminders Quiz 1 grading underway Next Quiz, next week.
CISC101 Reminders Quiz 2 this week.
LabVIEW.
Nate Brunelle Today: Turtles
Winter 2019 CISC101 2/17/2019 CISC101 Reminders
Looping III (do … while statement)
Let’s all Repeat Together
Nate Brunelle Today: Dictionaries
Loops.
Collections and iterators
CS1110 Today: collections.
A LESSON IN LOOPING What is a loop?
Bryan Burlingame 6 March 2019
CISC101 Reminders Assignment 2 due today.
Taking Notes WRITE ALL OF THIS DOWN!.
Introduction to Computer Science
Looping and Multiple Forms TEST REVIEW
Repetition: the for loop
Nate Brunelle Today: Style, Collections
Collections and iterators
CMPT 120 Lecture 10 – Unit 2 – Cryptography and Encryption –
How to allow the program to know when to stop a loop.
Scratch 7B IT 1.
Tuple.
Presentation transcript:

Gavin Restifo March 1, 2019 Today: Repetition Part 2 - For Loops CS 1110 Gavin Restifo March 1, 2019 Today: Repetition Part 2 - For Loops

Last time While loops Strategies for repetitive code Needs 3 things Condition Something to be repeated Adjust the condition Strategies for repetitive code Top down Start with the loop Bottom up Start with everything else and repeat

Today: For loops Similar to while Does not require a condition Instead requires a collection Almost everything you can do with while you can do with for What might you not be able to do with for? Keywords: for in

Syntax for something in collection: # Repeat this code For Something Iterate through whatever you give it Something Assigned in the loop In Specifies the set of iteration Collection Whatever we want to loop through

Collections (so far) Strings Ranges Lists Tuples*