Lecture 7: Objects (Chapter 15) CS 1110 Introduction to Computing Using Python

Size: px
Start display at page:

Download "Lecture 7: Objects (Chapter 15) CS 1110 Introduction to Computing Using Python"

Transcription

1 htt:// Lecture 7: Objects (Chater 15) CS 1110 Introduction to Comuting Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White]

2 Good news about Assignment A1 & Lab 3 Now: Otional one-on-one rogramming ractice with a staff member to hel just you, Sign u on CMS under the Otional 1-on-1 assignment This week: you have two weeks to do lab 3, and it hels you with A1. Break: There will be some consulting hours. Check the calendar Next week: no new lab. All Wed. Feb 21 labs are dro-in office hours oen to all. (Nobody at the Tuesday labs break). 2

3 3

4 Partnering (See section 1.1) You may do this assignment with at most one other erson Make artnershi on official on CMS before either of you submit any files If your artnershi dissolves, there are secial grou divorce rocedures you must follow Take this very seriously! 4

5 Academic Integrity Rules Gloss (1.2) Never look at another else s code. Never show your code or talk about lines of your actual code to someone else (excet course staff). DO secifically acknowledge by name all hel you received, whether or not it was legal 5

6 Submit early and often Submit your first draft to CMS by Monday, February 26 at 2m. You can relace older submissions with imroved ones u to the deadline of 11:59m. Benefits: ractice with CMS before deadline is looming alert us during business hours if roblems arise You have been warned to submit by 2m. Do not exect that we will accet work that doesn t make it onto CMS on time, for whatever reason. 2/14/17 6

7 Tye: set of values & oerations on them Tye float: Values: real numbers Os: +, -, *, /, ** Tye int: Values: integers Os: +, -, *, //, %, ** Tye bool: Values: integers Os: not, and, or Tye str: Values: string literals Double quotes: abc Single quotes: abc Os: + (concatenation) 7

8 Built-in Tyes are not Enough Want a oint in 3D sace We need three variables x, y, z coordinates What if have a lot of oints? Vars x0, y0, z0 for first oint Vars x1, y1, z1 for next oint This can get really messy How about a single variable that reresents a oint? x 2 y 3 z 5 8

9 Built-in Tyes are not Enough Want a oint in 3D sace We need three variables x, y, z coordinates What if have a lot of oints? Vars x0, y0, z0 for first oint Vars x1, y1, z1 for next oint This can get really messy How about a single variable that reresents a oint? Can we stick them together in a folder? Motivation for objects x 2 y 3 z 5 9

10 Objects: Organizing Data in Folders An object is like a manila folder It contains other variables Variables are called attributes These values can change It has an ID that identifies it Unique number assigned by Python (just like a NetID for a Cornellian) Cannot ever change Has no meaning; only identifies Unique tab identifier x 2 y 3 z 5 10

11 Classes: user-defined tyes Values must have a tye An object is a value Object tye is a class Modules rovide classes Examle: shaes.y Defines:, Rectangle classes x 2 y 3 z 5 class name 11

12 Constructor: Function to make Objects How do we create objects? Other tyes have literals No such thing for objects Constructor Function: Format: class name ( arguments ) Examle: (0,0,0) Makes a new object (manila folder) with a new id Called an instantiated object Returns folder id as value Examle: = (0, 0, 0) Creates a Point object x 0 y 0 z 0 Variable stores ID not object instantiated object Stores object s id in 12

13 Constructors and Modules >>> imort shaes >>> = shaes.(0,0,0) >>> id() Need to imort module that has Point class. Constructor is function. Prefix w/ module name. Shows the id of x 0 y 0 z 0 13

14 Accessing Attributes Attributes are variables that live inside of objects Can use in exressions Can assign values to them Format: variable. attribute Examle:.x Look like module variables To evaluate.x, Python: 1. finds folder with id stored in 2. returns the value of x in that folder id3 id3 x 1 y 2 z 3 14

15 Accessing Attributes Examle Examle: = shaes.(1, 2, 3).x =.x + 3 id3 id3 x 1 x 4 y 2 z 3 15

16 Object Variables Variable stores object id Reference to the object 1 2 Reason for folder analogy Assignment uses object id Examle: 1 = shaes.(0, 0, 0) 2 = 1 Takes contents from 1 Puts contents in 2 Does not make new folder! x 0 y 0 z 0 This is the cause of many mistakes in this course 16

17 Attribute Assignment (Question) >>> = shaes.(0,0,0) >>> q = Execute the assignments: >>>.x = 5 >>> q.x = 7 id4 id4 q id4 What is value of.x? x 0 A: 5 B: 7 C: id4 D: I don t know y 0 z 0 17

18 Attribute Assignment (Solution) >>> = shaes.(0,0,0) >>> q = Execute the assignments: >>>.x = 5 >>> q.x = 7 What is value of.x? A: 5 B: 7 CORRECT C: id4 D: I don t know id4 q id4 id4 x 0x 5 7 y 0 z 0 x 18

19 Call Frames and Objects (1) Objects can be altered in a function call Object variables hold ids! Folder can be accessed from global variable or arameter Examle: 1 def incr_x(q): q.x = q.x + 1 >>> = shaes.(1, 2, 3) >>> incr_x() Global Memory id5 id5 x 1 Call Frame incr_x 1 q id5 20

