title: loop python, return input function
body: <p>I am trying to create a loop that will get me asking for a user's bet until it runs out of money or decides to quit. How can i take inputs from the different functions?</p>
  
  <pre><code>import random
  import sys
  
  
  def greeting():
  
      print('COP1000 Slot Machine - Jesus Pacheco')
      print('Let\'s play slots!')
  
  # Function ask user starting amout to bet
  # then it will check for any input error 
  def intro():
      greeting()
  
      print('How much money do you want to start with?')
  
      print('Enter the starting amount of dollars.', end='')
      total = int(input())
  
      print('Your current total is '+ str(total)+'\n')
      while True:
  
          print('How much money do you want to bet (enter 0 to quit)?', end='');
  # Bett will be the amount of money that the player will bet 
          bett = int(input())
          if bett == 0:
              sys.exit()
          if bett &gt; int(total):
              print('ERROR You don\'t have that much left')
  
          elif bett &lt; int(0):
              print('ERROR: Invalid bet amount\n')
  
          else:
              break
  
  # Function will ask user to press enter to play slot machine
  def slotMachine():
      print('Press enter to pull slot machine handle!')
      input()
  
  # Function shows results of slot machine after handle being pulled
  def random():
      import random
  
  
      num1 = random.randint(1, 5)
      num2 = random.randint(1, 5)
      num3 = random.randint(1, 5)
  
      print('/---+---+---\  ')
      print('|-'+ str (num1)+'-|-'+ str(num2) +'-|-'+ str (num3) +'-|')
      print('\---+---+---/  ')
  
  
      if num1 == num2 and num2 == num3:
          print('JACKPOT! cha-ching, you win')
  
  
      if num1 == num3 or num2 == num3:
          print('Match two, you get your bet back!')
  
      else:
          print('sorry, no match')
  
  intro()
  
  slotMachine()
  
  random()
  
  input()
  </code></pre>