Jan-02-2025, 08:17 PM
Im recently learning python and im using a for function but every time that i tried to execute the code i receive the indent error. I review the youtube videos about this problem and tried every solution that i could find on the net , even reintalled my vs code ide. Now i know the code function corret because i tried it in www.online-python.com and there was no problem.
here is my pthyton code:
i think there is a parameter in the config section about linting or indenting that is causing a conflict but i donk know where to start searching. thanks
here is my pthyton code:
carros = ["mercedes", "toyota", "mazda", "bmw", "nissan", "hyundai", "byd"] for carro in carros: print(f"Me encanta tu {carro.title()}, es un gran carro") print(f"Además me encanta el color de tu {carro.title()}.\n")my output in vs code:Output:PS C:\Users\jose5\OneDrive\Documentos\Cursos_Academicos\PyThon\Crash_course> & C:/Users/jose5/AppData/Local/Programs/Python/Python313/python.exe Python 3.13.1 (tags/v3.13.1:0671451, Dec 3 2024, 19:06:28) [MSC v.1942 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> carros = ["mercedes", "toyota", "mazda", "bmw", "nissan", "hyundai", "byd"] >>> for carro in carros: ... print(f"Me encanta tu {carro.title()}, es un gran carro") ... print(f"Además me encanta el color de tu {carro.title()}.\n") ... File "<python-input-1>", line 3 print(f"Además me encanta el color de tu {carro.title()}.\n") IndentationError: unexpected indent >>> carros = ["mercedes", "toyota", "mazda", "bmw", "nissan", "hyundai", "byd"] >>> for carro in carros: ... print(f"Me encanta tu {carro.title()}, es un gran carro") ... Me encanta tu Mercedes, es un gran carro Me encanta tu Toyota, es un gran carro Me encanta tu Mazda, es un gran carro Me encanta tu Bmw, es un gran carro Me encanta tu Nissan, es un gran carro Me encanta tu Hyundai, es un gran carro Me encanta tu Byd, es un gran carro >>> for carro in carros: ... print(f"Me encanta tu {carro.title()}, es un gran carro") ... print(f"Además me encanta el color de tu {carro.title()}.\n") ... File "<python-input-4>", line 3 print(f"Además me encanta el color de tu {carro.title()}.\n") IndentationError: unexpected indent >>> KeyboardInterrupt >>> & C:/Users/jose5/AppData/Local/Programs/Python/Python313/python.exe c\>>> KeyboardInterrupt >>> & C:/Users/jose5/AppData/Local/Programs/Python/Python313/python.exe c\:/Users/jose5/OneDrive/Documentos/Cursos_Academicos/PyThon/Crash_course/f\or_practice.py File "<python-input-6>", line 1 & C:/Users/jose5/AppData/Local/Programs/Python/Python313/python.exe c:/Users/jose5/OneDrive/Documentos/Cursos_Academicos/PyThon/Crash_course/for_practice.py ^ SyntaxError: invalid syntaxhere is my vs code (there isnt showing any error about indenting or linting)i think there is a parameter in the config section about linting or indenting that is causing a conflict but i donk know where to start searching. thanks
