Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import json
- with open("serv.json", "r") as json_file:
- server_properties = json.loads(json_file.read())
- server_response = requests.get(f"http://{server_properties['server']}:{server_properties['port']}").json()
- average = (sum(server_response['highly_organized']) + sum(server_response["primitive"])) /\
- (len(server_response['primitive']) + len(server_response['highly_organized']))
- ho_sum_deflection = 0
- for el in server_response['highly_organized']:
- ho_sum_deflection += (el - average)**2
- p_sum_deflection = 0
- for el in server_response['primitive']:
- p_sum_deflection += (el - average)**2
- if ho_sum_deflection < p_sum_deflection:
- print(f"highly organized {round(ho_sum_deflection, 3)}")
- else:
- print(f"primitive {round(p_sum_deflection, 3)}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement