Python Find the N adjacent digits in the 1000-digit number that have the greatest product
Review

Yes the first option would be better as memory might become an issue with really long numbers (say you have a 10 million length number). But that implementation could be improved as well


Your first solution does not return the max product but rather a list generator of products. This is confusing!
Chop up your code into functions, as it makes it easier to test/change things


The problem can be divided into to 3 seperate functions:


Cut a big number into evenly sized chunks of adjacent digits
Sum the product of the chunks
A main function that returns the largest adjecent product


Alternative Code

from functools import reduce
import operator

def cut_adj_chunks(iterable, chunk_size):
    for i in range(len(iterable) - chunk_size):
        yield iterable[i:i+chunk_size]

def sum_prod(num_str):
    num_list = map(int, num_str)
    return reduce(operator.mul, num_list, 1)

def largest_prod(adj_digits, big_num):
    return max(sum_prod(chunk) for chunk in cut_adj_chunks(str(big_num), adj_digits))