mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-04 08:50:41 +08:00
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
""" Luhn Algorithm """
|
||||
from typing import List
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def is_luhn(string: str) -> bool:
|
||||
@ -17,9 +17,9 @@ def is_luhn(string: str) -> bool:
|
||||
[False, False, False, True, False, False, False, False, False, False]
|
||||
"""
|
||||
check_digit: int
|
||||
_vector: List[str] = list(string)
|
||||
_vector: list[str] = list(string)
|
||||
__vector, check_digit = _vector[:-1], int(_vector[-1])
|
||||
vector: List[int] = [int(digit) for digit in __vector]
|
||||
vector: list[int] = [int(digit) for digit in __vector]
|
||||
|
||||
vector.reverse()
|
||||
for i, digit in enumerate(vector):
|
||||
|
Reference in New Issue
Block a user