Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrent Liang
Courses Plus Student 2,944 PointsUnexpected indent/EOF when parsing?
list_of_word = []
x = 0
y = 0
z = 0
vowels = [a,e,i,o,u]
control = input("This is an interesting game. Press anything to begin. Press q to quit at all times!")
if control == "q":
quit()
else:
while True:
added = [input.lower("Type DONE to complete, otherwise, give me the {} word!".format(x))]
x += 1
list_of_word.append(added)
print("Okay, let's move on!")
if added == "DONE":
def un_vowelled (list_of_word):
try:
for item in list_of_word:
if item.index[y] == item in vowels:
del item [y]
y += 1
if y == len(item):
y = 0
z += 1
if z == len(list_of_word):
print("Here's your new list:")
print(list_of_word)
break
else:
continue
else:
continue
else:
y += 1
if y == len(item):
y = 0
z += 1
if z == len(list_of_word):
print("Here's your new list:")
print(list_of_word)
break
else:
continue
else:
continue
else:
continue
What's wrong with this code?
Name:GoogleSearch orJonathan Sum
5,039 PointsI am a noob. From what i have seen that "Unexpected indent/EOF when parsing" means missing "()" sign or indent error
Every time you create a block u need to indent 4 spaces infront of the first line of the block.
Here is a example. Moreover, i see your coding having more python syntax error
def functionA (a1,a2):
return (a1, a2)
# After another new line after the function ,which is "def functionA (a1,a2)" ,there is 4 spaces infront of the word"return". It #is not just function. if you want to use if or else statment ,you also need to do this.
#.lower() is a function ,but it doesn't mean u need to put whatever you want to convert to lower case in to the "()" sign.
#You need to put whatever you want to convert to lowercase infront of the ".lower()".
#Therefore,it should be this.
added = [input("Type DONE to complete, otherwise, give me the {} word!".format(x)).lower()]
#i haven't gone over more. If there is no1 doing this, i will do this later.
2 Answers
Zach Hudson
7,702 PointsTry looking at this:
while True:
added = input("Type DONE to complete, otherwise, give me the {} word!".format(x)).lower()
I changed the above line to have the .lower() after the input expression.
It looks like you have a indentation issue with the last else/continue. I put it into Pycharm and get an indentation error for that line.
Brent Liang
Courses Plus Student 2,944 PointsYeah thanks all, not entirely sure what's wrong with the indentation but I've tried achieving the same objective using a more succinct body of code and it worked.
Thank you all for the answers! I am choosing Zach's as the best answer. I really appreciate the comments Michael and Jonathan!
Micheal Allen
19,311 PointsMicheal Allen
19,311 PointsYour code is very confusing, you have way too much going on.
Are you trying to achieve the following?
If this isn't what you're trying to achieve, please provide a breakdown of what you're trying to achieve.