Looping and Random Numbers

Slides:



Advertisements
Similar presentations
December 11, 2013 Algebra and 8 th Grade Kimberly Tarnowieckyi Last time together October 23. Think back over your lessons form October 24 to December.
Advertisements

Top-Down Design CSC 161: The Art of Programming Prof. Henry Kautz 9/16/2009.
Scripts and Flow Control. Scripts So far we have been entering commands directly into the command line But there is a better way Script files (and functions)
Programming Concepts Chapter 3.
Computational Thinking – Lesson 3 Lesson Objective To be able to construct an algorithm and flowchart for a given problem.
Moving Sprites in Scratch Exploring Computer Science – Lesson 4-4.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Applying the Distributive Property Lesson Application Problem O A parking structure has 10 levels. There are 3 cards parked on each level. How many.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
1 Overview of Programming Principles of Computers.
Expressing Algorithms as Flowcharts and Pseudocode
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
JavaScript: API’s, Parameters and Creating Functions with Parameters
Encryption with Keys and Passwords
FOP: While Loops.
Mathematical Practice Standards
AP CSP: Creating Functions & Top-Down Design
The Need for Algorithms
JavaScript/ App Lab Programming:
CST 1101 Problem Solving Using Computers
Canvas and Arrays in Apps
CS 241 – Computer Programming II Lab
Algorithms and Problem Solving
Lesson 1-15 AP Computer Science Principles
APIs and Function Parameters
Introduction to Event-Driven Programming
How can we tell which portions are the same amount?
Applying the Distributive Property
Function Rules EQ: How do you write algebraic expressions? I will write algebraic expressions.
Algorithms Detour - Shortest Path
Creating Functions with Parameters
Functions and Top-Down Design
Lesson 5-2 AP Computer Science Principles
Creativity in Algorithms
Lesson 5-15 AP Computer Science Principles
UNIT 3 – LESSON 5 Creating Functions.
Exploring Computer Science Lesson 4-10 – Part 1
Software Design and Development
Building an App: Color Sleuth
The Need for Programming Languages
AP Computer Science Principals Course Importance and Overview
Strategies for Problem Solving
Strategies for Problem Solving
Basics of Computer Programming
Sending Bits on the Internet
Foundations of Programming: Introduction to Programming
Compound Conditional Logic
Exploring Computer Science Lesson 6-2
Lesson 15: Processing Arrays
UNIT 3 CHAPTER 1 LESSON 4 Using Simple Commands.
Creating Functions with Parameters
Looping and Random Numbers
Unit 3: Lesson 9-Looping and Random Numbers
Unit 3: Lesson 6 & 7- Functions and Top-Down Design / APIs and Function Parameters Day 27.
Open on the student drive
Moving Sprites in Scratch
The animated version (teaching method 2) Chalk v.s. The Computer
Algorithms and Problem Solving
Mod 2 Lesson 2 Repeating with loops
COMPUTATIONAL THINKING COMPUTATIONAL THINKING IN PROGRAMMING
AP Computer Science Principals Course Importance and Overview
U3L1 The Need For Programming
Vocabulary Algorithm - A precise sequence of instructions for processes that can be executed by a computer Low level programming language: A programming.
Pair work – Do you want to change seats??
EXPLICIT RULES: INPUT-OUTPUT FORMULAS
Dry Run Fix it Write a program
U3L8 Creating Functions with Parameters
Simplifying Expressions
Exploring Computer Science Lesson 4-10 – Part 1
Presentation transcript:

Looping and Random Numbers Lesson 3-7 AP Computer Science Principles

Objectives Students will be able to: Use a loop in a program to simplify the expression of repeated tasks. Identify appropriate situations in a program for using a loop. Use random values within a loop to repeat code that behaves differently each time it is executed.

Looping As we have developed as programmers, we have focused on the process of breaking down large tasks into smaller pieces and assigning each piece a function. When we break down a large task, often we will find that some portion of the task needs to be repeated many times. As programmers, we would simply call the same function many times. This might work if we need to call the same function five times, but if that function needs to be run 1,000,000 times, we’ll need a better solution.

Looping Today we’ll be exploring how a programming construct called a loop solves this problem by allowing us to repeat a set of commands many times. We’ll also practice looping through commands many times with random input, therefore giving us many instances of random output. Just as we saw last time, this will be both useful for testing our code and also for developing more variety in our drawings

Video

Stage 9 Complete Stage 9.

Journal Develop a rule for deciding when to use a loop within a program. Try to make connections to Top-Down Design in your response. Below your rule, write a couple sentences justifying your rule.