Help with Python UnboundLocalError: local variable referenced before assignment

后端 未结 4 1781
Happy的楠姐
Happy的楠姐 2021-01-14 23:53

I have post the similar question before,however,I think I may have misinterpreted my question,so may I just post my origin code here,and looking for someone can help me,I am

4条回答
  •  春和景丽
    2021-01-15 00:28

    where do you call force in this code?

    In any event, the problem is in update_r. You reference vs in the first line of update_r even though vs is not defined in this function. Python is not looking at the vs defined above. Try adding

    global vs
    

    as the first line of update_r or adding vs to the parameter list for update_r

提交回复
热议问题