Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import sys,os,random
- __author__ = 'L00PeR'
- how_to_play = '''
- \n\n
- Playing Wanna Be Rich is very easy !!
- First, you need to specify how much you want to bet.
- Example: Select a cuantity of money to bet: 38
- Then you need to specify the win percentage you want to have,
- the more risky you are, the more rich you can be!!!
- Example: Select a cuantity of win percentage: 45
- WARNING you don't have to write the % \after the number!!!
- Have fun!!!
- '''
- bets = '''1. 90% \win
- 2. 75% \win
- 3. 50% \win
- 4. 25% \win
- 5. 5% \win'''
- banner = '''
- __ ____ _ _ __ _ __ __ _
- \ \ /\ / / _` | '_ \| '_ \ / _` |
- \ V V / (_| | | | | | | | (_| |
- \_/\_/ \__,_|_| |_|_| |_|\__,_|
- _ _ _ _
- | | (_) | | | |
- | |__ ___ _ __ _ ___| |__ | |
- | '_ \ / _ \ | '__| |/ __| '_ \ | |
- | |_) | __/ | | | | (__| | | | |_|
- |_.__/ \___| |_| |_|\___|_| |_| (_)
- Vesion: 1.00
- L00PeR
- '''
- money = 100
- def bet(bet_money, w_percentage):
- global money
- rnd_number = random.randint(0,100)
- if rnd_number <= w_percentage:
- multiplier = 100/w_percentage-0.025
- price = bet_money*multiplier-bet_money
- price = round(price,2)
- print "You win "+str(price)+" $"
- money+=price
- else:
- print "Sorry you've losed "+str(bet_money)
- money-=bet_money
- def main():
- os.system("reset")
- print banner
- fst_tm = raw_input("Hi, is it your first time? Y/n ")
- if fst_tm == "Y" or fst_tm == "y": print how_to_play
- while True:
- if money <= 0:
- print "You have no money"
- exit(0)
- print "\nMoney: "+str(money)+ " $"
- try:
- bet_money = float(raw_input("Select a cuantity of money to bet: "))
- except ValueError:
- print "You must write the cuantity of money"
- if bet_money <= money:
- try:
- bet_win_percetage = float(raw_input("Select a cuantity of win percentage: "))
- except ValueError:
- print "You have to write the win percentage, ej: 28.30"
- if bet_win_percetage<=0 or bet_win_percetage > 100:
- print bet_win_percetage+" is not a valid win percentage"
- else:
- bet(bet_money, bet_win_percetage)
- else:
- print "You haven't so much money!"
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement