Untitled

mail@pastecode.io avatar
unknown
python
a year ago
598 B
3
Indexable
Never
from ast import parse
import requests
import json
import math

i = 1
count=0
summ=0
while(i<=10):
    response_API = requests.get("https://jsonmock.hackerrank.com/api/medical_records?page="+str(i))
    data = response_API.text
    parse_json = json.loads(data)
    print(type(parse_json))

    for j in range(len(parse_json['data'])):
        if(((parse_json['data'][j]['diagnosis']['name'])==diagnosisName) and ((parse_json['data'][j]['doctor']['id'])==doctorId)):
            summ=summ+parse_json['data'][j]['vitals']['pulse']
            count = count+1
    i=i+1

print(math.trunc(summ//count))