• + 0 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!