By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,420 Members | 1,219 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,420 IT Pros & Developers. It's quick & easy.

Python: Return outside function error? Tried redoing indentation, spacing, etc.

P: 1
Hi, I'm fairly new to python, and I keep getting an error 'return outside function'. I've looked around, and tried reformatting, redoing the indenting, and I still get the same error. Can anyone help me?

Expand|Select|Wrap|Line Numbers
  1. def syllableCount( someString ):
  2.     for syllSet in myDict[someString]:
  3.         for element in syllSet:
  4.             if (element[-1] == 0 or element[-1] == 1):
  5.                 return element[-1]
Feb 16 '13 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 2.5K+
P: 2,851
There does not appear to be an issue with the posted code. Maybe there is an issue with myDict. Can you post a sample?
Feb 16 '13 #2

Expert 100+
P: 626
Also post the complete traceback that includes the offending line.
Feb 17 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.