# import random library and set seed
import random
random.seed (12345)
# Step 1.
# Define a function which randomly draws a ball with an integer between 1 and 100 on it; 
# then returns True if Player
# wins and returns False if House wins. 
# Add a print statement to function to print random integer and test out function
# Add comment statements to function
#
def rand_num (n) :  #function
    rand_num = random.randint (1, 100) #generate random number
    print (rand_num)
    if (rand_num < 52) :  #if statement
        return True
    else :
        return False
rand_num(1)
# Step 2.
# Create a function which simulates playing the game n_plays times; keep track of number of wins and losses
#
def rand_pick (n_plays) :
    n_win = 0
    n_lose = 0
    funds = 1000
    for i in range (0, n_plays) :
        pick = random.randint (1, 100)
        if (pick < 52) :
            n_lose = n_lose + 1
            funds = funds - 100
        else :
            n_win = n_win + 1
            funds = funds + 100
    return ([n_win, n_lose], funds)
    
rand_pick (100)
def rand_pick (n_plays) :
    n_win = 0
    n_lose = 0
    funds = 10000
    wager = 100
    for i in range (0, n_plays) :
        pick = random.randint (1, 100)
        if (pick < 52) :
            n_lose = n_lose + 1
            funds = funds - 100
        else :
            n_win = n_win + 1
            funds = funds + 100
    #return ([n_win, n_lose], funds)
    print (f"Number of Wins: {n_win}. Number of Loses: {n_lose}. Funds Remaining: {funds}")
    
rand_pick (5)
def rand_pick (n_plays) :
    n_win = 0
    n_lose = 0
    funds = 10000
    wager = 100
    total = 0
    for i in range (0, n_plays) :
        pick = random.randint (1, 100)
        if (pick < 52) :
            n_lose = n_lose + 1
            funds = funds - 100
        else :
            n_win = n_win + 1
            funds = funds + 100
    for i in range (1, 100) :
        total = total + funds
        avg = total / 100
    print (f"Average amount of funds remaining after playing 5 games: {avg}")
    print (f"Discrete Probability of Winning: {n_win / 5}. Discrete Probability of Losing: {n_lose / 5}")
    #return ([n_win, n_lose], funds)
    
rand_pick (5)
def rand_pick (n_plays) :
    n_win = 0
    n_lose = 0
    funds = 10000
    wager = 100
    total = 0
    for i in range (0, n_plays) :
        pick = random.randint (1, 100)
        if (pick < 52) :
            n_lose = n_lose + 1
            funds = funds - 100
        else :
            n_win = n_win + 1
            funds = funds + 100
    for i in range (1, 100) :
        total = total + funds
        avg = total / 100
    print (f"Discrete Probability of Winning: {n_win / 100}. Discrete Probability of Losing: {n_lose / 100}")
    #return ([n_win, n_lose], funds)
    
rand_pick (100)
# 1.  import random and set seed
 
# 2.  Input target sales and number of sales persons for upcoming year; low and high
# percentages of sales for generating random numbers
 
# 3.  Generate a random sales amount for each rep and check that it is in the correct range 
# Use a for loop; round answer to nearest cent
 
# 4. Add to your loop in # 3 to determine the  commission for each rep
# (you need an if-elif-else construct to determine rate); keep a running tab of 
# the sum of all commissions
# round all dollar amounts to nearest cent
#
 
# 5.  Add a loop around your code in # 4 to do 10,000 simulations
# Only print out the average commission for all 10,000 simulations
# Don't print out all the information from Step # 4 - it will be way too much so remove
# or comment out those print statements
#