Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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_Loops_Python 3.x - Fatal编程技术网

Python循环到错误的点

Python循环到错误的点,python,loops,python-3.x,Python,Loops,Python 3.x,在Python3.3中,我正在制作一个包含两个while trues的游戏,当我运行它时,它会循环到第一个while trues,而不是第二个while trues。为什么会这样? 我的代码的第一部分如下: while True: # Callum Dashfield print ("You must answer all questions in block capitals") print ("Welcome to maze runner") print ("To l

在Python3.3中,我正在制作一个包含两个while trues的游戏,当我运行它时,它会循环到第一个while trues,而不是第二个while trues。为什么会这样? 我的代码的第一部分如下:

while True:
   # Callum Dashfield
   print ("You must answer all questions in block capitals")
   print ("Welcome to maze runner")
   print ("To learn about the controls press C")
   print ("To learn the about the different types T")
   print ("To play press START")
   run = input ()
   #Controls
   if run == "C":
      print ("To attack press H")
      print ("To walk forward press W")
      print ("To turn left press A")
      print ("To turn right press D")
      print ("To turn around press S")
      print ("To block press B")
      print ("To see what you are carrying press E")
      print ("To open stats press Q")
      print ("To open this screen press C")
      print ("To go back to the main menu press M")
      return_to_menu = input()
      if return_to_menu != "M":
         break
这是第二个循环:

while True:
   solider_close = ['7', '8' , '9', '10']
   from random import choice
   solider_long = ['1', '2', '3']
   from random import choice
   solider_speed = [ '4', '5', '6']
   from random import choice 
   solider_block = [ '4', '5', '6']            
   print ("You choose solider")
   print ("Your stats: close combat - " + choice(solider_close))
   print ("            long range combat - " + choice(solider_long))
   print ("            long range combat - " + choice(solider_speed))
   print ("            long range combat - " + choice(solider_block))
   print ("Press S to continue")
   continues = input ()
   if continues == "Y":
   #RESET  
   else:
      break

第二个循环在哪里?在程序开始时有一个循环,但我不能发布所有的代码,因为有太多的东西让它接受它,然后消除不重要的部分。例如,您的冗余导入和打印可以在上面省略。您应该删除所有无关紧要的内容:您的打印、不用于循环控制的变量,然后整个代码应该可以在此处邮寄。一旦完成,提供准确的行为和预期的行为,以便获得任何帮助,至于现在还远不清楚真正的问题是什么