This commit is contained in:
Maxwell Jeffress
2026-02-20 11:42:22 +11:00
commit 3fdb90a652
5 changed files with 189 additions and 0 deletions

64
activity3-transfer.py Normal file
View File

@@ -0,0 +1,64 @@
# Created by Maxwell Jeffress on 17/02/2026
# Simulates a game of Blackjack
import random
cards = [card for card in range(2, 11) for _ in range(4)]
def card_string(card: int) -> str:
match card:
case 11:
return "Jack"
case 12:
return "Queen"
case 13:
return "King"
case 14:
return "Ace"
case _:
return str(card)
# Create the card order
random.shuffle(cards)
def deal_card(cards: [int]) -> int:
return cards.pop()
print(cards)
you = 0
dealer = 0
card1 = deal_card(cards)
card2 = deal_card(cards)
you += card1 + card2
print("You got dealt", card_string(card1), "and", card_string(card2), "for a total of", you)
dealer += deal_card(cards) + deal_card(cards)
print("Shh dont tell them but the dealer has", dealer)
dealerWon = False
while True:
hors = input("Hit or stand? ")
if hors.lower() in ["h", "hi", "hit", "hit me"]:
print("Hitting")
card = deal_card(cards)
you += card
print("You got dealt", card_string(card), "for a total of", you)
if (you > 21):
print("Bust!")
dealerWon = True
break
elif hors.lower() in ["s", "st", "sta", "stan", "stand", "stand up"]:
print("Standing")
break
else:
print("That's not valid!")
continue
if not dealerWon:
print("Dealing the dealer")

30
old/activity-core.py Normal file
View File

@@ -0,0 +1,30 @@
# Created by Maxwell Jeffress, 11/02/2026
# Does add, subtract, multiply, and divide operations on 2 numbers.
left = 0
right = 0
# GET left (user input)
try:
left = int(input("Left side: "))
except ValueError:
print("Invalid input!")
exit(1)
# GET right (user input)
try:
right = int(input("Right side: "))
except ValueError:
print("Invalid input")
exit(1)
add = left + right
sub = left - right
mul = left * right
div = left / right
print("left + right =", add)
print("left - right =", sub)
print("left * right =", mul)
print("left / right =", div)

19
old/activity-deep.py Normal file
View File

@@ -0,0 +1,19 @@
# Created by Maxwell Jeffress on 11/02/2026.
# Calculates the volume of a cube, square based pyramid, and cylinder.
import math
width = 0
try:
width = int(input("Width: "))
except ValueError:
print("Invalid input!")
exit(1)
cubeSize = width ^^ 3
print("Cube volume is", cubeSize)
cylinder = ( math.pi * (width / 2) ^^ 2 * width )
print("Cylinder volume is", cylinder)

35
old/activity2-core.py Normal file
View File

@@ -0,0 +1,35 @@
# Created by Maxwell Jeffress on 13/02/2026
# Does operations on values
left = 0
right = 0
op = ""
while True:
try:
left = int(input("Left: "))
except ValueError:
print("Invalid input")
continue
try:
right = int(input("Right: "))
except ValueError:
print("Invalid input")
continue
op = input("Operation: ")
match op:
case "+":
print(left + right)
case "-":
print(left - right)
case "*":
print(left * right)
case "/":
print(left / right)
case _:
print("That's not an operation")
if input("Continue? (y/N) ") != "y":
break

41
old/activity2-transfer.py Normal file
View File

@@ -0,0 +1,41 @@
# Created by Maxwell Jeffress on 13/02/2026
# Helps troubleshoot stuff on a computer
def is_issue_fixed():
userInput = input("Was the issue fixed? (yes/no) ")
if userInput.lower() in ["y", "yes", "ye"]:
return True
else:
return False
def finish():
print("Goody! Thanks for using the troubleshooter")
def power_issue():
print("If it's a laptop, does the battery have charge?")
print("If it's a desktop, is the power cord plugged in correctly?")
print("Try connecting the power cord.")
def power_issue_2():
print("There might be an internal issue with the computer.")
print("If you'")
print("What is your issue? Type the number associated with the issue")
print(" 1) No power")
print(" 2) No sound")
print(" 3) No internet access")
while True:
option = input("Choose a number (between 1 and 3)")
match option.lower():
case "1" | "no power" | "power" | "power not working":
power_issue()
if is_issue_fixed():
finish()
power_issue_2()
case "2" | "no sound" | "sound" | "sound not working":
pass
case "3" | "no internet" | "no internet access" | "internet" | "internet not working":
pass