How does the variable shift work here?

can someone explain to me like i am five what is happening here. i’d like to understand the basic of how the shift variable is working here in accordance with the output. I dont want to progress without understanding the logic of these simple steps. thank you in advance to anyone kind enough to tap in for your time and patience

Welcome back to the forum @imanwashere

find is again returning -1 for uppercase letters, and for the space character, too. You are going to take care of the space later on.

For now, instead of iterating over text, change the for loop to iterate over text.lower().

Here is the orginal for loop.

This is the output.
image

A result of -1 means a match was not found.

Adding the .lower() method to the text variable converts all the letters to lower case.

For this step, the shift variable is not used.

Happy coding

1 Like

The shift variable will be used at a later point. For now, it has been declared but isn’t actually serving any useful purpose. This will all be explained as you progress through the following steps.

1 Like

thank you so much for this, it helps a lot

1 Like