20 Call Frames and Objects (2) Objects can be altered in a function call Object variables hold ids! Folder can be accessed from global variable or arameter Examle: 1 def incr_x(q): q.x = q.x + 1 >>> = shaes.(1, 2, 3) >>> incr_x() Global Memory id5 id5 x x 1 2 Call Frame incr_x q id5 RETURN NONE 21

21 Call Frames and Objects (3) Objects can be altered in a function call Object variables hold ids! Folder can be accessed from global variable or arameter Examle: 1 def incr_x(q): q.x = q.x + 1 Global Memory id5 id5 x x 1 2 Call Frame >>> = shaes.(1, 2, 3) >>> incr_x() 22

22 How Many Folders (Question) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) Draw everything that gets created. How many folders get drawn? 23

23 How Many Folders (Solution) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) Draw everything that gets created. How many folders get drawn? 2/16/17 x 1 y 2 z 3 x 3 y 4 z 5 24

24 What Else? (Question) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) Draw everything that gets created. How many folders get drawn? What else gets drawn? 2/16/17 x 1 y 2 z 3 x 3 y 4 z 5 25

25 What Else? (Solution) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) Draw everything that gets created. How many folders get drawn? What else gets drawn? q 2/16/17 x 1 y 2 z 3 x 3 y 4 z 5 26

26 Swa (Question) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa_x(, q) Execute swa_x on what we just drew. There should be a call frame. What is in.x at the end? def swa_x(, q): 1 t =.x 2.x = q.x 3 q.x = t A: 1 B: 2 C: 3 D: I don t know 27

27 Swa (Solution) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa_x(, q) Execute swa_x on what we just drew. There should be a call frame. What is in.x at the end? def swa_x(, q): 1 t =.x 2.x = q.x 3 q.x = t A: 1 B: 2 C: 3 CORRECT D: I don t know 28

28 Swa Exlanation (1) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa_x(, q) def swa_x(, q): 1 t =.x 2.x = q.x 3 q.x = t q x 1 y 2 x 3 y 4 swa_x:1 1 q t z 3 z 5 29

29 Swa Exlanation (2) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa_x(, q) def swa_x(, q): 1 t =.x 2.x = q.x 3 q.x = t q x 1 y 2 x 3 y 4 swa_x:1 2 q t 1 z 3 z 5 30

30 Swa Exlanation (3) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa_x(, q) def swa_x(, q): 1 t =.x 2.x = q.x 3 q.x = t q x x 1 3 y 2 x 3 y 4 swa_x:1 3 q t 1 z 3 z 5 31

31 Swa Exlanation (4) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa_x(, q) def swa_x(, q): 1 t =.x 2.x = q.x 3 q.x = t q x x 1 3 y 2 z 3 x x 3 1 y 4 z 5 swa_x:1 q t 1 Return NONE 32

32 Swa Exlanation (5) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa_x(, q) def swa_x(, q): 1 t =.x 2.x = q.x 3 q.x = t q ERASE WHOLE FRAME x x 1 3 x x 3 1 y 2 y 4 z 3 z 5 33

33 Global (Question) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa(, q) Before calling swa(, q): q def swa(, q): 1 t = 2 = q 3 q = t What is in global after calling swa? A: B: C: I don t know 34

34 Global (Solution) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa(, q) After calling swa(, q): q def swa(, q): 1 t = 2 = q 3 q = t What is in global after calling swa? A: CORRECT B: C: I don t know 35

35 Global Exlanation (1) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa(, q) def swa(, q): 1 t = 2 = q 3 q = t q x 1 Point x 3 Point swa 1 q y 2 y 4 z 3 z 5 36

36 Global Exlanation (2) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa(, q) def swa(, q): 1 t = 2 = q 3 q = t q x 1 y 2 Point x 3 y 4 Point swa 2 q t z 3 z 5 37

37 Global Exlanation (3) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa(, q) def swa(, q): 1 t = 2 = q 3 q = t q x 1 y 2 Point x 3 y 4 Point swa t x q 3 z 3 z 5 38

38 Global Exlanation (4) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa(, q) def swa(, q): 1 t = 2 = q 3 q = t q x 1 y 2 z 3 Point x 3 y 4 z 5 Point swa t x RETURN q x NONE 39

39 Global Exlanation (5) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa(, q) def swa(, q): 1 t = 2 = q 3 q = t q Point Point ERASE WHOLE FRAME x 1 x 3 y 2 y 4 z 3 z 5 40

40 Global Revisited (Question) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa(, q) Before calling swa(, q): q def swa(a, b): 1 t = a 2 a = b 3 b = t What is in global after calling swa? A: B: C: I don t know 41

41 Global Revisited (Solution) imort shaes = shaes.(1,2,3) q = shaes.(3,4,5) swa(, q) After calling swa(, q): Same question as the revious one, (excet we re-named the arameters) but this time it seems obvious that global is unaffected. q def swa(a, b): 1 t = a 2 a = b 3 b = t What is in global after calling swa? A: CORRECT B: C: I don t know 42

42 Methods: Functions Tied to Classes Method: function tied to object Method call looks like a function call receded by a variable name: id3 Examle: variable. method ( arguments ) imort shaes = shaes.(1,2,3).greet() Hi! I am a 3-dimensional oint located at (4,2,3) id3 x 5 y 2 z 3 43

43 Built-in Tyes vs. Classes Built-in tyes Built-into Python Refer to instances as values Instantiate with literals Can ignore the folders Classes Provided by modules Refer to instances as objects Instantiate w/ constructors Must reresent with folders 44

