-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Somea cleanups & new python solutions
- Loading branch information
Showing
22 changed files
with
142 additions
and
99 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from dataclasses import dataclass | ||
from datetime import date | ||
from collections import Counter | ||
|
||
@dataclass | ||
class Hasznalat: | ||
idopont: date | ||
kartya_sorszam: int | ||
indulo_szint: int | ||
celszint: int | ||
|
||
def parse_int_or_default(num: str, default_value: int) : | ||
try: | ||
return int(num) | ||
except ValueError: | ||
return default_value | ||
|
||
|
||
with open('lift.txt') as input_file: | ||
create_hasznalat = lambda split: Hasznalat(date.fromisoformat(split[0].removesuffix('.').replace('.', '-')), int(split[1]), int(split[2]), int(split[3])) | ||
hasznalatok = [ create_hasznalat(k.split(' ')) for k in input_file.readlines() ] | ||
|
||
print(f'3. Feladat: Lift alkalmak száma: {len(hasznalatok)}') | ||
print(f'4. Feladat: A korszak {hasznalatok[0].idopont}-től {hasznalatok[-1].idopont}-ig tartott') | ||
print(f'5. Feladat: Max célszint: {max(k.celszint for k in hasznalatok)}') | ||
|
||
be_kartya = parse_int_or_default(input('Írj be egy kártyaszámot: '), 5) | ||
be_celszint = parse_int_or_default(input('Írj be egy célszintet: '), 5) | ||
utaztak_e = any(k.kartya_sorszam == be_kartya and k.celszint == be_celszint for k in hasznalatok) | ||
|
||
print(f'7. Feladat: A {be_kartya} kártyával {"" if utaztak_e else "nem"} utaztak a {be_celszint}. emeletre') | ||
print('8. Feladat') | ||
|
||
for ido, db in Counter(k.idopont for k in hasznalatok).items(): | ||
print(f'{ido} - {db}x') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from dataclasses import dataclass | ||
from datetime import time | ||
|
||
@dataclass | ||
class Verseny: | ||
csapat: str | ||
versenyzo: str | ||
eletkor: int | ||
palya: str | ||
korido: time | ||
kor: int | ||
|
||
|
||
with open('autoverseny.csv', encoding = 'utf-8') as input_file: | ||
create_verseny = lambda split: Verseny(split[0], split[1], int(split[2]), split[3], time.fromisoformat(split[4]), int(split[5])) | ||
versenyek = [ create_verseny(k.split(';')) for k in input_file.readlines()[1:] ] | ||
|
||
print(f'3. Feladat: Adatsorok száma: {len(versenyek)}') | ||
|
||
kivalasztott = next(k for k in versenyek if k.versenyzo == 'Fürge Ferenc' and k.palya == 'Gran Prix Circuit' and k.kor == 3).korido | ||
print(f'4. Feladat: {(kivalasztott.hour * 60 + kivalasztott.minute) * 60 + kivalasztott.second} mp') | ||
|
||
be_nev = input('5. Felatad: Írj be egy nevet: ') | ||
be_versenyzo_korido = min((k.korido for k in versenyek if k.versenyzo == be_nev), default = None) | ||
|
||
print(f'6. Feladat: {be_versenyzo_korido}' if be_versenyzo_korido != None else '6. Feladat: Nincs ilyen versenyző') |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.