lec7_review_practice

lec7_review_practice - Review arrays and loops Practice...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Review arrays and loops Practice Exercises Ask your questions! HW#2 due today Finish Chap. 4 reading Start reading Chap. 5.1 (skip 5.2). Chap. 6 has helpful sections on reading/writing files, urllib, and neat things you can do with strings. From here on out, well be skipping around in the book. Class Notes Generate x and y arrays of length 50 where y= (x-2)**2*sin(x) from x=[0,10] Write data to a file (mydata.txt) in columns Read data back in and plot with line joined green squares. Find the maximum the y data and print the (x,y) values where the maximum occurs on the plot. Helpful array methods: y.argmax() produces the index where the maximum value in y occurs. Similar for y.argmin(). Follow up for loops A looping variable is created and referenced in the for loop. Does not exist anywhere else. looping variable changes with each iteration of the loop Nested loops: for loop inside another for loop for iterating 2 collections of data. iterating 2 collections of data....
View Full Document

Page1 / 7

lec7_review_practice - Review arrays and loops Practice...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online