The solution writes:
I understood all the steps except the step where I highlighted. Why is the probability of the $Y$, which is the sum of the two values $\frac{b-a+1}{36}$?
I acknowledged that the $b-a+1$ is the total number of the discrete values from $b$ to $a$, but I thought if $x=k$ is from $a$ to $b$, then $Y$ should be $2(b-a+1)$ since it is the sum of two dice.


A much simpler solution will follow by analyzing in two segments around $y=7$.
For $y \le 7$, $x$ will be uniformly distributed between $[1,y-1]$, with expected value $\frac{1+y-1}2=\frac{y}2$.
Similarly for $y > 7$, $x$ will be uniformly distributed between $[y-6,6]$, with expected value $\frac{y-6+6}2=\frac{y}2$.
Hence $\mathbb{E}\{X|Y=y\} = y/2$