May-08-2017, 12:09 PM
Your return statement is in the wrong place. Remember that indentation matters in Python.
Once you fix that, you will get an index error. Your looping variable i is going to go to the last index of d, and then your
return f
should be at the same indentation level as the for
statement.Once you fix that, you will get an index error. Your looping variable i is going to go to the last index of d, and then your
if
statement is going to try to go one beyond that with d[i+1]
. Normally I would suggest using enumerate, however since this is in homework you may not have gone over that in class. So would suggest for i in range(len(d) - 1):
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures