Skip to content

Instantly share code, notes, and snippets.

View amandaroos's full-sized avatar

Amanda Roos amandaroos

View GitHub Profile
@amandaroos
amandaroos / bluepacman.py
Created September 20, 2020 06:23
blue pacman ghost for Pi Sense hat LEDs
from sense_hat import SenseHat
import time
sense = SenseHat()
sense.rotation = 90
L = [0,0,200] #Blue
D = [0,0,100] #Dark Blue
W = [100, 100, 100] # White
B = [0,0,0] #Black
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
def translate(word, codes):
#Choose phrase to translate and enter the array of language codes you would like the phrase to be translated to
text= word
#Open string resource file, remove last line, add new translated line, for all language codes provided
from TranslationsFunctionReturnDictionary import translate
print ("starting!")
###UPDATE words_to_translate, codes, and myBasePath if necessary###
#word : resource name
words_to_translate = {
"Change Calculator":"app_name"
}
@amandaroos
amandaroos / FibonacciRabbits.py
Created April 30, 2020 21:09
Non-recursive way of solving Fibonacci rabbits: http://rosalind.info/problems/fib/
#n is generations, m is pairs of rabbits born per litter
#b is pairs of baby bunnies, B is pairs of adult bunnies
def get_rabbits(n, m):
b, B = 1, 0
for i in range(1, n):
b, B = B * m, B + b
return B + b
#n is generations, m is pairs of rabbits born per litter
#b is pairs of baby bunnies, B is pairs of adult bunnies
def get_rabbits(n,m):
if n == 1:
return 1, 0
else:
b, B = get_rabbits(n-1, m)
return(B*m, B + b)
@amandaroos
amandaroos / Quicksort2.py
Created April 20, 2020 03:21
Quicksort 2
"""Implement quick sort in Python.
Input a list.
Output a sorted list."""
def quicksort(array):
low = 0
high = len(array)-1
partition(array, low, high)
return array
def partition(array, low, high):
@amandaroos
amandaroos / Quicksort1.py
Last active April 20, 2020 03:22
Quicksort 1
"""Implement quick sort in Python.
Input a list.
Output a sorted list."""
def quicksort(array):
low = 0
high = len(array)-1
partition(array, low, high)
return array
def partition(array, testIndex, pivotIndex):
import turtle
import tkinter as tk
from tkinter import ttk
window = turtle.Screen()
def runTurtles():
window = turtle.Screen()
t1 = turtle.Turtle()
t2 = turtle.Turtle()
@amandaroos
amandaroos / dancingturtlesspiral.py
Created March 29, 2020 05:11
Spiral of dancing turtles
import turtle
import time
speed = 20
width = 5
t1 = turtle.Turtle()
t1.shape("turtle")
t1.color("#63A618")
t1.speed(speed)
@amandaroos
amandaroos / dancingturtleswreath.py
Created March 28, 2020 23:28
dancing turtles wreath
import turtle
import time
##tom
##ang