Python: ' ' is not defined

后端 未结 1 1272
眼角桃花
眼角桃花 2021-01-27 14:20

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 im         


        
1条回答
  •  说谎
    说谎 (楼主)
    2021-01-27 14:50

    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()
    

    0 讨论(0)
提交回复
热议问题