name 'times' is used prior to global declaration - But IT IS declared!

后端 未结 5 901
不思量自难忘°
不思量自难忘° 2020-12-05 23:11

I\'m coding a small program to time and show, in a ordered fashion, my Rubik\'s cube solvings. But Python (3) keeps bothering me about times being used prior to global decla

5条回答
  •  [愿得一人]
    2020-12-05 23:53

    For the main program, you can declare it on the top. Ther will be no warning. But, as said, the global mention is not useful here. Each variable put in the main program is in the global space. In functions, you must declare that you want use the global space for it with this keyword.

提交回复
热议问题