Project Euler Problem # 8 maximum product of sequences
Some suggestions:


number and n could be parameters to this script. That way the whole thing would be reusable.
You can use list comprehensions to partition your string:

&gt;&gt;&gt; def partition(digits: str, length: int) -&gt; List[str]:
...     return [digits[index:index + length] for index in range(len(digits) - length + 1)]
... 
&gt;&gt;&gt; partition("12345", 3)
['123', '234', '345']

Multiplying N random digits is going to be slower than checking whether any of the digits are zero. So your first pass could be to exclude any partitions which contain zero. If there are no partitions left afterwards the max is zero, and you've done no multiplications at all.

&gt;&gt;&gt; partitions = partition("7316717653133062491", 13)
&gt;&gt;&gt; nontrivial_partitions = [partition for partition in partitions if "0" not in partition]
&gt;&gt;&gt; nontrivial_partitions
['7316717653133']

An optimization on the above is to immediately discard the next N - 1 digits as soon as you encounter a zero when generating partitions, since all of those partitions are also going to multiply to zero. Make sure you check for any zeros within those numbers as well to keep skipping.
It looks like you have a newline at the end of number.