As it happens, someone put forward the idea that, since PPCG has graduated, up votes on questions should be worth 10 rep. As a result, I started wondering how much rep I would have if it had always been 10 rep.


Given a PPCG user's id as input, output how much total rep the user would have if question up votes were worth +10.

Example Calculation

I, Beta Decay (user id 30525), have 6744 rep. 3488 of that was earned by posting questions (calculated by subtracting the total rep lost from downvotes from the total rep gained from upvotes).

Firstly, we subtract 3488 from 6744, giving us 3256 rep, the amount earned from posting answers.

Next, we find out how much I would have earned from 10 rep questions by simply multiplying 3488 by 2, giving us 6976.

Finally, we add 3256 and 6976 together to get a final answer of 10232 rep.

A simplified method is to take the total, 6744 and add the rep from questions, 3488, giving is 10232 rep.

For continuity, you must use the method described above


Note that these examples are subject to change and are unlikely to stay current.

Helka Homba (UID 26997)


Martin Ender (UID 8478)


Downgoat (UID 40695)



Internet access is allowed. Similarly, access to the Stack Exchange API is allowed. However, URL shorteners are disallowed.

T-SQL entrants using the Stack Exchange Data Explorer are allowed.

You also do not have to take into account the daily rep cap of 200.


Shortest code in bytes wins.

  • 4
    \$\begingroup\$ If we don't take down votes into account where does 3488 come from, as it's not a multiple of 5? \$\endgroup\$
    – Neil
    Commented Aug 23, 2016 at 11:09
  • \$\begingroup\$ @Neil Hm, well I've changed the rules now to accountt for this \$\endgroup\$
    – Beta Decay
    Commented Aug 23, 2016 at 11:22

1 Answer 1


Python, 336 Bytes

Anonymous lambda function, takes a string.

Should work, but couldn't test it, because I drained my api quota.

(Warning! Will drain your api quota!)

import requests,re
lambda x,u="http://api.stackexchange.com/2.2/users/%s%s?site=codegolf&page=%d":int(re.search('n":\d+',requests.get(u%(x,"",1)).text).group()[3:])+sum([5*len(re.findall(':5,',requests.get(u%(x,"/reputation-history",i)).text))-2*len(re.findall('-2',requests.get(u%(x,"/reputation-history",i)).text))for i in range(99)])

a bit quota-friendlier:

import requests,re
f=lambda x,u="https://api.stackexchange.com/2.2/users/%s%s?site=codegolf&pagesize=100&page=%d":int(re.search('n":\d+',requests.get(u%(x,"",1)).text).group()[3:])+sum([5*len(re.findall(':5,',requests.get(u%(x,"/reputation-history",i)).text))-2*len(re.findall('-2',requests.get(u%(x,"/reputation-history",i)).text))for i in range(30)])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.