Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import random
- coin = 0
- def Game():
- global coin
- bet = int(input('how much will you bet? : '))
- if bet > coin:
- print('\nNo... you cannot bet that much')
- print(f'you only have {coin}')
- print(f'your bet become {coin}')
- bet = coin
- input('\npress any key to roll..')
- me = random.randint(1,6)
- print(f'your number is {me}')
- print('\ncomputer turn')
- comp = random.randint(1,6)
- print(f'computer number is {comp}')
- print()
- if(comp>me):
- print('computer wins')
- coin = coin - bet
- elif(comp<me):
- print('you win')
- coin = coin + bet
- else:
- print('draw')
- print(f'\nyour coin is {coin}')
- if coin == 0:
- print('\nyou need to buy more coin')
- print('will you buy or exit?')
- ans = input('y/n? ')
- if ans == 'y':
- coin = int(input('\nhow many coin: '))
- else:
- print('\n\nSee you next time buddy!')
- exit()
- # Program start here
- os.system('clear') # for windows use cls
- coin = int(input('how many coin? :'))
- while(True):
- print('1 - Play Game')
- print('2 - Exit')
- ans = input('1 or 2 ? : ')
- if(ans=='1'):
- print('\nPlaying Game...')
- Game()
- print()
- if(ans=='2'):
- print('Exiting now...')
- print()
- exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement