title: Is there a random function in python that accepts variables?
body: <p>I'm attempting to create a simple dice roller, and I want it to create a random number between 1 and the number of sides the dice has. However, <code>randint</code> will not accept a variable. Is there a way to do what I'm trying to do?</p>
  
  <p>code below:</p>
  
  <pre><code>import random
  a=0
  final=0
  working=0
  
  sides = input("How many dice do you want to roll?")
  
  while a&lt;=sides:
      a=a+1
      working=random.randint(1, 4)
      final=final+working
  
  print "Your total is:", final
  </code></pre>