The example is displayed multiple times at https://pygments.org/styles/. Code displayed on the Pygments website should follow best practices, such as https://peps.python.org/pep-0257/.
14 lines
316 B
Python
14 lines
316 B
Python
from typing import Iterator
|
|
|
|
# This is an example
|
|
class Math:
|
|
@staticmethod
|
|
def fib(n: int) -> Iterator[int]:
|
|
"""Fibonacci series up to n."""
|
|
a, b = 0, 1
|
|
while a < n:
|
|
yield a
|
|
a, b = b, a + b
|
|
|
|
result = sum(Math.fib(42))
|
|
print("The answer is {}".format(result))
|