我正在编写一个程序,要求您输入 5 个单词(一次一个),然后以相反的顺序将它们打印出来。(我使用的是 Python 3.3.2)它应该是这样的: http ://s11.postimg.org/rayd8m3oj/Untitled.png
但相反,它给了我这个:
http://s10.postimg.org/c1p590vex/example.png
这是我的代码:
fifth_word = input("Please enter your 1st word: ")
fifth_word = fifth_word.toLowerCase
fourth_word = input("Please enter your 2nd word: ")
fourth_word = fourth_word.toLowerCase
third_word = input("Please enter your 3rd word: ")
third_word = third_word.toLowerCase
second_word = input("Please enter your 4th word: ")
second_word = second_word.toLowerCase()
first_word = input("Please enter your 5th word: ")
first_word = first_word.capitalize()
print("The sentence is: " + first_word + second_word + third_word + fourth_word + fifth_word)
提前致谢