Python Data Structures

Size: px
Start display at page:

Download "Python Data Structures"

Transcription

1 Python Data Structures Zbigniew Jędrzejewski-Szmek George Mason University Python Summer School, Zürich, September 02, 2013 Version Zürich-83-gf79f32d This work is licensed under the Creative Commons CC BY-SA 3.0 License. 1 / 46

2 Outline 1 Introduction (using lists) How does Python manage memory? Comprehensions 2 Dictionaries, and sets Dictionaries How to create a dictionary? Specialized dictionary subclasses Sets 3 Iterators Iterator classes Generator expressions Generator functions 4 The end 2 / 46

3 Introduction (using lists) Introduction (and lists) 3 / 46

4 Introduction (using lists) Why? You can write sort(), but it ll take one day. DRY. Use proper data structures. 4 / 46

5 Introduction (using lists) The venerable list A sequence of arbitrary values Quiz: Is list.pop(0) faster than list.pop()? 5 / 46

6 Introduction (using lists) Test, test, test N = 1000 L0 = range(n) L = L0[:] for i in xrange(n): L.pop(0) 6 / 46

7 Introduction (using lists) How does time required depend on problem size? t / us N 7 / 46

8 Introduction (using lists) Reminder: computational complexity f (x) = O(g(x)) There s a constant C, such that f (x) C g(x) for big enough x. For computational complexity x is N 8 / 46

9 Introduction (using lists) What does this mean? Computational complexity depends on the data structure and operation good to understand what you re doing 9 / 46

10 Introduction (using lists) How is list implemented? L list.pop(0) list.pop(-1) 10 / 46

11 Introduction (using lists) pop(0) vs pop(-1) t / us N 11 / 46

12 Introduction (using lists) Solution for the.pop(0) problem collections.deque pops from both ends cheaply:.pop().popleft()... but does not allow other removals in the middle 12 / 46

13 Introduction (using lists) The complexity constant f (x) C g(x) 13 / 46

14 Introduction (using lists) Complexity constant example CPython vs. Jython t / us N 14 / 46

15 Introduction (using lists) Testing is not enough here Time complexity issues do not show up during development, because O(N 2 ) is small for small N. 15 / 46

16 Introduction (using lists) Removing an element from a list N = 1000 L0 = range(n) L = L0[:]... Why? 16 / 46

17 Introduction (using lists) Objects are kept around if they are referenced ints are referenced from both L and L0 L L 17 / 46

18 Introduction (using lists) How does Python manage memory? Other languages have variables int a = 1; a = 2; int b = a; Idiomatic Python by David Goodger 18 / 46

19 Introduction (using lists) How does Python manage memory? Python has names a = 1 a = 2 b = a Idiomatic Python by David Goodger 19 / 46

20 Introduction (using lists) Comprehensions List comprehensions [day for day in week] [day for day in week if day[0]!= M ] [(day, hour) for day in week for hour in [ 12:00, 14:00, 16:00 ] ] 20 / 46

21 Dictionaries, and sets Dictionaries and sets 21 / 46

22 Dictionaries, and sets How to create a dictionary? Creating dictionaries dict == a mapping of keys to arbitrary values D = { key1 : "value1", 2: [ a, list, here ], None: None, } 22 / 46

23 Dictionaries, and sets How to create a dictionary? From an iterator text = """\ lundi Monday mardi Tuesday mercredi Wednesday jeudi Thursday vendredi Friday samedi Saturday dimanche Sunday """ source = (line.split() for line in text.splitlines()) weekdays = dict(source) 23 / 46

24 Dictionaries, and sets How to create a dictionary? From a comprehension {x:x**2 for x in xrange(10)} 24 / 46

25 Dictionaries, and sets How to create a dictionary? How much does it cost to enter an item in the dictionary? >>> D = {} >>> L = range(10000) >>> for i in L:... D[i] = i O (1) 25 / 46

26 Dictionaries, and sets How to create a dictionary? How much does it cost to retrieve an item from the dictionary? >>> for i in L:... assert D[i] == i O(1) 26 / 46

27 Dictionaries, and sets How to create a dictionary? How are dictionaries organized? D / 46

28 Dictionaries, and sets How to create a dictionary? Weekdays in French and in English The order of keys is random! A list of the weekdays? >>> weekdays.keys() [ mardi, samedi, vendredi, jeudi, lundi, dimanche, mercredi ] 28 / 46

29 Dictionaries, and sets How to create a dictionary? Demo hash_demo.py # 1. Initialize a dict with the same keys. # 2. Display keys. from future import print_function d = dict(monday=1, tuesday=2, wednesday=3, thursday=4, friday=5) print(d.keys()) print( monday ->, hash( monday )) 29 / 46

30 Dictionaries, and sets Specialized dictionary subclasses collections.ordereddict # source = (( lundi, Monday ), # ( mardi, Tuesday ), #... >>> weekdays = collections.ordereddict(source) >>> weekdays.keys() [ lundi, mardi, mercredi, jeudi, vendredi, samedi, dimanche ] 30 / 46

31 Dictionaries, and sets Specialized dictionary subclasses Classifying objects Sorting objects into groups grades.log: John John Mary Jane / 46

32 Dictionaries, and sets Specialized dictionary subclasses Sorting objects into groups version 0 grades = {} for line in open( grades.log ): date, person, grade = line.split() grades[person].append(grade) 32 / 46

33 Dictionaries, and sets Specialized dictionary subclasses Sorting objects into groups version 0.5 grades = {} for line in open( grades.log ): date, person, grade = line.split() if person not in grades: grades[person] = [] grades[person].apend(grade) 33 / 46

