擅长:python、mysql、java
<ol>
<li>使用<code>raw_input</code>方法从用户处获取输入字</li>
<li>通过<code>len</code>方法获取输入字的长度。你知道吗</li>
<li>使用<code>while</code>循环在新变量中添加字符。你知道吗</li>
<li><p>将长度变量递减<code>1</code></p>
<pre><code>print "Program: word vise versa"
word = raw_input("Input your text:")
new_word = ""
wdlen = len(word)
while wdlen:
new_word += word[wdlen-1]
wdlen -= 1
print new_word
</code></pre></li>
</ol>
<p>输出:</p>
<pre><code>$ python test.py
Program: word vise versa
Input your text:abcdef
fedcba
</code></pre>
<hr/>
<p>使用<code>slice</code>。你知道吗</p>
<p>更多信息<a href="https://docs.python.org/2/whatsnew/2.3.html#extended-slices" rel="nofollow">https://docs.python.org/2/whatsnew/2.3.html#extended-slices</a></p>
<pre><code>>>> a = "12345"
>>> a[::-1]
'54321'
</code></pre>