0

This is a part of an "Oregon Trail" remake that I am making. Here is the bit of code with the problem:

if option == '3':
    print('Clothes cost: 2 per set')
    print('Recomended: 12 sets')
    try:
        clothnum = int(input('How many sets of clothes: '))
        clothmon = clothnum * 2
    except:
        print('')

And on the try: statement (on the colon to be exact) it raises this error:

TabError: inconsistent use of tabs and spaces in indentation

I checked the whole code, and I can't see anything wrong with the indentation.

  • 3
    Use a text editor such as notepad++ that will show whitespace characters. The message is clear. You're mixing tabs and spaces. –  Oct 26 '20 at 21:16
  • Use a text editor which can display tabs and white spaces. Or find a setting which converts tabs to white spaces. – AnsFourtyTwo Oct 26 '20 at 21:17
  • Ok I used the "find keyword" function in my compiler an found out that some of my indents were just 4 spaces. –  Oct 26 '20 at 21:24
  • 2
    Worth noting that the [PEP8](https://www.python.org/dev/peps/pep-0008/#indentation) style standard prescribes 4 spaces per indentation level, no tabs. – Hymns For Disco Oct 26 '20 at 21:56
  • Note that SO's formatter converts tabs to 4 spaces, but you can see the tabs if you [view the source](https://stackoverflow.com/revisions/bd3715c8-572c-4931-8851-c202e1202d17/view-source). – wjandrea Oct 27 '20 at 00:01

0 Answers0