44 Where To From Here? First, Understand objects All Python rograms use objects Most small rograms use objects of classes that are art of the Python Library Eventually, create your own classes: the heart of OO Programming the rimary tool for organizing Python rograms But we need to learn more basics first! 45

Announcements for this Lecture

Announcements for this Lecture Lecture 6 Objects Announcements for this Lecture Last Call Quiz: About the Course Take it by tomorrow Also remember survey Assignment 1 Assignment 1 is live Posted on web page Due Thur, Sep. 18 th Due

More information

Lecture 7. Memory in Python

Lecture 7. Memory in Python Lecture 7 Memory in Python Announcements For This Lecture Readings Reread Chapter 3 No reading for Thursday Lab Work on Assignment Credit when submit A Nothing else to do Assignment Moved to Fri, Sep.

More information

Lecture 17: Classes (Chapter 15)

Lecture 17: Classes (Chapter 15) http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 17: Classes (Chapter 15) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White]

More information

Lecture 2: Variables & Assignments

Lecture 2: Variables & Assignments http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 2: Variables & Assignments (Sections 2.1-2.3,2.5) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

CS1110. Lecture 6: Function calls

CS1110. Lecture 6: Function calls CS1110 Lecture 6: Function calls Announcements Grades for Lab 1 should all be posted in CMS. Please verify that you have a 1 if you checked off the lab. Let course staff know if your grade is missing!

More information

CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) First Name: Last Name: NetID:

CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28)   First Name: Last Name: NetID: CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) http://www.cs.cornell.edu/courses/cs1110/2016sp/labs/lab01/lab01.pdf First Name: Last Name: NetID: Goals. Learning a computer language is a lot like learning

More information

CS 1110 Final, December 7th, 2017

CS 1110 Final, December 7th, 2017 CS 1110 Final, December 7th, 2017 This 150-minute exam has 8 questions worth a total of 100 oints. Scan the whole test before starting. Budget your time wisely. Use the back of the ages if you need more

More information

CS 1110, LAB 1: EXPRESSIONS AND ASSIGNMENTS First Name: Last Name: NetID:

CS 1110, LAB 1: EXPRESSIONS AND ASSIGNMENTS   First Name: Last Name: NetID: CS 1110, LAB 1: EXPRESSIONS AND ASSIGNMENTS http://www.cs.cornell.edu/courses/cs1110/2018sp/labs/lab01/lab01.pdf First Name: Last Name: NetID: Learning goals: (1) get hands-on experience using Python in

More information

Conditionals & Control Flow

Conditionals & Control Flow CS 1110: Introduction to Computing Using Python Lecture 8 Conditionals & Control Flow [Andersen, Gries, Lee, Marschner, Van Loan, White] Announcements: Assignment 1 Due tonight at 11:59pm. Suggested early

More information

Lecture 26: Sorting CS 1110 Introduction to Computing Using Python

Lecture 26: Sorting CS 1110 Introduction to Computing Using Python http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 26: Sorting CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White] Academic

More information

CS 1110: Introduction to Computing Using Python Lists and Sequences

CS 1110: Introduction to Computing Using Python Lists and Sequences CS : Introduction to Computing Using Python Lecture Lists and Sequences [Andersen, Gries, Lee, Marschner, Van Loan, White] Prelim Lecture Announcements Date: Tuesday, March 4th, 7:3 pm to 9: pm Submit

More information

Lecture 17: Classes (Chapter 15)

Lecture 17: Classes (Chapter 15) http://www.cs.cornell.edu/courses/cs1110/018sp Lecture 17: Classes (Chapter 15) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White]

More information

Lecture 5. Defining Functions

Lecture 5. Defining Functions Lecture 5 Defining Functions Announcements for this Lecture Last Call Quiz: About the Course Take it by tomorrow Also remember the survey Readings Sections 3.5 3.3 today Also 6.-6.4 See online readings

More information

Lecture 4: Defining Functions (Ch ) CS 1110 Introduction to Computing Using Python

Lecture 4: Defining Functions (Ch ) CS 1110 Introduction to Computing Using Python http://www.cs.cornell.edu/courses/cs0/209sp Lecture 4: Defining Functions (Ch..4-.) CS 0 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White]

More information

CS1110. Lecture 6: Function calls

CS1110. Lecture 6: Function calls CS1110 Lecture 6: Function calls Announcements Additional space in labs: We have added some space and staffing to the 12:20 and 1:25 labs on Tuesday. There is still space to move into these labs. Printed

More information

Definition. Pointers. Outline. Why pointers? Definition. Memory Organization Overview. by Ziad Kobti. Definition. Pointers enable programmers to:

Definition. Pointers. Outline. Why pointers? Definition. Memory Organization Overview. by Ziad Kobti. Definition. Pointers enable programmers to: Pointers by Ziad Kobti Deinition When you declare a variable o any tye, say: int = ; The system will automatically allocated the required memory sace in a seciic location (tained by the system) to store

More information

Lecture 6: Specifications & Testing

Lecture 6: Specifications & Testing http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 6: Specifications & Testing (Sections 4.9, 9.5) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

Lecture 4: Defining Functions

Lecture 4: Defining Functions http://www.cs.cornell.edu/courses/cs0/208sp Lecture 4: Defining Functions (Ch. 3.4-3.) CS 0 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W.

More information

Lecture 10: Lists and Sequences

