Nate Brunelle Today: Pseudo-Code

Slides:



Advertisements
Similar presentations
CS 1400 Course Reader Introduction. What is Programming? Designing an appropriate algorithm Coding that algorithm in a computer language.
Advertisements

Loops and Iteration Chapter 5 Python for Informatics: Exploring Information
Adapted from slides by Marie desJardins
Tell the robot exactly how to draw a square on the board.
CPS120 Introduction to Computer Science Iteration (Looping)
Chapter 1: An Introduction to Control Structures Introduction to Programming with C++ Fourth Edition.
Loops Robin Burke IT 130. Outline Announcement: Homework #6 Conditionals (review) Iteration while loop while with counter for loops.
CPS120 Introduction to Computer Science Iteration (Looping)
Problem, Problem Solving, Algorithm & Flow Charts –Part 1 Presented By Manesh T Course:101 CS 101CS Manesh T1.
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
Describing a Pattern Lesson 2-1. Patterns and sequences We often need to spot a pattern in order to predict what will happen next. In maths, the correct.
CPS Today’s topics l Algorithms and pseudocode l Notes adapted from Marti Hearst at UC Berkeley and David Smith at Georgia Tech Upcoming ä Beginning.
Introduction to Computer Science - Python CSc 2010 Spring 2011 Marco Valero.
Concepts to Curriculum Building a course to build skills.
PYTHON PROGRAMMING Year 9. Objective and Outcome Teaching Objective Today we will look at conditional statements in order to understand how programs can.
PROGRAMMING: What’s It All About?
Prime Numbers and Prime Factorization
Prime Numbers and Prime Factorization
Problem , Problem Solving, Algorithm & Flow Charts –Part 1
Writing Algebraic Expressions
Simplifying Exponential Multiplication Expressions.
Introduction To Repetition The for loop
CS161 Introduction to Computer Science
Prime Numbers and Prime Factorization
ALGORITHMS AND FLOWCHARTS
Exponent Rules.
Programming Mehdi Bukhari.
UNIT 3 – LESSON 5 Creating Functions.
Pseudocode Upsorn Praphamontripong CS 1110 Introduction to Programming
Prime Numbers and Prime Factorization
Web Programming– UFCFB Lecture 16
Writing my algorithm ? Name Symbol Flowchart use Oval
Algorithm and Ambiguity
CS 240 – Lecture 11 Pseudocode.
Sentinel logic, flags, break Taken from notes by Dr. Neil Moore
Loops CS140: Introduction to Computing 1 Savitch Chapter 4 Flow of Control: Loops 9/18/13 9/23/13.
Exponent Rules
Nate Brunelle Today: Pseudo-Code, Party
Patterns and Algebraic rules
elppa legoog erawdrah erawtfos margorp Cisab llams Apple Google
Opening Activity Complete the following problems in your spiral on your “Multiplying Positive & Negative Integers” page. Write both the expression.
Sentinel logic, flags, break Taken from notes by Dr. Neil Moore
Program Design Introduction to Computer Programming By:
Introduction to pseudocode
Nate Brunelle Today: PyCharm
Nate Brunelle Today: Repetition, A Trip To The Moon
Let’s Review -- An equation is similar to a scale. Both sides of the scale need to be equal in order for the scale to balance. Properties of equality.
Programming Fundamentals (750113) Ch1. Problem Solving
Complex Numbers.
“Teach A Level Maths” Yr1/AS Statistics
Nate Brunelle Today: Repetition, Repetition
Nate Brunelle Today: Functions again, Scope
Sequences COURSE 3 LESSON 12-1
Algorithm and Ambiguity
Patterns and Algebraic rules
Nate Brunelle Today: Turtles
Introduction to Algorithms - 1
More Repetition While and For loop variations
Prime Numbers and Prime Factorization
Flowcharts and Pseudo Code
Tonga Institute of Higher Education IT 141: Information Systems
An Introduction to Debugging
Tonga Institute of Higher Education IT 141: Information Systems
Complex Numbers.
Prime Numbers and Prime Factorization
Nate Brunelle Today: Dictionaries
Review of Previous Lesson
Prime Numbers and Prime Factorization
Software Development Techniques
Presentation transcript:

Nate Brunelle Today: Pseudo-Code CS1110 Nate Brunelle Today: Pseudo-Code

Questions?

Ambiguity Put the pot in the dishwasher When we talk to computer, we give it some instruction How to wash your hair Lather Rinse repeat

Hair washing ambiguity Don’t know when to stop What am I rinsing? Where am I lather What should I repeat? What is lathering anyway?

Repeating Repeat 3 times: lather rinse Lather Repeat: Rinse

Repeat 3 times: lather rinse How to lather: wet your hair put shampoo in your hand repeat until your hair is foamy: run your hand through your hair

How to wash you hair

Pseudo-Code Code: write things in a way a computer can understand Pseudo- Not quite Pseudo-Code: Not quit write so that a computer can understand Good for expressing things unambiguously But still using English to gloss over the details

Conditionals What if I’m out of shampoo? How to wash your hair: if you are out of shampoo: get more shampoo repeat: lather rinse

Rules of Pseudo-Code Sequence Repetition = repeat something We start with the instruction written at the top We go in order, one instruction at a time Each line is “one” thing to do Repetition = repeat something Repeat a fixed number of times (repeat 3 times) Repeat Until something happens (repeat until hair is foamy) Conditions/Decisions = maybe do something Check something first If there is no shampoo, then get some more Named actions “how to lather” Definition = describe how to perform that action Use = no go do that thing

Do this Repeat 2 times: stand clap sit

Brush your teeth Write pseudo-code instructions for brushing your teeth Share with your neighbor, who will try to find a problem with it Remember: Sequence Repetition Conditionals Named Actions

3x+1 Let x be your age in years Let “the count” be 0 Repeat as long as x is not 1: add 1 to “the count” if x is even: divide x by 2 otherwise: multiply x by 3 and add 1 Clap “the count” many times

X = 18 X = 9 X = 28 X=14 X = 7 X = 22 X = 11 X = 34 X = 17 X = 52 X = 26 X = 13 X = 40 X = 20 X = 10 X = 5 X = 16 X = 8 X = 4 x = 2 X = 1

Variables In Math: In Statistics: In Programming: A name that refers to a particular value In Statistics: A name for a thing that has one value, but we don’t know what it is In Programming: A named value that can vary over the course of doing something x is a variable in the previous slide

Problem Programs cannot “reflect” on what they did Let x be your age in years Let “count” = 0 Repeat as long as x is not 1: add 1 to “count” if x is even: divide x by 2 otherwise: multiply x by 3 and add 1 Clap “count” many times

Bugs Syntax Semantic Logical Understandability

“Homework”