Lecture 10: Excel + Dictionaries
Craig Zilles (Computer Science) November 1, 2019 https://go.illinois.edu/cs105fa19
CS 105 Lecture 10: Excel + Dictionaries Craig Zilles (Computer - - PowerPoint PPT Presentation
CS 105 Lecture 10: Excel + Dictionaries Craig Zilles (Computer Science) https://go.illinois.edu/cs105fa19 November 1, 2019 Are you sitti ting next t to someone to talk to for th the clicker questi tions? To Today I'm using: a text editor
Craig Zilles (Computer Science) November 1, 2019 https://go.illinois.edu/cs105fa19
2
3
4
current_best = a value you know is worse than best for thing in collection: if thing is better than current_best: current_best = thing return / do something with current_best
5
current_best = a value you know is worse than best best_info = None for thing in collection: if thing is better than current_best: current_best = thing best_info = info about thing return / do something with current_best, best_info
6
import sys sys.argv is a list of arguments
7
8
import csv csv_data = csv.reader(csv_file)
9
my_list = [ ['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i'] ] x = my_list[1][2] A) 'b' B) 'd' C) 'f' D) 'h' E) Some other value
10
mylist = ['a', 'b', 'c'] mylist.append(['d', 'e'])
executes A) ['a', 'b', 'c'] B) ['a', 'b', 'c', 'd', 'e'] C) ['a', 'b', 'c', ['d', 'e']] D) ['d', 'e', 'a', 'b', 'c'] E) some other value
11
[expression for value in sequence] [expression for value in sequence if condition]
12
some points (when upload scores to Compass)
semester, but will wait to see remaining exams.
VLOOKUP
13
14
A) 9 B) 10 C) 18 D) 20 E) Some other value
15
16
A) D12 B) E11 C) E12 D) E13 E) F12
17
must be sorted in increasing order)
equal, values must be sorted in descending order)
containing the value
18
19
retrieve a value.
(default). FALSE = exact match.
20
for thing in collection: count[thing] += 1 # logically..
21
22
23
newlist = [] for thing in collection: if thing meets criteria: newlist.append(thing)
24