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 time | |
odd = True | |
counter = 0 | |
while True: | |
counter += 1 | |
time.sleep(600) | |
print('{word} {count}'.format(count=counter, word='tick' if odd else 'tock')) | |
odd = not odd |
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
def liar(answer): | |
return !answer | |
def honest(answer): | |
return answer | |
#"Would that door say that this is the door to the castle?" | |
#if asking the liar, and the liar is the death door: | |
print(liar(honest(false))) # "True" |
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
for row in curs.fetchall(): | |
print('{Name:<21} {Amount:>17,.2f} {AvgAmount:>18,.2f} {NumTimes:>12}'.format( | |
Name = row[0], | |
Amount = row[1], | |
AvgAmount = row[2], | |
NumTimes = row[3] | |
) |
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
upper = 100 | |
words = {"Fizz": 3, "Buzz": 5, "Baz": 7} | |
for i in range(1, upper+1): | |
result = "" | |
for word, number in words.items(): | |
if i % number == 0: | |
result += word | |
if result == "": | |
print(i) | |
else: |
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
for i in range(1,101): | |
if i % 3 == 0: | |
if i % 5 == 0: | |
print("FizzBuzz") | |
continue | |
print("Fizz") | |
elif i % 5 == 0: | |
print("Buzz") | |
elif i % 7 == 0: | |
print("Baz") |
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
#! /usr/bin/env python | |
print('Importing Libraries...') | |
import time | |
import datetime | |
import requests | |
import locale | |
import xml.etree.cElementTree as ET | |
from xml.etree.ElementTree import ElementTree | |
from operator import itemgetter |
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
<script type="text/javascript"> | |
$(document).ready(function () { | |
// add code here | |
$("#Button1").click(function () { | |
alert("Hello world!"); | |
}); | |
}) | |
</script> |
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
limit = 30 -- set the upper limit; don't care to get user input for this | |
function make_it_so() | |
local sum_of_squares = 0 --static | |
local sum_of_cubes = 0 --static | |
return function(a) | |
sum_of_squares = sum_of_squares + a^2 | |
sum_of_cubes = sum_of_cubes + a^3 | |
print("Squares: "..sum_of_squares, "Cubes: "..sum_of_cubes) --prints running total every time function is called |
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
#wrapper(header(h2{News}+img[src="image.png"])+nav(ul>li*3>a(img))+article#News_$*5(h1+p(lorem200)+li{Continue reading article in }>a{news.c0m})+footer) | |
becomes: | |
<div id="wrapper"> | |
<header> | |
<h2>News</h2> | |
<img src="image.png" alt=""> |
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
SELECT s1.Industry, s1.TickerSymbol, s1.ST_Close | |
FROM StockData AS s1 | |
WHERE s1.ST_Close = | |
(SELECT MAX(s2.ST_Close) | |
FROM StockData as s2 | |
WHERE s1.Industry = s2.Industry) | |
ORDER BY s1.ST_Close DESC; |
NewerOlder