Skip to content

Instantly share code, notes, and snippets.

@mightywombat
mightywombat / fileboop.py
Last active April 24, 2018 12:22
File Backup & Verify (Mac/*nix)
import os
import shutil
import hashlib
# Define variables
directory = raw_input( "Drag and drop the file or folder you want to back up." ) # Accepts input from user for source file path.
directory = directory.rstrip(" ") + "/" # Formats variable.
backup_path = raw_input( "Drag and drop the location to which you want to back up." ) # Accepts input from user for destination file path.
backup_path = backup_path.rstrip(" ") + "/" # Formats variable.
errnum = 0
@mightywombat
mightywombat / ppex01.py
Created April 18, 2018 21:39
practicepython.org Ex 01
# practicepython.org Ex 01
name = raw_input( "Please enter your name: " )
age = int(raw_input ( "Please enter your age: " ))
age = str( 100 - age )
print ( "Hi, " + name + "! You will turn 100 years old in " + age + " years!" )
@mightywombat
mightywombat / odd_even.py
Last active April 18, 2018 22:25
practicepython.org Ex 02
# practicepython.org Ex 02
num = int(raw_input ( "Enter a number you would like divided: " ))
check = int(raw_input ( "Enter a number you want to divide by: "))
rem = str( num % check )
divby2 = num % 2
if divby2 == 0:
print ( str(num) + " is EVEN." )
else:
print ( str(num) + " is ODD." )
@mightywombat
mightywombat / lt_five.py
Created April 18, 2018 22:25
practicepython.org Ex 03
# practicepython.org Ex 03
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
z = []
for integer in a:
if (integer < 5):
z.append(integer)
print (z)
@mightywombat
mightywombat / list_overlap.py
Last active April 19, 2018 21:06
practicepython.org Ex 05
# practicepython.org Ex 05
import random as ra
def randrng():
numlist = []
rnglen = ra.randrange(10, 20)
while rnglen > 0:
numlist.append(ra.randrange(1, 100))
rnglen -= 1
@mightywombat
mightywombat / string_lists.py
Created April 20, 2018 17:48
practicepython.org Ex 06
# practicepython.org Ex 06
word_og = raw_input("Palindrome checker. Enter your palindrome: ")
word = word_og.replace(" ", "")
start = 0
while (len(word) / 2) > start:
end = -(start + 1)
if word[start] == word[end]:
@mightywombat
mightywombat / palindrome.py
Created April 20, 2018 19:55
practicepython.org Ex 06
# practicepython.org Ex 06
import string
word = raw_input("Palindrome checker. Enter your palindrome: ")
#print word
word = word.replace(" ", "") # Removes spaces.
#print word
@mightywombat
mightywombat / roshambo.py
Last active April 23, 2018 23:12
practicepython.org Ex 08
# practicepython.org Ex 08
import getpass as g
import string
def crush(word): # Removes all variables from input text for maximum ease of parsing.
word = word.replace(" ", "") # Removes spaces.
word = string.lower(word) # Changes all letters to lowercase.
for c in word:
if c in string.punctuation:
@mightywombat
mightywombat / encounter_gen.py
Last active May 9, 2018 22:26
RPG encounter generator.
import Tkinter as tk
import random
import string
root = tk.Tk()
frame = tk.Frame(root)
frame.pack()
# Data pile
about_txt = "This is where the about stuff goes..."
@mightywombat
mightywombat / tweepbot.py
Created February 26, 2019 19:09
Posts to Twitter
import twitter
api = twitter.Api(consumer_key=[consumer key],
consumer_secret=[consumer secret],
access_token_key=[access token],
access_token_secret=[access token secret])
status = api.PostUpdate('@madsc13ntist I\'m callin\' you out!')
print(status.text)