0

Change the code to output squares of the list

def calc(list): if len(list)==0: return 0 else: return list[0] + calc(list[1:])   list = [1, 3, 4,

3rd May 2021, 8:46 AM
Bitu Kumar Sha
Bitu Kumar Sha - avatar
2 odpowiedzi
+ 1
Bitu Kumar Sha This might help, but doesn't use recursion which I think you were trying to implement in your code def squares(x): return [i**2 for i in x] lst = [1,3,4] print(squares(lst))
3rd May 2021, 9:21 AM
Rik Wittkopp
Rik Wittkopp - avatar
0
Bitu Kumar Sha Can you post your code in the body of the question, not the headings. As it stands, your question is too disjointed for us to help effectively
3rd May 2021, 9:10 AM
Rik Wittkopp
Rik Wittkopp - avatar