You are viewing a single comment's thread. Return to all comments →
cube = lambda x: x**3 def fibonacci(n): fibonacci_numbers = [] an = 0 an_1 = 1 for _ in range(n): if len(fibonacci_numbers) == 0: fibonacci_numbers.append(an) elif len(fibonacci_numbers) == 1: fibonacci_numbers.append(an_1) else: an_2 = an + an_1 fibonacci_numbers.append(an_2) an = an_1 an_1 = an_2 return fibonacci_numbers[:n] if __name__ == '__main__': n = int(input()) print(list(map(cube, fibonacci(n))))
I tried to write my code as comprehensible as possible!
Seems like cookies are disabled on this browser, please enable them to open this website
Map and Lambda Function
You are viewing a single comment's thread. Return to all comments →
I tried to write my code as comprehensible as possible!