\documentclass[a4paper,11pt]{article}
\usepackage[polish]{babel}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage[scaled=0.85]{beramono}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{geometry}
\lstloadlanguages{Python}

\geometry{width=126mm}



\begin{document}

\lstset{language=Python,
  basicstyle=\ttfamily\small,
}
\begin{lstlisting}[literate={!=}{$\ne$}{1} {=}{$\gets$}{1}]
a = 278
b = 16
while a != b:
    if a > b:
        a = a-b
    else:
        b = b-a
print(a)
\end{lstlisting}

\end{document}