I'm teaching kids Scratch, which means I need to learn it!
This program asks for a list of numbers, then prints the sorted result.
Eg if we give it the numbers 1488, 9001, 666, 777, and 13, and 12, it gives us:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC3ycW/AXmNXYAN/DgBG8R9Gwjdax0Dus5Nszx539/ZEZ6a+qwhXEoR0LI1b1NCW7zhwmaNlhj0GPBIP75nURGcnjTPr/pxvS/6MViqFogRHw60PiCmIrwgE5DoAnw7qWlJoqtP2755zs//ewfnK3sajndNiVxU8yMEctmiHG+8EXipsP/5uvX5kas0gC8c91GBbcMcT23MQxzcNuk/vZHMk1KSI36rLJ63LstvzmqVxU6CHbVW4neJzXo78jk3zdpqTybC+l+A73PpJOetAf4LOWT+/hKDRJg/cTbZnAaqQdAY2ymSnaLXagnE/hPnxq9e8yPQzQWy3UvKZyrv/y13lB0RjhCpVSVws4dIem+9eHEHgyvgTVa6DfTePKJPSauLxdRwONb8WE1OMuxn/RcKMAliWkab0wIWsALIGcJYAff+T0UzmsM3s6Y92RobwrY/w1RmDyN6H1045liaePD+JnI3XTe+8awRUn/BM+Q6ZOJ8M6538DaDjxiCymIDYLk= [email protected] |
' '.join([i[0].upper() + i[1:] for i in s.split()]) |
from itertools import chain, repeat | |
def is_floatable(num): | |
try: | |
float(num) | |
return True | |
except ValueError: | |
return False | |
# based on this glorious StackOverflow post: https://stackoverflow.com/a/56081775 |
with open('money.txt') as money_file: | |
raw_lines = money_file.readlines() | |
total = 0 | |
for line in raw_lines: | |
if '$' in line: | |
money = float(line.split()[-1][1:]) | |
total += float(money) | |
print('Remaining money til TOP RATED PLUS: ', 10_000 - total) |
def reversed_pairs(wordlist): | |
if len(wordlist) == 0: | |
return [] | |
word = wordlist[0] | |
other_words = wordlist[1:] | |
pair = [] | |
for w in other_words: | |
if word[::-1] == w: |
import requests | |
import re | |
# This script assumes you already have Tor installed and running | |
# Snagged from StackOverflow, haven't tested it! | |
def get_tor_session(): | |
session = requests.session() | |
# My Tor daemon is on port 9150 | |
# On your computer, it's more likely 9050 |
# re is the regular expressions library | |
# which facilitates our search for, and | |
# replacement of, strings! | |
import re | |
# This is the string we want to remove | |
bad_text = '#' | |
# Regular expressions are too deep to explain here. | |
# Look up a tutorial on regexes if you're curious! |
const parseIp = (ip: string) => | |
ip.split('.').map((p: string) => parseInt(p)); | |
const greaterIp = (rawIp1: string, rawIp2: string) => { | |
const ip1 = parseIp(rawIp1); | |
const ip2 = parseIp(rawIp2); | |
for (const ip of [ip1, ip2]) { | |
if (ip.length !== 4 | |
|| ip.some(p => p > 0 && p < 255)) | |
return `Invalid IP: ${ip}`; |
|= n=tape | |
=/ index 0 | |
=/ found "" | |
=/ vowels "aeiou" | |
|- | |
?: =(index (lent vowels)) | |
found | |
=/ current (trip (snag index vowels)) | |
=/ added ?: =(~ (find current n)) | |
"" |