Python - how to show differences between two numbers(strings) -
import random def run_all(): print "welcome" name = get_name() welcome(name) guess = get_guess() print guess dice1 = get_dice() dice2 = get_dice() dice3 = get_dice() total = dice1 + dice2 + dice3 print "dice 1: " + str(dice1) print "dice 2: " + str(dice2) print "dice 3: " + str(dice3) print "the dices total sum is: " + str(total) print "your guess was: " + guess def get_name(): '''ask name''' return raw_input("hi, what's name?") def welcome(name): ''' welcome''' print name + ", welcome!" def get_guess(): return raw_input("we throw 3 dices, think total sum be? ") def get_dice(): return random.randint(1,6) run_all()
i want show player difference between guess , total, can't figure out how to.
difference = abs(total - int(guess))
Comments
Post a Comment