Skip to content

Instantly share code, notes, and snippets.

@JamesChaps
JamesChaps / proto2-1-ud-software-analysis.html
Last active May 13, 2026 12:55
Proto 2.1 Uncommanded Disengagement Software Analysis - 28 Apr to 11 May 2026
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Proto2.1 Uncommanded Analysis — Software &amp; Vehicle Breakdown</title>
<script>/* Chart.js 4.4.7 inlined for offline/proxy hosting */
/**
* Skipped minification because the original files appears to be already minified.
* Original file: /npm/chart.js@4.4.7/dist/chart.umd.js
d = {
'Sam': 7,
'rolls': ['rock', 'paper', 'scissors'],
'done': 'True',
}
print(d["Sam"]) # outputs 7
print(d['rolls']) # outputs ['rock', 'paper', 'scissors']
print(d.get('Sarah')) # outputs None
print(d.get('Jeff', -1)) # outputs -1
print(d['done']) # outputs True
@JamesChaps
JamesChaps / gist:b8368c29aa204476eb977029c4d24a16
Created August 3, 2022 16:48
Assignment 4 (Steep learning curve, functions are confusing but I'm getting there)
import random
def sign():
print("Hello world!")
def amount():
mm_count = random.randint(1, 100)
return mm_count
def main():
@JamesChaps
JamesChaps / gist:253d4d4e3cad3b598173da5639c68dac
Created July 27, 2022 17:50
Assignment 3 (Actually made in PyCharm this time, much better formatting)
# 1.Create a hello_world.py file and execute it with Python. This can be in PyCharm or in another editor and using the technique above. Seems trivial but will help you verify everything is working right there. Just have the program output "Hello world"
print('Hello World!')
# 2.Write a program that requests a number from the user. Have the program print "Even" or "Odd" depending on whether they entered an even or odd number.
no_guess = input('Pick a number? ')
no = int(no_guess)
while no != 0:
remainder = no % 2 # Is this 0 or 1?
if remainder == 0:
@JamesChaps
JamesChaps / gist:5305e2dbb6c3a4ad621a184f8998ab08
Created July 24, 2022 17:21
Week 2 exercise (I did this in command prompt) (its very messy!)
>>> x = 5
>>> x**
File "<stdin>", line 1
x**
SyntaxError: invalid syntax
>>> x**2
25
>>> name = input("What is your name?")
What is your name? Simon