This is just the source code. I've been teaching myself Python and I've been creating little programs like this.
Python Code:
import random
coins = 100
r = random
reels = []
def set_dic():
reems = [("Cherry | Cherry | Cherry", 5),
("Bar | Bar | Bar", 15),
("7 | 7 | 7", 30),
("Cherry | Bar | 7", 0),
("Cherry | 7 | Bar", 0),
("Cherry | Cherry | 7", 2),
("Cherry | Cherry | Bar", 2),
("7 | Cherry | Bar", 0),
("7 | Bar | Cherry", 0),
("7 | 7 | Cherry", 0),
("7 | 7 | Bar", 0),
("Bar | 7 | Cherry", 0),
("Bar | Cherry | 7", 0),
("Bar | Bar | Cherry", 0),
("Bar | Bar | 7", 0)]
return reems
def balance():
print ("Your current coin balance is: " + str(coins))
print ()
def instructions():
print ("Instructions:")
print ("To view your balance type: b")
print ("To view these instructions type: d")
print ("To spin the slot machine type: p")
print ()
def pull():
spinned_reel = r.choice(reels)
print (spinned_reel[0])
return spinned_reel[1]
reels = set_dic()
instructions()
while coins > 0:
response = input()
if response == "b":
balance()
elif response == "d":
instructions()
elif response == "p":
coins -= 5
coins += pull()
else:
print ("Invalid Input")