Compsci 101.2, Fall 2015 21.1 Plan for 11/9 and 11/11 l Reviewing Concepts for test  Loops: index and by element  Strings, Lists, Sets, Dictionaries.

Slides:



Advertisements
Similar presentations
Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
Advertisements

Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
Dictionaries Last half of Chapter 5. Dictionary A sequence of key-value pairs – Key is usually a string or integer – Value can be any python object There.
Games and Simulations O-O Programming in Java The Walker School
Investigate the degree to which programming concepts are interrelated Reshmi Ravi.
 1 String and Data Processing. Sequential Processing Processing each element in a sequence for e in [1,2,3,4]: print e for c in “hello”: print c for.
The foreach LooptMyn1 The foreach Loop The foreach loop gives an easy way to iterate over arrays. foreach works only on arrays, and will issue an error.
Handling Lists F. Duveau 16/12/11 Chapter 9.2. Objectives of the session: Tools: Everything will be done with the Python interpreter in the Terminal Learning.
Introduction. 2COMPSCI Computer Science Fundamentals.
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.
Beyond Lists: Other Data Structures CS303E: Elements of Computers and Programming.
CompSci Today’s topics Java Review Just a bunch of headings meant to trigger questions A contraction of previous notes Upcoming Midterm Exam Reading.
CIT 590 Intro to Programming Lecture 4. Agenda Doubts from HW1 and HW2 Main function Break, quit, exit Function argument names, scope What is modularity!
If statements while loop for loop
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.
LISTS AND ARRAYS CHAPTER Topics  C# Collections  List –Flexible collection of variable length  Array –Standard arrays  Multidimensional Arrays.
And other languages….  Array literals/initialization a = [1,2,3] a2 = [-10..0, 0..10] a3 = [[1,2],[3,4]] a4 = [w*h, w, h] a5 = [] empty = Array.new zeros.
Compsci 6/101, Spring More on Python, Tools, Compsci 101 l APTs, Assignments, Tools  APT: Algorithmic Problem-solving and Testing  How to get.
Compsci 101.2, Fall PFTheWeek 9/21-9/25 l Potpourri, Hodgepodge of Review Concepts  File reading and writing  Boolean expressions  Arithmetic.
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.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 9 Dictionaries and Sets.
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,
CompSci 101 Introduction to Computer Science March 3, 2015 Prof. Rodger compsci101 spring151.
Compsci 101.2, Fall Plan for October l Review Catchup and Midterm and Future  Make sure everyone understand options l Review Assignment.
CompSci 6 Introduction to Computer Science September 13, 2011 Prof. Rodger.
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.
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.
Math 71A 4.2 – Compound Inequalities intersection.
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 101.2, Fall Plan for WBTB l APT Quiz 3 – due tonight l Solving problems in the wild  How can you change how things are sorted Other.
Objectives Solve compound inequalities with one variable.
Compsci 101.2, Fall Plan for October 22 l Images, tuples, RGB color model  Image processing by understanding API  Image processing with tuples.
Compsci 6/101, Spring WBFSB l Plan for this week  Get test back, review, look for problems/weaknesses  How to address these?  Assignments.
9.2 Compound Sentences Goal(s): Solve and Graph Conjunctions and Disjunctions.
Compsci 101.2, Fall Plan for eleven-four l Thinking about APTs and test problems  How do you choose: list, string, set, dictionary  Experience?
Compsci 101.2, Fall Plan for WEFWOO l Review for exam, studying and practicing for exams and APTs in Compsci 101  Why memorization doesn't help.
Compsci 101.2, Fall Plan for October l Structuring Data and Code for Efficiency  Computer time, how expensive is it?  Data storage, how.
CompSci 101 Introduction to Computer Science Feb 24, 2015 Prof. Rodger.
Compsci 06/101, Spring This week in Compsci 6/101 l From sets to dictionaries  Incredibly powerful in solving problems  Power in Perl, Python,
CompSci 101 Introduction to Computer Science November 11, 2014 Prof. Rodger CompSci 101 Fall Review for exam.
CIT 590 Intro to Programming Lecture 4. Random utilities to improve efficiency Search everything! Beyond Compare Keyboard shortcuts Not essentially but.
Quiz 3 Topics Functions – using and writing. Lists: –operators used with lists. –keywords used with lists. –BIF’s used with lists. –list methods. Loops.
CompSci 6 Introduction to Computer Science September 27, 2011 Prof. Rodger CompSci 6 Fall
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.
Python Fundamentals: Complex Data Structures Eric Shook Department of Geography Kent State University.
CompSci 101 Introduction to Computer Science March 1, 2016 Prof. Rodger.
Jeff Forbes Owen Astrachan September 8, 2017
Test 2 Review Outline.
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Python – May 18 Quiz Relatives of the list: Tuple Dictionary Set
CompSci 6 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Objectives Solve compound inequalities with one variable.
CompSci 101 Introduction to Computer Science
6.1 One-to-One Functions; Inverse Function
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
4.1 One-to-One Functions; Inverse Function
CompSci 101 Introduction to Computer Science
6.1 One-to-One Functions; Inverse Function
CISC101 Reminders Assignment 2 due today.
Agenda for Unit 8: Defining Arrays in Game Programs
Presentation transcript:

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  List Comprehensions l Lab and assignment concepts  While loops, Global Variables, Computer-aided Game Play  Image processing, RGB, simulation/random, CSV files

Compsci 101.2, Fall Reminder of APT quiz l How to solve it: APT Quiz style  Looking at problems from last time  Goals in time-driven APT-solving l CountUp  Ideas l Maker  Ideas l Anonymous

Compsci 101.2, Fall Looping by index or by element l Strings and lists: use either  range(len(x)) for index, can get element l Sets and Dictionaries: element only  Loop over d or d.keys() for dictionary  The keys are a set, so similar to set loop l Which is best when choice? It depends!  Can you get element from index?  Can you get index from element?

Compsci 101.2, Fall Questions

Compsci 101.2, Fall Unpacking a list comprehension [f(x) for x in foo if condition with x] [w for w in words if w.endswith('e')] [(w,words.count(w)) for w in set(words)]  Always possible to use a loop build = [] for x in foo: if condition with x: build.append(f(x)) build = [] for w in set(words): build.append((w,words.count(w)))

Compsci 101.2, Fall Set Concepts l Set union, intersection, difference  s.intersection(t) is the same as s&t  s.union(t) is the same as s|t  s.difference(t) is the same as s-t l Sets aren't in order during iteration  Convert to list, create from list  Sets are really, really efficient for add/search

Compsci 101.2, Fall Questions