我在寫一個讀取三行輸入的程序。第一行是一個單詞,然後是一些重複的字符,然後是重複的重複。但不幸的是,我無法做到這一點,任何人都可以通過查看我的代碼來指導我。謝謝python重複錯誤
word = raw_input("Enter the word: ")
length = int(raw_input("Enter the repeat length: "))
count = int(raw_input("Enter the repeat count: "))
print word.repeat() * count
I want this sort of output:
Enter the word: banana
Enter the repeat length: 2
Enter the repeat count: 3
banananana
你s總是給出一個你得到的輸出(或錯誤)的例子,並描述它與你想要的不同。在你的例子中,你甚至不使用「長度」變量。你期望它做什麼? – BrenBarn