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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -