#!/usr/bin/env python #import the random module to generate random numbers import random #generate random numbers for the player's dices dice1 = random.randint(1,6) dice2 = random.randint(1,6) #generate random numbers for the computer's dices computerdice1 = random.randint(1,6) computerdice2 = random.randint(1,6) #sum them up mine = dice1 + dice2 his = computerdice1 + computerdice2 #print the results print 'mine = ' + str(mine) + ' vs. computer = ' + str(his) #check the winner and print the results if mine > his: print "I won" elif mine < his: print "Computer won" else: print "Tie. Try again"