Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End the "Making Choices" lesson with an example that synthesizes what has been learned up to that point #293

Open
jdidion opened this issue Aug 3, 2016 · 0 comments
Labels
help wanted Looking for Contributors type:discussion Discussion or feedback about the lesson
Milestone

Comments

@jdidion
Copy link

jdidion commented Aug 3, 2016

Let's combine what we've learned about searching for files (glob), reading in data (numpy.loadtxt), iterating over sequences (for loops), and making choices (if statements) to check all of our data files in a single loop:

for datafile in glob.glob('data/inflammation*.csv'):
data = numpy.loadtxt(fname=datafile, delimiter=',')
if numpy.max(data, axis=0)[0] == 0 and numpy.max(data, axis=0)[20] == 20:
print('Suspicious looking maxima!')
elif numpy.sum(numpy.min(data, axis=0)) == 0:
print('Minima add up to zero!')
else:
print('Seems OK!')

@fmichonneau fmichonneau added type:discussion Discussion or feedback about the lesson help wanted Looking for Contributors and removed discussion labels Jun 8, 2018
@ErinBecker ErinBecker added this to the June 2019 Release milestone May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Looking for Contributors type:discussion Discussion or feedback about the lesson
Projects
None yet
Development

No branches or pull requests

4 participants