python 3.x - Passing a list from one function to another -


i need understanding instruction.

your main program code should call “getdata” function. pass list returned “summer” function “getdata” , save sum function returns.

def getdata():     fin = open("sample.dat","r")     numbers=[]     line in fin:         val =line.rstrip()         numbers.append(val)     return numbers def summer(lst):     sum=0     n in range(0,13,2):         sum+=powerval(lst[n],lst[n+1])     return sum 

if instruction read,

pass list returned getdata function summer , save sum function returns.

then try:

total = summer(getdata()) 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -