This file contains 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
## 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 |
This file contains 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 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.
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
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) |
This file contains 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
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 |
This file contains 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 random import randint, choice | |
from time import sleep | |
RPi = True | |
try: | |
import RPi.GPIO as GPIO | |
except ImportError: | |
RPi = False | |
if RPi: |
This file contains 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
## 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): |
This file contains 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 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=" ") |
OlderNewer