Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是一个玩 JES 的新手,我正在测试如何从另一个函数调用一个变量到主函数。我正在使用 return ,据我所知应该返回变量 num 但它仍然出错:(任何指导将不胜感激。
def update(): a = sqrt(10) b = 239 getTotal(a,b) print num def getTotal(a,b): num = a*b return num
需要某个地方让该值返回。
尝试这个:
def update(): a = sqrt(10) b = 239 c = getTotal(a,b) print c def getTotal(a,b): num = a*b return num