-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleBettor.py
More file actions
39 lines (28 loc) · 863 Bytes
/
SimpleBettor.py
File metadata and controls
39 lines (28 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import random
# change this to return a simple win/loss
def rollDice():
roll = random.randint(1,100)
if roll == 100:
print(roll,'roll was 100, you lose. What are the odds?! Play again!')
return False
elif roll <= 50:
print(roll,'roll was 1-50, you lose.')
return False
else:
print(roll,'roll was 51-99, you win! *pretty lights flash* (play more!)')
return True
'''
Simple bettor, betting the same amount each time.
'''
def simple_bettor(funds,initial_wager,wager_count):
value = funds
wager = initial_wager
currentWager = 0
while currentWager < wager_count:
if rollDice():
value += wager
else:
value -= wager
currentWager += 1
print('Funds:', value)
simple_bettor(10000,100,100)