Skip to content Skip to sidebar Skip to footer

Python: ' ' Is Not Defined

Here is my code: # This program makes the robot calculate the average amount of light in a simulated room from myro import * init('simulator') from random import* def pressC():

Solution 1:

If you want to return multiple items from scan(), don't use three separate return statements. Instead, do this:

return leftLightSeries, centerLightSeries, rightLightSeries

Also, when you call the function, you have to assign variable(s) to the returned values; it won't automatically create new local variables with the same names. So in main, call scan() like this:

leftLightSeries, centerLightSeries, rightLightSeries = scan()

Post a Comment for "Python: ' ' Is Not Defined"