Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 用户输入错误_Python_Wait_Raw Input - Fatal编程技术网

Python 用户输入错误

Python 用户输入错误,python,wait,raw-input,Python,Wait,Raw Input,这是我上一个问题“Python等待错误”中的另一个问题。您可能需要查看上一个问题才能完全理解这个问题。单击下面的链接转到我的上一个问题: 不管怎样,谢谢你对之前的回答进行了反思 我输入了你的密码Borrajax,它成功了。除非我选择了答案 1) blah blah 2) blah blah 3) blah blah 4) blah blah 它将直接进入 "Would you like to continue without choosing an answer?" 而不是说 "Your

这是我上一个问题“Python等待错误”中的另一个问题。您可能需要查看上一个问题才能完全理解这个问题。单击下面的链接转到我的上一个问题:

不管怎样,谢谢你对之前的回答进行了反思

我输入了你的密码Borrajax,它成功了。除非我选择了答案

1) blah blah
2) blah blah
3) blah blah
4) blah blah
它将直接进入

"Would you like to continue without choosing an answer?"
而不是说

"Your answer was incorrect."
继续我测验的下一个问题。 我怎样才能让它继续到下一个问题,而不去看电影

other = (raw_input("Would you like to continue without choosing a answer?:"))
谢谢你们所有有耐心的人,上次你们忍受了我那个措辞糟糕的问题

更新1:这是全部代码,人类

    import time
import sys, select

def timeout_input(message, timeout=8):
    print "He he! Q%s is a tricky one!" % timeout
    if message:
        sys.stdout.write(message)
        sys.stdout.flush()
    i, o, e = select.select( [sys.stdin], [], [], timeout )
    if (i):
        return sys.stdin.readline().strip()
    return ""
#This is the script for TUKT. DO NOT DELETE
score = 0
print ""
print "Welcome to the Ultimate Kirby Test."
print ""
print "Type 'yes' to begin. Type 'no' to quit. Type 'info' for how to play."
print ""
begin = (raw_input("Would you like to begin?:"))
if begin == "yes":
        print ""
        print "Alright then! Let's start, shall we?"
if begin == "no":
        quit()
if begin == "info":
        print ""
        print "Type the number of the answer that you think is correct after 'Answer='. Sometimes, ULTRA QUESTIONs will pop up. These are worth 3 points!! At the end of the test, I will show you your score. You must get over 7 right to pass. Good luck!"
#This is the first Question.
print "Q1. What color is Kirby?"
print "1) Black."
print "2) Blue."
print "3) Pink."
print "4) Technically, his color changes based on the opponent he swallows."
choice = input("Answer=")
if choice ==1:
        print ""
        print "Incorrect."
        print ""
elif choice ==2:
        print ""
        print "Incorrect."
        print ""
elif choice ==3:
        print ""
        print "Tee hee.... I fooled you!"
        print ""
elif choice ==4:
        print ""
        print "Nice job! You saw through my trick!"
        print ""
        score = score+1
elif choice > 4 or choice < 1:
        print ""
        print "That is not a valid answer."
        print ""
#This is the second Question.
print "Q2. Who turns Kirby into yarn? (Kirby's Epic Yarn)"
print "1) Elmo."
print "2) The terrible cotton wizard named the yarn lord."
print "3) A magician named Yin-Yarn."
print "4) King Dedede."
choice = input("Answer=")
if choice ==1:
        print ""
        print "Don't be silly. Elmo is copyrighted!"
        print ""
elif choice ==2:
        print ""
        print "I can't believe you fell for that!"
        print ""
elif choice ==3:
        print ""
        print "Nicely done!"
        print ""
        score = score+1
elif choice ==4:
        print ""
        print "Ha! Nice try."
        print ""
elif choice > 4 or choice < 1:
        print ""
        print "You have got to be joking."
        print ""
#This is the third Question.
print "Q3. Who is the villan in Kirby's Adventure?"
print "1) King Dedede."
print "2) The Nightmare."
print "3) Meta Knight."
print "4) All of the above."
choice = input("Answer=")
if choice ==1:
        print ""
        print "Too bad!"
        print ""
elif choice ==2:
        print ""
        print "I tricked you! Muahahaha!"
        print ""
elif choice ==3:
        print ""
        print "FALSE!!"
        print ""
elif choice ==4:
        print ""
        print "Let me think...................YES!"
        print ""
        score = score+1
elif choice > 4 or choice < 1:
        print ""
        print "You despise me."
        print ""
#This is the fourth Question.
print "Q4. In which game can Kirby combine the powers of his enemies?"
print "1) Kirby's Dream Land 2."
print "2) Kirby 64: The Crystal Shards."
print "3) Kirby and the seven stones."
print "4) Kirby Nightmare in Dreamland."
choice = input("Answer=")
if choice ==1:
        print ""
        print "Nope. Sorry!"
        print ""
elif choice ==2:
        print ""
        print "Yes! That is correct! Nicely done!"
        print ""
        score = score+1
elif choice ==3:
        print ""
        print "That isn't even a real game! (hence not capitalizing it.)"
        print ""
elif choice ==4:
        print ""
        print "No. You should be more knowledgable about Kirby games!"
        print ""
elif choice> 4 or choice < 1:
        print ""
        print "Hmph! You should actually 'try' next time!"
        print ""
#This is the fifth Question.
print "Q5. ULTRA QUESTION! There was a voting poll to see the top ten Kirby games! Which one do you think came up on top? The choices are:   Kirby 64 The Crystal Shards,  Kirby's Epic Yarn,  Kirby Super Star Ultra,  Kirby's Return to Dream Land,  Kirby and The Amazing Mirror,  Kirby Squeak Squad,  Kirby Air Ride,  Kirby's Dream Land 2, Kirby's Dream Land 3. Please type your guess in all LOWERCASE LETTERS and NO SPACES and NO PUNCTUATION! DO NOT SPELL IT WRONG. IF YOU DO, THE QUESTIONS WILL GO ON. Start!"
print ""
begin = (raw_input("What is your guess?:"))
if begin == "kirby64thecrystalshards":
        print ""
        print "Sorry that is incorrect."
        print ""
if begin == "kirbysepicyarn":
        print ""
        print "Sorry that is incorrect."
        print ""
if begin == "kirbysuperstarultra":
        print ""
        print "Sorry that is incorrect."
        print ""
if begin == "kirbysreturntodreamland":
        print ""
        print "Hurrah! You got it correct!"
        print ""
        score = score+3
if begin == "kirbyandtheamazingmirror":
        print ""
        print "Sorry that is incorrect."
        print ""
if begin == "kirbysqueaksquad":
        print ""
        print "Sorry that is incorrect."
        print ""
if begin == "kirbyairride":
        print ""
        print "Sorry that is incorrect."
        print ""
if begin == "kirbysdreamland2":
        print ""
        print "Sorry that is incorrect."
        print ""
if begin == "kirbysdreamland3":
        print ""
        print "Sorry that is incorrect."
        print ""
#This is the sixth Question.
print "Q6. Identify the picture!"
print ""
print ""
print ""      
print "   ------------------ "
print "  /                  \ "
print " |                    | "
print " |        | |         |"
print " |                    |"
print "  \                  / "
print "  /------------------\  "
print " |_______/   \________| "
print ""
print "1) A Kirby."
print "2) A walking box."
print "3) ?"
print "4) My mom."
choice = input("Answer=")
if choice ==1:
        print "FAIL!!! A Kirby has arms!"
        print ""
elif choice ==2:
        print "That is correct! It's not a Kirby because it doesn't have arms!"
        print ""
        score = score+1
elif choice ==3:
        print "No. That is incorrect. No points for you!"
        print ""
elif choice ==4:
        print "By the way, THAT IS NOT YOUR MOM!"
        print ""
elif choice> 4 or choice < 1:
        print "Wow. Really?"
        print ""
#This is the seventh Question.
print "Q7. Meta Knight really is:"
print "1) A Kirby."
print "2) A robot."
print "3) A Waddle Dee."
print "4) None of the above."
choice = input("Answer=")
if choice ==1:
        print "Nice try. YOU ARE CORRECT!"
        print ""
        score = score+1
elif choice ==2:
        print "INCORRECT! Nice try."
        print ""
elif choice ==3:
        print "HA! No way."
        print ""
elif choice ==4:
        print "Heh! It seems as if I have fooled you!"
        print ""
elif choice> 4 or choice < 1:
        print "Why don't you read the instructions next time?"
        print ""
#This is the eighth Question.
print "Q8. What is one of the main bosses in 'Super Smash Brothers Brawl' that is also a boss in 'Kirby the Amazing Mirror?'"
print "1) Krazy hand."
print "2) Mister hand."
print "3) Ganondorf."
print "4) Yoshi."
choice = timeout_input("Answer=", timeout=8)
if not(choice):
    print ""
other = (raw_input("Would you like to continue without choosing a answer?:"))
if other == "yes":
        print "Haha! Nicely done! None of those answers were correct! This was a ULTRA QUESTION in disguise!"
        print ""
        score = score+3
if other == "no":
        print "Well, we have to move on anyway. Too bad you didn't say yes......."
        print ""
elif int(choice) ==1:
        print "THAT IS INCORRECT! 'Krazy hand' is SUPPOSED to be spelled 'Crazy hand'!"
        print ""
elif int(choice) ==2:
        print "INCORRECT! 'Mister hand' is supposed to be spelled 'Master hand'!"
        print ""
elif int(choice) ==3:
        print "Ganondorf is in the LEGEND OF ZELDA!"
        print ""
elif int(choice) ==4:
        print "Yoshi isn't in Kirby!!!"
        print ""
elif int(choice)> 4 or int(choice) < 1:
        print "Go away if you want to fail."
        print ""
#This is the ninth question.
print "SOMETHING IS PUT HERE"
print ""
quit()
#DELETE THE UPPER 3 LINES OF CODE.
导入时间
导入系统,选择
def超时_输入(消息,超时=8):
打印“呵呵!Q%s是个棘手的问题!”%s超时
如果消息:
系统标准输出写入(消息)
sys.stdout.flush()
i、 o,e=select.select([sys.stdin],[],超时)
若(i):
返回sys.stdin.readline().strip()
返回“”
#这是TUKT的脚本。不删除
分数=0
打印“”
打印“欢迎参加终极科比测试。”
打印“”
打印“键入“是”开始。键入“否”退出。键入“信息”了解如何播放。”
打印“”
begin=(原始输入(“您想开始吗?:”)
如果开始==“是”:
打印“”
打印“好吧!我们开始吧,好吗?”
如果开始==“否”:
退出
如果开始==“信息”:
打印“”
打印“在‘答案=’后键入您认为正确的答案编号。有时,会弹出超级问题。这些问题值3分!!考试结束时,我会显示您的分数。您必须正确地获得7分以上才能通过。祝您好运!”
#这是第一个问题。
打印“Q1.Kirby是什么颜色?”
打印“1)黑色。”
打印“2)蓝色。”
打印“3)粉红色。”
打印“4)从技术上讲,他的颜色会根据他吞下的对手而变化。”
选择=输入(“回答=”)
如果选项==1:
打印“”
打印“不正确”
打印“”
elif选项==2:
打印“”
打印“不正确”
打印“”
elif选项==3:
打印“”
打印“Tee-hee…我骗了你!”
打印“”
elif选项==4:
打印“”
打印“干得好!你看穿了我的把戏!”
打印“”
分数=分数+1
elif选项>4或选项<1:
打印“”
打印“这不是有效答案。”
打印“”
#这是第二个问题。
打印“Q2.谁把柯比变成了纱线?(柯比史诗般的纱线)
打印“1)Elmo。”
打印“2)名为纱王的可怕的棉花巫师。”
打印“3)一个名叫尹纱的魔术师。”
打印“4)迪德国王。”
选择=输入(“回答=”)
如果选项==1:
打印“”
打印“别傻了,Elmo是版权所有的!”
打印“”
elif选项==2:
打印“”
打印“我不敢相信你会爱上它!”
打印“”
elif选项==3:
打印“”
打印“干得好!”
打印“”
分数=分数+1
elif选项==4:
打印“”
打印“哈!很好的尝试。”
打印“”
elif选项>4或选项<1:
打印“”
打印“你一定是在开玩笑。”
打印“”
#这是第三个问题。
打印“Q3.谁是Kirby冒险中的恶棍?”
打印“1)国王德德。”
打印“2)噩梦”
打印“3)元骑士。”
打印“4)以上所有内容。”
选择=输入(“回答=”)
如果选项==1:
打印“”
打印“太糟糕了!”
打印“”
elif选项==2:
打印“”
打印“我骗了你!哈哈哈!”
打印“”
elif选项==3:
打印“”
打印“假!!”
打印“”
elif选项==4:
打印“”
打印“让我想想……是的!”
打印“”
分数=分数+1
elif选项>4或选项<1:
打印“”
打印“你瞧不起我。”
打印“”
#这是第四个问题。
打印“Q4.Kirby可以在哪个游戏中组合敌人的力量?”
打印“1)Kirby的梦想之地2”
打印“2)柯比64:水晶碎片。”
打印“3)柯比和七块石头。”
打印“4)梦境中的柯比噩梦。”
选择=输入(“回答=”)
如果选项==1:
打印“”
打印“不,对不起!”
打印“”
elif选项==2:
打印“”
打印“是的!没错!做得很好!”
打印“”
分数=分数+1
elif选项==3:
打印“”
打印“这甚至不是一个真正的游戏!(因此没有资本化它。)”
打印“”
elif选项==4:
打印“”
打印“不,你应该更了解科比的游戏!”
打印“”
elif选项>4或选项<1:
打印“”
打印“嗯!下次你真的应该‘试试’!”
打印“”
#这是第五个问题。
印刷品“问题5。超问题!有一个投票调查,看看前十名科比游戏!你认为哪一个在上面?选择包括:Kirby 64水晶碎片、Kirby的史诗故事、Kirby超级巨星Ultra、Kirby回归梦境、Kirby和神奇镜子、Kirby Squeak Squad、Kirby Air Ride、Kirby梦境2、Kirby梦境3。请用所有小写字母输入您的猜测,不要用空格和标点符号!不要拼写错误。如果你这样做了,问题还会继续。开始"
打印“”
begin=(原始输入(“您的猜测是什么?”)
如果begin==“Kirby64晶体碎片”:
打印“”
打印“对不起,这不正确。”
打印“”
如果begin==“Kirbyson”:
打印“”
打印“对不起,这不正确。”
打印“”
如果begin==“kirbysuperstarultra”:
打印“”
打印“对不起,这不正确。”
打印“”
如果begin==“kirbysreturntodreamland”:
打印“”
打印“万岁!你说得对!"
打印“”
分数=分数+3
如果begin==“Kirby和TeamazingMirror”:
打印“”
打印“对不起,这不正确。”
打印“”
如果begin==“kirbysqueaksquad”:
打印“”
打印“对不起,这不正确。”
打印“”
如果begin==“kirbyairride”:
if not choice:
    other = (raw_input("Would you like to continue without choosing a answer?:"))