This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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): |
NewerOlder