title: How can we store previous value of some variable in some other variable in python?
body: <p>I would like to access the previous value of <code>num1</code> in other function by storing it in another variable.
  I have tried many ways without success; can you guys help me.</p>
  <pre><code>import random
  num2 = 3
      
  def token():
      global num2 
      print (num2) #It should print previous value of num1 (it is not giving previous value but giving me the same value with num1 every time )
      num1 = random.randint(40,90)
      print(num1) 
      num2= num1 
  
  def vcode():
      print(num2) #want to access here the previous value of num1 
  
  print(token(),vcode()) 
  </code></pre>