WHAT IS THE VALUE OF X? x = 0 for value in [3, 41, 12, 9, 74, 15] : if value < 10 : x = x + value print x.

Slides:



Advertisements
Similar presentations
How can Microsoft PowerPoint 2007 help you share information?
Advertisements

CMSC 104, Version 9/011 Arithmetic Operators Topics Arithmetic Operators Operator Precedence Evaluating Arithmetic Expressions In-class Project Incremental.
Learning how to use the Little man computer
The Little man computer
Java Programming Working with TextPad. Using TextPad to Work with Java This text editor is designed for working with Java You can download a trial version.
Program Design and Development
Von Neumann architecture
Pseudocode.
Fibonacci Problem Solving and Thinking in Engineering Programming H. James de St. Germain.
Simple Program Design Third Edition A Step-by-Step Approach
LMC Assembly Making Programming Friendlier. Machine Code Issues Have to remember numeric opcodes Have to think about physical memory locations – What.
Intro to C++. Getting Started with Microsoft Visual Studios Open Microsoft Visual Studios 2010 Click on file Click on New Project Choose Visual C++ on.
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Chapter 5.1.  Lesson Objective: NCSCOS 4.01 – Students will know how to find the slope of a line  Students will know how to find the equation of a line.
Programming with Visual C++: Concepts and Projects Chapter 2B: Reading, Processing and Displaying Data (Tutorial)
Assignment statements using the same variable in LHS and RHS.
By Chad Blankenbeker.  The for-loop is best used when you know how many times it is going to be looped  So if you know you want it to only loop 10 times,
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
What have we learned?. What is a database? An organized collection of related data.
Lesson 4-2 Operations on Functions. We can do some basic operations on functions.
SECTION 1.4 EXPONENTS. PRODUCT OF POWERS When you multiply two factors having the same base, keep the common base and add the exponents.
Java Programming, Second Edition Appendix A Working with Java SDK 1.4.
& dding ubtracting ractions.
Spreadsheets Lesson 1: Introduction. Lesson Objectives To understand what a spread sheet is and how it can be used To identify the features of a spreadsheet.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
The Little-Man Computer Damian Gordon. The Little-Man Computer Most computer architectures conform to the so-called von Neuman Architecture. This means.
Introduction to compilation process March 24. The following slides will show you step by step instruction how to get ready and build C language programs.
JavaScript 101 Lesson 3: Variables and Arithmetic.
CMSC 104, Version 8/061L10ArithmeticOps.ppt Arithmetic Operators Topics Arithmetic Operators Operator Precedence Evaluating Arithmetic Expressions In-class.
Multiply the coefficients, the 2 and the -3 to get -6 a 3 * a 2 will be a 5, you add exponents when you multiply terms b 1 * b 4 will be b 5.
Code Generation CPSC 388 Ellen Walker Hiram College.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
Binary! Objectives Recap what a instruction is Look at how binary can be used to store – Opcode – data.
This is where you can reset and run your program. If your program has an “INP” (input) command, you will type it in this box here. Using the LMC These.
Jeopardy $100 VariablesErrorsLoops Classes and Objects Program Structure $200 $300 $400 $500 $400 $300 $200 $100 $500 $400 $300 $200 $100 $500 $400 $300.
Lesson 4 : Exponent Laws I Check it out... Can you see a short cut rule?
For Loop GCSE Computer Science – Python. For Loop The for loop iterates over the items in a sequence, which can be a string or a list (we will discuss.
Mastering LMC Coding Part #1 Introduction to Low Level Languages Introduction to Little Man computer Simple examples (demos) with video tutorials included.
Program to multiply 2 numbers 500-Input x 291-Store acc. as x 500-Input y 292-Store acc. as y 193-Load y in to acc. (0 on 1 st parse) 391-Add x to acc.
Adding and Subtracting Fractions bottom numbers same
Little Man Computer Task 1 Last lesson you were asked to write a program to multiply two numbers together. The next slide has a working program to do this.
An Introduction to Programming with C++ Sixth Edition Chapter 8 More on the Repetition Structure.
Math operations 9/19/16.
The Little man computer
CHAPTER 6: The Little Man Computer
Partial Products Algorithm for Multiplication
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Starter Write a program that asks the user if it is raining today.
The Little Man Computer
Python I/O.
Learning Outcomes –Lesson 4
Hacking Minecraft on the Raspberry Pi using Python
Making Programming Friendlier
To get y, multiply x by 3 then add 2 To get y, multiply x by negative ½ then add 2 To get y, multiply x by 2 then subtract 3 To get y, multiply x.
Do it now – PAGE 10 You will find your do it now task in your workbook – look for the start button! Tuesday, 15 January 2019.
Title of Notes: Common Denominators
LMC Little Man Computer What do you know about LMC?
Little Man Computer Lesson 2
CSCI N207 Data Analysis Using Spreadsheet
Programming In Lesson 4.
Basic Lessons 5 & 6 Mr. Kalmes.
Little Man Computer (continued).
Problem Input a number and print its table using while loop. In the end print Good Bye only once.
A Level Computer Science Topic 5: Computer Architecture and Assembly
JavaScript 101 Lesson 8: Loops.
Learning how to use the Little man computer
Create Folder Unit 5 (All work for this unit to be stored here)
Little Man Computer Lesson 3 The times table
Little Man Computer.
Presentation transcript:

WHAT IS THE VALUE OF X? x = 0 for value in [3, 41, 12, 9, 74, 15] : if value < 10 : x = x + value print x

LMC LITTLE MAN COMPUTER LESSON 3A LET’S GO LOOP DE DO - LOOPING

WHAT IS A LOOP?

IF LMC CAN ONLY ADD OR SUBTRACT, HOW DO WE MULTIPLY? Loop! – share your ideas Think about what multiply is really doing

LET’S LOOK AT AN EXAMPLE 1.A number needs to be imputed 2.The number needs to be stored in a variable 3.The program needs to start a loop 4.Load the number that is stored 5.Add the number to it 6.Then store it 7.Then print it out 8.Then go back, (branch) to the start of the loop

LOAD LMC AND CREATE A LOOP 1.A number needs to be imputed 2.The number needs to be stored in a variable 3.The program needs to start a loop 4.Load the number that is stored 5.Add the number to it 6.Then store it 7.Then print it out 8.Then go back, (branch) to the start of the loop

COMPILER TOP TIPS ALWAYS SAVE THE FILE BEFORE RUNNING ENSURE THE LMC IS RESET ADD THE VARIABLES (DATA) TO THE END

HINTS Create the variable at the bottom with DAT Create a loop by assigning a name instead of a numen, For example – start LDA number

CAN YOU EDIT THE CODE SO THAT IT ADDS THE FIRST NUMBER EACH TIME?

DID YOU GET THIS?

THE HACK DEN Design an algorithm for a program which calculates and then prints out the first 5 values in the 8 times table. Test it Research it Create a compiler version Keep a record of what you did in word or notepad