1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-05-18 12:02:53 +02:00

refactor: usage of built-in type hinting in Python solutions

This commit is contained in:
Divlo
2022-04-24 20:27:51 +02:00
parent 64c5d41358
commit 34644bd333
27 changed files with 142 additions and 116 deletions

View File

@ -1,13 +1,11 @@
from typing import List
from Cell import Cell
class Grid:
def __init__(self, grid: List[List[int]]) -> None:
data: List[List[Cell]] = []
def __init__(self, grid: list[list[int]]) -> None:
data: list[list[Cell]] = []
for x in range(len(grid)):
column: List[Cell] = []
column: list[Cell] = []
for y in range(len(grid[x])):
column.append(Cell(grid[x][y], y, x))
data.append(column)

View File

@ -1,13 +1,12 @@
from typing import List
import sys
from Sudoku import Sudoku
from Grid import Grid
grid_values: List[List[int]] = []
grid_values: list[list[int]] = []
for value in sys.stdin:
row_values = value.rstrip('\n').split(' ')
current_row: List[int] = []
current_row: list[int] = []
for row_value in row_values:
current_row.append(int(row_value))
grid_values.append(current_row)