我对编码很新,所以我希望我的问题有意义/格式正确.
这是我的代码:
#this function takes a name and a town, and returns it as the following:
#"Hello. My name is [name]. I love the weather in [town name]."
def introduction("name","town"):
phrase1='Hello. My name is '
phrase2='I love the weather in '
return ("phrase1" + "name" + "phrase2" + "town")
Run Code Online (Sandbox Code Playgroud)
例如introduction("George","Washington")在python shell中将返回as"Hello. My name is George. I love the weather in Washington."
我的问题是我的代码没有这样做.相反,我收到以下错误:
Invalid syntax: <string> on line 1". In Wing101 **,"town"):
Run Code Online (Sandbox Code Playgroud)
在它下面有一个红色的摇摆.我不确定我做错了什么......我知道"名字"和"城镇"是字符串而不是变量,但我真的不知道如何解决它.
任何帮助/意见表示赞赏.