0

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

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
4

0 回答 0