34 Dictionaries, and sets Specialized dictionary subclasses Sorting objects into groups version 1.0 grades = collections.defaultdict(list) for line in open( grades.log ): date, person, grade = line.split() grades[person].append(grade) 34 / 46

35 Dictionaries, and sets Specialized dictionary subclasses Counting objects in groups Let s make a histogram grades = collections.counter() for line in open( grades.log ): date, person, grade = line.split() grades[grade] += 1 >>> grades Counter({ 4 : 2, 3 : 1, 2 : 1, 5 : 1}) >>> print( \n.join(x + + x *y... for (x, y) in sorted(grades.items()))) 1 x 2 xxx 3 x 4 xxx 5 xx 35 / 46

36 Dictionaries, and sets Sets Set A non-ordered collection of unique elements visitors = set() for connection in connection_log(): ip = connection.ip if ip not in visitors: print( new visitor, ip) visitors.add(ip) 36 / 46

37 Dictionaries, and sets Sets Using sets Poetry: find words used by the poet, sorted by length >>> shak = \... She walks in beauty, like the night... Of cloudless climes and starry skies;... And all that s best of dark and bright... Meet >>> words = set(shak.lower().translate(none,,; ).split()) >>> words { she, like, cloudless,...} >>> sorted(words, key=len, reverse=true) [ cloudless, starry, beauty,...] 37 / 46

38 Iterators Iterators 38 / 46

39 Iterators Collections and their iterators sequence. iter () iterator iterator. iter () self iterator.next() item iterator.next() item iterator.next() item 39 / 46

40 Iterators Iterators can be non-destructive or destructive list file 40 / 46

41 Iterators How can we create an iterator? 1 write a class with. iter and.next 2 use a generator expression 3 write a generator function 41 / 46

42 Iterators Iterator classes 1. Iterator class import random class randomaccess(object): def init (self, alist): self.indices = range(len(alist)) random.shuffle(self.indices) self.alist = alist def next(self): return self.alist[self.indices.pop()] def iter (self): return self 42 / 46

43 Iterators Generator expressions 2. Generator expressions # chomped lines (line.rstrip() for line in open(some_file)) # remove comments (line for line in open(some_file) if not line.startswith( # )) >>> type([i for i in abc ]) <type list > >>> type( i for i in abc ) <type generator > 43 / 46

