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 collections import Counter | |
>>> c = Counter() | |
>>> c['t'] = 3 | |
>>> c | |
Counter({'t': 3}) | |
>>> c['r'] = 2 | |
>>> c | |
Counter({'t': 3, 'r': 2}) | |
>>> c['r'] += 1 | |
>>> c |
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 fractions import Fraction | |
def fraz(r1,t1,r2,t2): | |
z = Fraction(r1,t1) + Fraction(r2,t2) | |
n = z.numerator/z.denominator | |
return n | |
if __name__ == "__main__": | |
print fraz(10,5,6,2) |
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
a = input("enter first number: ") | |
b = input("enter second number: ") | |
while b != 0: | |
if a > b: | |
a -= b | |
else: | |
b -= a | |
print a |
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 | |
import sys | |
// This sleeps for 10 secs, then prints a bunch of stars | |
for i in range(10): | |
time.sleep(1) | |
print '*', | |
// Same here | |
In [16]: for i in range(10): |
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
A = [-7, 1, 5, 2, -4, 3, 0] | |
def equi(A): | |
s = [] # array of equilibrium indices | |
for a in range(len(A)-1): # loop with '0 index' hack | |
x = A[:a+1] # split 'left' of the current index | |
y = A[a+2:] # split 'right' of the current index | |
n1 = 0 # this will be the total of the 'left' numbers |
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 math | |
# quick test cases | |
A = [-7, 1, 5, 2, -4, 3, 0] | |
B = [1, 2, 3, 4, 3, 2, 1] | |
C = [99, 0, 66, 32, 1] | |
D = [1, -1, 1, -1, 1, -1, 1] | |
E = [0,0,0] | |
F = [0,53,9] | |
G = [0,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
Are You There %filltext:name=field 1:default=God%? It's Me, Tommy | |
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 os | |
import gspread | |
import json | |
gpass = os.environ['GPASS'] | |
gc = gspread.login('[email protected]', gpass) | |
sh = gc.open('irobot_FE_Translation_Final') | |
worksheet = sh.get_worksheet(0) | |
thekeys = worksheet.col_values(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
request.get({url : 'https://lasamobi.com.br/LatLong/json/lojas.json', rejectUnauthorized: false }, function (error, response, body) { | |
console.log('request'); | |
storeData = JSON.parse(body); | |
}); |
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
if (/categories/.test($('body').data('path')) && $('nav.link-bar h3').length === 1) { | |
$(window).on('SSReady', function(){ | |
//soysauce.widgets[0].button.click(); | |
//$('nav.link-bar').data('ss-state', 'open'); | |
//$('nav.link-bar .subcategories').data('ss-state', 'open'); | |
//$('nav.link-bar h3').data('ss-state', 'open'); | |
}); | |
} |
OlderNewer