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 | |
from typing import TextIO | |
def my_print(*args: list, file: TextIO=sys.stdout, sep: str=' ', end: str='\n', flush: bool=False) -> None: | |
""" | |
Prints the values to a stream, or to sys.stdout by default. | |
Optional keyword arguments: | |
file: a file-like object (stream); defaults to the current sys.stdout. | |
sep: string inserted between values, default a space. | |
end: string appended after the last value, default a newline. |
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
# log(log(sqrt(4), 4), (sqrt(4)/4)) == 1 | |
import math | |
def repeat(func, n): | |
x = 4 | |
for _ in range(n): | |
x = func(x) | |
return x |
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
#!python3 | |
from datetime import datetime as dt | |
import requests | |
def get_stats(player_name): | |
player_name = player_name.replace(" ", "_").replace("-", "_") | |
player_type = 'Normal' |
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
#!/usr/bin/env python3 | |
from typing import Generator, Optional | |
from numbers import Real | |
def my_range(start: Real, stop: Optional[Real]=None, step: Real=1) -> Generator[Real, None, None]: | |
""" An example definition of Python 3's range-class as a function """ | |
# If only one argument was provided, use that | |
# argument as the goal and set start to 0 |
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
@echo off | |
rem Define a (local) name for the temporary file | |
setlocal | |
set temp="tmp.txt" | |
rem Copy the list of outdated modules to a text file | |
call pip list --outdated > %temp% | |
rem Process the text file to only contain module names |
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
#!python3 | |
import requests | |
from urllib.parse import quote | |
from prettytable import PrettyTable | |
def measure(user, MAX_XP, MAX_LVL, MAX_ELITE_XP): | |
SKILL_NAMES = ["Total level", "Attack", "Defence", "Strength", "Constitution", | |
"Ranged", "Prayer", "Magic", "Cooking", "Woodcutting", "Fletching", | |
"Fishing", "Firemaking", "Crafting", "Smithing", "Mining", | |
"Herblore", "Agility", "Thieving", "Slayer", "Farming", |
NewerOlder