0
我的程序是返回由字符串delim分隔的重複n次的字符串。例如repeat(「ho」,3,「,」)。python中的簡單函數
def repeat():
string=input("enter a string:")
n=int(input("enter how many times to repeat:"))
delim=(",")
return string,n,delim
print (repeat())
我需要將輸出更改爲(hi,hi,hi)而不是此。
輸入一個字符串:喜
輸入多少次重複:3
( 'HI',3, '')
現在唯一的問題是,我不能讓它通過字符串打印,在每一個之間。 – Jake