37 lines
700 B
Python
37 lines
700 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Created on Sat Oct 21 17:19:11 2023
|
|
|
|
@author: angoosh
|
|
"""
|
|
|
|
import json
|
|
|
|
FILE = './Alkator.json'
|
|
|
|
data_dict = ''
|
|
results = {}
|
|
|
|
with open(FILE,'r') as f:
|
|
file_content = f.read()
|
|
data_dict = json.loads(file_content)
|
|
|
|
for id in data_dict:
|
|
laps = int(data_dict[id]['laps'])
|
|
time = 0
|
|
for i in range(0,laps):
|
|
time += float(data_dict[id]['lap_time'][str(i)])
|
|
time = (time - (600*laps)) / 60
|
|
print(data_dict[id]['name'],time)
|
|
data_dict[id]['total_time'] = time
|
|
results[data_dict[id]['name']] = time
|
|
|
|
print(results)
|
|
dict(sorted(results.items(), key=lambda item: item[0]))
|
|
print(results)
|
|
|
|
|
|
|
|
|
|
|