Help with Python UnboundLocalError: local variable referenced before assignment

后端 未结 4 1757
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:32

    In the first line of update_r, you have vs,ve=update_v(n,vs,ve,ms,me,dt,fs,fe). Look at the function that you are calling. You are calling update_v with a bunch of parameters. One of these parameters is vs. However, that is the first time in that function that vs appears. The variable vs does not have a value associated with it yet. Try initializing it first, and your error should disappear

提交回复
热议问题