Skip to content

Instantly share code, notes, and snippets.

View pzp1997's full-sized avatar

Palmer Paul pzp1997

View GitHub Profile
## Age_Guess.py by Palmer (March 18, 2014)
## Written in Python 3.3.4
## Import statements
from random import randint
## Constants
name = "Bill"
min_age = 1
max_age = 50
import pdb
d = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
while True:
num = input("Input a Roman Numeral to convert it to Arabic numbers: ")
if num.lower() == "quit" or num.lower() == "q":
break
total = 0
x = 0
This file has been truncated, but you can view the full file.
Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
1
1 1
1 0 1
1 1 1 1
1 0 0 0 1
Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
1
1 1
1 1
1 1 1 1
1 1
class PascalsTriangle(object):
def __init__(self):
self.rows = [[1], [1, 1]]
def addRow(self):
row = [1]
for x in range(len(self.rows[-1])-1):
row.append(self.rows[-1][x] + self.rows[-1][x+1])
row.append(1)
self.rows.append(row)
Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
1
1 1
1 1
1 1 1 1
1 1
from random import randint, choice
from time import sleep
RPi = True
try:
import RPi.GPIO as GPIO
except ImportError:
RPi = False
if RPi:
@pzp1997
pzp1997 / Brainfuck.py
Created May 16, 2014 01:55
Brainfuck interpreter written in Python.
## Brainfuck.py by pzp1997 (May 11, 2014)
## Written in Python 3.4.0
def interpreter(program, userInput):
array = [0]*30000
pointer = 0
pc = 0
nest = 1
while pc < len(program):
from random import choice
i = input("Input a sentence: ")
i = i.split(" ")
length = len(i)
for x in range(length):
word = choice(i)
i.remove(word)
print(word, end=" ")