Lecture 10: Lists and Sequences http://www.cs.cornell.edu/courses/cs/8sp Lecture : Lists and Sequences (Sections.-.,.4-.6,.8-.) CS Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van

More information

Lecture 3: Functions & Modules (Sections ) CS 1110 Introduction to Computing Using Python

Lecture 3: Functions & Modules (Sections ) CS 1110 Introduction to Computing Using Python http://www.cs.cornell.edu/courses/cs1110/2019sp Lecture 3: Functions & Modules (Sections 3.1-3.3) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

CS 1110, LAB 3: STRINGS; TESTING

CS 1110, LAB 3: STRINGS; TESTING CS 1110, LAB 3: STRINGS; TESTING http://www.cs.cornell.edu/courses/cs1110/2017sp/labs/lab03.pdf First Name: Last Name: NetID: Getting Credit: Deadline: the first 10 minutes of (your) lab two weeks from

More information

CS 1110, LAB 3: MODULES AND TESTING First Name: Last Name: NetID:

CS 1110, LAB 3: MODULES AND TESTING   First Name: Last Name: NetID: CS 1110, LAB 3: MODULES AND TESTING http://www.cs.cornell.edu/courses/cs11102013fa/labs/lab03.pdf First Name: Last Name: NetID: The purpose of this lab is to help you better understand functions, and to

More information

Sage Estimating. (formerly Sage Timberline Estimating) Getting Started Guide

Sage Estimating. (formerly Sage Timberline Estimating) Getting Started Guide Sage Estimating (formerly Sage Timberline Estimating) Getting Started Guide This is a ublication of Sage Software, Inc. Document Number 20001S14030111ER 09/2012 2012 Sage Software, Inc. All rights reserved.

More information

Lecture 3: Functions & Modules

Lecture 3: Functions & Modules http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 3: Functions & Modules (Sections 3.1-3.3) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

CS1 Lecture 3 Jan. 18, 2019

CS1 Lecture 3 Jan. 18, 2019 CS1 Lecture 3 Jan. 18, 2019 Office hours for Prof. Cremer and for TAs have been posted. Locations will change check class website regularly First homework assignment will be available Monday evening, due

More information

Sage Estimating (formerly Sage Timberline Estimating) Getting Started Guide. Version has been retired. This version of the software

Sage Estimating (formerly Sage Timberline Estimating) Getting Started Guide. Version has been retired. This version of the software Sage Estimating (formerly Sage Timberline Estimating) Getting Started Guide Version 14.12 This version of the software has been retired This is a ublication of Sage Software, Inc. Coyright 2014. Sage Software,

More information

Lecture 11: Iteration and For-Loops

Lecture 11: Iteration and For-Loops http://www.cs.cornell.edu/courses/cs0/08sp Lecture : Iteration and For-Loops (Sections 4. and 0.3) CS 0 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C.

More information

Lecture 19: Subclasses & Inheritance (Chapter 18)

Lecture 19: Subclasses & Inheritance (Chapter 18) http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 19: Subclasses & Inheritance (Chapter 18) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

Lecture 24: Loop Invariants

Lecture 24: Loop Invariants http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 24: Loop Invariants [Online Reading] CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van

More information

Storage Allocation CSE 143. Pointers, Arrays, and Dynamic Storage Allocation. Pointer Variables. Pointers: Review. Pointers and Types

Storage Allocation CSE 143. Pointers, Arrays, and Dynamic Storage Allocation. Pointer Variables. Pointers: Review. Pointers and Types CSE 143 Pointers, Arrays, and Dynamic Storage Allocation [Chater 4,. 148-157, 172-177] Storage Allocation Storage (memory) is a linear array of cells (bytes) Objects of different tyes often reuire differing

More information

Lecture 9. Memory and Call Stacks

Lecture 9. Memory and Call Stacks Lecture 9 Memory and Call Stacks Announcements for Today Assignment 1 Reading We have started grading! Should have your grade tomorrow morning Resubmit until correct If you were close Will get feedback

More information

521493S Computer Graphics Exercise 3 (Chapters 6-8)

521493S Computer Graphics Exercise 3 (Chapters 6-8) 521493S Comuter Grahics Exercise 3 (Chaters 6-8) 1 Most grahics systems and APIs use the simle lighting and reflection models that we introduced for olygon rendering Describe the ways in which each of

More information

Lecture 1. Types, Expressions, & Variables

Lecture 1. Types, Expressions, & Variables Lecture 1 Types, Expressions, & Variables About Your Instructor Director: GDIAC Game Design Initiative at Cornell Teach game design (and CS 1110 in fall) 8/29/13 Overview, Types & Expressions 2 Helping

More information

CS 1110: Introduction to Computing Using Python Loop Invariants

CS 1110: Introduction to Computing Using Python Loop Invariants CS 1110: Introduction to Computing Using Python Lecture 21 Loop Invariants [Andersen, Gries, Lee, Marschner, Van Loan, White] Announcements Prelim 2 conflicts due by midnight tonight Lab 11 is out Due

More information

Announcements for This Lecture

Announcements for This Lecture Lecture 16 Classes Announcements for This Lecture Prelim and Regrades Still have some prelims Apparently were misfiled Pick them up in office hours Regrades in CMS next week Only for MAJOR mistakes We

More information

CS1110 Lab 1 (Jan 27-28, 2015)

CS1110 Lab 1 (Jan 27-28, 2015) CS1110 Lab 1 (Jan 27-28, 2015) First Name: Last Name: NetID: Completing this lab assignment is very important and you must have a CS 1110 course consultant tell CMS that you did the work. (Correctness

More information

CS1 Lecture 3 Jan. 22, 2018

CS1 Lecture 3 Jan. 22, 2018 CS1 Lecture 3 Jan. 22, 2018 Office hours for me and for TAs have been posted, locations will change check class website regularly First homework available, due Mon., 9:00am. Discussion sections tomorrow

More information

Lecture 18: Using Classes Effectively (Chapter 16)

Lecture 18: Using Classes Effectively (Chapter 16) http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 18: Using Classes Effectively (Chapter 16) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

This version of the software

This version of the software Sage Estimating (SQL) (formerly Sage Timberline Estimating) SQL Server Guide Version 16.11 This is a ublication of Sage Software, Inc. 2015 The Sage Grou lc or its licensors. All rights reserved. Sage,

More information

Lecture 10. Memory in Python

Lecture 10. Memory in Python Lecture 0 Memory in Python Announcements For This Lecture Reading Reread all of Chapter 3 Assignments Work on your revisions Want done by Sunday Survey: 50 responded Remaining do by tomorrow Avg Time:

More information

has been retired This version of the software Sage Timberline Office Get Started Document Management 9.8 NOTICE

has been retired This version of the software Sage Timberline Office Get Started Document Management 9.8 NOTICE This version of the software has been retired Sage Timberline Office Get Started Document Management 9.8 NOTICE This document and the Sage Timberline Office software may be used only in accordance with

More information

Lecture 9: Memory in Python

Lecture 9: Memory in Python http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 9: Memory in Python CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White]

More information

Sage Estimating (SQL) (formerly Sage Timberline Estimating) Installation and Administration Guide. Version 16.11

Sage Estimating (SQL) (formerly Sage Timberline Estimating) Installation and Administration Guide. Version 16.11 Sage Estimating (SQL) (formerly Sage Timberline Estimating) Installation and Administration Guide Version 16.11 This is a ublication of Sage Software, Inc. 2016 The Sage Grou lc or its licensors. All rights

More information

Lecture 20: While Loops (Sections 7.3, 7.4)

Lecture 20: While Loops (Sections 7.3, 7.4) http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 20: While Loops (Sections 7.3, 7.4) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van

More information

Who. Winter Compiler Construction Generic compiler structure. Mailing list and forum. IC compiler. How

Who. Winter Compiler Construction Generic compiler structure. Mailing list and forum. IC compiler. How Winter 2007-2008 Comiler Construction 0368-3133 Mooly Sagiv and Roman Manevich School of Comuter Science Tel-Aviv University Who Roman Manevich Schreiber Oen-sace (basement) Tel: 640-5358 rumster@ost.tau.ac.il

More information

Lecture 1. Course Overview Types & Expressions

Lecture 1. Course Overview Types & Expressions Lecture 1 Course Overview Types & Expressions CS 1110 Spring 2012: Walker White Outcomes: Basics of (Java) procedural programming Usage of assignments, conditionals, and loops. Ability to write recursive

More information

Assignment 7: Due Wednesday May 11 at 6pm UPDATES on Monday May 9

Assignment 7: Due Wednesday May 11 at 6pm UPDATES on Monday May 9 CS1110 Spring 2016 Assignment 7: Due Wednesday May 11 at 6pm UPDATES on Monday May 9 You must work either on your own or with one partner. If you work with a partner, you and your partner must first register

More information

Simple example. Analysis of programs with pointers. Points-to relation. Program model. Points-to graph. Ordering on points-to relation

Simple example. Analysis of programs with pointers. Points-to relation. Program model. Points-to graph. Ordering on points-to relation Simle eamle Analsis of rograms with ointers := 5 tr := @ *tr := 9 := rogram S1 S2 S3 S4 deendences What are the deendences in this rogram? Problem: just looking at variable names will not give ou the correct

More information

Lecture06: Pointers 4/1/2013

Lecture06: Pointers 4/1/2013 Lecture06: Pointers 4/1/2013 Slides modified from Yin Lou, Cornell CS2022: Introduction to C 1 Pointers A ointer is a variable that contains the (memory) address of another variable What is a memory address?

More information

Truth Trees. Truth Tree Fundamentals

Truth Trees. Truth Tree Fundamentals Truth Trees 1 True Tree Fundamentals 2 Testing Grous of Statements for Consistency 3 Testing Arguments in Proositional Logic 4 Proving Invalidity in Predicate Logic Answers to Selected Exercises Truth

More information

Welcome to CS61A! Last modified: Thu Jan 23 03:58: CS61A: Lecture #1 1

Welcome to CS61A! Last modified: Thu Jan 23 03:58: CS61A: Lecture #1 1 Welcome to CS61A! This is a course about programming, which is the art and science of constructing artifacts ( programs ) that perform computations or interact with the physical world. To do this, we have

More information

Readings for This Lecture

Readings for This Lecture Lecture 4 Classes Readings for This Lecture Section 1.4, 1.5 in text Section 3.1 in text Plive activities referenced in the text Please look at lecture summaries online Handouts are short version Presentation

More information

CS 1110 SPRING 2016: LAB 3: PRACTICE FOR A2 (Feb 23-24)

CS 1110 SPRING 2016: LAB 3: PRACTICE FOR A2 (Feb 23-24) CS 1110 SPRING 2016: LAB 3: PRACTICE FOR A2 (Feb 23-24) http://www.cs.cornell.edu/courses/cs1110/2016sp/labs/lab03/lab03.pdf First Name: Last Name: NetID: The lab assignments are very important. Remember

