My code looks completely different to the “View solution” code provided by Codecademy. BUT my output produced the correct order of characters! Here’s a screenshot of my code vs Codecademy’s solution code side by side …
Can someone please explain, uh … I mean, I can obviously see where my code differs from the Codecademy solution, but, uh … I am baffled enough to not even know what to ask or where to ask for help in my thinking.
I set my password = which would output a list of characters separated by commas … as seen in the scary you-are-wrong message. I actually needed to output a string … that’s why the correct code is password = ‘’ with the quotes.
And because you’re supposed to set password to output a string (denoted by the quotes), I cannot used .append(). The only way to add to a string is with a += operator (as seen in the correct code).
The index 0 needs to be specified (which I failed to do in my code) because the instructions said that the first character in the password would be the last character in the username. So the combination of the index 0 and the code [index -1] addresses this.
Am I understanding this all correctly? So much to keep track of and to think about.
In my original code, I didn’t include the 0 index in the start argument. The statement that I underlined in red seems to support my original code … that writing out the 0 index wasn’t necessary because leaving it empty (omitting it) would have defaulted the value to 0?
The question’s directions asks that password is set to an empty string, not a list of letters (as you have it). So, after re-reading the reply to yourself–(and the last sentence in my reply)–yes, those three points are correct.