nov13_participation.py - import the module import numpy as np create a one dimensional array called q1 with values 2.5 5 7.5 97.5 100

nov13_participation.py - import the module import numpy as...

This preview shows page 1 - 2 out of 2 pages.

# import the module import numpy as np # create a one dimensional array called q1 with values 2.5, 5, 7.5, ... , 97.5, 100 q1=np.arange(2.5,101,2.5) # create an array called q2 with only the values in q1 that are divisble by 4 q2=q1[q1%4==0] # create a 2 dimensional (15 x 15) array called q3 with values from 1-225: # [[ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15], # [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], # .... # [211,212,213,...,223,224,225]] q3=np.arange(1,226).reshape(15,15) # create an 2 dimensional (15 x 2) array called q4 # where each row of q4 is made up of the first 2 values in each row of q3 # [[ 1, 2], # [16,17], # [31,31] # ... # [196,197], # [211,212]] q4=q3[:,:2] # create an array called q5 of shape (12,8) filled entirely with 0 (all floats) q5=np.zeros((12,8))
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Spring '12
  • summet

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes