Skip to content

Instantly share code, notes, and snippets.

@Mathsmaniac
Mathsmaniac / Lucky_Unicorn_v4.py
Created Jul 22, 2021
Added round counter and included round details in feedback to player
View Lucky_Unicorn_v4.py
"""Lucky Unicorn - fully working program, combining all 4 components v3
Added round counter and included round details in feedback to player
Created by Nathan Smith
28/06/21
"""
import random
# Integer checking function
@Mathsmaniac
Mathsmaniac / Lucky_Unicorn_v3.py
Created Jul 22, 2021
Adds token formatting function To clearly differentiate tokens making them readily identifiable
View Lucky_Unicorn_v3.py
"""Lucky Unicorn - fully working program, combining all 4 components v3
Adds token formatting function
To clearly differentiate tokens making them readily identifiable
Created by Nathan Smith
28/06/21
"""
import random
@Mathsmaniac
Mathsmaniac / Lucky_Unicorn_v2.py
Created Jul 22, 2021
Includes post usability testing changes: Adds introduction at start Makes feedback messages clearer regarding wins and losses
View Lucky_Unicorn_v2.py
"""Lucky Unicorn - fully working program, combining all 4 components v2
Includes post usability testing changes:
Adds introduction at start
Makes feedback messages clearer regarding wins and losses
Created by Nathan Smith
28/06/21
"""
import random
@Mathsmaniac
Mathsmaniac / Lucky_Unicorn_v1.py
Created Jul 20, 2021
First version of fully working program, not yet tested for usability
View Lucky_Unicorn_v1.py
"""Lucky Unicorn - fully working program, combining all 4 components
First version of fully working program, not yet tested for usability
Created by Nathan Smith
28/06/21
"""
import random
# Integer checking function
@Mathsmaniac
Mathsmaniac / 03Winnings_System.py
Created Jul 9, 2021
Calculate winnings for session
View 03Winnings_System.py
"""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 Nathan Smith
08/07/2021
"""
# Assuming starting balance of $10
user_balance = 10
UNICORN_PAYOUT = 5
@Mathsmaniac
Mathsmaniac / 02Token_GeneratorV2.py
Created Jul 6, 2021
Includes constants for payout amounts and loop range
View 02Token_GeneratorV2.py
"""
Component 2 of Lucky Unicorn - v2 advanced testing
Include constants for payout amounts and loop range
Format currency for payout calculation
Created by Nathan Smith
28/06/21
"""
import random
@Mathsmaniac
Mathsmaniac / 01User_Balance.py
Created Jun 27, 2021
This function gets an input, and if it is a whole number between 1 and 10, it puts the value inuser_balance
View 01User_Balance.py
"""
Component 1 of Lucky Unicorn
This function gets an input, and if it is a whole number between 1 and 10, it
puts the value in user_balance
Otherwise, it raises errors and tells the user that a invalid input is entered
until a valid input is entered.
Written by Nathan Smith
28/06/21
"""
@Mathsmaniac
Mathsmaniac / Movie_Tickets.py
Created Jun 8, 2021
the one about movie tickets
View Movie_Tickets.py
totalprice = 0
counta = 0
counts = 0
countc = 0
countg = 0
while True:
yesno = input("Do you want to sell a ticket? (Y/N)")
if yesno == 'N' or yesno == 'n':
break
print('What ype of ticket do you want')