Skip to content

Instantly share code, notes, and snippets.

@tjguk
tjguk / pr726.py
Created December 23, 2018 12:14
Explore https://github.com/mu-editor/mu/pull/726 in different environments
import os, sys
import site
def munged(text):
user_profile = os.environ['USERPROFILE'].lower()
return text.lower().replace(user_profile, "[user]")
with open("pr726.log", "w") as f:
f.write("CWD: %s\n" % munged(os.getcwd()))
f.write("File location: %s\n" % munged(__file__))
@tjguk
tjguk / first.py
Created November 18, 2018 17:23
first.py
name = input("Hi, what's your name?")
year = input("Hi " + name + " what year were you born in?")
month = input("What month were you born in?")
day = input("What day were you born in?")
age = 0
counter = 1
check = input("just making sure, you were born on " + day +"/"+ month +"/"+ year + " ,correct?")
if check == "yes":
print("Great!!")
fizz = 5
buzz = 7
counter = 1
while counter <= 60:
fizz_num = counter % fizz
buzz_num = counter % buzz
if fizz_num == 0:
print("Fizz")
elif buzz_num == 0:
from __future__ import with_statement
import os, sys
import htmlentitydefs
import itertools
import operator
import posixpath
import re
import sgmllib
import tempfile
import itertools
BLOCK_COLOURS = "purple", "lightgreen", "lightblue", "orange"
colours = itertools.cycle(BLOCK_COLOURS)
for n_block in range(8):
colour = next(colours)
print(colour)
BLOCK_COLOURS = "purple", "lightgreen", "lightblue", "orange"
for n_block in range(8):
# stuff
colour = BLOCK_COLOURS[n_block % len(BLOCK_COLOURS)]
print(colour)