How do updates in SARSA and Q-learning differ in code?
Picking actions and making updates should be treated as separate things. For Q-learning you also need to explore by using some exploration strategy (e.g. $\epsilon$-greedy).

Steps for Q-learning:
1) initialize state $S$
For every step of the episode:
2) choose action $A$ by some exploratory policy (e.g. $\epsilon$-greedy) from state $S$
3) take action $A$ and observe $R$ and $S'$
4) do the update $Q(S, A) = Q(S, A) + \alpha(R + \gamma*\max_aQ(S', a) - Q(S, A))$
5) update the state $S = S'$ and keep looping from step 2 until the end of episode

Steps for Sarsa:
1) initialize state $S$
2) initialize first action $A$ from state $S$ by some exploratory policy (e.g. $\epsilon$-greedy)
For every step of the episode:
3) take action $A$ and observe $R$ and $S'$
4) choose action $A'$ from state $S'$ by some exploratory policy (e.g. $\epsilon$-greedy)
5) do the update $Q(S, A) = Q(S, A) + \alpha(R + \gamma * Q(S', A') - Q(S, A))$
6) update state and action $S = S'$, $A = A'$ and keep looping from step 3 until end of the episode