title: How to loop a whole python quiz without using def's?
body: <p>The code is below. I am trying to figure out how to make the user able to input 'yes' or 'no' to play again. I tried making the question section into a def by spacing each line forward but it kept putting in the 'expected indented line' error message. Is it possible to loop the entire quiz without using defs</p>
  
  <pre><code>import time
  #Welcome message
  print("Welcome! Have a go at this quiz!")
  time.sleep(1)
  print("Whats your name?")
  player_name = input()
  
  #Questions
  
  score = 0 #this defines variable score and sets it to 0
  
  
  print("What is 2 + 2 " + player_name)
  answer  = input()
  answer = int(answer)
  if answer == 4:
      print("Well done " + player_name)
      score = score + 1 #This increases score by 1
  else:
      print("Sorry the answer was 4 " + player_name)
  
  
  
  print("your score is " + str(score))
  
  print("What is 4 + 3 " + player_name)
  answer  = input()
  answer = int(answer)
  if answer == 7:
      print("Well done " + player_name)
      score = score + 1 #This increases score by 1
  else:
      print("Sorry the answer was 7 " + player_name)
  
  print("your score is " + str(score))
  
  print("What is 5 + 7 " + player_name)
  answer  = input()
  answer = int(answer)
  if answer == 12:
      print("Well done " + player_name)
      score = score + 1 #This increases score by 1
  else:
      print("Sorry the answer was 12 " + player_name)
  
  
  
  print("your score is " + str(score))
  
  
  print("What is 8 + 9 " + player_name)
  answer  = input()
  answer = int(answer)
  if answer == 17:
      print("Well done " + player_name)
      score = score + 1 #This increases score by 1
  else:
      print("Sorry the answer was 17 " + player_name)
  
  
  
  print("your score is " + str(score))
  
  
  print("What is 11 + 9 " + player_name)
  answer  = input()
  answer = int(answer)
  if answer == 20:
      print("Well done " + player_name)
      score = score + 1 #This increases score by 1
  else:
      print("Sorry the answer was 20 " + player_name)
  
  
  
  print("your score is " + str(score))
  
  
  
  
  print("What is 12 + 14 " + player_name)
  answer  = input()
  answer = int(answer)
  if answer == 26:
      print("Well done " + player_name)
      score = score + 1 #This increases score by 1
  else:
      print("Sorry the answer was 26 " + player_name)
  
  
  
  print("your score is " + str(score))
  
  
  print("What is 15 + 15 " + player_name)
  answer  = input()
  answer = int(answer)
  if answer == 30:
      print("Well done " + player_name)
     score = score + 1 #This increases score by 1
  else:
      print("Sorry the answer was 30 " + player_name)
  
  
  
  
  
  print("CONGRATULATIONS!, You have finished this quiz!")
  
  print("your final score was " + str(score))
  if score &gt; 6:
      print("Great work! You got top marks!")
  elif score &gt; 5:
     print("Good, try harder next time and you might get full marks!")
  elif score &gt; 4:
      print("You did alright")
  elif score &gt; 3:
      print("That was ok")
  elif score &gt; 2:
      print("Ummm...Maybe next time you should know study or try harder")
  else:
      print("Wow, You are horrible at math...")
  </code></pre>