title: higher or lower card game in python
body: <p>I need to write some code which shows a random single number/card from 1-12, the player then guesses whether the next card will be higher or lower than the first card/number. (play your cards right british game) if they guess right they get another go, if they guess wrong (they say higher or lower and it's the opposite) they lose and the game ends. if they guess four in a row right they win. </p>
  
  <p>I have a very rough idea of how to go about this.</p>
  
  <p>Could you please lend a hand? </p>
  
  <pre><code>import random
  
  guessesTaken = 0 
  
  print('Hello! I am going to show you a card, guess whether the next card is higher or lower, get four in a row to win!')
  
  
  number = random.randint(1, 12)
  number1 = random.randint(1, 12)
  number2 = random.randint(1, 12)
  number3 = random.randint(1, 12)
  number4 = random.randint(1, 12)
  
  #five variables for five cards, all random cards between 1 and 12
  
  print('Well I am thinking of a card between 1 and 12, the first number is:')
  print (number) #shows them first card
  
  while guessesTaken &lt; 5: #limit number of guesses to make game less than 4 to win?
      print('Take a guess, is the next card higher or lower? Please enter a number from 1 to 12.') 
      guess = input()
      guess = str(guess) # limit input to "h" or "l"?
  
      guessesTaken = guessesTaken + 1 #increment guesses taken
  
      if guess = h and guess !&gt; number1:
      print ("you lose")
          break
  
      if guess =l and guess !&lt; number1:
          print('you lose')
  
      if guess = h and guess !&lt; number1:
      print ("well done")
          #ask about next card
  
      if guess =l and guess !&gt; number1:
          print('well done')
          #ask about next card
  
  
      if guess == number1:
          print ('you lose it was neither higher nor lower')
          break
  
      #basically I know the middle comparison for values higher or lower for the four cards can be done with a loop, just not sure how, very new to this. 
  </code></pre>
  
  <p>second version (working sort of)</p>
  
  <pre><code>import random
  
  guessesTaken = 0 
  
  print('Hello! I am going to show you a card, guess whether the next card is higher or lower, get four in a row to win!')
  
  number = random.randint(1, 12)
  
  #five variables for five cards, all random cards between 1 and 12
  
  print('Well I am thinking of a card between 1 and 12, the first number is:')
  print (number) #shows them first card
  
  guess = input('Take a guess, is the next card higher or lower? Please enter either "h" or "l".')
  
  while guessesTaken &lt;= 4: #limit number of guesses to make game less than 4 to win?
  
      if guessesTaken == 4:
          print("You win")
          break
      else:
          nextnumber = random.randint(1,12)
          print(nextnumber)
  
          if guess == "h" and nextnumber &lt;= number:
              print ("you lose")
              break
          elif guess == "l" and nextnumber &gt;= number:
              print ("you lose")
              break
          else:
              guess = input("the card was" + str(nextnumber) + "is the next card higher or lower?")
  
          guessesTaken += 1 #increment guesses taken
          number = nextnumber
  </code></pre>