Hi @devjumper48717 .
Glad you found the error. A common form of bug concerning a block of code, such as a function or a loop, is that a line of code is indented too little or too much. This makes it either external to the block when it should have been part of the block, or makes it part of the block when it should have been outside the block.
Because the code that you posted was not formatted, it was difficult for other users to read and debug it. After code has been pasted into the editing window for posting, you can format it by selecting it, and then by clicking the </> button above the editing area. This will enable us to see important details, such as the indentation and underscores.