Hello there!
I think you should try and check your indentation because that also might be the problem. Make sure that the indentation is four spaces or your code should be on the same level as the declaration of your for loop
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.