作者ilvicco (家齊說我是螞蟻)
看板Python
標題[問題]reverse string
時間Sat Nov 28 21:10:26 2009
Please write a function to inverse a string. This function accept a string
argument and return the reversed string. For example,
reverse (‘apple’) returned ‘elppa’
reverse(‘madam’) returned ‘madam’.
Hine:
(1) set local variable y = ‘’。
(2) from right to left, read a char from input string and append to the end
of y.
(3) return y as result
reverse 要怎麼寫?
我只是個新手希望大家幫幫我~~謝謝:)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.44.148.189
推 timerover:s = 'abc' 11/28 21:39
→ timerover:s = s[::-1] 11/28 21:39