To actually compute the value, take 1 minus the sum of the squared errors over the sum of the squared variations from the mean:
So, it's not very difficult to compute, but again, Python will give you functions that will just compute that for you, so you'll never have to actually do that math yourself.