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 os | |
import random | |
# Computer Space Games by Usborne Publishing | |
# https://drive.google.com/file/d/0Bxv0SsvibDMTNlMwTi1PTlVxc2M/view?resourcekey=0-kaU6eyAmIVhT3_H8RkHfHA | |
def display_banner(title): | |
clear_screen_cmd = "clear" if os.name == "posix" else "cls" | |
os.system(clear_screen_cmd) | |
print("="*len(title)) |
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 machine import Pin | |
import time | |
redbutton = Pin(2, Pin.IN, Pin.PULL_DOWN) | |
greenbutton = Pin(3, Pin.IN, Pin.PULL_DOWN) | |
seg1 = Pin(13, Pin.OUT) | |
seg2 = Pin(12, Pin.OUT) | |
seg3 = Pin(11, Pin.OUT) | |
seg4 = Pin(10, Pin.OUT) |
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
"""Unicode character testing done for Unicode source.""" | |
# Even in the year 2021, unicode is still not used everywhere so we must test our entire processing | |
# chain for uncommon or exceptional characters. | |
# Within the Nordic region, we must test for common letters that are used in the various | |
# languages of the region, which can also be found on our country-specific keyboards. | |
# Note: It is common for those with Russian heritage to live in Nordic countries, especially Finland. | |
# Our technology stack and tools must also handle these additional letters not found in the default code page. | |
NORDIC_SPECIAL_CHARS = [ |
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 xlrd |
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 subprocess | |
import os | |
def get_ram(): | |
"Returns a tuple (total ram, available ram) in megabytes. See www.linuxatemyram.com" | |
try: | |
s = subprocess.check_output(["free", "-m"]) | |
lines = s.split("\n") | |
return (int(lines[1].split()[1]), int(lines[2].split()[3])) |