Making an arrey of a zipped list, Python

  • Context: Python 
  • Thread starter Thread starter MaxManus
  • Start date Start date
  • Tags Tags
    List Python
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
MaxManus
Messages
268
Reaction score
1
How do you make an arrey out of this list?

for X, H in zip(xarrey,harrey):
print "%.2f %.5f" % (X,H)
 
Physics news on Phys.org
Can you give me a more detailed explanation? I don't know what list you're talking about, or what you mean by "making an array" out it. Python doesn't have "arrays," it has lists.

- Warren
 
from scitools.all import *

def h(x):
return (1/(sqrt(2*pi)))*e**-(0.5*x**2)

xarray = linspace(-4,4,10)
x = xarray
harrey = zeros(len(xarrey))

for i in xrange(len(xarray)):
harrey = h(x)

for X, H in zip(xarray,harray):
print "%.2f %.5f" % (X,H)