Skip to content

Instantly share code, notes, and snippets.

View serhiitytarenko's full-sized avatar

Serhii Tytarenko serhiitytarenko

View GitHub Profile
import re
import datetime
from collections import OrderedDict
def create_racer_abbreviations_dict(file_name):
"""Retrieves {'abbreviation': (name, team)}" format dict from abbreviations.txt"""
abbreviations_dict = {}
with open(file_name, 'r') as fn:
for line in fn:
7620cdb0:0001000010111011
3e20c9b6:0101110000010000
512372de:0001001101000111
70056ff5:1110000000010001
4fb7672d:1101011111011000
5cc8cd42:0011110001111001
5264cfda:0101000011100110
6ae48931:0010111001010010
614edbdd:0011010011001100
4ef3ebbb:0110100010111011
@serhiitytarenko
serhiitytarenko / parser.py
Created March 11, 2020 14:19
Parse kml file
from fastkml import kml │
with open('/home/stytarenko/Downloads/test.kml', 'rb') as myfile: │
doc=myfile.read() │
k.from_string(doc) │
features = list(k.features()) │
import random
class HealthManager:
def __init__(self, health, delta_health=20):
self.__health = health
self.delta_health = delta_health
@property
def health(self):
return self.__health
import random
class Health:
def __init__(self, health, delta=10):
self.health = health
self.delta = delta
def decrease(self, ratio):
self.health -= ratio * self.delta