Reputation: 1
Im confused as to where the errors in my syntax are occuring. I'm new to coding and am trying to learn but im lost here. the error is occuring after the def fun2(n): during the if 0<=n: statement. if you would be kind to point out any other errors in my code it would be appreicated. for reference I am using python 2.7.9.
EDIT: I had forgotten about my established main function. that was the source of my syntax error due to my inner functions not being tabbed. Thank you to those who answered.
def main():
def fun(n):
func= (n**3)-1
def fun2(n):
for i in range(n):
if 0<=n:
func2 += i*fun(i)
if 0 > n:
func2 = 0
def fun3(m,n):
c3=[]
if m<=n:
C3.append[func2(n)]
if m>n:
c3=[]
Upvotes: 0
Views: 19
Reputation: 1060
Another thing to check is that you are consistently using tabs or consistently using spaces. Python doesn't like to mix the two, and even if you press only the tab key, sometimes your computer still puts in 4 or 5 spaces instead.
This is especially a problem if you copy and pasted some of the code from somewhere--who knows whether that pasted code used spaces or tabs?
Upvotes: 0
Reputation: 3711
Python is based on tabs and spaces, and you've got a line of code that is more intended than python would like it to be. Its not possible to see from your code above, but an IDE like pyCharm or a text editor like sublime text could help you out here.
Upvotes: 1