python中的raw_input,输出错误

时间:2015-01-29 09:14:26

标签: python raw-input

我是python的新手,遇到了raw_input的问题。见吼声

Welcome to the game, Hangman!
I am thinking of a word that is 1 letters long.
-------------
you have 8 guesses left.
Available letters: abcdefghijklmnopqrstuvwxyz
please give a guess letter: c
Good guess: c
-------------
Congratulations, you won!
None

*** ERROR: Failing test.
Expected line: Please guess a letter: c
Your code generated: please give a guess letter: c *** 

--------------------

这是输出,我使用raw_input的代码是

    guess = raw_input("please give a guess letter: ")

正确的输出是,

Welcome to the game Hangman!
I am thinking of a word that is 1 letters long
-----------
You have 8 guesses left
Available Letters: abcdefghijklmnopqrstuvwxyz
Please guess a letter: c
Good guess: c
-----------
Congratulations, you won!
None

差异在于raw_input,你能解释一下发生了什么吗?

1 个答案:

答案 0 :(得分:0)

问题是测试脚本期望Please guess a letter:的具体输出,您的代码有please give a guess letter:

如果您更改raw_input提示符以匹配文本,则测试将通过。