Showing the circles for 1 ≤ k ≤ 10
Now all we need to do is find when both of these circles intersect the x-axis, and that take the integral of the top circle from 0 to intersection - integral of bottom circle from 0 to intersection.
This is where I recommend you don't solve Project Euler problems at 2am, I spent a good 30 mins finding the intersection with the bisection method, until I realised that the circles intersect the x and y axis at the same point... so all you need to do is evaluate the function at x = 0 to find the intersection... what a waste of time.
After that I used scipy.integrate.quad to evaluate the integral, and the problem is done!
Enter a number (yourinput)
Code will output expected value of his total score give that he plays yourinput turns with k = 1, k = 2, k = 3, ..., k = yourinput, rounded to 5 decimal places