44 Iterators Generator functions 3. Generator functions >>> def countdown(n):... print --start... for i in range(n, 0, -1):... yield i... print --done >>> for i in countdown(3):... print i --start done >>> g = gen(2) >>> g <generator object...> >>> g.next() --start 2 >>> g.next() 1 >>> g.next() --stop Traceback (most recent cal... StopIteration 44 / 46

45 Iterators Generator functions Generator objects iter and next >>> g. iter () <generator object gen at 0x7f24a5e1c690> >>> g <generator object gen at 0x7f24a5e1c690> >>> g.next() --start 1 45 / 46

46 The end That s all! 46 / 46

Advanced Python. generators, decorators, context managers. Zbigniew Jędrzejewski-Szmek. George Mason University

Advanced Python. generators, decorators, context managers. Zbigniew Jędrzejewski-Szmek. George Mason University Advanced Python generators, decorators, context managers Zbigniew Jędrzejewski-Szmek George Mason University Python Summer School, Zürich, September 05, 2013 Version Zürich-98-ge13be00 This work is licensed

More information

PIC 16: Iterators and Generators

PIC 16: Iterators and Generators PIC 16: Iterators and Generators Assigned 10/9/2018. To be completed before lecture 10/12/2018. Intended Learning Outcomes. By the end of this preparatory assignment, students should be able to: implement

More information

Python iterators and generators

Python iterators and generators Python iterators and generators Iterators and generators Python makes good use of iterators And has a special kind of generator function that is powerful and useful We ll look at what both are And why

More information

CS1 Lecture 2 Jan. 16, 2019

CS1 Lecture 2 Jan. 16, 2019 CS1 Lecture 2 Jan. 16, 2019 Contacting me/tas by email You may send questions/comments to me/tas by email. For discussion section issues, sent to TA and me For homework or other issues send to me (your

More information

A Brief Introduction to Python for those who know Java. (Last extensive revision: Daniel Moroz, fall 2015)

A Brief Introduction to Python for those who know Java. (Last extensive revision: Daniel Moroz, fall 2015) A Brief Introduction to Python for those who know Java (Last extensive revision: Daniel Moroz, fall 2015) Plan Day 1 Baby steps History, Python environments, Docs Absolute Fundamentals Objects, Types Math

More information

Simplified Operating Instructions T105-C / T108-C / T106-C / T17B-C DISPLAYS DAY OR DAY BLOCK PROG 00:0000 PROG PROG ALWAYS OFF

Simplified Operating Instructions T105-C / T108-C / T106-C / T17B-C DISPLAYS DAY OR DAY BLOCK PROG 00:0000 PROG PROG ALWAYS OFF Button Operations Simplified Operating Instructions T105-C / T108-C / T106-C / T17B-C R - Reset (with pen or other pointed instrument). Y - Enters function setup. +/- Buttons to scroll through icons. Y

More information

View a Students Schedule Through Student Services Trigger:

View a Students Schedule Through Student Services Trigger: Department Responsibility/Role File Name Version Document Generation Date 6/10/2007 Date Modified 6/10/2007 Last Changed by Status View a Students Schedule Through Student Services_BUSPROC View a Students

More information

61A Lecture 3. Friday, September 5

61A Lecture 3. Friday, September 5 61A Lecture 3 Friday, September 5 Announcements There's plenty of room in live lecture if you want to come (but videos are still better) Please don't make noise outside of the previous lecture! Homework

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College September 25, 2017 Outline Outline 1 Chapter 4: Linked Structures and Chapter 4: Linked Structures and Outline 1 Chapter 4:

More information

Substitute Quick Reference (SmartFindExpress Substitute Calling System and Web Center)

Substitute Quick Reference (SmartFindExpress Substitute Calling System and Web Center) Substitute Quick Reference (SmartFindExpress Substitute Calling System and Web Center) System Phone Number 578-6618 Help Desk Phone Number 631-4868 (6:00 a.m. 4:30 p.m.) Write your Access number here Write

More information

Programming with Python

Programming with Python Programming with Python Lecture 3: Python Functions IPEC Winter School 2015 B-IT Dr. Tiansi Dong & Dr. Joachim Köhler Python Functions arguments return obj Global vars Files/streams Function Global vars

More information

Arrays (Lists) # or, = ("first string", "2nd string", 123);

Arrays (Lists) # or, = (first string, 2nd string, 123); Arrays (Lists) An array is a sequence of scalars, indexed by position (0,1,2,...) The whole array is denoted by @array Individual array elements are denoted by $array[index] $#array gives the index of

More information

Python iterators and generators

Python iterators and generators Iterators and generators Python iterators and generators Python makes good use of iterators And has a special kind of generator func7on that is powerful and useful We ll look at what both are And why they

More information

61A Lecture 4. Monday, September 9

61A Lecture 4. Monday, September 9 61A Lecture 4 Monday, September 9 Announcements Homework 1 due Tuesday 9/10 at 5pm; Late homework is not accepted! Quiz on Wednesday 9/11 released at 1pm, due Thursday 9/12 at 11:59pm Open-computer: You

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College September 18, 2017 Outline Outline 1 Chapter 4: Linked Structures and Iterators Outline 1 Chapter 4: Linked Structures and

More information

Agenda: Discussion Week 7. May 11, 2009

Agenda: Discussion Week 7. May 11, 2009 Agenda: Discussion Week 7 Method signatures Static vs. instance compareto Exceptions Interfaces 2 D arrays Recursion varargs enum Suggestions? May 11, 2009 Method signatures [protection] [static] [return

More information

Iterators & Generators

Iterators & Generators Iterators & Generators Sequences A sequence is something that you can: Index into Get the length of What are some examples of sequences? Sequences We ve been working with sequences all semester! Examples:

More information

Python for loops. Girls Programming Network School of Information Technologies University of Sydney. Mini-lecture 7

Python for loops. Girls Programming Network School of Information Technologies University of Sydney. Mini-lecture 7 Python for loops Girls Programming Network School of Information Technologies University of Sydney Mini-lecture 7 Lists for loops More Strings Summary 2 Outline 1 Lists 2 for loops 3 More Strings 4 Summary

More information

Introduction to Python programming, II

Introduction to Python programming, II Grid Computing Competence Center Introduction to Python programming, II Riccardo Murri Grid Computing Competence Center, Organisch-Chemisches Institut, University of Zurich Nov. 16, 2011 Today s class

More information

Geometry Agenda. Week 4.6 Objective Stamp Grade. Similar Polygons. Practice. Proving Triangles Similar. Practice. Practice

Geometry Agenda. Week 4.6 Objective Stamp Grade. Similar Polygons. Practice. Proving Triangles Similar. Practice. Practice Name Period Geometry Agenda Week.6 Objective Stamp Grade Monday February 8, 2016 Tuesday February 9, 2016 Wednesday February 10, 2016 Thursday February 11, 2016 Friday February 12, 2016 Similar Polygons

More information

Other conditional and loop constructs. Fundamentals of Computer Science Keith Vertanen

Other conditional and loop constructs. Fundamentals of Computer Science Keith Vertanen Other conditional and loop constructs Fundamentals of Computer Science Keith Vertanen Overview Current loop constructs: for, while, do-while New loop constructs Get out of loop early: break Skip rest of

More information

RYÛSHIN SHÔCHI RYÛ Seminar in Milano YAHAGI Kunikazu, Sôke Milano , April 25 th to 28 th INFORMATION SHEET

RYÛSHIN SHÔCHI RYÛ Seminar in Milano YAHAGI Kunikazu, Sôke Milano , April 25 th to 28 th INFORMATION SHEET RYÛSHIN SHÔCHI RYÛ Seminar in Milano YAHAGI Kunikazu, Sôke Milano - 2013, April 25 th to 28 th INFORMATION SHEET :: Venue Palestra ATHLON, Via Ferrari 21, 21047 Saronno. By train By car The dojo lies a

More information

Armstrong State University Engineering Studies MATLAB Marina Switch-Case Statements Primer

Armstrong State University Engineering Studies MATLAB Marina Switch-Case Statements Primer Armstrong State University Engineering Studies MATLAB Marina Switch-Case Statements Primer Prerequisites The Switch-Case Statements Primer assumes knowledge of the MATLAB IDE, MATLAB help, arithmetic operations,

More information

Cloning Enums. Cloning and Enums BIU OOP

Cloning Enums. Cloning and Enums BIU OOP Table of contents 1 Cloning 2 Integer representation Object representation Java Enum Cloning Objective We have an object and we need to make a copy of it. We need to choose if we want a shallow copy or

More information

Institute For Arts & Digital Sciences SHORT COURSES

Institute For Arts & Digital Sciences SHORT COURSES Institute For Arts & Digital Sciences SHORT COURSES SCHEDULES AND FEES 2017 SHORT COURSES - GRAPHIC DESIGN Adobe Photoshop Basic 07 February 28 February Tuesdays 14:30-17:30 Adobe Photoshop Basic 07 February

More information

Introduction to Python programming, II

Introduction to Python programming, II GC3: Grid Computing Competence Center Introduction to Python programming, II (with a hint of MapReduce) Riccardo Murri Grid Computing Competence Center, University of Zurich Oct. 10, 2012 Today s class

More information

DSC 201: Data Analysis & Visualization

DSC 201: Data Analysis & Visualization DSC 201: Data Analysis & Visualization Classes Dr. David Koop Tuple, List, Dictionary, or Set? [1,2,"abc"] 2 Tuple, List, Dictionary, or Set? {"a", 1, 2} 3 Tuple, List, Dictionary, or Set? {} 4 Tuple,

More information

AGENDA de la Quinzaine

AGENDA de la Quinzaine AGENDA de la Quinzaine Du 16 au 31 Juillet 2018 #2 Les Marchés Marché traditionnel - Local market Les mercredis et samedis matin en centre-ville de Vias. Every Wednesday and Saturday morning in town center.

More information

Midterm I Practice Problems

Midterm I Practice Problems 15-112 Midterm I Practice Problems Name: Section: andrewid: This PRACTICE midterm is not meant to be a perfect representation of the upcoming midterm! You are responsible for knowing all material covered

More information

San Diego Unified School District Substitute Reference Guide

San Diego Unified School District Substitute Reference Guide San Diego Unified School District Substitute Reference Guide System Phone Number (619) 297-0304 Help Desk Phone Number (619) 725-8090 Write your PIN here Web Browser URL https://subweb.sandi.net THE SYSTEM

More information

Advanced Python. decorators, generators, context managers. Zbigniew Jędrzejewski-Szmek. Institute of Experimental Physics University of Warsaw

Advanced Python. decorators, generators, context managers. Zbigniew Jędrzejewski-Szmek. Institute of Experimental Physics University of Warsaw Advanced Python decorators, generators, context managers Zbigniew Jędrzejewski-Szmek Institute of Experimental Physics University of Warsaw Python Summer School St Andrews, September 11, 2011 Version AP_version_2011

More information

Python itertools. Stéphane Vialette. October 22, LIGM, Université Paris-Est Marne-la-Vallée

Python itertools. Stéphane Vialette. October 22, LIGM, Université Paris-Est Marne-la-Vallée Python itertools Stéphane Vialette LIGM, Université Paris-Est Marne-la-Vallée October 22, 2009 Stéphane Vialette (LIGM, Université Paris-Est Marne-la-Vallée) Python itertools October 22, 2009 1 / 31 Outline

More information

Advanced Python. decorators, generators, context managers. Zbigniew Jędrzejewski-Szmek. Institute of Experimental Physics University of Warsaw

Advanced Python. decorators, generators, context managers. Zbigniew Jędrzejewski-Szmek. Institute of Experimental Physics University of Warsaw Advanced Python decorators, generators, context managers Zbigniew Jędrzejewski-Szmek Institute of Experimental Physics University of Warsaw Python Summer School St Andrews, September 11, 2011 Version AP_version_2011

More information

61A Lecture 7. Monday, September 15

61A Lecture 7. Monday, September 15 61A Lecture 7 Monday, September 15 Announcements Homework 2 due Monday 9/15 at 11:59pm Project 1 deadline extended, due Thursday 9/18 at 11:59pm! Extra credit point if you submit by Wednesday 9/17 at 11:59pm

More information

Cambridge English Dates and Fees for 2018

Cambridge English Dates and Fees for 2018 Cambridge English Dates and Fees for 2018 Cambridge English: Key (KET) KET 10,900.00 10,500.00 10,300.00 Saturday, 17 March Thursday, 01 February 9 March 18 March Saturday, 12 May Friday, 6 April 4 May

More information

Physics 2660: Fundamentals of Scientific Computing. Lecture 5 Instructor: Prof. Chris Neu

Physics 2660: Fundamentals of Scientific Computing. Lecture 5 Instructor: Prof. Chris Neu Physics 2660: Fundamentals of Scientific Computing Lecture 5 Instructor: Prof. Chris Neu (chris.neu@virginia.edu) Reminder I am back! HW04 due Thursday 22 Feb electronically by noon HW grades are coming.

More information

Programming Language. Control Structures: Selection (switch) Eng. Anis Nazer First Semester

Programming Language. Control Structures: Selection (switch) Eng. Anis Nazer First Semester Programming Language Control Structures: Selection (switch) Eng. Anis Nazer First Semester 2018-2019 Multiple selection choose one of two things if/else choose one from many things multiple selection using

More information

YEAR 8 STUDENT ASSESSMENT PLANNER SEMESTER 1, 2018 TERM 1

YEAR 8 STUDENT ASSESSMENT PLANNER SEMESTER 1, 2018 TERM 1 YEAR 8 STUDENT ASSESSMENT PLANNER SEMESTER 1, 2018 TERM 1 Term 1 - Due Dates 22 26 January 29 January 2 February 5 9 February 12 16 February 19 23 February 26 February 2 March 5 9 March 12 16 March 19

More information

Nights & Weekend ROB & PHIL DECEMBER 12, 2008

Nights & Weekend ROB & PHIL DECEMBER 12, 2008 Nights & Weekend ROB & PHIL DECEMBER 12, 2008 Input Surveys R&IS Student Assistant R&IS Faculty & Staff Access Services Students Statistics Totals Services R&IS & Access Service Seniority R&IS Student

More information

CS 331 Midterm Exam 1

CS 331 Midterm Exam 1 CS 331 Midterm Exam 1 Friday, October 6 th, 2016 Please bubble your answers in on the provided answer sheet. Also be sure to write and bubble in your student ID number (without the leading A ). 1. What

More information

CS 331/401 Summer 2018 Midterm Exam

CS 331/401 Summer 2018 Midterm Exam CS 331/401 Summer 2018 Midterm Exam Instructions: This exam is closed-book, closed-notes. Computers of any kind are not permitted. For numbered, multiple-choice questions, fill your answer in the corresponding

More information

Creating a File and Folder Backup

Creating a File and Folder Backup Applicable Products These instructions apply to the following products: Barracuda Intronis Backup - MSP How to Create a Files and Folders Backup Before creating a files and folders backup set, make sure

More information

ACT! Calendar to Excel

ACT! Calendar to Excel Another efficient and affordable ACT! Add-On by ACT! Calendar to Excel v.6.0 for ACT! 2008 and up http://www.exponenciel.com ACT! Calendar to Excel 2 Table of content Purpose of the add-on... 3 Installation

More information

DATA VISUALIZATION Prepare the data for visualization Data presentation architecture (DPA) is a skill-set that seeks to identify, locate, manipulate,

DATA VISUALIZATION Prepare the data for visualization Data presentation architecture (DPA) is a skill-set that seeks to identify, locate, manipulate, DATA VISUALIZATION Prepare the data for visualization Data presentation architecture (DPA) is a skill-set that seeks to identify, locate, manipulate, format and present data in such a way as to optimally

More information

Calendar PPF Production Cycles Non-Production Activities and Events

Calendar PPF Production Cycles Non-Production Activities and Events 20-207 Calendar PPF Production Cycles Non-Production Activities and Events Four Productions For non-holiday productions 7 Week Stage Cycles 36 Uses plus strike (as in prior years and per agreement with

More information

Lecture 17: Hash Tables, Maps, Finish Linked Lists

Lecture 17: Hash Tables, Maps, Finish Linked Lists ....... \ \ \ / / / / \ \ \ \ / \ / \ \ \ V /,----' / ^ \ \.--..--. / ^ \ `--- ----` / ^ \. ` > < / /_\ \. ` / /_\ \ / /_\ \ `--' \ /. \ `----. / \ \ '--' '--' / \ / \ \ / \ / / \ \ (_ ) \ (_ ) / / \ \

More information

Substitute Quick Reference Card For Questions Please Contact, Shaunna Wood: ext. 1205

Substitute Quick Reference Card For Questions Please Contact, Shaunna Wood: ext. 1205 Substitute Quick Reference Card For Questions Please Contact, Shaunna Wood: 218-336-8700 ext. 1205 System Phone Number: (218) 461-4437 Help Desk Phone Number: (218) 336-8700 ext. 1059 ID PIN System Calling

More information

How It All Stacks Up - or - Bar Charts with Plotly. ISC1057 Janet Peterson and John Burkardt Computational Thinking Fall Semester 2016

How It All Stacks Up - or - Bar Charts with Plotly. ISC1057 Janet Peterson and John Burkardt Computational Thinking Fall Semester 2016 * How It All Stacks Up - or - Bar Charts with Plotly ISC1057 Janet Peterson and John Burkardt Computational Thinking Fall Semester 2016 In a game of poker, players bet by tossing chips into the center

More information

PART 1: Getting Fancy with Column Charts

PART 1: Getting Fancy with Column Charts PART 1: Getting Fancy with Column Charts Essential Learning Skills: comparing data, setting up a column chart, changing chart formats including labels, gridlines, titles, colors, and legends. 1. Open a

More information

What is Python? State some programming language features of Python.

What is Python? State some programming language features of Python. What is Python? State some programming language features of Python. Python is a modern powerful interpreted language with objects, modules, threads, exceptions, and automatic memory managements. Python

More information

Lecture 12. Data Types and Strings

Lecture 12. Data Types and Strings Lecture 12 Data Types and Strings Class v. Object A Class represents the generic description of a type. An Object represents a specific instance of the type. Video Game=>Class, WoW=>Instance Members of

More information

61A Lecture 7. Monday, September 16

61A Lecture 7. Monday, September 16 61A Lecture 7 Monday, September 16 Announcements Homework 2 due Tuesday at 11:59pm Project 1 due Thursday at 11:59pm Extra debugging office hours in Soda 405: Tuesday 6-8, Wednesday 6-7, Thursday 5-7 Readers

More information

! A set is a collection of objects of the same. ! {6,9,11,-5} and {11,9,6,-5} are equivalent. ! There is no first element, and no successor. of 9.

! A set is a collection of objects of the same. ! {6,9,11,-5} and {11,9,6,-5} are equivalent. ! There is no first element, and no successor. of 9. Sets & Hash Tables Week 13 Weiss: chapter 20 CS 5301 Fall 2015 What are sets?! A set is a collection of objects of the same type that has the following two properties: - there are no duplicates in the

More information

Python Lists and Dictionaries CS 8: Introduction to Computer Science, Winter 2019 Lecture #13

Python Lists and Dictionaries CS 8: Introduction to Computer Science, Winter 2019 Lecture #13 Python Lists and Dictionaries CS 8: Introduction to Computer Science, Winter 2019 Lecture #13 Ziad Matni, Ph.D. Dept. of Computer Science, UCSB Administrative Hw07 out today DUE ON MONDAY 3/11 Lab07 will

More information

COSC The StringTokenizer Class. Yves Lespérance. Lecture Notes Week 7 Testing & File I/O

COSC The StringTokenizer Class. Yves Lespérance. Lecture Notes Week 7 Testing & File I/O COSC 1020 Yves Lespérance Lecture Notes Week 7 Testing & File I/O Recommended Readings: Horstmann: Ch. 8 Sec. 1 to 3 & Sec. 6.4.2 Lewis & Loftus: Ch. 10 Sec. 1 & Ch. 4 Sec. 6 The StringTokenizer Class

More information

Week 2: Quick and Dirty Jython Refresher

Week 2: Quick and Dirty Jython Refresher Week 2: Quick and Dirty Jython Refresher (Prelude to Asynchronous Programming) CS6452 Connecting the Lo-Fi Prototype with the Project A few points about the IM assignment The IM protocol we ll be using

More information

DECISION CONTROL AND LOOPING STATEMENTS

DECISION CONTROL AND LOOPING STATEMENTS DECISION CONTROL AND LOOPING STATEMENTS DECISION CONTROL STATEMENTS Decision control statements are used to alter the flow of a sequence of instructions. These statements help to jump from one part of

More information

2013 Association Marketing Benchmark Report

2013 Association  Marketing Benchmark Report 2013 Association Email Marketing Benchmark Report Part I: Key Metrics 1 TABLE of CONTENTS About Informz.... 3 Introduction.... 4 Key Findings.... 5 Overall Association Metrics... 6 Results by Country of

More information

Crystal Reports. Overview. Contents. Cross-Tab Capabilities & Limitations in Crystal Reports (CR) 6.x

Crystal Reports. Overview. Contents. Cross-Tab Capabilities & Limitations in Crystal Reports (CR) 6.x Crystal Reports Cross-Tab Capabilities & Limitations in Crystal Reports (CR) 6.x Overview Contents This document provides an overview of cross-tab capabilities and limitations in Crystal Reports (CR) 6.

More information

AIMMS Function Reference - Date Time Related Identifiers

AIMMS Function Reference - Date Time Related Identifiers AIMMS Function Reference - Date Time Related Identifiers This file contains only one chapter of the book. For a free download of the complete book in pdf format, please visit www.aimms.com Aimms 3.13 Date-Time

More information

CIS192 Python Programming. Robert Rand. August 27, 2015

CIS192 Python Programming. Robert Rand. August 27, 2015 CIS192 Python Programming Introduction Robert Rand University of Pennsylvania August 27, 2015 Robert Rand (University of Pennsylvania) CIS 192 August 27, 2015 1 / 30 Outline 1 Logistics Grading Office

More information

Beyond Blocks: Python Session #1

Beyond Blocks: Python Session #1 Beyond Blocks: Session #1 CS10 Spring 2013 Thursday, April 30, 2013 Michael Ball Beyond Blocks : : Session #1 by Michael Ball adapted from Glenn Sugden is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike

More information

Enters system mode. Example The following example creates a scheduler named maintenancesched and commits the transaction:

Enters system mode. Example The following example creates a scheduler named maintenancesched and commits the transaction: Deployment, on page 1 Deployment Creating a Schedule UCS-A /system # create scheduler Creates a scheduler and enters scheduler mode. UCS-A /system/scheduler # commit-buffer The following example creates

More information

CS Lecture 26: Grab Bag. Announcements

CS Lecture 26: Grab Bag. Announcements CS 1110 Lecture 26: Grab Bag Announcements The End is Nigh! 1. Next (last) lecture will be recap and final exam review 2. A5 due Wednesday night 3. Final exam 7pm Thursday May 15 in Barton Hall (East section)

More information

CPython cannot into threads

CPython cannot into threads GIL CPython cannot into threads 1992 PyPy Jython CPython IronPython Brython PyPy Jython CPython IronPython Brython PyPy Jython CPython IronPython Brython CPython cannot into threads CPython cannot into

More information

Logistics. Half of the people will be in Wu & Chen The other half in DRLB A1 Will post past midterms tonight (expect similar types of questions)

Logistics. Half of the people will be in Wu & Chen The other half in DRLB A1 Will post past midterms tonight (expect similar types of questions) Data Structures Logistics Midterm next Monday Half of the people will be in Wu & Chen The other half in DRLB A1 Will post past midterms tonight (expect similar types of questions) Review on Wednesday Come

More information

LinkedList Implementation Mini-project intro

LinkedList Implementation Mini-project intro LinkedList Implementation Mini-project intro Turn in your written problems Mini-project Partner Survey: Do it by 4:00 today Reminder: Exam #2 is this Thursday In order to reduce time pressure, you optionally

More information

Geometry Agenda. Week 1.6 Objective Grade. Lines and Angles. Practice. Angles Formed by Parallel Lines Practice Proving Lines Parallel.

Geometry Agenda. Week 1.6 Objective Grade. Lines and Angles. Practice. Angles Formed by Parallel Lines Practice Proving Lines Parallel. Name Period Geometry Agenda Week 1.6 Objective Grade Monday September 26, Tuesday September 27, Wednesday September 28, Thursday September 29, Friday September 30, Lines and Angles Practice Angles Formed

More information

Lecture 6. COMP1006/1406 (the OOP course) Summer M. Jason Hinek Carleton University

Lecture 6. COMP1006/1406 (the OOP course) Summer M. Jason Hinek Carleton University Lecture 6 COMP1006/1406 (the OOP course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments A1,A2,A3 are all marked A4 marking just started A5 is due Friday, A6 is due Monday a quick

More information

Pytest C. Release. John McNamara

Pytest C. Release. John McNamara Pytest C Release John McNamara Mar 08, 2018 Contents 1 The C Unit Tests 1 2 The Pytest hooks 3 2.1 The conftest.py file............................................ 3 2.2 Finding test files.............................................

More information

callback, iterators, and generators

callback, iterators, and generators callback, iterators, and generators 1 Adding a Callback Function a function for Newton s method a function of the user to process results 2 A Newton Iterator defining a counter class refactoring the Newton

More information

Ad*Views/Monitor-Plus Reporting Guidelines Spot TV Brand Schedule. Part I: Creating a Spot TV Brand Schedule

Ad*Views/Monitor-Plus Reporting Guidelines Spot TV Brand Schedule. Part I: Creating a Spot TV Brand Schedule Ad*Views/Monitor-Plus Reporting Guidelines Spot TV Brand Schedule What is the Spot TV Brand Schedule? The Spot TV Brand Schedule provides an occurrence-by-occurrence listing of an account s television

More information

Example. Section: PS 709 Examples of Calculations of Reduced Hours of Work Last Revised: February 2017 Last Reviewed: February 2017 Next Review:

Example. Section: PS 709 Examples of Calculations of Reduced Hours of Work Last Revised: February 2017 Last Reviewed: February 2017 Next Review: Following are three examples of calculations for MCP employees (undefined hours of work) and three examples for MCP office employees. Examples use the data from the table below. For your calculations use

More information

Working with Data using OpenRefine. Owen Stephens British Library

Working with Data using OpenRefine. Owen Stephens British Library Working with Data using OpenRefine Owen Stephens British Library Using these slides These slides were developed by Owen Stephens (owen@ostephens.com) on behalf of the British Library. Unless otherwise

More information

Iterators and Generators

Iterators and Generators Iterators and Generators it ain't your gramps' loop any more 2005 Alex Martelli aleaxit@gmail.com Python Iteration Protocol the old way: "for x in y:..." used to mean: at each leg of the loop: y got indexed

More information

61A Lecture 9. Friday, September 20

61A Lecture 9. Friday, September 20 61A Lecture 9 Friday, September 20 Announcements Midterm 1 is on Monday 9/23 from 7pm to 9pm 2 review sessions on Saturday 9/21 2pm-4pm and 4pm-6pm in 1 Pimentel HKN review session on Sunday 9/22 from

More information

CS108 Lecture 16: User Defined Classes. Overview/Questions

CS108 Lecture 16: User Defined Classes. Overview/Questions CS108 Lecture 16: User Defined Classes Aaron Stevens 23 February 2009 1 Overview/Questions Review: the function of functions Thinking about program structure Review: objects and classes How do we design

More information

Python review. 1 Python basics. References. CS 234 Naomi Nishimura

Python review. 1 Python basics. References. CS 234 Naomi Nishimura Python review CS 234 Naomi Nishimura The sections below indicate Python material, the degree to which it will be used in the course, and various resources you can use to review the material. You are not

More information

es T tpassport Q&A * K I J G T 3 W C N K V [ $ G V V G T 5 G T X K E G =K ULLKX LXKK [VJGZK YKX\OIK LUX UTK _KGX *VVR YYY VGUVRCUURQTV EQO

es T tpassport Q&A * K I J G T 3 W C N K V [ $ G V V G T 5 G T X K E G =K ULLKX LXKK [VJGZK YKX\OIK LUX UTK _KGX *VVR YYY VGUVRCUURQTV EQO Testpassport Q&A Exam : 70-290 Title : Managing and Maintaining a MS Win Server 2003 Environment Version : DEMO 1 / 9 1.You are a network administrator for your company. The network consists of a single

More information

University of Washington CSE 140 Data Programming Winter Final exam. March 11, 2013

University of Washington CSE 140 Data Programming Winter Final exam. March 11, 2013 University of Washington CSE 140 Data Programming Winter 2013 Final exam March 11, 2013 Name: Section: UW Net ID (username): This exam is closed book, closed notes. You have 50 minutes to complete it.

More information

Strings. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington

Strings. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington Strings CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Strings Store Text In the same way that int and float are designed to store numerical values,

More information

JavaScript. Like PHP, JavaScript is a modern programming language that is derived from the syntax at C.

JavaScript. Like PHP, JavaScript is a modern programming language that is derived from the syntax at C. Like PHP, JavaScript is a modern programming language that is derived from the syntax at C. It has been around just about as long as PHP, also having been invented in 1995. JavaScript, HTML, and CSS make

More information

A Brief Introduction to Python for those who know Java Last extensive revision: Jie Gao, Fall 2018 Previous revisions: Daniel Moroz, Fall 2015

A Brief Introduction to Python for those who know Java Last extensive revision: Jie Gao, Fall 2018 Previous revisions: Daniel Moroz, Fall 2015 A Brief Introduction to Python for those who know Java Last extensive revision: Jie Gao, Fall 2018 Previous revisions: Daniel Moroz, Fall 2015 Meet the Mighty Python Plan Day 1 Baby steps History, Python

More information

Outline. LList: A Linked Implementation of a List ADT Iterators Links vs. Arrays In-class work. 1 Chapter 4: Linked Structures and Iterators

Outline. LList: A Linked Implementation of a List ADT Iterators Links vs. Arrays In-class work. 1 Chapter 4: Linked Structures and Iterators Chapter 4: Linked Structures and Outline 1 Chapter 4: Linked Structures and Chapter 4: Linked Structures and Using the ListNode Class Ideas about Linked List Implementation We have a pretty good feeling

More information

Holiday Messaging Trends and Best Practices

Holiday Messaging Trends and Best Practices Holiday Messaging Trends and Best Practices Welcome to a Fishbowl Best Practices Webinar Hosted by: Natalie Ikemeier Managing Consultant Agenda A Snapshot of U.S. Holiday Email Data Holiday Messaging Performance

More information

CS61A Lecture 15 Object Oriented Programming, Mutable Data Structures. Jom Magrotker UC Berkeley EECS July 12, 2012

CS61A Lecture 15 Object Oriented Programming, Mutable Data Structures. Jom Magrotker UC Berkeley EECS July 12, 2012 CS61A Lecture 15 Object Oriented Programming, Mutable Data Structures Jom Magrotker UC Berkeley EECS July 12, 2012 COMPUTER SCIENCE IN THE NEWS http://www.iospress.nl/ios_news/music to my eyes device converting

More information

Lecture 13. For-Loops

Lecture 13. For-Loops Lecture 3 For-Loops Announcements for This Lecture Reading Assignments/Lab Today: Chapters 8, 0 Thursday: Chapter Prelim, 0/ 5:5 OR 7:30 Material up to TUESDAY Study guide is posted Times/rooms by last

More information

CPSC 2380 Data Structures and Algorithms

CPSC 2380 Data Structures and Algorithms CPSC 2380 Data Structures and Algorithms Spring 2014 Department of Computer Science University of Arkansas at Little Rock 2801 South University Avenue Little Rock, Arkansas 72204-1099 Class Hours: Tuesday

More information

The Practice of Computing Using PYTHON

The Practice of Computing Using PYTHON The Practice of Computing Using PYTHON William Punch Richard Enbody Chapter 6 Lists and Tuples 1 Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Data Structures 2 Data Structures

More information

MEIN 50010: Python Data Structures

MEIN 50010: Python Data Structures : Python Data Structures Fabian Sievers Higgins Lab, Conway Institute University College Dublin Wednesday, 2017-10-18 Data Structures Stacks, Queues & Deques Structures Data structures are a way of storing

More information

BUP2 5/2 12/4/07 12:49 AM Page 1. Introduction

BUP2 5/2 12/4/07 12:49 AM Page 1. Introduction BUP2 5/2 12/4/07 12:49 AM Page 1 Introduction This booklet will give you easy to follow instructions to allow you to set your BUP2 Programmer to the Weekday/Weekend, (same times Monday - Friday, different

More information

TutorTrac for Staff LOGINS: Kiosk Login Setting up the Kiosk for Student Login:

TutorTrac for Staff LOGINS: Kiosk Login Setting up the Kiosk for Student Login: LOGINS: TutorTrac for Staff Kiosk Login Setting up the Kiosk for Student Login: Click on the TutorTrac icon: This goes to http://tutortrac.davenport.edu (or type in the URL, if the shortcut is not available).

More information

COMP 364: Computer Tools for Life Sciences

COMP 364: Computer Tools for Life Sciences COMP 364: Computer Tools for Life Sciences Algorithm design: Linear and Binary Search Mathieu Blanchette, based on material from Christopher J.F. Cameron and Carlos G. Oliver 1 / 24 Algorithms An algorithm

More information

PYTHON DATA SCIENCE TOOLBOX II. List comprehensions

PYTHON DATA SCIENCE TOOLBOX II. List comprehensions PYTHON DATA SCIENCE TOOLBOX II List comprehensions Populate a list with a for loop In [1]: nums = [12, 8, 21, 3, 16] In [2]: new_nums = [] In [3]: for num in nums:...: new_nums.append(num + 1) In [4]:

More information

A Little Python Part 2

A Little Python Part 2 A Little Python Part 2 Introducing Programming with Python Data Structures, Program Control Outline Python and the System Data Structures Lists, Dictionaries Control Flow if, for, while Reminder - Learning

More information

Abstract Data Types Chapter 1

Abstract Data Types Chapter 1 Abstract Data Types Chapter 1 Part Two Bags A bag is a basic container like a shopping bag that can be used to store collections. There are several variations: simple bag grab bag counting bag 2 Bag ADT

More information

AP Statistics Assignments Mr. Kearns José Martí MAST 6-12 Academy

AP Statistics Assignments Mr. Kearns José Martí MAST 6-12 Academy AP Statistics Assignments Mr. Kearns José Martí MAST 6-12 Academy 2016-2017 Date Assigned Assignments Interested in Join the Edmodo group 2017 Summer Work Group for community service Green Club using the

More information

Basic Device Management

Basic Device Management This chapter contains the following sections: About, page 1 Licensing Requirements for, page 2 Default Settings for Basic Device Parameters, page 3 Changing the Device Hostname, page 3 Configuring the

More information

AQA Decision 1 Algorithms. Section 1: Communicating an algorithm

AQA Decision 1 Algorithms. Section 1: Communicating an algorithm AQA Decision 1 Algorithms Section 1: Communicating an algorithm Notes and Examples These notes contain subsections on Flow charts Pseudo code Loops in algorithms Programs for the TI-83 graphical calculator

More information

Administrative Notes January 19, 2017

Administrative Notes January 19, 2017 Administrative Notes January 19, 2017 Reminder: In the News due on Friday Reminder: Reading Quizzes due next Monday Anne will be away next Monday and Tuesday and will not have office hours on Monday Jessica

More information