J is for … Compsci 101 Pancakes, While loops, Parallel Lists • JSON Live Lecture • Format for data transmitted across the web Susan Rodger • JPEG September 17, 2020 • Image format based on lossy compression • Jacquard Loom • 1804 "automated" loom 9/17/2020 Compsci 101, Fall 2020 1 9/17/2020 Compsci 101, Fall 2020 2 Announcements PFTD • APT-3 due Tuesday, September 22 • Assignment 2 due September 29 • Files and Data • Last Chance for Accommodations letter • Pancake APT • Email to Yesenia at yvelasco@cs.duke.edu • While loops and Collatz sequence • Do not email Prof. Rodger! • Parallel lists • No Videos, RQ’s next week • Exam 1 Thursday 9/24 • Pick a time and take it that day • Fixed amount of time to take it • APT Quiz 1 9/25-9/28 9/17/2020 Compsci 101, Fall 2020 3 9/17/2020 Compsci 101, Fall 2020 4
WOTO-1 Files Pancakes! http://bit.ly/101f20-0917-1 • In your groups: • Come to a consensus 9/17/2020 Compsci 101, Fall 2020 6 9/17/2020 Compsci 101, Fall 2020 7 APT Pancake • How do you solve this (or any) problem? • 7 Steps! • Some APTs are hard problems to solve (step 1-4) • Translating to code easy • Some APTs have easy-to-see algorithms (step 5) • Translating to code is hard 9/17/2020 Compsci 101, Fall 2020 8 compsci 101, fall 2017 9
WOTO-2 Pancakes http://bit.ly/101f20-0917-2 • In your groups: • Come to a consensus compsci 101, fall 2017 10 9/17/2020 Compsci 101, Fall 2020 14 Let’s code it up! Review: While Loops • Don't know: how many times loop executes • a priori knowledge, we'll know afterword • Do know: condition that should be true after loop • Its negation is the expression for BOOL_CONDITION (loop guard) while BOOL_CONDITION: LOOP_BODY # modify variables, affect expression 9/17/2020 Compsci 101, Fall 2020 25 9/17/2020 Compsci 101, Fall 2020 28
WOTO-3 Collatz and While Genesis Bond ‘16 http://bit.ly/101f20-0917-3 • Facebook Engineer • Struggled at Duke • In your groups: • 5 years • Dismissed 1 semester due • Come to a consensus to grades • Revature • Trainer Full Stack Development • http://bit.ly/dukebond Poor preparation promotes poor performance. In anything you do, your preparation will show. 9/17/2020 Compsci 101, Fall 2020 29 9/17/2020 Compsci 101, Fall 2020 30 WOTO-4 File Frequency Parallel Lists Review http://bit.ly/101f20-0917-4 • We will use parallel lists to track data • Each word is stored in a list named words • In your groups: • Word’s count is stored in a list named counts • Come to a consensus • # occurrences of words[k] is in counts[k] ["apple", "fox", "vacuum", "lime"] [5,2,25,15] • What happens when we read a word? 9/17/2020 Compsci 101, Fall 2020 31 9/17/2020 Compsci 101, Fall 2020 32
More recommend