Advertisement
Guest User

Untitled

a guest
May 13th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import sys,os,random
  3. __author__ = 'L00PeR'
  4. how_to_play = '''
  5. \n\n
  6. Playing Wanna Be Rich is very easy !!
  7. First, you need to specify how much you want to bet.
  8. Example: Select a cuantity of money to bet: 38
  9. Then you need to specify the win percentage you want to have,
  10. the more risky you are, the more rich you can be!!!
  11. Example: Select a cuantity of win percentage: 45
  12. WARNING you don't have to write the % \after the number!!!
  13. Have fun!!!
  14.  
  15. '''
  16. bets = '''1. 90% \win
  17. 2. 75% \win
  18. 3. 50% \win
  19. 4. 25% \win
  20. 5. 5% \win'''
  21. banner = '''
  22. __ ____ _ _ __ _ __ __ _
  23. \ \ /\ / / _` | '_ \| '_ \ / _` |
  24. \ V V / (_| | | | | | | | (_| |
  25. \_/\_/ \__,_|_| |_|_| |_|\__,_|
  26.  
  27.  
  28. _ _ _ _
  29. | | (_) | | | |
  30. | |__ ___ _ __ _ ___| |__ | |
  31. | '_ \ / _ \ | '__| |/ __| '_ \ | |
  32. | |_) | __/ | | | | (__| | | | |_|
  33. |_.__/ \___| |_| |_|\___|_| |_| (_)
  34.  
  35. Vesion: 1.00
  36. L00PeR
  37. '''
  38. money = 100
  39. def bet(bet_money, w_percentage):
  40. global money
  41.  
  42. rnd_number = random.randint(0,100)
  43. if rnd_number <= w_percentage:
  44. multiplier = 100/w_percentage-0.025
  45. price = bet_money*multiplier-bet_money
  46. price = round(price,2)
  47. print "You win "+str(price)+" $"
  48. money+=price
  49. else:
  50. print "Sorry you've losed "+str(bet_money)
  51. money-=bet_money
  52.  
  53. def main():
  54. os.system("reset")
  55. print banner
  56. fst_tm = raw_input("Hi, is it your first time? Y/n ")
  57. if fst_tm == "Y" or fst_tm == "y": print how_to_play
  58. while True:
  59. if money <= 0:
  60. print "You have no money"
  61. exit(0)
  62. print "\nMoney: "+str(money)+ " $"
  63.  
  64. try:
  65. bet_money = float(raw_input("Select a cuantity of money to bet: "))
  66. except ValueError:
  67. print "You must write the cuantity of money"
  68. if bet_money <= money:
  69. try:
  70. bet_win_percetage = float(raw_input("Select a cuantity of win percentage: "))
  71. except ValueError:
  72. print "You have to write the win percentage, ej: 28.30"
  73. if bet_win_percetage<=0 or bet_win_percetage > 100:
  74. print bet_win_percetage+" is not a valid win percentage"
  75. else:
  76. bet(bet_money, bet_win_percetage)
  77. else:
  78. print "You haven't so much money!"
  79.  
  80.  
  81.  
  82.  
  83. if __name__ == '__main__':
  84. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement