Python Forum
Thread Rating:
  • 3 Vote(s) - 2.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help, cant find the mistake
#1
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
Reply
#2
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.
Reply
#3
(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?
Reply
#4
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 ?
Reply
#5
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
Reply
#6
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.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Solved] Please, help me find a simple mistake AlekseyPython 2 1,868 Jun-17-2021, 12:20 PM
Last Post: AlekseyPython
  [split] Could you please clarify where i did mistake also how run without admin right Abubakkar 1 1,875 Jun-14-2021, 09:32 AM
Last Post: Larz60+
  Please help to me to find my mistake in code leonardin 2 1,956 Nov-29-2020, 04:17 PM
Last Post: Larz60+
  minor mistake in code for factorial spalisetty06 2 2,046 Aug-22-2020, 05:00 PM
Last Post: spalisetty06
  Simple mistake about for Nomatter 4 2,434 Jul-16-2020, 02:24 PM
Last Post: Nomatter
  Install Mistake jlerette5 1 1,986 Feb-18-2020, 12:19 AM
Last Post: jefsummers
  What was my mistake in this Python code (easy)? voltman 4 3,617 Nov-19-2019, 09:58 PM
Last Post: snippsat
  countdown script not working..plz help what is mistake randyjack 1 2,207 Oct-28-2019, 06:57 AM
Last Post: perfringo
  Beginner mistake. bbweeg 1 2,134 Aug-17-2019, 07:27 AM
Last Post: perfringo
  Help to understand my mistake TeeMan 8 4,233 Jul-05-2019, 01:42 PM
Last Post: TeeMan

Forum Jump:

User Panel Messages

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