Compsci 6/101, Spring 2012 10.1 WBFSB l Plan for this week  Get test back, review, look for problems/weaknesses  How to address these?  Assignments.

Slides:



Advertisements
Similar presentations
Lecture 6 : Dynamic Hashing Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.
Advertisements

DICTIONARIES. The Compound Sequence Data Types All of the compound data types we have studies in detail so far – strings – lists – Tuples They are sequence.
Searching/Sorting Introduction to Computing Science and Programming I.
index.php Palmyra Area High School 1.
A Level Computer Science Topic 9: Data Structures T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen.
Python Programming Chapter 10: Dictionaries Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
General Programming Introduction to Computing Science and Programming I.
Compsci 06/101, Fall Compsci 6/101: Sept 6-10 l We've looked at the language Python  Names and types: int, float, long, String, file, …  Operations:
Introduction. 2COMPSCI Computer Science Fundamentals.
© Copyright 2012 by Pearson Education, Inc. All Rights Reserved. Chapter 14 Tuples, Sets, and Dictionaries 1.
Week 6 - Friday.  What did we talk about last time?  Recursive running time  Fast exponentiation  Merge sort  Introduced the Master theorem.
Python Lists and Such CS 4320, SPRING List Functions len(s) is the length of list s s + t is the concatenation of lists s and t s.append(x) adds.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Compsci 06/101, Fall What will you do in Compsci 6 Today? l Learn about selection and if/else statements  In context of solving problems  Understanding.
Built-in Data Structures in Python An Introduction.
Compsci 6/101, Spring More on Python, Tools, Compsci 101 l APTs, Assignments, Tools  APT: Algorithmic Problem-solving and Testing  How to get.
Recap form last time How to do for loops map, filter, reduce Next up: dictionaries.
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
Compsci 06/101, Fall What's ahead in Compsci 6/101? l Software architecture and design, why Jotto has modules and how communication works  We.
Python Arrays. An array is a variable that stores a collection of things, like a list. For example a list of peoples names. We can access the different.
Compsci 06/101, Fall Vocabulary l What's the Spanish word for 'boy'? 'eat'?  How do you know? l What about the Turkish equivalents?  How do.
Compsci 101.2, Fall Plan for FFWOO l Programming in the small and in the large  Making one function work correctly, especially in the context.
CPS 100, Spring Tools: Solve Computational Problems l Algorithmic techniques  Brute-force/exhaustive, greedy algorithms, dynamic programming,
OCR GCSE Computing © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 1: Introduction.
Lecture 04 – Models of memory Mutable and immutable data.
LogTree: A Framework for Generating System Events from Raw Textual Logs Liang Tang and Tao Li School of Computing and Information Sciences Florida International.
Compsci 101.2, Fall Plan for October l Review Catchup and Midterm and Future  Make sure everyone understand options l Review Assignment.
Tuples and Dictionaries Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Compsci 101.2, Fall Plan for TDAFB (after fall break) l Hear via about plans to catch-up and stay-ahead  Profs. Rodger and Astrachan to.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Thomas Kuehne.
Compsci 101.2, Fall Plan for FWON l Review current assignments and APTs  Review Dictionaries and how to use them  Code and APT walk-through.
Compsci 101.2, Fall Plan for 11/9 and 11/11 l Reviewing Concepts for test  Loops: index and by element  Strings, Lists, Sets, Dictionaries.
14. DICTIONARIES AND SETS Rocky K. C. Chang 17 November 2014 (Based on from Charles Dierbach, Introduction to Computer Science Using Python and Punch and.
Compsci 101.2, Fall Plan for October 29 l Review dictionaries and their use  Very efficient, easy to use  Efficiency doesn't matter much for.
CompSci Introduction to Jam’s Video Game Package.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Compsci 101.2, Fall Plan for eleven-four l Thinking about APTs and test problems  How do you choose: list, string, set, dictionary  Experience?
Week 12 - Monday.  What did we talk about last time?  Defining classes  Class practice  Lab 11.
Compsci 101.2, Fall Plan for October l Structuring Data and Code for Efficiency  Computer time, how expensive is it?  Data storage, how.
CompSci 44.1 Game Package Introduction to Jam’s Video Game Package.
Compsci 06/101, Spring Compsci 6: PFTW l Problem solving and (Python) programming  What are the steps in solving an APT?  How do you get better.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
Dictionaries Intro to Computer Science CS 1510 Dr. Sarah Diesburg.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Compsci 06/101, Spring This week in Compsci 6/101 l From sets to dictionaries  Incredibly powerful in solving problems  Power in Perl, Python,
Genome Revolution: COMPSCI 004G 5.1 Searching l Why does SSAHA compute locations of all n-mers?  agttc occurs at (1,3) (1,18) (2,6) (3,13), …  What is.
CompSci 101 Introduction to Computer Science February 16, 2016 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were.
CompSci 101 Introduction to Computer Science March 24, 2016 Prof. Rodger compsci 101, spring
CompSci 101 Introduction to Computer Science March 8, 2016 Prof. Rodger.
Coupling and Cohesion Schach, S, R. Object-Oriented and Classical Software Engineering. McGraw-Hill, 2002.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
Intro to CS Nov 21, 2016.
Introduction to Computing Science and Programming I
Test 2 Review Outline.
CompSci 101 Introduction to Computer Science
Compsci 6/101: I Python Techniques for looping
Python – May 18 Quiz Relatives of the list: Tuple Dictionary Set
PFTD and PFTW Review hashing from intuitive view point, from general viewpoint, from Java 8 viewpoint Try to isolate dependencies on Java, but knowledge.
What is a Literary Fingerprint?
CompSci 101 Introduction to Computer Science
COSC 1323 – Computer Science Concepts I
CISC101 Reminders Slides have changed from those posted last night…
CompSci 101 Introduction to Computer Science
Programming for Engineers in Python
CEV208 Computer Programming
Dictionaries: Keeping track of pairs
See requirements for practice program on next slide.
Python Basics with Jupyter Notebook
Compsci 201, Collections, Hashing, Objects
Dictionary.
Presentation transcript:

Compsci 6/101, Spring WBFSB l Plan for this week  Get test back, review, look for problems/weaknesses  How to address these?  Assignments and APTs, reviewing concepts  Dictionary: new Python structuring mechanism (set,list) l Walkthrough for Jotto assignment  Start today in class, continue l What is Computer Science? Why study it?  The future belongs to those who can process information?

Compsci 6/101, Spring Jotto: The Program Architecture You write jotto_model.py  This is the guts, brains, state of the program  Keeps track of how the game is progressing  Functions communicate via global state Maintain state between function calls l We provide two views: command-line and GUI  Allow you to view and control the model  Both view-controllers: jotto_commandline.py and jotto_gui.py know about the model, but model doesn't know about them atypical MV/MVC

Compsci 6/101, Spring Model View Controller (MVC)

Compsci 6/101, Spring What are global variables? l Accessible to all functions in a module  Declared as global varname in functions Mandatory for writing global variables Good idea for reading global variables  Defined at 'top' of module for reading code l Why are global variables are bad idea?  Very difficult to reason about correct code  Very difficult to extend, modify code  Non-locality makes maintenance difficult

Compsci 6/101, Spring Maria Klawe Chair of Computer Science at UBC, Dean of Engineering at Princeton, President of Harvey Mudd College, ACM Fellow,… Klawe's personal interests include painting, long distance running, hiking, kayaking, juggling and playing electric guitar. She describes herself as "crazy about mathematics" and enjoys playing video games. "I personally believe that the most important thing we have to do today is use technology to address societal problems, especially in developing regions"

Compsci 6/101, Spring How does this work? l  URL Shortener, why useful on Twitter?  How are URLs stored, searched for, used? l Hashing: convert long string to short number  glFvFi is a number!  Look up and use!

Compsci 6/101, Spring Count word occurrences: tag cloud

Compsci 6/101, Spring What is a Literary Fingerprint? l l l What are some of the issues in creating 'fingerprint'  Where else do fingerprints occur?  What is others? l How do we go from sets to frequency analysis?  Understanding Python dictionary data type

Compsci 6/101, Spring Literary Fingerprint l Timing and playing with code in fingerPrint.py  How do we find out how fast this is?  How do we change the format of the output?  Can we organize output differently? l How can we find 'other' fingerprints  Shazaam, genome, images  What will be the key, what will be the value?

Compsci 6/101, Spring From 10,000 ft to 1 km: Dictionaries l What is a dictionary? By example  is  is cnn.com  is espn.go.com l A collection of (key,value) pairs  Look up a key, get an associated value  Update the value associated with a key  Insert a (key,value) pair  Loop over the keys, access pairs or value

Compsci 6/101, Spring A Python view of dictionaries l A collection of (key,value) pairs that is similar syntactically to a list  A list can be accessed by index: a[3]  A dictionary can be accessed by key: d["cat"] l The key in a dictionary must be immutable  Essentially because key converted to number and number used as index (to find value) l Finding the value associated with a key is very fast  Essentially doesn't depend on # keys!

Compsci 6/101, Spring Python syntax for dictionaries l Create a dictionary:  d = {}  d = {"apple":3, "guava":37}  d = dict([("owen":62.5)("bob":73.9)] l Internal dictionaries in Python  Sometimes useful in meta-programming  globals():  locals():