# import random library and set seed
import numpy as np

# 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 lotto():
ball = np.random.randint(1, 100)
print(f"Drew: {ball}")
if (ball < 50):
return 0
else:
return 1
result = lotto()
if (result == 0):
print(f"Player wins.")
else:
print(f"House wins.")

```
Drew: 24
Player wins.
```

# Step 2.
# Create a function which simulates playing the game n_plays times; keep track of number of wins and losses
#
def game_cycle(n_plays):
count = 0
for i in range (0, n_plays):
x = lotto()
if (x == 0):
count += 1
return count
wins = game_cycle(10)
print(f"Wins: {wins}")

```
Drew: 44
Drew: 63
Drew: 7
Drew: 48
Drew: 62
Drew: 36
Drew: 90
Drew: 92
Drew: 44
Drew: 58
Wins: 5
```

funds = 10000
wins = 0
for i in range (0, 5):
state = game_cycle(1)
if (state > 0):
wins += 1
funds += 200
else:
funds -= 100
print(f"${funds} remaining, {wins} wins.")

```
Drew: 36
Drew: 31
Drew: 43
Drew: 55
Drew: 85
$10400 remaining, 3 wins.
```

total = 0
for j in range (0, 100):
funds = 10000
for i in range (0, 5):
state = game_cycle(1)
if (state > 0):
funds += 200
else:
funds -= 100
total += funds
print(f"\n")
average = total/100
print(f"Average funds after 100 5 game sets: ${average}")

```
Drew: 87
Drew: 63
Drew: 89
Drew: 21
Drew: 93
Drew: 38
Drew: 78
Drew: 69
Drew: 57
Drew: 73
Drew: 98
Drew: 52
Drew: 49
Drew: 12
Drew: 12
Drew: 32
Drew: 9
Drew: 58
Drew: 15
Drew: 74
Drew: 45
Drew: 55
Drew: 4
Drew: 48
Drew: 11
Drew: 83
Drew: 17
Drew: 77
Drew: 38
Drew: 2
Drew: 64
Drew: 99
Drew: 79
Drew: 87
Drew: 84
Drew: 25
Drew: 69
Drew: 50
Drew: 31
Drew: 95
Drew: 77
Drew: 42
Drew: 33
Drew: 47
Drew: 13
Drew: 93
Drew: 52
Drew: 9
Drew: 48
Drew: 65
Drew: 81
Drew: 49
Drew: 92
Drew: 7
Drew: 1
Drew: 87
Drew: 16
Drew: 42
Drew: 39
Drew: 60
Drew: 66
Drew: 25
Drew: 90
Drew: 34
Drew: 72
Drew: 88
Drew: 74
Drew: 60
Drew: 85
Drew: 36
Drew: 99
Drew: 55
Drew: 2
Drew: 27
Drew: 25
Drew: 54
Drew: 78
Drew: 27
Drew: 34
Drew: 42
Drew: 68
Drew: 65
Drew: 54
Drew: 31
Drew: 10
Drew: 79
Drew: 35
Drew: 92
Drew: 93
Drew: 72
Drew: 57
Drew: 30
Drew: 77
Drew: 7
Drew: 22
Drew: 79
Drew: 64
Drew: 92
Drew: 73
Drew: 68
Drew: 97
Drew: 79
Drew: 78
Drew: 81
Drew: 29
Drew: 47
Drew: 67
Drew: 85
Drew: 23
Drew: 33
Drew: 74
Drew: 32
Drew: 12
Drew: 74
Drew: 82
Drew: 26
Drew: 84
Drew: 11
Drew: 56
Drew: 46
Drew: 3
Drew: 27
Drew: 93
Drew: 21
Drew: 75
Drew: 43
Drew: 82
Drew: 52
Drew: 62
Drew: 88
Drew: 80
Drew: 2
Drew: 12
Drew: 43
Drew: 20
Drew: 81
Drew: 54
Drew: 10
Drew: 18
Drew: 90
Drew: 60
Drew: 15
Drew: 48
Drew: 32
Drew: 19
Drew: 30
Drew: 68
Drew: 74
Drew: 85
Drew: 38
Drew: 52
Drew: 50
Drew: 23
Drew: 71
Drew: 70
Drew: 63
Drew: 71
Drew: 28
Drew: 87
Drew: 90
Drew: 29
Drew: 90
Drew: 44
Drew: 23
Drew: 90
Drew: 68
Drew: 41
Drew: 46
Drew: 61
Drew: 6
Drew: 31
Drew: 46
Drew: 61
Drew: 43
Drew: 80
Drew: 10
Drew: 60
Drew: 58
Drew: 7
Drew: 31
Drew: 91
Drew: 63
Drew: 19
Drew: 87
Drew: 4
Drew: 84
Drew: 25
Drew: 63
Drew: 98
Drew: 88
Drew: 94
Drew: 39
Drew: 65
Drew: 74
Drew: 99
Drew: 89
Drew: 73
Drew: 32
Drew: 96
Drew: 57
Drew: 12
Drew: 21
Drew: 46
Drew: 54
Drew: 5
Drew: 79
Drew: 16
Drew: 40
Drew: 47
Drew: 26
Drew: 57
Drew: 58
Drew: 73
Drew: 87
Drew: 27
Drew: 72
Drew: 8
Drew: 26
Drew: 83
Drew: 23
Drew: 30
Drew: 41
Drew: 90
Drew: 27
Drew: 31
Drew: 67
Drew: 23
Drew: 63
Drew: 92
Drew: 55
Drew: 95
Drew: 29
Drew: 95
Drew: 40
Drew: 83
Drew: 31
Drew: 89
Drew: 33
Drew: 53
Drew: 73
Drew: 67
Drew: 72
Drew: 14
Drew: 80
Drew: 71
Drew: 20
Drew: 52
Drew: 90
Drew: 74
Drew: 81
Drew: 13
Drew: 55
Drew: 73
Drew: 90
Drew: 67
Drew: 6
Drew: 33
Drew: 35
Drew: 55
Drew: 52
Drew: 22
Drew: 89
Drew: 96
Drew: 53
Drew: 12
Drew: 28
Drew: 40
Drew: 62
Drew: 27
Drew: 95
Drew: 76
Drew: 26
Drew: 74
Drew: 99
Drew: 78
Drew: 2
Drew: 69
Drew: 25
Drew: 22
Drew: 5
Drew: 53
Drew: 99
Drew: 75
Drew: 1
Drew: 45
Drew: 95
Drew: 8
Drew: 71
Drew: 47
Drew: 12
Drew: 89
Drew: 63
Drew: 9
Drew: 3
Drew: 55
Drew: 66
Drew: 14
Drew: 70
Drew: 39
Drew: 16
Drew: 30
Drew: 46
Drew: 30
Drew: 95
Drew: 39
Drew: 13
Drew: 20
Drew: 45
Drew: 15
Drew: 92
Drew: 61
Drew: 72
Drew: 65
Drew: 20
Drew: 64
Drew: 89
Drew: 22
Drew: 72
Drew: 18
Drew: 82
Drew: 21
Drew: 31
Drew: 91
Drew: 79
Drew: 4
Drew: 15
Drew: 47
Drew: 40
Drew: 92
Drew: 60
Drew: 7
Drew: 41
Drew: 74
Drew: 83
Drew: 3
Drew: 22
Drew: 95
Drew: 26
Drew: 90
Drew: 53
Drew: 37
Drew: 64
Drew: 8
Drew: 53
Drew: 34
Drew: 86
Drew: 54
Drew: 70
Drew: 51
Drew: 20
Drew: 27
Drew: 80
Drew: 9
Drew: 68
Drew: 29
Drew: 64
Drew: 97
Drew: 3
Drew: 65
Drew: 59
Drew: 79
Drew: 13
Drew: 12
Drew: 19
Drew: 57
Drew: 4
Drew: 7
Drew: 19
Drew: 68
Drew: 94
Drew: 4
Drew: 20
Drew: 5
Drew: 17
Drew: 86
Drew: 50
Drew: 70
Drew: 11
Drew: 97
Drew: 93
Drew: 63
Drew: 65
Drew: 72
Drew: 1
Drew: 72
Drew: 37
Drew: 59
Drew: 42
Drew: 17
Drew: 13
Drew: 26
Drew: 11
Drew: 71
Drew: 4
Drew: 84
Drew: 33
Drew: 83
Drew: 97
Drew: 50
Drew: 79
Drew: 57
Drew: 72
Drew: 77
Drew: 93
Drew: 9
Drew: 32
Drew: 6
Drew: 22
Drew: 87
Drew: 41
Drew: 76
Drew: 89
Drew: 27
Drew: 53
Drew: 38
Drew: 37
Drew: 21
Drew: 31
Drew: 65
Drew: 23
Drew: 83
Drew: 45
Drew: 58
Drew: 84
Drew: 13
Drew: 21
Drew: 68
Drew: 75
Drew: 51
Drew: 94
Drew: 62
Drew: 80
Drew: 30
Drew: 18
Drew: 64
Drew: 68
Drew: 33
Drew: 87
Drew: 7
Drew: 95
Drew: 85
Drew: 65
Drew: 6
Drew: 91
Drew: 3
Drew: 79
Drew: 49
Drew: 9
Drew: 41
Drew: 33
Drew: 22
Drew: 90
Drew: 69
Drew: 6
Drew: 55
Drew: 20
Drew: 20
Drew: 5
Drew: 88
Drew: 50
Drew: 16
Drew: 36
Drew: 15
Drew: 16
Drew: 52
Drew: 10
Drew: 44
Drew: 80
Drew: 44
Drew: 60
Drew: 23
Drew: 7
Drew: 10
Drew: 46
Drew: 58
Drew: 59
Drew: 70
Drew: 88
Drew: 76
Drew: 26
Drew: 86
Drew: 47
Drew: 78
Drew: 70
Drew: 88
Drew: 6
Drew: 82
Drew: 5
Drew: 14
Drew: 75
Drew: 71
Drew: 71
Drew: 55
Drew: 42
Drew: 37
Drew: 73
Drew: 33
Drew: 21
Drew: 35
Drew: 3
Average funds after 100 5 game sets: $10208.0
```

# 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
#