1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Making an arrey of a zipped list, Python

  1. Sep 26, 2008 #1
    How do you make an arrey out of this list?

    for X, H in zip(xarrey,harrey):
    print "%.2f %.5f" % (X,H)
     
  2. jcsd
  3. Sep 26, 2008 #2

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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
     
  4. Sep 27, 2008 #3
    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)
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook