I got this program that will prompt the user to enter the number. I want to import a file and have it filled. How do I do that?
Code:
from numarray import *
def clrscr():
print '\n'*50
return
def pressenter():
raw_input('Press the enter key to continue')
return
prompt=['Enter row first number ', 'Enter row second number ']
clrscr()
rows=int(raw_input('Enter the number of rows in the array '))
print
cols=3
print;print
marray=zeros([rows,cols],type='f')
for row in range(0,rows,1):
for col in range(0,cols-1,1):
marray[row,col]=float(raw_input(prompt[col]))
print
for row in range(0,rows,1):
marray[row,2]=marray[row,0]*marray[row,1]
for row in range(0,rows,1):
print marray[row,0],marray[row,1],marray[row,2]
Comment