语法错误:“无法分配给函数调用" [英] SyntaxError: "can't assign to function call"

查看:67
本文介绍了语法错误:“无法分配给函数调用"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我程序中的这一行:

invest(initial_amount,top_company(5,year,year+1)) = subsequent_amount

导致我收到此错误:

SyntaxError: can't assign to function call

如何解决这个问题并利用函数调用的值?

How do I fix this and make use of value of the function call?

推荐答案

在语法上,这行没有意义:

Syntactically, this line makes no sense:

invest(initial_amount,top_company(5,year,year+1)) = subsequent_amount

您正试图为函数调用赋值,如错误所示.你想达到什么目的?如果您尝试将 subsequent_amount 设置为函数调用的值,请切换顺序:

You are attempting to assign a value to a function call, as the error says. What are you trying to accomplish? If you're trying set subsequent_amount to the value of the function call, switch the order:

subsequent_amount = invest(initial_amount,top_company(5,year,year+1))

这篇关于语法错误:“无法分配给函数调用"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