编写函数引用所需的提示

时间:2017-03-24 11:01:00

标签: python

编写一个名为" quote_this"接受两个 arguments:表示引用的字符串(未包围 用引号)和一个名字的字符串。功能 应该返回一个包含引号的新字符串 引号(")后跟破折号和给定的

python中的名称。

不知道如何开始解决这个问题。任何帮助

2 个答案:

答案 0 :(得分:1)

这应该有效:

def quote_this(quote,name):
    return '"' + quote + '" - ' + name

在哪个引号中表示引号的字符串并命名作者姓名

答案 1 :(得分:0)

def quote_this(quote_string, name):
    return '\"' + str(quote_string) + '\"' + ' - ' + str(name)

quote_this('this', 'John')

您应该真正关注Google或阅读本书。这很简单。此外,下次提供示例代码。