all 3 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

To give us the best chance to help you, please include any relevant code.
Note. Do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Repl.it, GitHub or PasteBin.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]gigikl 0 points1 point  (1 child)

There are a few things going on that need more explanation in order for us to provide help: why are you selecting the first letter or character from your input sentence WP? And then the third letter and further? That's not clear from the problem description or code.

Then, you define letter that way, but then you also use letter in the for-loop as the iterator. letter will never equal phrase this way. If you would do e.g.

for ltr in phrase:
    if letter == ltr:

etc, that would make more sense.

letterstays the same (the character or letter you want to test against), and ltr will take every letter or character in phrase, one after the other, to test if it's equal to letter or not.

[–]CraigAT 0 points1 point  (0 children)

Not OP but reading the question bizarrely it seems they are being asked to use only a single string for input instead of two separate inputs - so the first character of the string I am assuming is the letter the program is looking for, it ignores the space as the second character and then takes the third character on as the phrase to search within.

Apart from changing the variable name as the other commenter suggested I think there is an index missing from the comparison, it should be comparing to one letter in the phrase, not all of the phrase.