Skip to content

Instantly share code, notes, and snippets.

@jwong1109
jwong1109 / hello.py
Created May 4, 2021 02:58
Initial Program testing connection
print ("hello world")
def calc_ticket(type):
adult = 12.50
student = 9.00
child = 7.00
gift = 0.00
if type == "a":
price = adult
elif type == "s":
price = student
elif type == "c":
@jwong1109
jwong1109 / 01 user_balance.py
Created June 24, 2021 00:26
Component 1 of Lucky Unicorn Game Get amount user wants to play with
""" Component 1 of Lucky Unicorn Game
Get amount user wants to play with
Created by Joseph Wong
24/06/21"""
# Integer checking function
def integer_checker(question, low, high):
valid = False
@jwong1109
jwong1109 / 02_generate_token_v1.py
Created June 25, 2021 01:51
Component 2 of Lucky Unicorn game Generate the random token
""" Component 2 of Lucky Unicorn game
Generate the random token
Created by Joseph Wong
25/06/21
"""
import random
tokens = ["horse", "zebra", "donkey", "unicorn"]
@jwong1109
jwong1109 / 02_generate_token_v2.py
Created June 27, 2021 04:23
Component 2 of Lucky Unicorn game Generate the random token
""" Component 2 of Lucky Unicorn game
Generate the random token
Created by Joseph Wong
25/06/21
"""
import random
tokens = ["horse", "zebra", "donkey", "unicorn"]
@jwong1109
jwong1109 / 02_generate_token_v3.py
Created June 27, 2021 06:06
Component 2 of Lucky Unicorn game Generate the random token
""" Component 2 of Lucky Unicorn game
Generate the random token
Created by Joseph Wong
25/06/21
"""
import random
# Balancing the odds - now only a 1/10 chance of getting a unicorn
tokens = ["horse", "horse", "horse", # Keeping line length under 79 chars
"zebra", "zebra", "zebra",
@jwong1109
jwong1109 / 02_generate_token_v4.py
Created June 27, 2021 07:30
Component 2 of Lucky Unicorn game - v4 advanced testing Include constants for payout amounts and loop range Format currency for payout calculation
""" Component 2 of Lucky Unicorn game - v4 advanced testing
Include constants for payout amounts and loop range
Format currency for payout calculation
Created by Joseph Wong
27/06/21
"""
import random
HOW_MUCH = 100 # Constant representing the amount spent by user
@jwong1109
jwong1109 / 03_winnings_system.py
Created June 27, 2021 21:43
Component 3 of Lucky Unicorn game - winnings system Calculate winnings for session Assumes starting balance of $10 and allows manual input of token for testing purposes
"""Component 3 of Lucky Unicorn game - winnings system
Calculate winnings for session
Assumes starting balance of $10 and allows
manual input of token for testing purposes
Created by Joseph Wong
28/06/2021
"""
# Assume starting balance of $10
user_balance = 10
@jwong1109
jwong1109 / lucky_unicorn_v1.py
Created June 29, 2021 03:05
Lucky Unicorn - fully working program, combining all 4 components First version of fully working program, not yet tested for usability
"""Lucky Unicorn - fully working program, combining all 4 components
First version of fully working program, not yet tested for usability
Created by Joseph Wong
29/06/21
"""
import random
# Integer checking function
"""Lucky Unicorn - fully working program, combining all 4 components v2
Includes post usability testing changes:
Add introduction at start and make feedback messages clearer
regarding wins and losses
Created by Joseph Wong
1/07/21
"""
import random