Unable to find error in my code.
Though simple, but was interested in the site that states to build up a project in steps.
The very first project is stuck at: https://www.freecodecamp.org/learn/s...cipher/step-17. The original answer, as well as the modified one, don't help; as shown in the two attachments attached herewith. The further steps are blocked by the unknown error, so needed help. -------- Edit : Sorry, am unable to add images (screenshots), and this is continuing. -------- Edit 2: Same error of 'Security token missing', on attempting from smartphone, too. |
Please post the code here between [code] [/code] tags. It is hard to guess what the problem might be without actually seeing the code.
|
Quote:
|
The code and the suggested change works just fine for me :)
|
Please quote (as text) all of these:
- what do you wish to accomplish - your program (complete and minimal) - the error message or symptom you got Note: attaching screenshot images is very insulting, don't do that |
Is your line 4: index = alphabet.find(text[0].lower())
Note the ()) It prints 7 |
Quote:
Edit: The output '7' is not important, but the moving to the next step is, which it is not, due to the error, as 'also' shown in the next post by me. |
Quote:
I intend to complete a particular step of the project, that is building up in an incremental manner the very first project. And am stuck at the 17th step. The code is: Code:
text = 'Hello World' It is given as the first project titled: Learning string manipulation by building a cipher; at : https://www.freecodecamp.org/learn/s...g-with-python/ The task as given for the step #17 is: Code:
Step 17 3. - the error message or symptom you got The error it gives is: Code:
Sorry, your code does not pass. You're getting there. P.S.: For the last line, hope with time would understand it. Edit: Please see my post at: https://forum.freecodecamp.org/t/lea...step-17/681588 |
Your program prints -1 and then 7. Is that what you wanted, or something else?
Code:
$ python3 ajiten17.py Code:
text = 'Hello World' |
Quote:
Code:
text = 'Hello World' |
So the issue is you have not followed the instructions correctly.
Original code: Code:
text = 'Hello World' Code:
>>> -1 hello world is returned in final print which is displaying value of "text" variable in lower case What you were requested to do: Quote:
Code:
text = 'Hello World' Code:
text = 'Hello World' Hope that is clearer |
Quote:
* Posting your code inline here prevents loss of context over time due to disappearing images and linked resources, thus preserving the full context of the question and its solution in one place. This preserves the value of the information found here at LQ and respects the efforts of others who take time to provide help, both for yourself and for all future visitors. * Failure to post your code examples as text, inline and properly formatted using [CODE]...[/CODE] tags may be most convenient for you, but is disrespectful of the time taken by others to consider your question and provide replies. It requires extra effort on their part just to understand the question, then to either follow links off-site or type the examples themselves in order to reproduce the error conditions and offer solutions. Please take this as a final request to amend this behavior, and review the Site FAQ for guidance in asking well formed questions. Especially visit the link from that page, How to Ask Questions the Smart Way for discussion of things to consider when asking others for help. From that page: Quote:
|
Upon careful (&inferential) re-reading of #10, I think you neglected to say that you solved it, with the code you posted in #10. (In that case, mark Thread as Solv'ed with Thread Tools pull-down above #1)
IF not, here's my 'stern' reply (excuse the 'stern'): You are, simply&clearly, **NOT** following the instructions! Outputting a -1 *VIOLATES* their instructions & you FAIL. Output *ONLY* a 7. Period. NOthing else. Do it *THEIR* way (their site is probably NOT 'smart' enough to handle anything else.) Make your code *EXACTLY* this (preferably delete, not comment, the last line tho # passes) Code:
text = 'Hello World' They are trying to teach you the concept of 'index'. More: that website is very AI-lacking because this PASSES (with -1!) Code:
text = 'Hello World' Continuing to torture that website, this passes, tho it prints 0 then -1! Code:
text = 'H' (it also passes without the 2nd print, so its primitive 'AI' maybe just grep'ing for those last 2 lines!) |
Quote:
It states for the code: Code:
# Append space to the message Add the not operator at the beginning of the if condition to check if the character is not alphabetic. I made the change to the code as: Code:
# Append space to the message Then removed the outer 'not' too, still fails. The error message is: Sorry, your code does not pass. Try again. You should use the not operator in the condition of your if statement. |
Quote:
Code:
c = char |
All times are GMT -5. The time now is 04:30 PM. |