CompSci 101 Introduction to Computer Science

Slides:



Advertisements
Similar presentations
ITC242 – Introduction to Data Communications ITC431 – Computer Networks Week 13 Exam Preparation.
Advertisements

CompSci 101 Introduction to Computer Science January 13, 2015 Prof. Rodger compsci 101 spring
CompSci 101 Introduction to Computer Science January 20, 2015 Prof. Rodger compsci 101, spring
CS 140 Computer Programming (I) Second semester (3 credits) Imam Mohammad bin Saud Islamic University College of Computer Science and Information.
CompSci 6 Introduction to Computer Science October 20, 2011 Prof. Rodger.
CompSci 101 Introduction to Computer Science September 23, 2014 Prof. Rodger.
CompSci 101 Introduction to Computer Science Sept. 9, 2014 Prof. Rodger President Brodhead speech graduation 2010 CompSci 101 Fall
Math 15 Introduction to Scientific Data Analysis Lecture 9 Python Programming – #3 University of California, Merced.
CompSci 6 Introduction to Computer Science Sept 29, 2011 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not.
CompSci 6 Introduction to Computer Science November 8, 2011 Prof. Rodger.
CompSci 101 Introduction to Computer Science November 18, 2014 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.
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.
CompSci 101 Introduction to Computer Science March 31, 2015 Prof. Rodger Thanks to Elizabeth Dowd for giving this lecture Review for exam.
CompSci 101 Introduction to Computer Science February 10, 2015 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were.
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 Introduction to Computer Science Feb 24, 2015 Prof. Rodger.
CompSci 6 Introduction to Computer Science Sept. 20, 2011 Prof. Rodger CompSci 6 Fall
CompSci 101 Introduction to Computer Science November 11, 2014 Prof. Rodger CompSci 101 Fall Review for exam.
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 April 7, 2015 Prof. Rodger.
CompSci 101 Introduction to Computer Science March 24, 2016 Prof. Rodger compsci 101, spring
CompSci 101 Introduction to Computer Science March 1, 2016 Prof. Rodger.
CompSci 101 Introduction to Computer Science March 29, 2016 Prof. Rodger.
CompSci 101 Introduction to Computer Science February 5, 2015 Prof. Rodger Lecture given by Elizabeth Dowd compsci101 spring151.
CompSci 101 Introduction to Computer Science Sept 13, 2016 Prof. Rodger compsci101 fall161.
CompSci 4 Java 1 Apr 2, 2009 Prof. Susan Rodger. Announcements Assignment 7 questions? –Beware having two events that kick in at the same time! –Beware.
Any questions on today’s homework. (Sections 1. 6/1
Course Information and Introductions
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CMSC201 Computer Science I for Majors Lecture 13 – Midterm Review
Discrete Structures for Computer Science
CompSci 6 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CMSC201 Computer Science I for Majors Lecture 22 – Searching
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Introduction to Programmng in Python
CMSC201 Computer Science I for Majors Lecture 13 – Midterm Review
Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
We’ll be spending minutes talking about Quiz 1 that you’ll be taking at the next class session before you take the Gateway Quiz today.
Welcome to CS 1010! Algorithmic Problem Solving.
Last Class We Covered Data representation Binary numbers ASCII values
Welcome to CS 1010! Algorithmic Problem Solving.
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Lesson 05: Iterations Topic: Introduction to Programming, Zybook Ch 4, P4E Ch 5. Slides on website.
CompSci 101 Introduction to Computer Science
CMSC201 Computer Science I for Majors Lecture 25 – Final Exam Review
Last Class We Covered Asymptotic Analysis Run “time” Big O
Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg
CompSci 101 Introduction to Computer Science
CMSC201 Computer Science I for Majors Final Exam Information
Prof. Qi Tian Fall 2013 CS 3843 Midterm Review Prof. Qi Tian Fall 2013.
Presentation transcript:

CompSci 101 Introduction to Computer Science Nov 15, 2016 Prof. Rodger Review for exam cps101 fall 2016

Announcements No Lab this week! No Consulting Hours Thursday night Exam 2 Thursday Reading and RQ for next week – coming… Assignment 7 due Nov 29 APT 8 due today Doing extra ones – good practice for exam No Lab this week! No Consulting Hours Thursday night Review Session – Wed 7:30pm LSRC B101 Today: Finish notes from last time – Dictionary timings Reviewing for the exam Assignment 7 – add a dictionary but note it is not as simple a dictionary as Assignment 6 was. It is a bit more challenging. Don’t wait til the last minute to start!

Future Duke CS Alum Flunching with CompSci 101 students Time for flunching is running out. Two weeks after thanksgiving break is last chance this semester cps101 fall 2016

Clever Hangman Version of Hangman that is hard to win. Program keeps changing secret word to make it hard to guess! User never knows! Once a letter is chosen and shown in a location, program picks from words that only have that letter in that location Program smart to pick from largest group of words available cps101 fall 2016

Clever Hangman - Dictionary Builds a dictionary of categories Start with list of words of correct size Repeat User picks a letter Make dictionary of categories based on letter New list of words is largest category Category includes already matched letters List shrinks in size each time cps101 fall 2016

Clever Hangman Example Possible scenerio after several rounds From list of words with a the second letter. From that build a dictionary of list of words with no d and with d in different places: Great Dictionary example to solve a problem! Choose “no d”, most words, 147 Only 17 words of this type Only 1 word of this type

Exam logistics Only need a pen or pencil No scratch paper See the reference sheet of Python information you will get with the test (see resources page) Closed book, closed notes, closed neighbor Covers lecture, lab and assigned reading Have put old quizzes back up as quiz review This is NOT for a grade, for studying only cps101 fall 2016

Understand old and new topics Old topics: if, for, while, lists, strings list comprehension, enumerate Files – write code - Will give you a file already opened and ready for reading Sets, Dictionaries – write code – create and use Understand items on Python review sheet on resources page HAVE NOT COVERED TOPICS – regular expressions or recursion cps101 fall 2016

The best way to study Write code on paper! Resources page has old tests and solutions Try writing code, then look at solutions Rewrite an APT Rewrite code we did in lecture Rewrite code we did in classwork or lab cps101 fall 2016

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

Questions bit.ly/101f16-1115-1 cps101 fall 2016

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))) cps101 fall 2016

Set Concepts 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 Sets aren't in order during iteration Convert to list, create from list Sets are really, really efficient for add/search cps101 fall 2016

Dictionaries Build a dictionary Use a dictionary Counting dictionary string to number Grouping dictionary string to list of items related Use a dictionary Get values Get keys Get key,value pair cps101 fall 2016

Questions bit.ly/101f16-1115-2 cps101 fall 2016

Now go over Test Practice problems cps101 fall 2016