This demo requires a font file, replace "B612-Regular.ttf" with the font file you have in the same folder.
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 enum | |
from collections import UserList | |
from dataclasses import dataclass | |
from itertools import product | |
from random import shuffle | |
from random import choice | |
from typing import List | |
class Suit(enum.Enum): | |
CLUBS = "♣" |
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
(lambda ppb: ppb.run(setup=lambda scene: scene.add(s := ppb.Sprite(position=ppb.Vector(0, -4), image=ppb.Image("player.png"), on_update=lambda update, signal: setattr(s, 'position', s.position + (ppb.Vector(0, 1) * update.time_delta))))))(__import__("ppb")) |
This is a SCRIPT-8 cassette.
This is a SCRIPT-8 cassette.
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 functools import partial | |
from flask import Flask | |
from flask import jsonify | |
from flask import render_template | |
from flask import request | |
app = Flask(__name__) |
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
# Assume this is an image file. |
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 copy import copy | |
from timeit import timeit | |
count = 1000000 | |
test_set = {str(x) for x in range(100)} | |
snippets = { | |
"list_comprehension": "list(list(test_set))", | |
"method intersection": "list(test_set.intersection(test_set))", | |
"copy": "list(copy(test_set))", |
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 typing import Iterable | |
import pygame as pg | |
class Target(pg.sprite.Sprite): | |
def __init__(self, image: pg.Surface, position: Iterable[int]): | |
"""position needs to be length 2.""" | |
super().__init__() | |
self.image = image |
NewerOlder