title: Python how to check if value changed
body: <p>I want to print "Same number" if the new number value equals to the last one(same number), else print number variable value if it has changed. How can I do that?</p>
  
  <pre><code>from random import randint
  x=0
  number=(randint(0,9))
  while(x&lt;10):
      x+= 1
      if(number=="""LAST PRINTED VALUE NUMBER"""):
          print ("Same number")
      else:
          print(number)
  </code></pre>