Created
July 5, 2023 11:46
-
-
Save igrishaev/e31248c6e72585d9c3332d68bd6d0cf8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[11pt]{book} | |
\usepackage[OT1, T2A]{fontenc} | |
\usepackage[utf8]{inputenc} | |
\usepackage[english, russian]{babel} | |
\usepackage[newfloat=true]{minted} | |
\usemintedstyle{bw} | |
\SetupFloatingEnvironment{listing}{placement=H} | |
\newminted[python]{python}{} | |
\usepackage{bold-extra} | |
\newenvironment{english}{\begin{otherlanguage}{english}}{\end{otherlanguage}} | |
\begin{document} | |
\begin{english} | |
\begin{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)) | |
\end{python} | |
\end{english} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment