Intro to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and The Cloud
by Paul J. Deitel, Harvey M. Deitel
Exercises
Use IPython sessions for each exercise where practical. Each time you create or modify an array, Series or DataFrame, display the result.
7.1 (Filling
arrays) Fill a 2-by-3arraywith ones, a 3-by-3arraywith zeros and a 2-by-5 array with7s.7.2 (Broadcasting) Use
arangeto create a 2-by-2arraycontaining the numbers 0–3. Use broadcasting to perform each of the following operations on the originalarray:Cube every element of the
array.Add
7to every element of thearray.Multiply every element of the array by
2.
7.3 (Element-Wise
arrayMultiplication) Create a 3-by-3arraycontaining the even integers from2through18. Create a second 3-by-3arraycontaining the integers from9down to1, then multiply the firstarrayby the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access