content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def func(a, b): # a is state 1 # b is state 2 # this is horrible code but it works! :^) s = r"\frac{1}{6}" s1 = r"\frac{1}{2}" s2 = r"\frac{1}{3}" if a == 19 and b != 19: return 0 if a == b: if a == 19: return 1 else: return 0 ...
def func(a, b): s = '\\frac{1}{6}' s1 = '\\frac{1}{2}' s2 = '\\frac{1}{3}' if a == 19 and b != 19: return 0 if a == b: if a == 19: return 1 else: return 0 elif a == 0: if b <= 6: return s else: return 0 e...
""" `InverseHaar1D <http://community.topcoder.com/stat?c=problem_statement&pm=5896>`__ """ def solution (t, l): if (l == 1): # level-1 untransformation i = len(t) / 2 sums, diffs = t[:i], t[i:] ut = [] for j in range(len(sums)): # a + b = s, a - b = d ...
""" `InverseHaar1D <http://community.topcoder.com/stat?c=problem_statement&pm=5896>`__ """ def solution(t, l): if l == 1: i = len(t) / 2 (sums, diffs) = (t[:i], t[i:]) ut = [] for j in range(len(sums)): (s, d) = (sums[j], diffs[j]) (a, b) = ((s + d) / 2, (s -...
# This file contains the credentials needed to connect to and use the TTN Lorawan network # # Steps: # 1. Populate the values below from your TTN configuration and device/modem. # (For RAK Wireless devices the dev_eui is printed on top of the device.) # 2.Then rename the file to: creds_config.py # # Done, the file ...
dev_eui = 'XXXXXXXXXXXXXX' dev_eui_rak4200 = 'XXXXXXXXXXXXXX' dev_eui_rak3172 = 'XXXXXXXXXXXXXX' app_eui = 'YYYYYYYYYYYYYY' app_key = 'ZZZZZZZZZZZZZZ'
""" entradas mujeres-->muj-->int hombres-->hom-->int sumatotal=tot salidas porcentajemujeres=mujp porcentajehombres=homp """ #entradas muj=int(input("Ingrese el numero de mujeres ")) hom=int(input("Ingrese el numero de hombres ")) #caja negra tot=muj+hom mujp=(muj/tot)*100 homp=(hom/tot)*100 #salidas print("El po...
""" entradas mujeres-->muj-->int hombres-->hom-->int sumatotal=tot salidas porcentajemujeres=mujp porcentajehombres=homp """ muj = int(input('Ingrese el numero de mujeres ')) hom = int(input('Ingrese el numero de hombres ')) tot = muj + hom mujp = muj / tot * 100 homp = hom / tot * 100 print('El porcentajes de mujer...
def main(): n, m = [int(x) for x in input().split()] def wczytajJiro(): defs = [0]*n atks = [0]*n both = [0]*2*n defi = atki = bothi = 0 for i in range(n): pi, si = input().split() if (pi == 'ATK'): atks[atki] = int(si) ...
def main(): (n, m) = [int(x) for x in input().split()] def wczytaj_jiro(): defs = [0] * n atks = [0] * n both = [0] * 2 * n defi = atki = bothi = 0 for i in range(n): (pi, si) = input().split() if pi == 'ATK': atks[atki] = int(si) ...
load_modules = { 'hw_USBtin': {'port':'auto', 'debug':2, 'speed':500}, # IO hardware module 'ecu_controls': {'bus':'BMW_F10', 'commands':[ # Music actions {'High light - blink': '0x1ee:2:20ff', 'cmd':'127'}, {'TURN LEFT and RIGHT': '0x2fc:7:31000000000000', 'cmd':'126'}, ...
load_modules = {'hw_USBtin': {'port': 'auto', 'debug': 2, 'speed': 500}, 'ecu_controls': {'bus': 'BMW_F10', 'commands': [{'High light - blink': '0x1ee:2:20ff', 'cmd': '127'}, {'TURN LEFT and RIGHT': '0x2fc:7:31000000000000', 'cmd': '126'}, {'TURN right ON PERMANENT': '0x1ee:2:01ff', 'cmd': '124'}, {'TURN right x3 or OF...
#!/usr/bin/env python3 fname = input("Enter file name: ") fh = open(fname) lst = list() sorted_words = list() for line in fh: line = line.rstrip() words = line.split() for word in words: if lst.count(word) == 0: lst.append(word) lst.sort() print(lst)
fname = input('Enter file name: ') fh = open(fname) lst = list() sorted_words = list() for line in fh: line = line.rstrip() words = line.split() for word in words: if lst.count(word) == 0: lst.append(word) lst.sort() print(lst)
# Python3 program to add two numbers number1 = input("First number: ") number2 = input("\nSecond number: ") # Adding two numbers # User might also enter float numbers sum = float(number1) + float(number2) # Display the sum # will print value in float print("The sum of {0} and {1} is {2}" .format(number1, numbe...
number1 = input('First number: ') number2 = input('\nSecond number: ') sum = float(number1) + float(number2) print('The sum of {0} and {1} is {2}'.format(number1, number2, sum))
def extractCNovelProj(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('Please Be More Serious', 'Please Be More Serious', 'translated'), ('Still Not Wanting to Forget...
def extract_c_novel_proj(item): """ """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None tagmap = [('Please Be More Serious', 'Please Be More Serious', 'translated'), ('Still Not Wanting to Fo...
class Solution: # @param {string} a a number # @param {string} b a number # @return {string} the result def addBinary(self, a, b): # Write your code here max_len = max(len(a), len(b)) a = a.zfill(max_len) b = b.zfill(max_len) result = '' carry = 0 ...
class Solution: def add_binary(self, a, b): max_len = max(len(a), len(b)) a = a.zfill(max_len) b = b.zfill(max_len) result = '' carry = 0 for (a, b) in zip(a, b)[::-1]: bits_sum = carry bits_sum += int(a) + int(b) result = ('0' if ...
class Solution: def dailyTemperatures(self, T: list) -> list: if len(T) == 1: return [0] else: mono_stack = [(T[0], 0)] i = 1 res = [0] * len(T) while i < len(T): if T[i] <= mono_stack[-1][0]: ...
class Solution: def daily_temperatures(self, T: list) -> list: if len(T) == 1: return [0] else: mono_stack = [(T[0], 0)] i = 1 res = [0] * len(T) while i < len(T): if T[i] <= mono_stack[-1][0]: mono_stac...
with open("inputs_7.txt") as f: inputs = [x.strip() for x in f.readlines()] ex_inputs= [ "shiny gold bags contain 2 dark red bags.", "dark red bags contain 2 dark orange bags.", "dark orange bags contain 2 dark yellow bags.", "dark yellow bags contain 2 dark green bags.", "dark green bags contain 2 dark blue b...
with open('inputs_7.txt') as f: inputs = [x.strip() for x in f.readlines()] ex_inputs = ['shiny gold bags contain 2 dark red bags.', 'dark red bags contain 2 dark orange bags.', 'dark orange bags contain 2 dark yellow bags.', 'dark yellow bags contain 2 dark green bags.', 'dark green bags contain 2 dark blue bags.'...
#Simple calculator def add(x,y): return x+y def subs(x,y): return x-y def multi(x,y): return x*y def divide(x,y): return x/y num1 = int(input("Enter the Value of Num1 :")) num2 = int(input("Enter the Value of NUm2 :")) print("Choose 1 for '+'/ 2 for '-'/ 3 for '*'/ 4 for '/' :-") select = int(inpu...
def add(x, y): return x + y def subs(x, y): return x - y def multi(x, y): return x * y def divide(x, y): return x / y num1 = int(input('Enter the Value of Num1 :')) num2 = int(input('Enter the Value of NUm2 :')) print("Choose 1 for '+'/ 2 for '-'/ 3 for '*'/ 4 for '/' :-") select = int(input('Enter t...
PI = float(3.14159) raio = float(input()) print("A=%0.4f" %(PI * (raio * raio)))
pi = float(3.14159) raio = float(input()) print('A=%0.4f' % (PI * (raio * raio)))
x = {} with open('input.txt', 'r', encoding='utf8') as f: for line in f: line = line.strip() x[line] = x.get(line, 0) + 1 lol = [(y, x) for x, y in x.items()] lol.sort() with open('output.txt', 'w', encoding='utf8') as f: if lol[-1][0] / sum(x.values()) > 0.5: f.write(lol[-1][1]) el...
x = {} with open('input.txt', 'r', encoding='utf8') as f: for line in f: line = line.strip() x[line] = x.get(line, 0) + 1 lol = [(y, x) for (x, y) in x.items()] lol.sort() with open('output.txt', 'w', encoding='utf8') as f: if lol[-1][0] / sum(x.values()) > 0.5: f.write(lol[-1][1]) e...
{ "includes": [ "drafter/common.gypi" ], "targets": [ { "target_name": "protagonist", "include_dirs": [ "drafter/src", "<!(node -e \"require('nan')\")" ], "sources": [ "src/options_parser.cc", "src/parse_async.cc", "src/parse_sync.cc", ...
{'includes': ['drafter/common.gypi'], 'targets': [{'target_name': 'protagonist', 'include_dirs': ['drafter/src', '<!(node -e "require(\'nan\')")'], 'sources': ['src/options_parser.cc', 'src/parse_async.cc', 'src/parse_sync.cc', 'src/protagonist.cc', 'src/protagonist.h', 'src/refractToV8.cc', 'src/validate_async.cc', 's...
# Chalk Damage Skin success = sm.addDamageSkin(2433236) if success: sm.chat("The Chalk Damage Skin has been added to your account's damage skin collection.")
success = sm.addDamageSkin(2433236) if success: sm.chat("The Chalk Damage Skin has been added to your account's damage skin collection.")
""" Key point: - Locate a '1' first and make all the right, left, up and down to '0'. - Make all the adjacent '1' to '0' so all the islands would be counted. """ class Solution: def numIslands(self, grid): if not grid: return 0 row = len(grid) col = len(grid[0]) ...
""" Key point: - Locate a '1' first and make all the right, left, up and down to '0'. - Make all the adjacent '1' to '0' so all the islands would be counted. """ class Solution: def num_islands(self, grid): if not grid: return 0 row = len(grid) col = len(grid[0]) count...
N_T = input().split() N = int(N_T[0]) T = int(N_T[1]) interactions = [] input_condition = input() conditions = list(input_condition) conditions = [int(x) for x in conditions] for x in range(T): input_line = input().split() input_line = [int(x) for x in input_line] interactions.append(input_lin...
n_t = input().split() n = int(N_T[0]) t = int(N_T[1]) interactions = [] input_condition = input() conditions = list(input_condition) conditions = [int(x) for x in conditions] for x in range(T): input_line = input().split() input_line = [int(x) for x in input_line] interactions.append(input_line) sorted_inte...
#WAP to calculate and display the factorial of #an inputted number. num = int(input("enter the range for factorial: ")) f = 1 if num < 0: print("factorial does not exist") elif num == 0: print("The factorial of 0 is 1") else: for i in range(1,num + 1): f = f * i print("The factorial ...
num = int(input('enter the range for factorial: ')) f = 1 if num < 0: print('factorial does not exist') elif num == 0: print('The factorial of 0 is 1') else: for i in range(1, num + 1): f = f * i print('The factorial of', num, 'is', f)
""" while / Else contadores acumuladores """ contador = 1 acumulador = 1 while contador <= 20: print(contador, acumulador) acumulador += contador contador += 1 if contador > 7: break else: print('cheguei no else') print('sai do while')
""" while / Else contadores acumuladores """ contador = 1 acumulador = 1 while contador <= 20: print(contador, acumulador) acumulador += contador contador += 1 if contador > 7: break else: print('cheguei no else') print('sai do while')
def pascal_nth_row(line_num): if line_num == 0: return [1] line = [1] last_line = pascal_nth_row(line_num - 1) for i in range(len(last_line) - 1): line.append(last_line[i] + last_line[i + 1]) line.append(1) # line here will the line at num line_num return line print(pasca...
def pascal_nth_row(line_num): if line_num == 0: return [1] line = [1] last_line = pascal_nth_row(line_num - 1) for i in range(len(last_line) - 1): line.append(last_line[i] + last_line[i + 1]) line.append(1) return line print(pascal_nth_row(5))
#Attept a def isPerfectSquare(n): if n <= 1: return True start = 0 end = n//2 while((end - start) > 1): mid = (start + end)//2 sq = mid*mid print(mid, sq, start, end) if sq == n: return True if sq > n: end = mid if sq < ...
def is_perfect_square(n): if n <= 1: return True start = 0 end = n // 2 while end - start > 1: mid = (start + end) // 2 sq = mid * mid print(mid, sq, start, end) if sq == n: return True if sq > n: end = mid if sq < n: ...
"""Below Python Programme demonstrate maketrans functions in a string""" #Example: # example dictionary dict = {"a": "123", "b": "456", "c": "789"} string = "abc" print(string.maketrans(dict)) # example dictionary dict = {97: "123", 98: "456", 99: "789"} string = "abc" print(string.maketrans(dict))
"""Below Python Programme demonstrate maketrans functions in a string""" dict = {'a': '123', 'b': '456', 'c': '789'} string = 'abc' print(string.maketrans(dict)) dict = {97: '123', 98: '456', 99: '789'} string = 'abc' print(string.maketrans(dict))
#!/usr/bin/env python # -*- coding: utf-8 -*- base_url = "https://es.wikiquote.org/w/api.php" quote_of_the_day_url = "https://es.wikiquote.org/wiki/Portada" def quote_of_the_day_parser(html): table = html("table")[1]("table")[0] quote = table("td")[3].text.strip() author = table("td")[5].div.a.text.strip(...
base_url = 'https://es.wikiquote.org/w/api.php' quote_of_the_day_url = 'https://es.wikiquote.org/wiki/Portada' def quote_of_the_day_parser(html): table = html('table')[1]('table')[0] quote = table('td')[3].text.strip() author = table('td')[5].div.a.text.strip() return (quote, author) non_quote_sections...
# membuat tupple buah = ('anggur', 'jeruk', 'mangga') print(buah) # output: ('anggur', 'jeruk', 'mangga')
buah = ('anggur', 'jeruk', 'mangga') print(buah)
input = """ 1 2 0 0 1 3 0 0 1 4 0 0 1 5 0 0 1 6 0 0 1 7 0 0 1 8 0 0 1 9 0 0 1 10 0 0 1 11 0 0 1 12 0 0 1 13 0 0 1 14 0 0 1 15 0 0 1 16 0 0 1 17 0 0 1 18 0 0 1 19 0 0 1 20 0 0 1 21 0 0 1 22 0 0 1 23 0 0 1 24 0 0 1 25 0 0 1 26 0 0 1 27 0 0 1 28 0 0 1 29 0 0 1 30 0 0 1 31 0 0 1 32 0 0 1 33 0 0 1 34 0 0 1 35 0 0 1 36 0 0 1...
input = '\n1 2 0 0\n1 3 0 0\n1 4 0 0\n1 5 0 0\n1 6 0 0\n1 7 0 0\n1 8 0 0\n1 9 0 0\n1 10 0 0\n1 11 0 0\n1 12 0 0\n1 13 0 0\n1 14 0 0\n1 15 0 0\n1 16 0 0\n1 17 0 0\n1 18 0 0\n1 19 0 0\n1 20 0 0\n1 21 0 0\n1 22 0 0\n1 23 0 0\n1 24 0 0\n1 25 0 0\n1 26 0 0\n1 27 0 0\n1 28 0 0\n1 29 0 0\n1 30 0 0\n1 31 0 0\n1 32 0 0\n1 33 0 ...
class Solution: def searchMatrix(self, matrix: 'List[List[int]]', target: int) -> bool: m = len(matrix) if m == 0: return False n = len(matrix[0]) if n == 0: return False left, right = 0, m * n while left + 1 < right: mid = (left + ...
class Solution: def search_matrix(self, matrix: 'List[List[int]]', target: int) -> bool: m = len(matrix) if m == 0: return False n = len(matrix[0]) if n == 0: return False (left, right) = (0, m * n) while left + 1 < right: mid = le...
#Eoin Lees student = { "name":"Mary", "modules": [ { "courseName":"Programming", "grade":45 }, { "courseName":"History", "grade":99 } ] } print ("Student: {}".format(student["name"])) for module in student["modules"]: print...
student = {'name': 'Mary', 'modules': [{'courseName': 'Programming', 'grade': 45}, {'courseName': 'History', 'grade': 99}]} print('Student: {}'.format(student['name'])) for module in student['modules']: print('\t {} \t: {}'.format(module['courseName'], module['grade']))
# crypto_test.py 21/05/2016 D.J.Whale # # Placeholder for test harness for crypto.py #TODO: print("no tests defined") # END
print('no tests defined')
def ask(name='Jack'): print(name) class Person: def __init__(self): print('Ma') my_func = ask my_func() """ Jack """ print() my_class = Person my_class() """ Ma """ print() obj_list = [] obj_list.extend([ask, Person]) for item in obj_list: print(item()) """ Jack None Ma <__main__.Person object ...
def ask(name='Jack'): print(name) class Person: def __init__(self): print('Ma') my_func = ask my_func() '\nJack\n' print() my_class = Person my_class() '\nMa\n' print() obj_list = [] obj_list.extend([ask, Person]) for item in obj_list: print(item()) '\nJack\nNone\nMa\n<__main__.Person object at 0x...
''' Given a balanced parentheses string S, compute the score of the string based on the following rule: () has score 1 AB has score A + B, where A and B are balanced parentheses strings. (A) has score 2 * A, where A is a balanced parentheses string. Example 1: Input: "()" Output: 1 Example 2: Input:...
""" Given a balanced parentheses string S, compute the score of the string based on the following rule: () has score 1 AB has score A + B, where A and B are balanced parentheses strings. (A) has score 2 * A, where A is a balanced parentheses string. Example 1: Input: "()" Output: 1 Example 2: Input:...
# Modified from https://github.com/google/subpar/blob/master/debug.bzl def dump(obj, obj_name): """Debugging method that recursively prints object fields to stderr Args: obj: Object to dump obj_name: Name to print for that object Example Usage: ``` load("debug", "dump") ... dump(...
def dump(obj, obj_name): """Debugging method that recursively prints object fields to stderr Args: obj: Object to dump obj_name: Name to print for that object Example Usage: ``` load("debug", "dump") ... dump(ctx, "ctx") ``` Example Output: ``` WARNING: /code/rrrr...
class Node: def __init__(self, data): self.data = data self.both = id(data) def __repr__(self): return str(self.data) a = Node("a") b = Node("b") c = Node("c") d = Node("d") e = Node("e") # id_map simulates object pointer values id_map = dict() id_map[id("a")] = a id_map[id("b")] = b ...
class Node: def __init__(self, data): self.data = data self.both = id(data) def __repr__(self): return str(self.data) a = node('a') b = node('b') c = node('c') d = node('d') e = node('e') id_map = dict() id_map[id('a')] = a id_map[id('b')] = b id_map[id('c')] = c id_map[id('d')] = d id...
#!/usr/bin/env python3 # --------------------( LICENSE )-------------------- # Copyright (c) 2014-2022 Beartype authors. # See "LICENSE" for further details. ''' Project-wide **unimportable data submodule.** This submodule exercises dynamic importability by providing an unimportable submodul...
""" Project-wide **unimportable data submodule.** This submodule exercises dynamic importability by providing an unimportable submodule defining an arbitrary attribute. External unit tests are expected to dynamically import this attribute from this submodule. """ raise value_error('Can you imagine a fulfilled society?...
while True: print("hello") if 2<1: 2 print('hi')
while True: print('hello') if 2 < 1: 2 print('hi')
# Copyright 2016 by Raytheon BBN Technologies Corp. All Rights Reserved """ Names and descriptions of attributes that may be added to AST nodes to represent information used by the preprocessor. Attribute names are typically used literally (except when checking for the presence of an attribute by name) so the purpos...
""" Names and descriptions of attributes that may be added to AST nodes to represent information used by the preprocessor. Attribute names are typically used literally (except when checking for the presence of an attribute by name) so the purpose of this file is primarily documentation. """ class Qgl2Ast(object): ...
''' A submodule for doing basic error analysis for experimental physics results. ''' def average(values): # TODO: add documentation pass def percent_diff(expected, actual): # TODO: add documentation pass
""" A submodule for doing basic error analysis for experimental physics results. """ def average(values): pass def percent_diff(expected, actual): pass
# A list is a collection which is ordered and changeable. In Python lists are written with square brackets. thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"] print(thislist) # You access the list items by referring to the index number # Print the second item of the list print("The second e...
thislist = ['apple', 'banana', 'cherry', 'orange', 'kiwi', 'melon', 'mango'] print(thislist) print('The second element of list are:' + thislist[1]) print('The last element of list are:' + thislist[-1]) print('The 3rd 4th and 5th item of list are:') print(thislist[2:5]) print(thislist[:4]) print(thislist[2:]) print(this...
with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="gprpy", version="1.0.8", author="Alain Plattner", author_email="plattner@alumni.ethz.ch", description="GPRPy - open source ground penetrating radar processing and visualization", entry_points={'cons...
with open('README.md', 'r') as fh: long_description = fh.read() setuptools.setup(name='gprpy', version='1.0.8', author='Alain Plattner', author_email='plattner@alumni.ethz.ch', description='GPRPy - open source ground penetrating radar processing and visualization', entry_points={'console_scripts': ['gprpy = gprpy._...
class _Emojis: def __init__(self): self.key = "\U0001F511" self.link = "\U0001F4CE" self.alert = "\U0001F6A8" self.ghost = "\U0001F47B" self.package = "\U0001F4E6" self.folder = "\U0001F5C2" self.bell = "\U0001F514" self.dissy = "\U0001F4AB" se...
class _Emojis: def __init__(self): self.key = '🔑' self.link = '📎' self.alert = '🚨' self.ghost = '👻' self.package = '📦' self.folder = '🗂' self.bell = '🔔' self.dissy = '💫' self.genie = '🧞' self.linked_paperclip = '🖇' se...
icu_sources = [ 'utypes.cpp', 'uloc.cpp', 'ustring.cpp', 'ucase.cpp', 'ubrk.cpp', 'brkiter.cpp', 'filteredbrk.cpp', 'ucharstriebuilder.cpp', 'uobject.cpp', 'resbund.cpp', 'servrbf.cpp', 'servlkf.cpp', 'serv.cpp', 'servnotf.cpp', 'servls.cpp', 'servlk.cpp',...
icu_sources = ['utypes.cpp', 'uloc.cpp', 'ustring.cpp', 'ucase.cpp', 'ubrk.cpp', 'brkiter.cpp', 'filteredbrk.cpp', 'ucharstriebuilder.cpp', 'uobject.cpp', 'resbund.cpp', 'servrbf.cpp', 'servlkf.cpp', 'serv.cpp', 'servnotf.cpp', 'servls.cpp', 'servlk.cpp', 'servslkf.cpp', 'stringtriebuilder.cpp', 'uvector.cpp', 'ustrenu...
while(True): try: x, a, y, b = map(int, input().split()) if(x * b == a * y): print("=") elif (x * b > a * y): print(">") else: print("<") except: exit()
while True: try: (x, a, y, b) = map(int, input().split()) if x * b == a * y: print('=') elif x * b > a * y: print('>') else: print('<') except: exit()
class Graph(object): def __init__(self, graph={}): """ create the graph dictionary. use empty dictionary if no input. """ self.graph = graph def vertex(self, v): """ add new vertex. checks to see if vertex is already present before adding. """ if v not in self.graph: ...
class Graph(object): def __init__(self, graph={}): """ create the graph dictionary. use empty dictionary if no input. """ self.graph = graph def vertex(self, v): """ add new vertex. checks to see if vertex is already present before adding. """ if v not in self.graph: ...
META = [{ 'lookup': 'city', 'tag': 'city', 'path': ['names','en'], },{ 'lookup': 'continent', 'tag': 'continent', 'path': ['names','en'], },{ 'lookup': 'continent_code', 'tag': 'continent', 'path': ['code'], },{ 'loo...
meta = [{'lookup': 'city', 'tag': 'city', 'path': ['names', 'en']}, {'lookup': 'continent', 'tag': 'continent', 'path': ['names', 'en']}, {'lookup': 'continent_code', 'tag': 'continent', 'path': ['code']}, {'lookup': 'country', 'tag': 'country', 'path': ['names', 'en']}, {'lookup': 'iso_code', 'tag': 'country', 'path':...
# Example: Fetch single bridge by ID my_bridge = api.get_bridge('brg-bridgeId') print(my_bridge) ## { 'bridgeAudio': True, ## 'calls' : 'https://api.catapult.inetwork.com/v1/users/u-123/bridges/brg-bridgeId/calls', ## 'createdTime': '2017-01-26T01:15:09Z', ## 'id' : 'brg-bridgeId', ## 's...
my_bridge = api.get_bridge('brg-bridgeId') print(my_bridge) print(my_bridge['state'])
# partisan.tests # Tests for the complete partisan package. # # Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> # Created: Sat Jul 16 11:36:08 2016 -0400 # # Copyright (C) 2016 District Data Labs # For license information, see LICENSE.txt # # ID: __init__.py [80822db] benjamin@bengfort.com $ """ Tests fo...
""" Tests for the complete partisan package. """
class Solution: def isAdditiveNumber(self, num: str) -> bool: l = len(num) for i in range(1, (2 * l) // 3): for j in range(0, i): if num[0] == "0" and j + 1 != 1: break if num[j + 1] == "0" and i - j != 1: continue ...
class Solution: def is_additive_number(self, num: str) -> bool: l = len(num) for i in range(1, 2 * l // 3): for j in range(0, i): if num[0] == '0' and j + 1 != 1: break if num[j + 1] == '0' and i - j != 1: continue ...
# Database Config config = { 'MYSQL_DATABASE_USER' : 'root', #Username for mysql 'MYSQL_DATABASE_DB' : 'CoveServices', 'MYSQL_DATABASE_PASSWORD' : 'root', # Password to connect to mysql 'MYSQL_DATABASE_HOST' : 'localhost', 'USERNAME' : '', 'USERID' :'', }
config = {'MYSQL_DATABASE_USER': 'root', 'MYSQL_DATABASE_DB': 'CoveServices', 'MYSQL_DATABASE_PASSWORD': 'root', 'MYSQL_DATABASE_HOST': 'localhost', 'USERNAME': '', 'USERID': ''}
nota1 = float(input()) while nota1 > 10 or nota1 < 0: print('nota invalida') nota1 = float(input()) nota2 = float(input()) while nota2 > 10 or nota2 < 0: print('nota invalida') nota2 = float(input()) media = (nota1+nota2)/2 print('media = %.2f'%media)
nota1 = float(input()) while nota1 > 10 or nota1 < 0: print('nota invalida') nota1 = float(input()) nota2 = float(input()) while nota2 > 10 or nota2 < 0: print('nota invalida') nota2 = float(input()) media = (nota1 + nota2) / 2 print('media = %.2f' % media)
players = """ -- Name; Case Race; Beer Ball; Flip 50; Nicole;1;2;2; Jenna;2;2;5; Krendan;4;3;3; Dylan;4;3;3; Luke;5;5;3; Jason;5;4;3; Brendan;5;4;3; James E;3;3;3; Aidan;3;4;5; Daniel;4;5;4; Maya;3;3;5; James C;3;3;3; Kayvan;3;2;2; Steph;3;2;4; Kevin;3;3;3; """
players = '\n-- Name; Case Race; Beer Ball; Flip 50;\nNicole;1;2;2;\nJenna;2;2;5;\nKrendan;4;3;3;\nDylan;4;3;3;\nLuke;5;5;3;\nJason;5;4;3;\nBrendan;5;4;3;\nJames E;3;3;3;\nAidan;3;4;5;\nDaniel;4;5;4;\nMaya;3;3;5;\nJames C;3;3;3;\nKayvan;3;2;2;\nSteph;3;2;4;\nKevin;3;3;3;\n'
# -*- coding: utf-8 -*- # TODO: deprecated URL_DID_SIGN_IN = '/api/v2/did/signin' URL_DID_AUTH = '/api/v2/did/auth' URL_DID_BACKUP_AUTH = '/api/v2/did/backup_auth' URL_BACKUP_SERVICE = '/api/v2/internal_backup/service' URL_BACKUP_FINISH = '/api/v2/internal_backup/finished_confirmation' URL_BACKUP_FILES = '/api/v2/inte...
url_did_sign_in = '/api/v2/did/signin' url_did_auth = '/api/v2/did/auth' url_did_backup_auth = '/api/v2/did/backup_auth' url_backup_service = '/api/v2/internal_backup/service' url_backup_finish = '/api/v2/internal_backup/finished_confirmation' url_backup_files = '/api/v2/internal_backup/files' url_backup_file = '/api/v...
""" .. module: lemur.plugins.utils :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ def get_plugin_option(name, options): """ Retrieve option name from options di...
""" .. module: lemur.plugins.utils :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ def get_plugin_option(name, options): """ Retrieve option name from options dic...
def input(channel): pass def wait_for_edge(channel, edge_type, timeout=None): pass def add_event_detect(channel, edge_type, callback=None, bouncetime=None): pass def add_event_callback(channel, callback, bouncetime=None): pass def event_detected(channel): pass def remove_event_detect(chann...
def input(channel): pass def wait_for_edge(channel, edge_type, timeout=None): pass def add_event_detect(channel, edge_type, callback=None, bouncetime=None): pass def add_event_callback(channel, callback, bouncetime=None): pass def event_detected(channel): pass def remove_event_detect(channel): ...
class Solution: def generateParenthesis(self, n: int) -> List[str]: st = [] res = [] def backtracking(op ,cl): if op == cl == n : res.append("".join(st)) return if op < n : st.append("(") ...
class Solution: def generate_parenthesis(self, n: int) -> List[str]: st = [] res = [] def backtracking(op, cl): if op == cl == n: res.append(''.join(st)) return if op < n: st.append('(') backtracking(op...
general_desc = """ <div><span class="bold">$name</span><span>: $desc</span></div> """ general_head = """ <html> <body> """ general_foot = """ </html> </body> """ not_srd = """ <!DOCTYPE html> <html> <head> <style> .name { font-size:225%; font-family:Georgia, serif; font-varia...
general_desc = '\n<div><span class="bold">$name</span><span>: $desc</span></div> \n' general_head = '\n<html>\n<body>\n' general_foot = '\n</html>\n</body>\n' not_srd = '\n<!DOCTYPE html>\n <html>\n <head>\n <style>\n .name {\n font-size:225%;\n font-family:Georgia, serif;\n font-varia...
""" Eugene """ __all__ = ["Config", "Primatives", "Node", "Tree", "Individual", "Population", "Util"] __version__ = '0.1.1' __date__ = '2015-08-07 07:09:00 -0700' __author__ = 'tmthydvnprt' __status__ = 'development' __website__ = 'https://github.com/tmthydvnprt/eugene' __email__ = 'tmthydvnprt@users.noreply.github.co...
""" Eugene """ __all__ = ['Config', 'Primatives', 'Node', 'Tree', 'Individual', 'Population', 'Util'] __version__ = '0.1.1' __date__ = '2015-08-07 07:09:00 -0700' __author__ = 'tmthydvnprt' __status__ = 'development' __website__ = 'https://github.com/tmthydvnprt/eugene' __email__ = 'tmthydvnprt@users.noreply.github.com...
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def glog(): http_archive( name="glog" , sha256="bae42ec37b50e156071f5b92d2ff09aa5ece56fd8c58d2175fc1ffea85137664" , ...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def glog(): http_archive(name='glog', sha256='bae42ec37b50e156071f5b92d2ff09aa5ece56fd8c58d2175fc1ffea85137664', strip_prefix='glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6', urls=['https://github.com/Unilang/glog/archive/0a2e5931bd5ff22fd3bf8999...
''' Created on 14.10.2019 @author: JM ''' class TMC2130_register_variant: " ===== TMC2130 register variants ===== " "..."
""" Created on 14.10.2019 @author: JM """ class Tmc2130_Register_Variant: """ ===== TMC2130 register variants ===== """ '...'
# Rainbow Grid handgezeichnet add_library('handy') def setup(): global h h = HandyRenderer(this) size(600, 600) this.surface.setTitle("Rainbow Grid Handy") rectMode(CENTER) h.setRoughness(1) h.setFillWeight(0.9) h.setFillGap(0.9) def draw(): colorMode(RGB) background(235, 215, ...
add_library('handy') def setup(): global h h = handy_renderer(this) size(600, 600) this.surface.setTitle('Rainbow Grid Handy') rect_mode(CENTER) h.setRoughness(1) h.setFillWeight(0.9) h.setFillGap(0.9) def draw(): color_mode(RGB) background(235, 215, 182) color_mode(HSB) ...
set_name(0x800A0CD8, "VID_OpenModule__Fv", SN_NOWARN) set_name(0x800A0D98, "InitScreens__Fv", SN_NOWARN) set_name(0x800A0E88, "MEM_SetupMem__Fv", SN_NOWARN) set_name(0x800A0EB4, "SetupWorkRam__Fv", SN_NOWARN) set_name(0x800A0F44, "SYSI_Init__Fv", SN_NOWARN) set_name(0x800A1050, "GM_Open__Fv", SN_NOWARN) set_name(0x800A...
set_name(2148142296, 'VID_OpenModule__Fv', SN_NOWARN) set_name(2148142488, 'InitScreens__Fv', SN_NOWARN) set_name(2148142728, 'MEM_SetupMem__Fv', SN_NOWARN) set_name(2148142772, 'SetupWorkRam__Fv', SN_NOWARN) set_name(2148142916, 'SYSI_Init__Fv', SN_NOWARN) set_name(2148143184, 'GM_Open__Fv', SN_NOWARN) set_name(214814...
__title__ = "Django REST framework Caching Tools" __version__ = "1.0.3" __author__ = "Vincent Wantchalk" __license__ = "MIT" __copyright__ = "Copyright 2011-2019 xsudo.com" # Version synonym VERSION = __version__ # Header encoding (see RFC5987) HTTP_HEADER_ENCODING = "iso-8859-1" default_app_config = "drf_cache.apps...
__title__ = 'Django REST framework Caching Tools' __version__ = '1.0.3' __author__ = 'Vincent Wantchalk' __license__ = 'MIT' __copyright__ = 'Copyright 2011-2019 xsudo.com' version = __version__ http_header_encoding = 'iso-8859-1' default_app_config = 'drf_cache.apps.DOTConfig'
# Generate input data for EM 514, Homework Problem 8 def DefineInputs(): area = 200.0e-6 nodes = [{'x': 0.0e0, 'y': 0.0e0, 'z': 0.0e0, 'xflag': 'd', 'xbcval': 0.0, 'yflag': 'd', 'ybcval': 0.0e0, 'zflag': 'd', 'zbcval': 0.0e0}] nodes.append({'x': 3.0e0, 'y': 0.0e0, 'z': 0.0e0, 'xflag': 'f', 'xb...
def define_inputs(): area = 0.0002 nodes = [{'x': 0.0, 'y': 0.0, 'z': 0.0, 'xflag': 'd', 'xbcval': 0.0, 'yflag': 'd', 'ybcval': 0.0, 'zflag': 'd', 'zbcval': 0.0}] nodes.append({'x': 3.0, 'y': 0.0, 'z': 0.0, 'xflag': 'f', 'xbcval': 0.0, 'yflag': 'f', 'ybcval': 0.0, 'zflag': 'd', 'zbcval': 0.0}) nodes.app...
n = int(input('Valor do produto: ')) val = (n*5) / 100 res = val print('O VALOR FINAL COM 5% DE DESCONTO VAI SER ${}:'.format(val))
n = int(input('Valor do produto: ')) val = n * 5 / 100 res = val print('O VALOR FINAL COM 5% DE DESCONTO VAI SER ${}:'.format(val))
quarter = (dta.inspection_date.dt.month - 1) // 3 quarter_size = dta.groupby((quarter, violation_num)).size() axes = quarter_size.unstack(level=0).plot.bar( figsize=(14, 8), )
quarter = (dta.inspection_date.dt.month - 1) // 3 quarter_size = dta.groupby((quarter, violation_num)).size() axes = quarter_size.unstack(level=0).plot.bar(figsize=(14, 8))
# pin numbers # http://micropython-on-wemos-d1-mini.readthedocs.io/en/latest/setup.html # https://forum.micropython.org/viewtopic.php?t=2503 D0 = 16 # wake D5 = 14 # sck D6 = 12 # miso D7 = 13 # mosi D8 = 15 # cs PULL-DOWN 10k D4 = 2 # boot PULL-UP 10k D3 = 0 # flash PULL-UP 10k D2 = 4 # sda D1 = 5 # scl RX...
d0 = 16 d5 = 14 d6 = 12 d7 = 13 d8 = 15 d4 = 2 d3 = 0 d2 = 4 d1 = 5 rx = 3 tx = 1 led = D4
CENTRALIZED = False EXAMPLE_PAIR = "ZRX-WETH" USE_ETHEREUM_WALLET = True FEE_TYPE = "FlatFee" FEE_TOKEN = "ETH" DEFAULT_FEES = [0, 0.00001]
centralized = False example_pair = 'ZRX-WETH' use_ethereum_wallet = True fee_type = 'FlatFee' fee_token = 'ETH' default_fees = [0, 1e-05]
''' 154. Find Minimum in Rotated Sorted Array II https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ similar problem: "153. Find Minimum in Rotated Sorted Array" https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/ Suppose an array sorted in ascending order is rotated at some pivot u...
""" 154. Find Minimum in Rotated Sorted Array II https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ similar problem: "153. Find Minimum in Rotated Sorted Array" https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/ Suppose an array sorted in ascending order is rotated at some pivot u...
def self_powers(final:int): sum_pows = 0 for integer in range(1, final + 1): power = 1 for _ in range(integer): power = (power * integer) % (10**11) sum_pows += power return sum_pows % (10 ** 10) if __name__ == "__main__": print(self_powers(1000))
def self_powers(final: int): sum_pows = 0 for integer in range(1, final + 1): power = 1 for _ in range(integer): power = power * integer % 10 ** 11 sum_pows += power return sum_pows % 10 ** 10 if __name__ == '__main__': print(self_powers(1000))
SP500 = {'A.O. Smith Corp': 'AOS', 'Abbott Laboratories': 'ABT', 'AbbVie Inc.': 'ABBV', 'Accenture plc': 'ACN', 'Activision Blizzard': 'ATVI', 'Acuity Brands Inc': 'AYI', 'Adobe Systems Inc': 'ADBE', 'Advance Auto Parts': 'AAP', 'Advanced Micro Dev...
sp500 = {'A.O. Smith Corp': 'AOS', 'Abbott Laboratories': 'ABT', 'AbbVie Inc.': 'ABBV', 'Accenture plc': 'ACN', 'Activision Blizzard': 'ATVI', 'Acuity Brands Inc': 'AYI', 'Adobe Systems Inc': 'ADBE', 'Advance Auto Parts': 'AAP', 'Advanced Micro Devices Inc': 'AMD', 'AES Corp': 'AES', 'Aetna Inc': 'AET', 'Affiliated Man...
a= int(input()) if (a%4 == 0) and (a%100 != 0): print(1) elif a%400 ==0: print(1) else: print(0)
a = int(input()) if a % 4 == 0 and a % 100 != 0: print(1) elif a % 400 == 0: print(1) else: print(0)
# encoding: utf-8 # module cv2.optflow # from /home/davtoh/anaconda3/envs/rrtools/lib/python3.5/site-packages/cv2.cpython-35m-x86_64-linux-gnu.so # by generator 1.144 # no doc # no imports # Variables with simple values DISOpticalFlow_PRESET_FAST = 1 DISOpticalFlow_PRESET_MEDIUM = 2 DISOpticalFlow_PRESET_ULTRAFAST = ...
dis_optical_flow_preset_fast = 1 dis_optical_flow_preset_medium = 2 dis_optical_flow_preset_ultrafast = 0 disoptical_flow_preset_fast = 1 disoptical_flow_preset_medium = 2 disoptical_flow_preset_ultrafast = 0 gpc_descriptor_dct = 0 gpc_descriptor_wht = 1 __loader__ = None __spec__ = None def calc_optical_flow_sf(from_...
c = 0 while(True): c+=1 inp = input() if(inp == '0'): break n = int(inp) inp = input().split(' ') su = 0 for j in range(0,len(inp)): su += int(inp[j]) av = int(su / len(inp)) count = 0 for j in range(0,len(inp)): count += abs(av - int(inp[j])) print('Set #' + str(c)) print('The minimum...
c = 0 while True: c += 1 inp = input() if inp == '0': break n = int(inp) inp = input().split(' ') su = 0 for j in range(0, len(inp)): su += int(inp[j]) av = int(su / len(inp)) count = 0 for j in range(0, len(inp)): count += abs(av - int(inp[j])) print(...
# cook your dish here def highestPowerOf2(n): return (n & (~(n - 1))) for t in range(int(input())): ts=int(input()) sum=0 if ts%2==1: print((ts-1)//2) else: x=highestPowerOf2(ts) print(ts//((x*2)))
def highest_power_of2(n): return n & ~(n - 1) for t in range(int(input())): ts = int(input()) sum = 0 if ts % 2 == 1: print((ts - 1) // 2) else: x = highest_power_of2(ts) print(ts // (x * 2))
"""Functions to help edit essay homework using string manipulation.""" def capitalize_title(title): """Convert the first letter of each word in the title to uppercase if needed. :param title: str - title string that needs title casing. :return: str - title string in title case (first letters capitalized)...
"""Functions to help edit essay homework using string manipulation.""" def capitalize_title(title): """Convert the first letter of each word in the title to uppercase if needed. :param title: str - title string that needs title casing. :return: str - title string in title case (first letters capitalized)....
'''rig pipeline prototype by Ben Barker, copyright (c) 2015 ben.barker@gmail.com for license info see license.txt '''
"""rig pipeline prototype by Ben Barker, copyright (c) 2015 ben.barker@gmail.com for license info see license.txt """
def main(): # Manage input file input = open(r"C:\Users\lawht\Desktop\Github\ROSALIND\Bioinformatics Stronghold\(2) Transcribing DNA into RNA\(2) Transcribing DNA into RNA\rosalind_rna.txt","r"); DNA_string = input.readline(); # take first line of input file for counting # Take in input file of DNA st...
def main(): input = open('C:\\Users\\lawht\\Desktop\\Github\\ROSALIND\\Bioinformatics Stronghold\\(2) Transcribing DNA into RNA\\(2) Transcribing DNA into RNA\\rosalind_rna.txt', 'r') dna_string = input.readline() print(dna_to_rna(DNA_string)) input.close() def dna_to_rna(s): rna = '' for n in ...
class Solution: def minDifference(self, nums: List[int]) -> int: # pick three values if len(nums) <= 4: return 0 nums.sort() ans = nums[-1] - nums[0] for i in range(4): ans = min(nums[-1 - (3 - i)] - nums[i], ans) return ans
class Solution: def min_difference(self, nums: List[int]) -> int: if len(nums) <= 4: return 0 nums.sort() ans = nums[-1] - nums[0] for i in range(4): ans = min(nums[-1 - (3 - i)] - nums[i], ans) return ans
'''https://practice.geeksforgeeks.org/problems/bottom-view-of-binary-tree/1 https://www.geeksforgeeks.org/bottom-view-binary-tree/ Bottom View of Binary Tree Medium Accuracy: 45.32% Submissions: 90429 Points: 4 Given a binary tree, print the bottom view from left to right. A node is included in bottom view if it can b...
"""https://practice.geeksforgeeks.org/problems/bottom-view-of-binary-tree/1 https://www.geeksforgeeks.org/bottom-view-binary-tree/ Bottom View of Binary Tree Medium Accuracy: 45.32% Submissions: 90429 Points: 4 Given a binary tree, print the bottom view from left to right. A node is included in bottom view if it can b...
class dotControlObject_t(object): # no doc aName = None Color = None Extension = None IsMagnetic = None ModelObject = None Plane = None
class Dotcontrolobject_T(object): a_name = None color = None extension = None is_magnetic = None model_object = None plane = None
#Ask User for his role and save it in a variable role = input ("Are you an administrator, teacher, or student?: ") #If role "administrator or teacher" print they have keys if role == "administrator" or role == "teacher": print ("Administrators and teachers get keys!") #If role "Student" print they dont get ke...
role = input('Are you an administrator, teacher, or student?: ') if role == 'administrator' or role == 'teacher': print('Administrators and teachers get keys!') elif role == 'student': print('Students do not get keys') else: print('You can only be an administrator, teacher, or student!')
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( k , s1 , s2 ) : n = len ( s1 ) m = len ( s2 ) lcs = [ [ 0 for x in range ( m + 1 ) ] for y in range ( n...
def f_gold(k, s1, s2): n = len(s1) m = len(s2) lcs = [[0 for x in range(m + 1)] for y in range(n + 1)] cnt = [[0 for x in range(m + 1)] for y in range(n + 1)] for i in range(1, n + 1): for j in range(1, m + 1): lcs[i][j] = max(lcs[i - 1][j], lcs[i][j - 1]) if s1[i - 1...
name = 'Zed A. Shaw' age = 35 height = 74 weight = 180 # lbs eyes = 'Blue' teeth = 'White' hair = 'Brown' print(f"Let's talk about {name}.") print(f"He's {height} inches tall.") print(f"He's {weight} pounds heavy.") print("Actually it's not too heavy") print(f"He's got {eyes} eyes and {hair} hair.") print(f"His teeth ...
name = 'Zed A. Shaw' age = 35 height = 74 weight = 180 eyes = 'Blue' teeth = 'White' hair = 'Brown' print(f"Let's talk about {name}.") print(f"He's {height} inches tall.") print(f"He's {weight} pounds heavy.") print("Actually it's not too heavy") print(f"He's got {eyes} eyes and {hair} hair.") print(f'His teeth are usu...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 17 16:17:25 2017 @author: jorgemauricio - Escribe un programa que calcule el valor neto de una cuenta de banco basado en las transacciones que se ingresan en la consola de comandos. Ej: D 200 D 250 P 300 D 100 P 200 Donde: D = Deposito P...
""" Created on Mon Jul 17 16:17:25 2017 @author: jorgemauricio - Escribe un programa que calcule el valor neto de una cuenta de banco basado en las transacciones que se ingresan en la consola de comandos. Ej: D 200 D 250 P 300 D 100 P 200 Donde: D = Deposito P = Pago Resultado 50 """
def get_data(path): try: file_handler = open(path, "r") except: return 0 data = [] for line in file_handler: values = line.strip().split(" ") data.append([int(values[1]), int(values[2]), int(values[3])]) return data def sensortxt_parser(path): order = ['lu', 'ru', 'lu', 'ru'] order2 = ['ld', 'rd', ...
def get_data(path): try: file_handler = open(path, 'r') except: return 0 data = [] for line in file_handler: values = line.strip().split(' ') data.append([int(values[1]), int(values[2]), int(values[3])]) return data def sensortxt_parser(path): order = ['lu', 'ru'...
# -*- coding: utf-8 -*- # Copyright (C) 2018 by # Marta Grobelna <marta.grobelna@rwth-aachen.de> # Petre Petrov <petrepp4@gmail.com> # Rudi Floren <rudi.floren@gmail.com> # Tobias Winkler <tobias.winkler1@rwth-aachen.de> # All rights reserved. # BSD license. # # Authors: Marta Grobelna <marta.grob...
def bern_choice(probabilities, random_function) -> int: """Draws a random value with random_function and returns the index of a probability which the random value undercuts. The list is theoretically expanded to include 1-p """ assert type(probabilities) is list random_value = random_function() ...
r""" ************************* Text rendering With LaTeX ************************* Matplotlib can use LaTeX to render text. This is activated by setting ``text.usetex : True`` in your rcParams, or by setting the ``usetex`` property to True on individual `.Text` objects. Text handling through LaTeX is slower than Mat...
""" ************************* Text rendering With LaTeX ************************* Matplotlib can use LaTeX to render text. This is activated by setting ``text.usetex : True`` in your rcParams, or by setting the ``usetex`` property to True on individual `.Text` objects. Text handling through LaTeX is slower than Matp...
# first line: 1 @mem.cache def get_data(filename): data=load_svmlight_file(filename) return data[0],data[1]
@mem.cache def get_data(filename): data = load_svmlight_file(filename) return (data[0], data[1])
""" Defines an Indexer Object with different methods to index data, look up, add, remove etc Extremely useful across all NLP tasks Author: Greg Durrett Contact: gdurrett@cs.utexas.edu """ class Indexer(object): """ Bijection between objects and integers starting at 0. Useful for mapping labels, features, ...
""" Defines an Indexer Object with different methods to index data, look up, add, remove etc Extremely useful across all NLP tasks Author: Greg Durrett Contact: gdurrett@cs.utexas.edu """ class Indexer(object): """ Bijection between objects and integers starting at 0. Useful for mapping labels, features, e...
# # Copyright 2017, Data61 # Commonwealth Scientific and Industrial Research Organisation (CSIRO) # ABN 41 687 119 230. # # This software may be distributed and modified according to the terms of # the BSD 2-Clause license. Note that NO WARRANTY is provided. # See "LICENSE_BSD2.txt" for details. # # @TAG(DATA61_BSD) # ...
""" Helpers for accessing architecture-specific information """ def is_64_bit_arch(arch): return arch in ('x86_64', 'aarch64') def min_untyped_size(arch): return 4 def max_untyped_size(arch): if is_64_bit_arch(arch): return 47 else: return 29
def find_num_1(response_list): responses = [] for r in response_list: responses.extend([i for i in r]) responses = list(set(responses)) return len(responses) def find_num_2(response_list): if len(response_list) == 0: return 0 responses = set(response_list[0]) if len(respons...
def find_num_1(response_list): responses = [] for r in response_list: responses.extend([i for i in r]) responses = list(set(responses)) return len(responses) def find_num_2(response_list): if len(response_list) == 0: return 0 responses = set(response_list[0]) if len(response...
LOWER_PRIORITY = 100 LOW_PRIORITY = 75 DEFAULT_PRIORITY = 50 HIGH_PRIORITY = 25 HIGHEST_PRIORITY = 0
lower_priority = 100 low_priority = 75 default_priority = 50 high_priority = 25 highest_priority = 0
class Config(object): data = './' activation='Relu'#Swish,Relu,Mish,Selu init = "kaiming"#kaiming save = './checkpoints'#save best model dir arch = 'resnet' depth = 50 #resnet-50 gpu_id = '0,1' #gpu id train_data = '/home/daixiangzi/dataset/cifar-10/files/...
class Config(object): data = './' activation = 'Relu' init = 'kaiming' save = './checkpoints' arch = 'resnet' depth = 50 gpu_id = '0,1' train_data = '/home/daixiangzi/dataset/cifar-10/files/train.txt' test_data = '/home/daixiangzi/dataset/cifar-10/files/test.txt' train_batch = 51...
# Make an xor function # Truth table # | left | right | Result | # |-------|-------|--------| # | True | True | False | # | True | False | True | # | False | True | True | # | False | False | False | # def xor(left, right): # return left != right xor = lambda left, right: left != right print(xor(True, Tr...
xor = lambda left, right: left != right print(xor(True, True)) print(xor(True, False)) print(xor(False, True)) print(xor(False, False)) def print_powers_of(base, exp=1): i = 1 while i <= exp: print(base ** i) i += 1 print_powers_of(15) print_powers_of(exp=6, base=7) print_powers_of(2, 5) print_...
class Users: ''' Class that generates new instances of users ''' users_list = [] def save_users(self): ''' This method will save all users to the user list ''' Users.users_list.append(self) def __init__ (self,user_name,first_name,last_name,birth_mont...
class Users: """ Class that generates new instances of users """ users_list = [] def save_users(self): """ This method will save all users to the user list """ Users.users_list.append(self) def __init__(self, user_name, first_name, last_name, birth_month, passwo...
PREDEFINED_TORQUE_INPUTS = [ "$torque.environment.id", "$torque.environment.virtual_network_id", "$torque.environment.public_address", "$torque.repos.current.current", "$torque.repos.current.url", "$torque.repos.current.token" ]
predefined_torque_inputs = ['$torque.environment.id', '$torque.environment.virtual_network_id', '$torque.environment.public_address', '$torque.repos.current.current', '$torque.repos.current.url', '$torque.repos.current.token']
def iterate(days): with open("inputs/day6.txt") as f: input = [int(x) for x in f.readline().strip().split(",")] fish = {} for f in input: fish[f] = fish.get(f, 0) + 1 for day in range(1, days+1): new_fish = {} for x in fish: if x =...
def iterate(days): with open('inputs/day6.txt') as f: input = [int(x) for x in f.readline().strip().split(',')] fish = {} for f in input: fish[f] = fish.get(f, 0) + 1 for day in range(1, days + 1): new_fish = {} for x in fish: if x ...
rows, cols = [int(x) for x in input().split()] line = input() index = 0 matrix = [] for row in range(rows): matrix.append([None]*cols) for col in range(cols): if row % 2 == 0: matrix[row][col] = line[index] else: matrix[row][cols - 1 - col] = line[index] index = ...
(rows, cols) = [int(x) for x in input().split()] line = input() index = 0 matrix = [] for row in range(rows): matrix.append([None] * cols) for col in range(cols): if row % 2 == 0: matrix[row][col] = line[index] else: matrix[row][cols - 1 - col] = line[index] index...
# -*- coding: utf-8 -*- """ Created on Wed Jul 21 08:25:14 2021 @author: ASUS """
""" Created on Wed Jul 21 08:25:14 2021 @author: ASUS """
class SplendaException(Exception): def __init__(self, method_name, fake_class, spec_class): self.fake_class = fake_class self.spec_class = spec_class self.method_name = method_name def __str__(self): spec_name = self.spec_class.__name__ fake_name = self.fake_class.__name...
class Splendaexception(Exception): def __init__(self, method_name, fake_class, spec_class): self.fake_class = fake_class self.spec_class = spec_class self.method_name = method_name def __str__(self): spec_name = self.spec_class.__name__ fake_name = self.fake_class.__nam...