I am new in python, there is this error in the if else statement "unindent does not match any outer indentation level"
, can anyone tell me what is the problem with if else statements?
def idfs(graph, start, end,limit):
# maintain a queue of paths
count=0
queue = []
# push the first path into the queue
queue.append([start])
#print queue
while queue:
count +=1
# get the first path from the queue
path = queue.pop(0)
# get the last node from the path
node = path[-1]
# path found
if node == end and count==2:
return path
elif node!=end and count==2:
print 'goal not found'
limit=input('Enter the limit again')
path=idfs(graph,node,goal,limit)
return path
# enumerate all adjacent nodes, construct a new path and push it into the queue
for adjacent in graph.get(node, []):
new_path = list(path)
print new_path
new_path.append(adjacent)
print new_path
queue.append(new_path)
print queue
# example execution of code
start = input('Enter source node: ')
goal = input('Enter goal node: ')
limit=input('Enter the limit')
print(idfs(graph,start,goal,limit))