-4

Getting an error: "Inconsistent use of tabs and spaces in indentation" Please help to spot an error in my code for the sub that "If a word starts with a vowel (aeiou), add the letters 'yay'. Example: the word are would become areyay."

Error for line #5

def convertEnglishToPigLatin():
    print('You chose to convert English to PigLatin.')
    eng = input('Enter the English sentence to convert to PigLatin.\n')
    engWordSplit = eng.split()
    for i in range(0, len(engWordSplit)):  
        if engWordSplit[i].startswith(("a","A","e","E","i","I","o","O","u","U")):
            engWordSplit[i].append("yay")
        else:
            firstCharacter = engWordSplit.strip(0)
            engWordSplit.append(firstCharacter)
            engWordSplit.append("ay")
    print(engWordSplit)
kstatinet
  • 11
  • 1
  • hmmm, https://stackoverflow.com/questions/5685406/inconsistent-use-of-tabs-and-spaces-in-indentation – David_Zizu Dec 01 '19 at 03:13
  • lbragile: voila. this works! thank you so much. – kstatinet Dec 01 '19 at 03:20
  • Forgot to mention: Variable and function names should follow the `lower_case_with_underscores` style. – AMC Dec 01 '19 at 04:21
  • i know. for now, i'm just following naming conventions as per examples from the 'master' (community college introduction to prog. teacher) – kstatinet Dec 01 '19 at 04:32
  • still a bit struggling with the code, but the original question was answered already. my current ugly code is as follows: – kstatinet Dec 01 '19 at 04:34
  • def convertEnglishToPigLatin(): print('You chose to convert English to PigLatin.') eng = input('Enter the English sentence to convert to PigLatin.\n') engWordSplit = eng.split() for i in range(0, len(engWordSplit)): currentWord = engWordSplit[i] – kstatinet Dec 01 '19 at 04:34
  • Please consider accepting my answer by hitting the check mark to make it green – lbragile Dec 10 '19 at 07:31

1 Answers1

1

You can just do the following in sublime text editor:

View => Indentation => Indent using spaces

This should convert all tabs to spaces and eliminate the error.

lbragile
  • 7,549
  • 3
  • 27
  • 64