def show_excitement():
return ' '.join(['I am super excited for this course!'] * 5)
示例
>>> show_excitement()
'I am super excited for this course! I am super excited for this course! I am super excited for this course! I am super excited for this course! I am super excited for this course!'
def show_excitement(str,n):
global result
if(n==0):
return result.strip()
else:
result=result+" "+str
return show_excitement(str,n-1)
result = ""
str="I am super excited for this course!"
print show_excitement(str,5)
7条答案
按热度按时间tf7tbtn21#
在字符串的末尾给予一个空格
42fyovps2#
在这种情况下,您可能需要
str.join
示例
iovurdzv3#
将
print(str)
移动到行首dgtucam14#
最简单的方法
xzabzqsa5#
你可以这样做:
qnyhuwrf6#
oxiaedzo7#
print(show_excitation())在此输入代码'