A Day at the Supermarket- Something of Value


#1

hello all

i am currently working on this task, and am getting an error :

File "python", line 18
SyntaxError: 'return' outside function

could someone please explain what is wrong ? i am following the indentation protocols by keeping the return in line with the for loop

for key in prices:    
    
    prices[key]= prices[key]*stock[key]
    print prices[key]
    total = total + prices[key]
return total

print total

#2

return can only be used in a function, you don't have a function. So why do you use return?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.