It might be due to a mix of tabs and spaces in the indentation. Different codes or editors may use different types of indentation, so issues can occur when you copy and use code with mixed indentation styles. If you select all the code with Ctrl + A like in the image below, you'll be able to tell which type of indentation was used. Additionally, the 'Spaces: 4' label at the bottom of VS Code shows how indentation is currently configured in the editor. You can change it as needed.