Comp 150-001, MWF 12:35, Crown 105

Week 12






Issues with emojis

Ports

Fixes:

1. Skip those ports:

    if port in [2037, 2058, 2071]: continue

2. Run python from the command line (bash/Terminal/cmd). The problem: this is probably a major pain on Windows

3. Use try/except on the bytes-to-string conversion

try:
    response = str(buf,'utf-8')
except:
    print('port {}: unicode conversion error'.format(port))
    continue
print('port {}: received string {}'.format(port, response)) 

A quick look at the server (in Java)


Loop idioms:

Converting one list to a related list
    mapping
    filtering
    summing ("folding")

Animation loop

using dictionaries to look up data:

    wordcount   

    labeled records:

    d = {
    'fname': 'peter',
    'lname': 'dordal',
    'dept':    'CS',
    'university': 'loyola',
    'courses': [150, 170, 264, 271, 305, 317, 343 ]
    }

Sets: based on the dictionary idea. A set can be thought of as a dictionary with the set values as keys, and the values are all True.

account lookup:

d[username] = hashed_password

d[username] = access_list


countyhealthrankings.org