Content deleted Content added
m →Programming example: modernize |
Made the program compatible for older versions of Python 3. |
||
Line 311:
==Programming example==
The example below searches for polydivisible numbers in [[Python (programming language)|Python 3.x]].
<syntaxhighlight lang="python">
from typing import List▼
def find_polydivisible(base: int) -> list[int]:
"""Find polydivisible number."""
Line 334 ⟶ 331:
return numbers
</syntaxhighlight>
Older versions of Python do not support annotations using built-in classes. Instead of using list[int], the beginning would become:
<syntaxhighlight lang="python">
▲from typing import List
def find_polydivisible(base: int) -> List[int]:
</syntaxhighlight>
The remaining portion of the program would remain the same.
==Related problems==
|