This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def checkNum(number): | |
if number % 3 == 0 and number % 5 == 0: | |
return "FizzBuzz" | |
elif number % 3 == 0: | |
return "Fizz" | |
elif number % 5 == 0: | |
return "Buzz" | |
return number | |
for i in range(101): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys # Args from cmd - sys.argv[1] | |
import pygame # Display graphically | |
import math # Position stuff correctly | |
import random # Shuffle thingies. | |
class Window: | |
def __init__(self, *, dimensions=[700, 700], title="Mystic Rose"): | |
pygame.init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import discord | |
import asyncio | |
import sys | |
from discord.ext import commands | |
bot = commands.Bot(command_prefix=']',self_bot=True) | |
non_bmp_map = dict.fromkeys(range(0x10000, sys.maxunicode + 1), 0xfffd) | |
@bot.event | |
async def on_ready(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import discord | |
from discord.ext import commands | |
from asyncio import sleep | |
me = commands.Bot(command_prefix='.', self_bot=True) | |
@me.event | |
async def on_ready(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img id="embeddedImage" src="placeholder.png" /> | |
<select id="genderDropdown" onchange="changeImage(this)"> | |
<option value="male">Male</option> | |
<option value="female">Female</option> | |
<option value="other">Other</option> | |
</select> | |
<script type="text/javascript"> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import argv | |
from random import randint | |
def dice_compiler(string:str) -> tuple: | |
''' | |
Compiles a string (XdN+C) into tuple (X, N, +C). Works when X is not present, or when C is not present | |
(by inserting 1 and +0 respectively) | |
Does not give the actual roll of the dice | |
Works only with strings that match the regex "^\d*d\d+([+-]\d+)?$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_value(captcha:int) -> int: | |
''' | |
Gets the captcha value for the given integer | |
Advent of Code day 1 | |
A captcha value is determined by the value of n being added to a total if | |
n+1 is the same number as n. This wraps round back to the start, so the end | |
value can be equal to the first. | |
Parameters: | |
captcha: int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_checksum(spreadhseet:str) -> int: | |
spreadhseet = [[int(val) for val in row.split('\t') if val] for row in spreadhseet.split('\n')] | |
val = 0 | |
for row in spreadhseet: | |
val += max(row) - min(row) | |
return val | |
def get_checksum_part_2(spreadhseet:str) -> int: | |
spreadhseet = [[int(val) for val in row.split('\t') if val] for row in spreadhseet.split('\n')] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_passphrase(passphrases:str) -> int: | |
''' | |
Counts the number of valid passphrases | |
''' | |
passphrases = [[item for item in row.split(' ')] for row in passphrases.split('\n')] | |
valid = 0 | |
for row in passphrases: | |
counter = 0 | |
for item in row: |
OlderNewer