Page 205 -
P. 205
comprehending data
Let’s take a few moments to implement the review team’s suggestion to turn those four with
statements into a function. Here’s the code again. In the space provided, create a function to
abstract the required functionality, and then provide one example of how you would call your
new function in your code:
with open('james.txt') as jaf:
data = jaf.readline()
james = data.strip().split(',')
with open('julie.txt') as juf:
data = juf.readline()
julie = data.strip().split(',')
with open('mikey.txt') as mif:
data = mif.readline()
mikey = data.strip().split(',')
with open('sarah.txt') as saf:
data = saf.readline()
sarah = data.strip().split(',')
Write your new
function here.
Provide one
example call.
you are here 4 169