954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Please help Python error..., pleeease

I get this python error: unindent does not match any outer indentation level, and a red bar appears where "RIGHT HERE RED" is.., keep in mind that this is just a fraction of the entire program but i dont know where the spacing error occurs... pleeeaaase i beg you and thank you!!!

this is the area of my code that it appears

while len(players)<max_players:
    print()
    print("New Character")
    print()
    #create empty profile dictionary
   profile = {'Name':"",'Desc':"",'Race':"",'Gender':"",'Muscle':0, #<---RIGHT HERE RED
              'Brainz':0,'Speed':0,'Charm':0,'life':0,'magic':0,
              'prot':0,'gold':0,'inventory':[]}
   #prompt user for user-defined information(name,desc,gender,race)
   name=input('What is your name? ')
   desc=input('Describe your self: ')
   gender=gender.lower()
   if gender.startswith('f'):
rayden150
Light Poster
32 posts since Aug 2010
Reputation Points: 9
Solved Threads: 0
 

That is exactly where the problem is look directly above that line buddy :).

predator78
Junior Poster
168 posts since Sep 2008
Reputation Points: 34
Solved Threads: 17
 
That is exactly where the problem is look directly above that line buddy :).

Where i dont see an issue?

rayden150
Light Poster
32 posts since Aug 2010
Reputation Points: 9
Solved Threads: 0
 

Does profile or anything below it match the spacing above it? Looks a little off to me. The r in profile is under the # in the line above it.

predator78
Junior Poster
168 posts since Sep 2008
Reputation Points: 34
Solved Threads: 17
 

You need to keep your indentation spacing consistent. Like predator78 pointed out, you are switching from 4 spaces to 3 spaces in the same block of code. Not good!

Most Python IDEs will assist you on obvious mistakes like that.

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: