Python Forum
I am getting an IndentError on my python code in VS Code and i dont know why
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am getting an IndentError on my python code in VS Code and i dont know why
#11
Indentation issues can be tricky in Python. It’s best to stick to either tabs or spaces consistently. You can set your editor to convert tabs to spaces to avoid this problem in the future.
Reply
#12
I only use Idle to try things out. The following works fine in Idle.

carros = ["mercedes", "toyota", "mazda", "bmw", "nissan", "hyundai", "byd"]
colores = ['blanco', 'negro', 'rojo', 'amarillo', 'gris', 'verde', 'marrón']

for i in range(len(carros)):
    car = carros[i].capitalize()
    if len(car) == 3:
        car = car.upper()
    print(f"¡No me gusta tu {car} en nada, es un trasto tío!")
    print(f"¡Además odio ese color {colores[i].title()} ¡Que marrón!\n")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python code not running Azdaghost 1 360 Apr-22-2025, 08:44 PM
Last Post: deanhystad
  Mathematica code vs Python MiloChocolatito 0 669 Mar-31-2025, 06:32 AM
Last Post: MiloChocolatito
  I trying to automate the Variable Logon button using the python code but I couldn't surendrasamudrala 0 356 Mar-07-2025, 05:02 AM
Last Post: surendrasamudrala
  How do i run python code? smattiko83 5 962 Mar-06-2025, 09:20 PM
Last Post: ArchieLinux
  I'm new to Python - can someone help with this code as it is not working? lminc123 1 620 Feb-13-2025, 06:13 PM
Last Post: lminc123
  I cannot create a virtual environment on visual studio code using python Willem_Aucamp316 2 4,303 Nov-27-2024, 02:20 PM
Last Post: menator01
  CLI to python code azxo1 11 2,451 Oct-21-2024, 08:32 AM
Last Post: azxo1
  Algorithm for extracting comments from Python source code Pavel1982 7 3,192 Aug-28-2024, 02:50 AM
Last Post: timothyferriss
  Coding help required in Python using VS Code KakashiSenpai 3 1,247 Jul-04-2024, 12:32 PM
Last Post: jefsummers
  Merge Python code with Micro Python code? adzy 2 1,049 Jul-03-2024, 11:41 AM
Last Post: kkinder

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020