Advertisement
timber101

Dice Game 2 - Scoring

Nov 23rd, 2022
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. # dice game - scores
  2. # roll even number +10, roll odd -5 ( cant go below zero ) roll a double get an extra roll
  3. #  DONT JUST COPY THIS, I WILL ASK QUESTIONS!
  4.  
  5. import random
  6. """
  7. d1 = random.randint(1,6)
  8. d2 = random.randint(1,6)
  9. """
  10. d1 = int(input("Enter d1 >>"))
  11. d2 = int(input("Enter d2 >>"))
  12. d3 = 0
  13.  
  14. tot = d1 + d2
  15.  
  16. if tot % 2 ==0:  # testing there for an even number
  17.     #tot = tot +10
  18.     tot +=10
  19. else:
  20.     tot -= 5 # tot = tot -5
  21.     if tot < 0:
  22.         tot = 0
  23.  
  24. if d1 == d2: # checking for both the same
  25.     d3 = random.randint(1,6)
  26.     tot += d3
  27.    
  28.  
  29. #print("die1=",d1,"die2=", d2, "die3=",d3,"total=", tot)
  30. #print("die1= " + str(d1) +" die2= " +str(d2) + " tot= " +str(tot)) # concatenation + casting
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement