Change the code to output squares of the list | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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