[Tutor] calling subroutines into program

Kent Johnson kent37 at tds.net
Mon Feb 7 15:36:02 CET 2005


Liam Clarke wrote:
>>>example of (1):
>>>---------------------------------------------------------
>>>#this part of the program reads the file basin.out (the data we want to
>>>analyze) and changes its contents to the array arr_xy
>>>#layout of basin.out:
>>>#1  -950.00    10.00 200        > this line contains start, interval and
>>>number of x values;
>>>#    0.000000E+00               > remainder is a column of y values
>>>#   -1.931787E-07
>>>#   -5.713295E-07
>>>#   -9.322559E-07
>>>#   -1.071361E-06
>>>#   -7.801342E-07
>>>#    .....
>>start = int(float(list[1]))
>>interval = int(float(list[2]))
>>n = int(float(list[3]))
> 
> 
> list[1] is a string, so if I'm not missing something,  start =
> int(list[1]) will do just fine.

No, because list[1]  is '-950.00' which will not parse as an int.

Kent



More information about the Tutor mailing list