It seems like this works perfectly as long as I input a word of the correct length
The first time I did this I got an assertion error, and started panicking.
It took me a while to realise that, yeah - we are assuming the word is valid. This will be true by the time we’ve finished, but is certainly not true now - as you say, if you put in a word that’s too short, or has repeat characters we will get errors.
Till we do the validation stuff we just need to be careful with our typong