Question: EXPLAIN THIS CODE STEP BY STEP in words please?? Type or paste question hereimport random balance=250 betAmount=0 sumGuess=0 while True: if balance==0: print(You do not
EXPLAIN THIS CODE STEP BY STEP in words please??
Type or paste question hereimport random balance=250 betAmount=0 sumGuess=0 while True: if balance==0: print("You do not have enough balance!") break dice1=random.randint(1,6) dice2=random.randint(1,6) sumRandom=dice1+dice2 while True: betAmount=int(input("Enter how much money you are betting:")) if betAmount<=0 or betAmount>balance: print("Invalid Amount! Please Enter Again. ") else: break sumGuess=int(input("Enter your guess for sum of two rolled dice : ")) if(sumGuess==sumRandom): if dice1==dice2: print(" Jumbo Jackpot You are Rewarded DOUBLE bet Money!") balance=balance+(2*betAmount) else: print(" You guess the sum correct! You are Rewarded the bet Money!") balance=balance+betAmount else: print(" You guess was wrong! Better luck next time!") balance=balance-betAmount print("Your current balance is",balance) playAgain='y' while True: playAgain=input('Do you want to play again? Enter Y/y for yes else N/n for no:') if playAgain=='Y' or playAgain=='y' or playAgain=='N' or playAgain=='n': break else: print("Invalid Input! Enter again.") if playAgain=='n' or playAgain=='N': print("Bye!") break print(" ")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
