Nate Brunelle Today: Pseudo-Code, Party

Slides:



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

Program Design and Development
Lecture Notes 1/21/04 Program Design & Intro to Algorithms.
Loops and Iteration Chapter 5 Python for Informatics: Exploring Information
Tell the robot exactly how to draw a square on the board.
CPS120 Introduction to Computer Science Iteration (Looping)
Loops Robin Burke IT 130. Outline Announcement: Homework #6 Conditionals (review) Iteration while loop while with counter for loops.
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
End of the beginning Let’s wrap up some details and be sure we are all on the same page Good way to make friends and be popular.
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
11 Making Decisions in a Program Session 2.3. Session Overview  Introduce the idea of an algorithm  Show how a program can make logical decisions based.
Subtraction with Borrowing By Mrs. Cupples So let’s say that we start with the following math problem…
PYTHON PROGRAMMING Year 9. Objective and Outcome Teaching Objective Today we will look at conditional statements in order to understand how programs can.
JavaScript: Conditionals contd.
Error Analysis Logic Errors.
Prime Numbers and Prime Factorization
Prime Numbers and Prime Factorization
Software Development.
Chapter 10 Programming Fundamentals with JavaScript
Whatcha doin'? Aims: To start using Python. To understand loops.
Problem , Problem Solving, Algorithm & Flow Charts –Part 1
Converting Fractions to Decimals
CS161 Introduction to Computer Science
Prime Numbers and Prime Factorization
ALGORITHMS AND FLOWCHARTS
Programming Mehdi Bukhari.
UNIT 3 – LESSON 5 Creating Functions.
The Need for Programming Languages
Prime Numbers and Prime Factorization
Diamond Hunt Mock Programming Project.
Control Structures
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
Exponent Rules
Chapter 10 Programming Fundamentals with JavaScript
elppa legoog erawdrah erawtfos margorp Cisab llams Apple Google
Sentinel logic, flags, break Taken from notes by Dr. Neil Moore
Program Design Introduction to Computer Programming By:
7/8 A Review and new concepts with Integers!
Nate Brunelle Today: PyCharm
Nate Brunelle Today: Repetition, A Trip To The Moon
“Teach A Level Maths” Yr1/AS Statistics
Topic 1: Problem Solving
Nate Brunelle Today: Functions again, Scope
Algorithm and Ambiguity
Patterns and Algebraic rules
Nate Brunelle Today: Turtles
Flowcharting & Algorithms
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
Java Programming Loops
An Introduction to Debugging
Algorithms vs. Programming
Nate Brunelle Today: Programming Languages, Stationary Aviation
FLUENCY WITH INFORMATION TECNOLOGY
Tonga Institute of Higher Education IT 141: Information Systems
Prime Numbers and Prime Factorization
Find your new seat for today.
Nate Brunelle Today: Dictionaries
Review of Previous Lesson
Prime Numbers and Prime Factorization
Pseudocode For Program Design.
Software Development Techniques
IPC144 Introduction to Programming Using C Week 2 – Lesson 2
Nate Brunelle Today: Pseudo-Code
Algorithms vs. Programming
Presentation transcript:

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

Questions?

Course structure Concepts “Turtle”

Ambiguity “Put the pot in the dishwasher” What we say to computers: Instructions How to wash your hair? How to wash your hair: Lather rinse repeat

How to wash you hair: repeat: lather rinse Lather Repeat:

How to wash you hair: repeat 3 times: lather rinse How to lather: wet your hair put shampoo in your hand repeat until hair is foamy: rub your hand through 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 hair: if you are out of shampoo: get more shampoo repeat: lather rinse

Rules of Pseudo-Code Sequence = Do the highest line first, then perform them in order from top to bottom Line = one “thing” to do Repetition = repeat something Fixed number of times : e.g. “repeat 3 times” Until something happens: e.g. “until hair is foamy” Conditions/Decisions = maybe do something Check something first If there is no more shampoo, then get more Named actions = two parts: definition, use Definition = how to do a thing Use = when to do the thing defined

Party Repeat 2 times: Sing “Happy Birthday to you” Sing “Happy Birthday to Nathan” Sing “Happy Birthday to You” Clap

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 count start as 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 “the count” many times

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 Statement does not “parse” Semantic Grammatically correct, but nonsense Logical Means something, but not what you meant Understandability I said it, it makes sense, and it means what I meant, but no one else can understand it

Syntax Semantic Statement does not “parse” Dog of by chicken for running video the W202dkdljdkla9**ls Semantic Grammatically correct, but nonsense Colorless green ideas sleep furiously Park your car upon the cloud. 3  0

Logical Understandability Means something, but not what you meant “double 5” vs “5+2” Understandability I said it, it makes sense, and it means what I meant, but no one else can understand it The sign should have dashes between fish and and and and and and and and and chips. Prandial soleation is gauche.

“Homework”