Home > Software engineering >  I want to return the last value of y , and the appended list. However, the list is not being returne
I want to return the last value of y , and the appended list. However, the list is not being returne

Time:11-10

I want to return the last value of y , and the appended list. However, the list is not being returned.

It states : name 'y' is not defined.

y_list = []
x_list = []
final_list_y = []
final_list_x = []


def test_1(angle , c):
    for i in range(0 , angle , 1):

    y = (i * 3)**c

    final_list_y = y_list.append(y)
    final_list_x = x_list.append(i)        
    return y_list  , x_list , y 


test_1(60 , 5)
print (fina_list_y)
print (final_list_x)
print y

CodePudding user response:

Remove y list = []. it does not mean anything.

 return (y_list  , x_list , y )

result  = test_1(60 , 5)
print(result[0])
print(result[1])
print(result[2])
  • Related