Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. import random
  2.  
  3. money = 100
  4. #num = random.randint(1, 10)
  5. #Write your game of chance functions here
  6. def coin(call, bet):
  7. flip = random.randint(0,100)
  8. if flip >= 50:
  9. flip = "Heads"
  10. else:
  11. flip = "Tails"
  12. if call == flip:
  13. print("You Won! $"+str(bet))
  14. return bet
  15. else:
  16. print("You lost! $"+str(bet*-1))
  17. return bet*-1
  18. def cho(call, bet):
  19. dice1 = random.randint(1,6)
  20. dice2 = random.randint(1,6)
  21. sumdice = dice1+dice2
  22. if sumdice % 2 == 0:
  23. sumdice = "Even"
  24. else:
  25. sumdice = "Odd"
  26. if call == sumdice:
  27. print("CHO You won! $"+str(bet))
  28. return bet
  29. else:
  30. print("CHO You lost! $"+str(bet*-1))
  31. return bet*-1
  32. def cards(bet):
  33. pull = random.randint(1,14)
  34. pull2 = random.randint(1,14)
  35. if pull > pull2:
  36. print("You won! $"+str(bet))
  37. return bet
  38. elif pull2 > pull:
  39. print("You lost! $"+str(bet*-1))
  40. return bet*-1
  41. else:
  42. print("You tied! $0")
  43. return 0
  44. def roul(num, odd_even, range_1, bet):
  45. rando = random.randint(0, 37)
  46. print("The rolled number was "+str(rando))
  47. if rando >= 19:
  48. call = "High"
  49. else:
  50. call = "Low"
  51. if num == rando:
  52. print("You won with correct number! $"+str(bet*rando))
  53. return bet*rando
  54. elif range_1 == call:
  55. print("You won with range call! $"+str(bet))
  56. return bet
  57. elif num % 2 == 0 and odd_even == "Even":
  58. print("You won with Even call! $"+str(bet))
  59. return bet
  60. elif num % 2 != 0 and odd_even == "Odd":
  61. print("You won with Odd call! $"+str(bet))
  62. return bet
  63. else:
  64. print("You lost! $"+str(bet*-1))
  65. return bet
  66.  
  67. #Call your game of chance functions here
  68. money += coin("Tails", 10)
  69. print("You made $"+str(money))
  70. money+=cho("Even", 20)
  71. print("You made $"+str(money))
  72. money+=cards(25)
  73. print("You made $"+str(money))
  74. money+=roul(15, "Even", "Low", 50)
  75. print("You made $"+str(money))
  76. #print(coin("Heads", 10)) #test for coin function, IS WORKING
  77. #print(cho("Even", 10)) #test for cho-Han function, IS WORKING
  78. #print(cards(10)) #test for cards function, is WORKING
  79. #print(roul(15, "Even", "Low", 10))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement