Python Forum
HELP TabError: inconsistent use of tabs and spaces in indentation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HELP TabError: inconsistent use of tabs and spaces in indentation
Hi there, i'm trying to print my code but it gives me this error:

File "C:\Users\jay\Desktop\", line 6 print("Checking in passenger: " + current_passenger) ^ TabError: inconsistent use of tabs and spaces in indentation [Finished in 0.1s with exit code 1]
Here is my code.
def passengers(not_checked_in, checked_in):
	"""Simulate passengers who are not checked in."""

	while not_checked_in:
		current_passenger = not_checked_in.pop()
        print("Checking in passenger: " + current_passenger)

def show_checked_in_passengers(checked_in):
  print("\nThe following passengers have been checked in ")
  for passengers in checked_in:

not_checked_in = ["Jay Senyani"]
checked_in = []

passengers(not_checked_in, checked_in)
I'm new at python so any help would be much appreciated :-)
And what is that you don't understand in the message TabError: inconsistent use of tabs and spaces in indentation?

You cannot mix both tabs and spaces to create indentation. The recommended is to use spaces. All decent IDEs have an option to automatically make tab into 4 spaces (or whatever number of spaces you use, but 4 is recommended as per PEP8)

In addition - your indentation is inconsistent (again!) in lines 10-13, but that will be another error, when you fix the tab/spaces problem.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Now that u explained it i see what u mean. I fixed my problem. Thank you for helping newcomers to python! Have a great day.

Possibly Related Threads…
Thread Author Replies Views Last Post
  create new tabs and populate using python reggie4 2 294 Jan-23-2021, 11:25 PM
Last Post: Larz60+
  inconsistent map() behavior mcmxl22 2 707 May-23-2020, 10:17 PM
Last Post: mcmxl22
  Python function returns inconsistent results bluethundr 4 1,017 Dec-21-2019, 02:11 AM
Last Post: stullis
  Setting Tabs in a listbox scratchmyhead 2 708 Nov-12-2019, 11:18 PM
Last Post: scratchmyhead
  removing spaces/tabs after used .strip() zarize 0 542 Sep-11-2019, 12:46 PM
Last Post: zarize
  removing tabs from input text jenya56 3 981 Mar-28-2019, 03:10 PM
Last Post: DeaD_EyE
  Why interpreter accepts indentation made with spaces and not those by tabs sylas 13 2,368 Jan-10-2019, 11:17 PM
Last Post: texadactyl
  inconsistent processing of list of tuples PyFool 4 1,316 Nov-05-2018, 05:24 PM
Last Post: PyFool
  [inconsistent output] to run cmd commands to get Kerberos ticket Yelin 2 2,473 Jun-08-2018, 09:02 AM
Last Post: Yelin
  TabError: grbibb 2 2,409 Mar-21-2018, 11:50 PM
Last Post: Truman

Forum Jump:

User Panel Messages

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