Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
Timed 4
The_Gman wrote: final += final[i]?
I understand pseudo code, but that isn't correct, unless they mean append or something, and I don't want to waste my time.
IMO you're right. There is actually an error in the pseudo code.
IF isEvenOrZero(i)
final += final[i]
ELSE
final += final[i+2]
END FOR
final += final[1]
RETURN final```
In the line where it says *final += final[i]* the final[i] would be null, because the final is a nonexistent variable at this point. It should actually say final += str[i], because str is the variable referred to on the first line. I believe str in this case refers to the string given in the challenge. Same goes for the next ones too (final[i+2] and final[1]). On the last line the final variable would still be null.
wait wait, what about the last odd character? str[i+2] clearly won't work.
And we're trying to REVERSE that algorithm, correct?
something like this? (although this won't run)
code = 'x'*len(word)
code[1] = word[len(word)-1]
for i in range (len(word)):
if (i%2 == 0):
code[i] = word[i]
else:
code[i+2] = word[i]