title: How to calculate the average of the sum of 10 random rolled dices
body: <p>The program gonna rolls 10 fair dice (six sided) until the sum of these rolls is prime and larger or equal to 45 and then output the average of the sum of all these rolls. I am trying to use a while loop. Here is what I have until now: </p>
  
  <pre><code>import random
  
  # function to generate a random number between 1 and 6
  def rollDice():
      roll = random.randint(1,6)
      return roll
  
  for i in range(10):
      print(rollDice(), end = ' ')
  # checks if the sum of the dices value is prime
  def is_prime(dices):
      total_sum = sum(dices)
      for x in range(2,int(total_sum**0.5)+1):
          if total_sum % x == 0:
              return False
      return True
  
  total_sum = 0
  isPrime = False
  while isPrime is False or total_sum &lt; 45:
      dices = [rollDice() for dice in range(10)]
      total_sum = sum(dices)
      isPrime = is_prime(dices)
  
  print('Average of the sum of the ten-rolls is {0:.2f}'.format(float(total_sum)/10))
  </code></pre>
  
  <p>The problem is sometimes I run the program the sum of those 10 rolls is not larger than 45, and the Average of those sums are somehow always equal 4.70 no matter what </p>
  
  <p>The output supposed to be: <em>display 10 random numbers from 1-6</em> Average of the sum of the ten-rolls is ...</p>