Exercise 1 solution import re log = "GET /a 200 12ms; POST /b 404 8ms; GET /c 200 130ms" rec = re.compile(r"(?P[A-Z]+) (?P/\w+) (?P\d{3}) (?P\d+)ms") total = 0 for m in rec.finditer(log): print(m["method"], m["path"], m.start()) total += int(m["ms"]) print(total) # GET /a 0 # POST /b 17 # GET /c 34 # 150 (All lines were run and printed exactly what is shown.) Explanation: finditer yields a match object per record, so m.start() gives the position and m["name"] gives each named group. The group text is a string, so it is converted with int() before adding. findall could not report the positions.