New to Python, creating a craps game when given n games
<p>I'm new to programming, and particular python, and I'm having trouble with a problem I have for homework. </p>

<p>Here's the problem:</p>

<p>Craps is a dice-based game played in may casinos. Like blackjack, a player plays against the house. The game starts with the player throwing a pair of standard, six-sided dice. If the player rolls a total of 7 or 11, the player wins. If the player rolls a total of 2, 3, or 12, the player loses. For all other roll values, the player will repeatedly roll the pair of dice until either she rolls the initial value again (in which case she wins) or 7 (in which case she loses)</p>

<p>Implement function testCraps() that takes a positive interger n as input, simulates n games of craps, and returns the fraction of games the player won.</p>

<pre><code>&gt;&gt;&gt; testCraps(1000)
0.4844

&gt;&gt;&gt; testCraps(1000)
0.492
</code></pre>

<p>Here's what I have so far:</p>

<pre><code>import random

def roll():
   dice = (random.randrange(1,7) + random.randrange (1,7))
   return dice

def testCraps(n):
    dice = roll()
    total = 0
    count = 0

    for i in range (n):
        total = total + 1

        if dice == 2 or dice == 3 or dice == 12:
            count = count + 0
        elif dice == 7 or dice == 11:
            count += 1
        else:
            dice1 = roll()
             while dice1 != 7 or dice1 != dice:
                  if dice1 == 7:
                     count = count + 0
                  elif dice1 == dice:
                     count += 1
                  else: 
                     dice1 = roll()

     return(float(count/total))
</code></pre>

<p>Am I missing anything? Any hints would be greatly appreciated! Thanks in advance!</p>
