Python Forum

Full Version: Help, cant find the mistake
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am programing a simple thing where you just have to chose between yes and no but for one reason when I run it PowerShell says this:
TabError: inconsistent use of tabs and spaces in indentation
PS C:\Users\Bernardo\desktop\Python Learning> python .\Introduct
 File ".\Introduction.py", line 17
   print(' Will you be the chosen one? (Yes or No)')
                                                   ^
TabError: inconsistent use of tabs and spaces in indentation

def play():
   play = ''
   while play !='yes' and cave != 'no':
print(' Will you be the chosen one? (Yes or No)')
play = input()

   return play
if play == 'yes':
print('So, young adventurer, what is your name?')
yourName = input()
if play == 'no':
print('Then why are you playing this game dear inferior human? or is it that you are frightened ? C´mon you pussy, say yes!')
return play
Use tabs, or use spaces. Don't use both.

If the code you posted is what you're trying to run, then there's a bunch of indentation errors, too.
(Jul-07-2017, 08:27 PM)SrGeed Wrote: [ -> ]C´mon
Do you purposefully have a forward-tick in your string, instead of an apostrophe?
Mind if I ask what editor you're using?
I am using annacoonda python with notepad++ but I am just learning the basics.
I just used tabs, and I dont see were the mistakes are ;/
http://prntscr.com/fsztnm
This is the code right now, would you mind telling me where the indentation error is ?
def play():
    play = None
    while play !='Yes' and play != 'No':
        print(' Will you be the chosen one? (Yes or No)')
        play = input()
   # At this point, has to be Yes or No
    if play == 'Yes':
        print('So, young adventurer, what is your name?')
        yourName = input()
    else:
        print("Then why are you playing this game dear inferior human? or is it that you are frightened ? C'mon you pussy, say yes!")
    return yourName, play
Several changes made, not tested
returns two values
Go to editor's settings and set it to enter spaces instead of tab symbol when you hit the tab button. Set the indentation to four spaces.