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
a = 1 | |
b = 1 | |
c = 1 | |
while True: | |
if a**2+b**2 == c**2 and a+b>c: | |
print([a, b, c]) | |
if a+b <= c: | |
a += 1 |
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 time import sleep | |
s = 0 | |
m = 0 | |
h = 0 | |
while True: | |
if len(str(s)) == 1: | |
strs = "0" + str(s) | |
elif len(str(s)) > 1: |
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
## 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 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 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 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
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 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
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 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
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 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
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 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
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 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 random import randint, choice | |
from time import sleep | |
RPi = True | |
try: | |
import RPi.GPIO as GPIO | |
except ImportError: | |
RPi = False | |
if RPi: |
OlderNewer