import random
#set counters
counter2=0
counter3=0
counter4=0
counter5=0
counter6=0
counter7=0
counter8=0
counter9=0
counter9=0
counter10=0
counter11=0
counter12=0
doubles=0
def main():
#get input from user
rolls = int(input("How many times would you like to roll the dice?")
for count in range(rolls+1)
#roll dice
die1 = random.randint(1,6)
die2 = random.randint(1,6)
#add up dice totals to counters
if die1 + die2 = 2:
counter2 += 1
if die1 + die2 == 3:
counter3 += 1
if die1 + die2 == 4:
counter4 += 1
if die1 + die2 == 5:
counter5 += 1
if die1 + die2 == 6:
counter6 += 1
if die1 + die2 == 7:
counter7 += 1
if die1 + die2 == 8:
counter8 += 1
if die1 + die2 == 9:
counter9 += 1
if die1 + die2 == 10:
counter10 += 1
if die1 + die2 == 11:
counter11 += 1
if die1 + die2 == 12:
counter12 += 1
if die1 == die2:
doubles += 1
#print data
print("2 - ", counter2, \
"3 - ", counter3, \
"4 - ", counter4, \
"5 - ", counter5, \
"6 - ", counter6, \
"7 - ", counter7, \
"8 - ", counter8, \
"9 - ", counter9, \
"10 - ", counter10, \
"11 - ", counter11, \
"12 - ", counter12, \
"Doubles - ", doubles)
main()
该程序的目标是掷 2 个骰子,无论用户想要多少次,然后列出骰子掷了多少次 1,2,3,4 等。行“die1 = random.randint(1,6)并且 die2 = random.randint(1,6) 给我一个语法错误并突出显示“die1”头脑告诉我我做错了什么?