擅长:python、mysql、java
<p>因为您只调用<code>throw = random.randint(1,6) </code>一次</p>
<p>您需要将其添加到循环中以继续生成随机数</p>
<pre><code>#import random module
import random
#introduce the program
print("a program to count the number of 6's thrown in a simulation of a dice being thrown 6000 times")
#declare the variables
max = int(6) #need to declare max number for the dice
min = int(1) #need to declare min number for the dice
countThrow = 0 #count the number of throws
maxThrow = int(6) #max throw
sixRolled = 0 #count the number of 6's thrown
#while loop
while countThrow != maxThrow:
throw = random.randint(1,6) #each throw of the dice generates a number
countThrow = countThrow + 1
print(throw)
print("Number of rolls ", countThrow)
if throw == 6:
sixRolled = sixRolled + 1
print("You have thrown a", throw)
else:
print("you have rolled a", throw, "roll again.")
print("You have rolled ", sixRolled, "6's in 6 throws")
</code></pre>