More information

Course Overview, Python Basics

Course Overview, Python Basics CS 1110: Introduction to Computing Using Python Lecture 1 Course Overview, Python Basics [Andersen, Gries, Lee, Marschner, Van Loan, White] Interlude: Why learn to program? (which is subtly distinct from,

More information

Lecture 8: Orthogonal Range Searching

Lecture 8: Orthogonal Range Searching CPS234 Comutational Geometry Setember 22nd, 2005 Lecture 8: Orthogonal Range Searching Lecturer: Pankaj K. Agarwal Scribe: Mason F. Matthews 8.1 Range Searching The general roblem of range searching is

More information

Lecture 3: Geometric Algorithms(Convex sets, Divide & Conquer Algo.)

Lecture 3: Geometric Algorithms(Convex sets, Divide & Conquer Algo.) Advanced Algorithms Fall 2015 Lecture 3: Geometric Algorithms(Convex sets, Divide & Conuer Algo.) Faculty: K.R. Chowdhary : Professor of CS Disclaimer: These notes have not been subjected to the usual

More information

Iteration and For Loops

Iteration and For Loops CS 1110: Introduction to Computing Using Python Lecture 11 Iteration and For Loops [Andersen, Gries, Lee, Marschner, Van Loan, White] Rooms: Announcements: Prelim 1 aa200 jjm200 Baker Laboratory 200 jjm201

More information

Lecture 12. Lists (& Sequences)

Lecture 12. Lists (& Sequences) Lecture Lists (& Sequences) Announcements for Today Reading Read 0.0-0., 0.4-0.6 Read all of Chapter 8 for Tue Prelim, Oct th 7:30-9:30 Material up to October 3rd Study guide net week Conflict with Prelim

More information

Assignment 4: Due Friday Mar 11 at 6pm

Assignment 4: Due Friday Mar 11 at 6pm CS1110 Spring 2016 Assignment 4: Due Friday Mar 11 at 6pm You must work either on your own or with one partner. If you work with a partner, you and your partner must first register as a group in CMS (this

More information

An Efficient Coding Method for Coding Region-of-Interest Locations in AVS2

An Efficient Coding Method for Coding Region-of-Interest Locations in AVS2 An Efficient Coding Method for Coding Region-of-Interest Locations in AVS2 Mingliang Chen 1, Weiyao Lin 1*, Xiaozhen Zheng 2 1 Deartment of Electronic Engineering, Shanghai Jiao Tong University, China

More information

Real Numbers and Algebraic Expressions

Real Numbers and Algebraic Expressions College Algebra - MAT 161 Page: 1 Coyright 2009 Killoran Real Numbers and Algebraic Exressions Idea #1 Infinity- a never ending rogression Is there an infinity of sand grains on the Outer Banks of North

More information

CS 1110, LAB 1: PYTHON EXPRESSIONS.

CS 1110, LAB 1: PYTHON EXPRESSIONS. CS 1110, LAB 1: PYTHON EXPRESSIONS Name: Net-ID: There is an online version of these instructions at http://www.cs.cornell.edu/courses/cs1110/2012fa/labs/lab1 You may wish to use that version of the instructions.

More information

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 Due to CMS by Tuesday, February 14. Social networking has caused a return of the dot-com madness. You want in on the easy money, so you have decided to make

More information

Announcements for This Lecture

Announcements for This Lecture Lecture 17 Classes Announcements for This Lecture Assignments A4 Thursday at midnight Hopefully you are on Task 4 Minor extension for reasons Will post A5 on Wednesday Written assignment like A2 Needs

More information

Assignment 3: Due Friday Mar 4 at 6pm on CMS Updates in orange/red; last update 12:10pm Sun Feb 28

Assignment 3: Due Friday Mar 4 at 6pm on CMS Updates in orange/red; last update 12:10pm Sun Feb 28 CS1110 Spring 2016 Assignment 3: Due Friday Mar 4 at 6pm on CMS Updates in orange/red; last update 12:10pm Sun Feb 28 You must work either on your own or with one partner. If you work with a partner, you

More information

CIS192: Python Programming

CIS192: Python Programming CIS192: Python Programming Introduction Harry Smith University of Pennsylvania January 18, 2017 Harry Smith (University of Pennsylvania) CIS 192 Lecture 1 January 18, 2017 1 / 34 Outline 1 Logistics Rooms

More information

Lecture 1. Course Overview, Python Basics

Lecture 1. Course Overview, Python Basics Lecture 1 Course Overview, Python Basics We Are Very Full! Lectures and Labs are at fire-code capacity We cannot add sections or seats to lectures You may have to wait until someone drops No auditors are

More information

CENTRAL AND PARALLEL PROJECTIONS OF REGULAR SURFACES: GEOMETRIC CONSTRUCTIONS USING 3D MODELING SOFTWARE

CENTRAL AND PARALLEL PROJECTIONS OF REGULAR SURFACES: GEOMETRIC CONSTRUCTIONS USING 3D MODELING SOFTWARE CENTRAL AND PARALLEL PROJECTIONS OF REGULAR SURFACES: GEOMETRIC CONSTRUCTIONS USING 3D MODELING SOFTWARE Petra Surynková Charles University in Prague, Faculty of Mathematics and Physics, Sokolovská 83,

More information

Equality-Based Translation Validator for LLVM

Equality-Based Translation Validator for LLVM Equality-Based Translation Validator for LLVM Michael Ste, Ross Tate, and Sorin Lerner University of California, San Diego {mste,rtate,lerner@cs.ucsd.edu Abstract. We udated our Peggy tool, reviously resented

More information

CS Lecture 19: Loop invariants

CS Lecture 19: Loop invariants CS 1110 Lecture 19: Loop invariants Announcements Prelim 2 conflicts Today (April 2) is two weeks before the prelim, and the deadline for submitting prelim conflicts. Instructor travel This week and the

More information

1.5 Case Study. dynamic connectivity quick find quick union improvements applications

1.5 Case Study. dynamic connectivity quick find quick union improvements applications . Case Study dynamic connectivity quick find quick union imrovements alications Subtext of today s lecture (and this course) Stes to develoing a usable algorithm. Model the roblem. Find an algorithm to

More information

CS 1110, LAB 10: ASSERTIONS AND WHILE-LOOPS 1. Preliminaries

CS 1110, LAB 10: ASSERTIONS AND WHILE-LOOPS  1. Preliminaries CS 0, LAB 0: ASSERTIONS AND WHILE-LOOPS http://www.cs.cornell.edu/courses/cs0/20sp/labs/lab0.pdf. Preliminaries This lab gives you practice with writing loops using invariant-based reasoning. Invariants

More information

Lecture 5: Strings

Lecture 5: Strings http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 5: Strings (Sections 8.1, 8.2, 8.4, 8.5, 1 st paragraph of 8.9) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries,

More information

CS 1110, LAB 2: ASSIGNMENTS AND STRINGS

CS 1110, LAB 2: ASSIGNMENTS AND STRINGS CS 1110, LAB 2: ASSIGNMENTS AND STRINGS http://www.cs.cornell.edu/courses/cs1110/2014fa/labs/lab02.pdf First Name: Last Name: NetID: The purpose of this lab is to get you comfortable with using assignment

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Sage Document Management Version 17.1

Sage Document Management Version 17.1 Sage Document Management Version 17.1 User's Guide This is a ublication of Sage Software, Inc. 2017 The Sage Grou lc or its licensors. All rights reserved. Sage, Sage logos, and Sage roduct and service

More information

Lecture 18. Today, we will discuss developing algorithms for a basic model for parallel computing the Parallel Random Access Machine (PRAM) model.

Lecture 18. Today, we will discuss developing algorithms for a basic model for parallel computing the Parallel Random Access Machine (PRAM) model. U.C. Berkeley CS273: Parallel and Distributed Theory Lecture 18 Professor Satish Rao Lecturer: Satish Rao Last revised Scribe so far: Satish Rao (following revious lecture notes quite closely. Lecture

More information

Announcements for the Class

Announcements for the Class Lecture 2 Classes Announcements for the Class Readings Section 1.4, 1.5 in text Section 3.1 in text Optional: PLive CD that comes with text References in text Assignment Assignment 1 due next week Due

More information

CMSC 425: Lecture 16 Motion Planning: Basic Concepts

CMSC 425: Lecture 16 Motion Planning: Basic Concepts : Lecture 16 Motion lanning: Basic Concets eading: Today s material comes from various sources, including AI Game rogramming Wisdom 2 by S. abin and lanning Algorithms by S. M. LaValle (Chats. 4 and 5).

More information

Lecture 2. Variables & Assignment

Lecture 2. Variables & Assignment Lecture 2 Variables & Assignment Announcements for Today If Not Done Already Enroll in Piazza Sign into CMS Fill out the Survey Complete AI Quiz Read the tetbook Chapter 1 (browse) Chapter 2 (in detail)

More information

6.01, Spring Semester, 2008 Assignment 3, Issued: Tuesday, February 19 1

6.01, Spring Semester, 2008 Assignment 3, Issued: Tuesday, February 19 1 6.01, Spring Semester, 2008 Assignment 3, Issued: Tuesday, February 19 1 MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.01 Introduction to EECS I Spring

More information

A Study of Protocols for Low-Latency Video Transport over the Internet

A Study of Protocols for Low-Latency Video Transport over the Internet A Study of Protocols for Low-Latency Video Transort over the Internet Ciro A. Noronha, Ph.D. Cobalt Digital Santa Clara, CA ciro.noronha@cobaltdigital.com Juliana W. Noronha University of California, Davis

More information

Lecture 1. Course Overview, Python Basics

Lecture 1. Course Overview, Python Basics Lecture 1 Course Overview, Python Basics We Are Very Full! Lectures are at fire-code capacity. We cannot add sections or seats to lectures You may have to wait until someone drops No auditors are allowed

More information

CS 1110, LAB 03: STRINGS; TESTING First Name: Last Name: NetID:

CS 1110, LAB 03: STRINGS; TESTING  First Name: Last Name: NetID: CS 1110, LAB 03: STRINGS; TESTING http://www.cs.cornell.edu/courses/cs1110/2018sp/labs/lab03/lab03.pdf First Name: Last Name: NetID: Correction on pg 2 made Tue Feb 13, 3:15pm Getting Credit: As always,

More information

Lecture 8: Conditionals & Control Flow (Sections ) CS 1110 Introduction to Computing Using Python

Lecture 8: Conditionals & Control Flow (Sections ) CS 1110 Introduction to Computing Using Python http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 8: Conditionals & Control Flow (Sections 5.1-5.7) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

A Brief Introduction to Truth-Table Logic. Kent Slinker Pima Community College

A Brief Introduction to Truth-Table Logic. Kent Slinker Pima Community College ` A Brief Introduction to ruth-able Logic Kent Slinker Pima Community College Earlier in this class, we learned that all arguments are either valid or invalid. Additionally, we learned that certain valid

More information

CS1110. Lecture 22: Prelim 2 Review Session. Announcements. Processed prelim regrade requests: on the front table.

CS1110. Lecture 22: Prelim 2 Review Session. Announcements. Processed prelim regrade requests: on the front table. CS1110 Lecture 22: Prelim 2 Review Session Announcements Processed prelim regrade requests: on the front table. Reminders: Exam: 7:30 9:00PM, Tuesday Apr 16 th Kennedy 116 (Call Auditorium, same as before).

More information

Optimizing Dynamic Memory Management!

Optimizing Dynamic Memory Management! Otimizing Dynamic Memory Management! 1 Goals of this Lecture! Hel you learn about:" Details of K&R hea mgr" Hea mgr otimizations related to Assignment #6" Faster free() via doubly-linked list, redundant

More information

A DEA-bases Approach for Multi-objective Design of Attribute Acceptance Sampling Plans

A DEA-bases Approach for Multi-objective Design of Attribute Acceptance Sampling Plans Available online at htt://ijdea.srbiau.ac.ir Int. J. Data Enveloment Analysis (ISSN 2345-458X) Vol.5, No.2, Year 2017 Article ID IJDEA-00422, 12 ages Research Article International Journal of Data Enveloment

More information

Verification Options. To Store Or Not To Store? Inside the UPPAAL tool. Inactive (passive) Clock Reduction. Global Reduction

Verification Options. To Store Or Not To Store? Inside the UPPAAL tool. Inactive (passive) Clock Reduction. Global Reduction Inside the UPPAAL tool Data Structures DBM s (Difference Bounds Matrices) Canonical and Minimal Constraints Algorithms Reachability analysis Liveness checking Termination Verification Otions Verification

More information

Programming for Engineers in Python. Autumn

Programming for Engineers in Python. Autumn Programming for Engineers in Python Autumn 2011-12 Plan Administration: Course site Homework submission guidelines Working environment Python: Variables Editor vs. shell Homework 0 Python Cont. Conditional

More information

Improved heuristics for the single machine scheduling problem with linear early and quadratic tardy penalties

Improved heuristics for the single machine scheduling problem with linear early and quadratic tardy penalties Imroved heuristics for the single machine scheduling roblem with linear early and quadratic tardy enalties Jorge M. S. Valente* LIAAD INESC Porto LA, Faculdade de Economia, Universidade do Porto Postal

More information

SEARCH ENGINE MANAGEMENT

SEARCH ENGINE MANAGEMENT e-issn 2455 1392 Volume 2 Issue 5, May 2016. 254 259 Scientific Journal Imact Factor : 3.468 htt://www.ijcter.com SEARCH ENGINE MANAGEMENT Abhinav Sinha Kalinga Institute of Industrial Technology, Bhubaneswar,

More information

isinstance and While Loops

isinstance and While Loops CS 1110: Introduction to Computing Using Python Lecture 20 isinstance and While Loops [Andersen, Gries, Lee, Marschner, Van Loan, White] Announcements A4: Due 4/20 at 11:59pm Should only use our str method

More information

10 File System Mass Storage Structure Mass Storage Systems Mass Storage Structure Mass Storage Structure FILE SYSTEM 1

10 File System Mass Storage Structure Mass Storage Systems Mass Storage Structure Mass Storage Structure FILE SYSTEM 1 10 File System 1 We will examine this chater in three subtitles: Mass Storage Systems OERATING SYSTEMS FILE SYSTEM 1 File System Interface File System Imlementation 10.1.1 Mass Storage Structure 3 2 10.1

More information

Basic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2

Basic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2 Basic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2 Ziad Matni, Ph.D. Dept. of Computer Science, UCSB Your Instructor Your instructor: Ziad Matni, Ph.D(zee-ahd

More information

Lecture 2: Fixed-Radius Near Neighbors and Geometric Basics

Lecture 2: Fixed-Radius Near Neighbors and Geometric Basics structure arises in many alications of geometry. The dual structure, called a Delaunay triangulation also has many interesting roerties. Figure 3: Voronoi diagram and Delaunay triangulation. Search: Geometric

More information

CS 428: Fall Introduction to. Geometric Transformations. Andrew Nealen, Rutgers, /15/2010 1

CS 428: Fall Introduction to. Geometric Transformations. Andrew Nealen, Rutgers, /15/2010 1 CS 428: Fall 21 Introduction to Comuter Grahics Geometric Transformations Andrew Nealen, Rutgers, 21 9/15/21 1 Toic overview Image formation and OenGL (last week) Modeling the image formation rocess OenGL

More information

Source Coding and express these numbers in a binary system using M log

Source Coding and express these numbers in a binary system using M log Source Coding 30.1 Source Coding Introduction We have studied how to transmit digital bits over a radio channel. We also saw ways that we could code those bits to achieve error correction. Bandwidth is

More information

Lecture 24. GUI Applications

Lecture 24. GUI Applications Lecture 24 GUI Applications Announcements for This Lecture Assignments A6 due midnight TONIGHT Last day for consultants Also, fill out survey A7 due December 11 Instructions posted today Focus of today

More information