Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import os
- exit = False
- money = input('How much ? : ')
- coin = int(money)
- while not exit:
- os.system('cls')
- print('Choose Suit')
- print('1-Spade')
- print('2-Heart')
- print('3-Diamond')
- print('4-Club')
- user_suit = input('Choose one (1,2,3,4): ')
- user_number = input('Choose a Number for the Card: ')
- bet = input('How much will you bet on it? ')
- bet = int(bet)
- while bet > coin:
- print('You dont have enough money!')
- print('1-Add more money')
- print('2-Lower you bet')
- print('3-Exit')
- bet_ans = input('Choose 1,2,3: ')
- bet_ans = int(bet_ans)
- if bet_ans == 1:
- money = input('How much ? : ')
- money = int(money)
- coin = coin + money # coin += money
- elif bet_ans == 2:
- bet = input(f'How much will you bet on it? it must less than or equal to {coin} ')
- bet = int(bet)
- elif bet_ans == 3:
- print('Bye!')
- exit(0)
- user_suit = int(user_suit)
- user_number = int(user_number)
- card_number = random.randint(1,13)
- card_suit = random.randint(1,4)
- if user_suit == 1:
- user_suit = 'Spade'
- elif user_suit == 2:
- user_suit = 'Heart'
- elif user_suit == 3:
- user_suit ='Diamond'
- elif user_suit == 4:
- user_suit = 'Club'
- print(f'You choose {user_suit} of {user_number}')
- os.system('pause')
- if card_suit == 1:
- card_suit = 'Spade'
- elif card_suit == 2:
- card_suit = 'Heart'
- elif card_suit == 3:
- card_suit ='Diamond'
- elif card_suit == 4:
- card_suit = 'Club'
- print(f'Actual Card is {card_suit} of {card_number}')
- if (user_suit==card_suit) and (user_number==card_number):
- print("You won the prize!")
- coin += bet * 50 #coin = coin + (bet * 50)
- else:
- print('You lose!')
- coin -= bet # coin = con - bet
- print(f'Now your coin is {coin}')
- ans = input('Continue?...(y/n): ')
- if(ans != 'y'):
- exit = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement