Python Forum
HELP TabError: inconsistent use of tabs and spaces in indentation - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: HELP TabError: inconsistent use of tabs and spaces in indentation (/thread-24086.html)



HELP TabError: inconsistent use of tabs and spaces in indentation - blackjesus24 - Jan-30-2020

Hi there, i'm trying to print my code but it gives me this error:

Error:
File "C:\Users\jay\Desktop\asd.py", 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)
        checked_in.append(current_passenger)

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


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

passengers(not_checked_in, checked_in)
show_checked_in_passengers(checked_in)
I'm new at python so any help would be much appreciated :-)


RE: HELP TabError: inconsistent use of tabs and spaces in indentation - buran - Jan-30-2020

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.


RE: HELP TabError: inconsistent use of tabs and spaces in indentation - blackjesus24 - Jan-30-2020

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.