对于函数ask,以下调用错误的是哪一项?1. def ask(prompt = "Do you like Python? ", hint = "yes or no"):2. while True:3. answer = raw_input(prompt)4. if answer.lower() in ('y', 'yes'):5. print "Thank you"6. return True7. if answer.lower() in ('n', 'no'):8. print "Why not "9. return False10. else:11. print hint
A.
answer.lower() 是调用了string自带函数lower(),将输入转换为小写字母。
B.
调用函数ask(),在交互页面输入N,则会继续打印yes or no提示你继续输入。
C.
调用函数ask(),在交互页面输入x,则会打印yes or no,如果继续输入y,则会打印Thank you并退出ask()函数的执行同时返回值true。
D.
函数调用ask("Do you like Python? ")与ask()效果一致