content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#@<OUT> get cluster status { "clusterName": "testCluster", "defaultReplicaSet": { "name": "default", "topology": [ { "address": "<<<hostname>>>:<<<__mysql_sandbox_port2>>>", "label": "<<<hostname>>>:<<<__mysql_sandbox_port2>>>", "ro...
{'clusterName': 'testCluster', 'defaultReplicaSet': {'name': 'default', 'topology': [{'address': '<<<hostname>>>:<<<__mysql_sandbox_port2>>>', 'label': '<<<hostname>>>:<<<__mysql_sandbox_port2>>>', 'role': 'HA'}, {'address': '<<<hostname>>>:<<<__mysql_sandbox_port1>>>', 'label': '<<<hostname>>>:<<<__mysql_sandbox_port1...
s = input().split() for i in range(len(s)): if int(s[i]) % 2 == 0: print(s[i], end=' ')
s = input().split() for i in range(len(s)): if int(s[i]) % 2 == 0: print(s[i], end=' ')
CERT_FILE = 'release.pem' SETUP_USERS_FILE = 'setup_users.sh' CERTIFICATE_FOLDER = '/opt/instance' ALLOWED_EXTENSIONS = {'pem'} ISO_REPO_URL = 'https://yum.128technology.com/isos/' ISO_RE = '(.+)\.iso$' IMAGE_FOLDER = '/opt/images' SCRIPT_FOLDER = '/opt/scripts' PRE_BOOTSTRAP = 'pre' POST_BOOTSTRAP = 'post' PRE_BOOTSTR...
cert_file = 'release.pem' setup_users_file = 'setup_users.sh' certificate_folder = '/opt/instance' allowed_extensions = {'pem'} iso_repo_url = 'https://yum.128technology.com/isos/' iso_re = '(.+)\\.iso$' image_folder = '/opt/images' script_folder = '/opt/scripts' pre_bootstrap = 'pre' post_bootstrap = 'post' pre_bootst...
#Class for sources table class Sources: def __init__(self, cursor): self.cursor = cursor #read from db #check existing pagespeed of stored sources def getSpeed(cursor, hash): sql= "SELECT sources_speed from sources WHERE sources_hash=%s LIMIT 1" data = (hash,) cursor.execut...
class Sources: def __init__(self, cursor): self.cursor = cursor def get_speed(cursor, hash): sql = 'SELECT sources_speed from sources WHERE sources_hash=%s LIMIT 1' data = (hash,) cursor.execute(sql, data) rows = cursor.fetchall() return rows def get_source...
class Dog: def __init__(self, name, color): self.name = name self.color = color def bark(self): print('Woof!') fido = Dog("Fido", "brown") print(fido.name) print(fido.color) fido.bark()
class Dog: def __init__(self, name, color): self.name = name self.color = color def bark(self): print('Woof!') fido = dog('Fido', 'brown') print(fido.name) print(fido.color) fido.bark()
#!/usr/bin/env python3 #encoding=utf-8 #--------------------------------------------- # Usage: python3 4-spam_class2.py # Description: Code that needs to manage per-class instance counters, for example, # might be best off leveraging class methods. In the following, the # top-level supercla...
class Spamclass: instance_counter = 0 def count(cls): cls.instance_counter += 1 def __init__(self): self.count() count = classmethod(count) class Spamsub(SpamClass): instance_counter = 0 def __init__(self): SpamClass.__init__(self) class Spamsubother(SpamClass): ...
a=int(input()) e=[] def cont(no,arr): arr=list(set(arr)) for i in range(len(arr)): if(no==arr[i]): return True for i in range(a): b=int(input()) c=list(map(int,input().split())) e.append(c) for i in range(len(e)): e[i].sort() for i in e: f=[] g=[] for j in range(len(i)): if(cont(i[j]...
a = int(input()) e = [] def cont(no, arr): arr = list(set(arr)) for i in range(len(arr)): if no == arr[i]: return True for i in range(a): b = int(input()) c = list(map(int, input().split())) e.append(c) for i in range(len(e)): e[i].sort() for i in e: f = [] g = [] ...
def three_highest(cars): return sorted(cars, key=lambda car: car.dimensions[2], reverse=True)[:3] def three_fastest(cars): return sorted(cars, key=lambda car: car.to100km)[:3]
def three_highest(cars): return sorted(cars, key=lambda car: car.dimensions[2], reverse=True)[:3] def three_fastest(cars): return sorted(cars, key=lambda car: car.to100km)[:3]
dollar={"rupees":75.53,"yen":107.50,"dirham":3.67,"euro":0.91,"pound":0.81} def mainCurrency(query): splitQuery=query.split() value,fromCurrency,toCurrency=splitQuery[1],splitQuery[2],splitQuery[4] if fromCurrency=="dollars":finalValue=float(value)*dollar[toCurrency] elif toCurrency=="dollars":finalValu...
dollar = {'rupees': 75.53, 'yen': 107.5, 'dirham': 3.67, 'euro': 0.91, 'pound': 0.81} def main_currency(query): split_query = query.split() (value, from_currency, to_currency) = (splitQuery[1], splitQuery[2], splitQuery[4]) if fromCurrency == 'dollars': final_value = float(value) * dollar[toCurrenc...
class Node: def __init__(self, idx, name, shape="box", color="#d6d6d6"): self.idx = idx self.name = name self.shape = shape self.color = color
class Node: def __init__(self, idx, name, shape='box', color='#d6d6d6'): self.idx = idx self.name = name self.shape = shape self.color = color
''' Created on 1.12.2016 @author: Darren '''''' Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library function such as sqrt. Example 1: Input: 16 Returns: True Example 2: Input: 14 Returns: False Cr...
""" Created on 1.12.2016 @author: Darren Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library function such as sqrt. Example 1: Input: 16 Returns: True Example 2: Input: 14 Returns: False Credits:Special thanks to @e...
#!/usr/bin/python # -*- coding: utf-8 -*- DEBUG = True SECRET_KEY = 'development key' WEB_HOST = '0.0.0.0' WEB_PORT = 8888 REDIS_HOST = 'localhost' REDIS_PORT = 7778 REDIS_PASS = 'r3'
debug = True secret_key = 'development key' web_host = '0.0.0.0' web_port = 8888 redis_host = 'localhost' redis_port = 7778 redis_pass = 'r3'
m,n=map(int,input().split()) ip=[] for i in range(m): ip.append(list(map(int,input().split()))) ''' Traverse the rows once keeping track of all the rows and columns which should finally be set to 0. ''' rows=[0 for i in range(m)] columns=[0 for i in range(n)] for i in range(m): for j in range(n): if i...
(m, n) = map(int, input().split()) ip = [] for i in range(m): ip.append(list(map(int, input().split()))) '\nTraverse the rows once keeping track of all the rows\nand columns which should finally be set to 0.\n' rows = [0 for i in range(m)] columns = [0 for i in range(n)] for i in range(m): for j in range(n): ...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. ### CONTROLS (non-tunable) ### # general TYPE_OF_RUN = evaluate # train, test, test_episodes, evaluate LOAD_MODEL_FROM = mlruns/0/eb021674da6d4662b5e360703c518476/artifacts/agent/data/model.pth SAVE_MODELS_TO = None # worker.py ENV = Battle...
type_of_run = evaluate load_model_from = mlruns / 0 / eb021674da6d4662b5e360703c518476 / artifacts / agent / data / model.pth save_models_to = None env = BattleshipEnv env_random_seed = 2 agent_random_seed = 1 reporting_interval = 1000 total_steps = 100000 anneal_lr = False num_episodes_to_test = 5 agent_net = APPROXBA...
''' This is the Entities module assigning unique features to an entity ''' class Entity: entity = None def id(self): pass def toString(self): line = '' for i in self.entity: line += str(self.entity[i]) + ', ' return line[:-2] + '\n' ''' user resource entity:...
""" This is the Entities module assigning unique features to an entity """ class Entity: entity = None def id(self): pass def to_string(self): line = '' for i in self.entity: line += str(self.entity[i]) + ', ' return line[:-2] + '\n' '\nuser resource entity: us...
{ "targets": [ { "target_name": "node-dotnet-bridge", "sources": [ "addon.cpp", "Proxy.cpp", "AsyncContext.cpp" ], "include_dirs": [ "<!(node -e \"require('nan')\")" ], ...
{'targets': [{'target_name': 'node-dotnet-bridge', 'sources': ['addon.cpp', 'Proxy.cpp', 'AsyncContext.cpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'cflags': ['-Wall', '-std=c++14'], 'conditions': [['OS=="win"', {'defines': ['WINDOWS']}], ['OS=="linux"', {'defines': ['LINUX']}]]}]}
BINARY_FNAME_TEMPLATE = "{version}-{platform}-{architecture}" ARCHIVE_FNAME_TEMPLATE = BINARY_FNAME_TEMPLATE + ".{ext}" CLOUD_STORAGE_URL = "http://cloud.raiden.network/"
binary_fname_template = '{version}-{platform}-{architecture}' archive_fname_template = BINARY_FNAME_TEMPLATE + '.{ext}' cloud_storage_url = 'http://cloud.raiden.network/'
# automatically generated by the FlatBuffers compiler, do not modify # namespace: proto class ResultType(object): Success = 0 Failed = 1
class Resulttype(object): success = 0 failed = 1
class Solution: def countStrings(self,n): a = 1 b = 1 for _ in range(n) : c = (a + b) % 1000000007 a, b = b, c return b # Driver code if __name__ == "__main__": tc=int(input()) while tc > 0: n=int(input()) ...
class Solution: def count_strings(self, n): a = 1 b = 1 for _ in range(n): c = (a + b) % 1000000007 (a, b) = (b, c) return b if __name__ == '__main__': tc = int(input()) while tc > 0: n = int(input()) ob = solution() ans = ob.c...
# HOMETASK 1 - UPPER AND LOWER CASES print("# HOMETASK 1 - UPPER AND LOWER CASES") p_phylosophy = "Beautiful is better than ugly \ Explicit is better than implicit \ Simple is better than complex \ Complex is better than complicated \ Readability counts" # Printing in upper cases print (p_phylosophy.upper()) p_phyloso...
print('# HOMETASK 1 - UPPER AND LOWER CASES') p_phylosophy = 'Beautiful is better than ugly Explicit is better than implicit Simple is better than complex Complex is better than complicated Readability counts' print(p_phylosophy.upper()) p_phylosophy_upper = p_phylosophy.upper() print(p_phylosophy_upper.isupper()) prin...
#!/usr/bin/env python # AUTO GENERATED FILE - PLEASE CHECK gen.py! # Instructions = [{'code': 0, 'cycles': 4, 'flagResult': {'carry': None, 'halfcarry': None, 'sub': None, 'zero': None}, 'hexCode': '00', 'instruction': 'NOP', 'name': 'NOP', 'simpleFlags': ['-', '-', '-', '-'], 'size': '1', 'templateDa...
instructions = [{'code': 0, 'cycles': 4, 'flagResult': {'carry': None, 'halfcarry': None, 'sub': None, 'zero': None}, 'hexCode': '00', 'instruction': 'NOP', 'name': 'NOP', 'simpleFlags': ['-', '-', '-', '-'], 'size': '1', 'templateData': {'args': [], 'name': 'NOP'}}, {'code': 1, 'cycles': 12, 'flagResult': {'carry': No...
TRIPPIFY_DB_USER = 'trippify' TRIPPIFY_DB_PASSWORD = 'trippify1234' TRIPPIFY_DB_DB = 'trippify' TRIPPIFY_DB_HOST = 'localhost' TRIPPIFY_DB_PORT = 5432 MAPS_GEO_CODING_API_KEY = 'AIzaSyBUl98DdV0U05pu7spTcP-RIB_qoCkNcYU' HERE_APP_ID = 'm7AG9dmM8HNO5ZnJWRVO' HERE_APP_CODE = '2mCmRml-o_e3-uZuD_Z62A' HERE_GEO_CODER_URL = ...
trippify_db_user = 'trippify' trippify_db_password = 'trippify1234' trippify_db_db = 'trippify' trippify_db_host = 'localhost' trippify_db_port = 5432 maps_geo_coding_api_key = 'AIzaSyBUl98DdV0U05pu7spTcP-RIB_qoCkNcYU' here_app_id = 'm7AG9dmM8HNO5ZnJWRVO' here_app_code = '2mCmRml-o_e3-uZuD_Z62A' here_geo_coder_url = 'h...
#for x in range(0,5): #print("Hello World",x) #def recursive(string, num): # if num == 5: # return # print(string,num) #recursive(string,num+1) #recursive("Hello World",0) #def listsum(numList): # sum = 0 # for i in numList: # sum = sum + i # return sum #print(listsum([1,2,5,9,7])) ...
def listsum(numList): if len(numList) == 1: return numList[0] else: return numList[0] + listsum(numList[1:]) print(listsum([1, 2, 5, 9, 7]))
# Solution to problem 9 # Open the file moby-dick.txt for reading and mark as "f" with open('moby-dick.txt', 'r') as f: count = 0 # set counter to zero for line in f: # for every line in the file count+=1 # count +1 if count % 2 == 0: # if the remainder is 0 print(line) ...
with open('moby-dick.txt', 'r') as f: count = 0 for line in f: count += 1 if count % 2 == 0: print(line)
#/usr/bin/env python3 def nth_prime(n): ans = 2 known = [] for _ in range(n): while not all(ans%x != 0 for x in known): ans += 1 known.append(ans) return ans if __name__ == "__main__": n = int(input("Which one? ")) print(nth_prime(n))
def nth_prime(n): ans = 2 known = [] for _ in range(n): while not all((ans % x != 0 for x in known)): ans += 1 known.append(ans) return ans if __name__ == '__main__': n = int(input('Which one? ')) print(nth_prime(n))
def factory(n): def current(): return n def counter(): return n + 1 return current, counter f_current, f_counter = factory(int(input()))
def factory(n): def current(): return n def counter(): return n + 1 return (current, counter) (f_current, f_counter) = factory(int(input()))
numbers = [ -9, +7, +5, -13, +6, +14, -5, -10, -10, -12, +2, +5, +2, -6, -12, +1, +13, +5, +3, -15, -12, +4, -11, +10, -5, -14, -6, +2, -9, -18, +8, -1, +12, +9, +5, -9, +14, +3, -4, -16, +14, +14, +13, -7, -19, +12, -9, +5, +21, -7, +19, -2, +14, +18, +17, +4, +11, -16, -5, -6, -7, -2, -1, -2, -1, +14, -17, +5, +13, +...
numbers = [-9, +7, +5, -13, +6, +14, -5, -10, -10, -12, +2, +5, +2, -6, -12, +1, +13, +5, +3, -15, -12, +4, -11, +10, -5, -14, -6, +2, -9, -18, +8, -1, +12, +9, +5, -9, +14, +3, -4, -16, +14, +14, +13, -7, -19, +12, -9, +5, +21, -7, +19, -2, +14, +18, +17, +4, +11, -16, -5, -6, -7, -2, -1, -2, -1, +14, -17, +5, +13, +8...
METRICS_LABELS = { 'precision': 'Precision', 'recall': 'Recall', 'fmeasure': 'F-measure', 'auc': 'AUC', 'mcc': 'MCC', } MODELS_LABELS = { 'DummyClassifier(strategy=\'most_frequent\')': 'BM', 'DummyClassifier(strategy=\'prior\')': 'BP', 'DummyClassifier(strategy=\'stratified\')': 'BS', ...
metrics_labels = {'precision': 'Precision', 'recall': 'Recall', 'fmeasure': 'F-measure', 'auc': 'AUC', 'mcc': 'MCC'} models_labels = {"DummyClassifier(strategy='most_frequent')": 'BM', "DummyClassifier(strategy='prior')": 'BP', "DummyClassifier(strategy='stratified')": 'BS', "DummyClassifier(strategy='uniform')": 'BU',...
class Goat: legs_number: int = 4 def __init__(self, height: int, weight: int, hungry: bool) -> None: self._height: int = height self._weight: int = weight self._hungry: bool = hungry def stats(self) -> str: return f"Goat has {self._height} height and {self._weight} weight!"...
class Goat: legs_number: int = 4 def __init__(self, height: int, weight: int, hungry: bool) -> None: self._height: int = height self._weight: int = weight self._hungry: bool = hungry def stats(self) -> str: return f'Goat has {self._height} height and {self._weight} weight!'...
colors = [ '\033[38;5;21m', # blue (cold) '\033[38;5;39m', '\033[38;5;50m', '\033[38;5;48m', '\033[38;5;46m', # green '\033[38;5;118m', '\033[38;5;190m', '\033[38;5;226m', # yellow '\033[38;5;220m', '\033[38;5;214m', # orange '\033[38;5;208m', '\033[38;5;202m', '\033[...
colors = ['\x1b[38;5;21m', '\x1b[38;5;39m', '\x1b[38;5;50m', '\x1b[38;5;48m', '\x1b[38;5;46m', '\x1b[38;5;118m', '\x1b[38;5;190m', '\x1b[38;5;226m', '\x1b[38;5;220m', '\x1b[38;5;214m', '\x1b[38;5;208m', '\x1b[38;5;202m', '\x1b[38;5;196m', '\x1b[38;5;203m', '\x1b[38;5;210m', '\x1b[38;5;217m', '\x1b[38;5;224m', '\x1b[38;...
name1_1_1_0_0_0_0 = None name1_1_1_0_0_0_1 = None name1_1_1_0_0_0_2 = None name1_1_1_0_0_0_3 = None name1_1_1_0_0_0_4 = None
name1_1_1_0_0_0_0 = None name1_1_1_0_0_0_1 = None name1_1_1_0_0_0_2 = None name1_1_1_0_0_0_3 = None name1_1_1_0_0_0_4 = None
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. ### CONTROLS (non-tunable) ### # general TYPE_OF_RUN = train # train, test, test_episodes, render LOAD_MODEL_FROM = None SAVE_MODELS_TO = models/new_gru_flat_babyai.pth # worker.py ENV = BabyAI_Env ENV_RANDOM_SEED = randint # Use an intege...
type_of_run = train load_model_from = None save_models_to = models / new_gru_flat_babyai.pth env = BabyAI_Env env_random_seed = randint agent_random_seed = 1 reporting_interval = 10000 total_steps = 2000000 anneal_lr = False agent_net = GRU_Network babyai_env_level = BabyAI - GoToLocal - v0 use_success_rate = True succ...
#DictExample3.py print("---------------------------------------------------") student = {"name":"sumit","college":"stanford","grade":"1"} print("Student information :\n") print("Student Name : ",student['name']) print("College : ",student['college']) print("grade : ",student['grade']) print("--------------...
print('---------------------------------------------------') student = {'name': 'sumit', 'college': 'stanford', 'grade': '1'} print('Student information :\n') print('Student Name : ', student['name']) print('College : ', student['college']) print('grade : ', student['grade']) print('------------------------------------...
config = { 'username': 'demo', 'password': 'demo1', 'url': 'http://127.0.0.1:18800', 'upload_url': '/YouWillNeverGuess' }
config = {'username': 'demo', 'password': 'demo1', 'url': 'http://127.0.0.1:18800', 'upload_url': '/YouWillNeverGuess'}
class Settings: WLAN_HOST = '$sudo' WLAN_PASSWORD = 'HowNowBrownCow' MQTT_BROKER_HOST = '192.168.0.136' MQTT_BROKER_PORT = '1883' API_URL = 'http://192.168.0.136:5000/api'
class Settings: wlan_host = '$sudo' wlan_password = 'HowNowBrownCow' mqtt_broker_host = '192.168.0.136' mqtt_broker_port = '1883' api_url = 'http://192.168.0.136:5000/api'
def calculate_period(x): if x == 'weeks': return x * 7 elif x == 'month': return x * 30 else: return x def currentlyinfected(x): return x * 10 def currently_infected(x): return x * 50 def infectionbyrequestedattime(x,y): factor = calculate_period(x) // 3 return ...
def calculate_period(x): if x == 'weeks': return x * 7 elif x == 'month': return x * 30 else: return x def currentlyinfected(x): return x * 10 def currently_infected(x): return x * 50 def infectionbyrequestedattime(x, y): factor = calculate_period(x) // 3 return cu...
# pylint: disable=line-too-long, no-member def generator_name(identifier): # pylint: disable=unused-argument return 'Voice Activity Detection' def extract_secondary_identifier(properties): if 'voices_present' in properties: if properties['voices_present']: return 'present' return...
def generator_name(identifier): return 'Voice Activity Detection' def extract_secondary_identifier(properties): if 'voices_present' in properties: if properties['voices_present']: return 'present' return 'not-present' return 'unknown'
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres...
def sol(): for i in range(int(input())): R, S = input().split() print("".join([i * int(R) for i in S])) if __name__ == "__main__": sol()
def sol(): for i in range(int(input())): (r, s) = input().split() print(''.join([i * int(R) for i in S])) if __name__ == '__main__': sol()
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def trimBST(self, root: TreeNode, L: int, R: int) -> TreeNode: if not root: return None if r...
class Solution: def trim_bst(self, root: TreeNode, L: int, R: int) -> TreeNode: if not root: return None if root.val < L: return self.trimBST(root.right, L, R) if root.val > R: return self.trimBST(root.left, L, R) root.left = self.trimBST(root.lef...
class CustomException(Exception): _message = '' def __init__(self, message): self._message = message # Call the base class constructor with the parameters it needs super().__init__(message)
class Customexception(Exception): _message = '' def __init__(self, message): self._message = message super().__init__(message)
__is_prod = False def set_production(is_prod): global __is_prod __is_prod = is_prod def is_production(): return __is_prod
__is_prod = False def set_production(is_prod): global __is_prod __is_prod = is_prod def is_production(): return __is_prod
def format(piece): if piece.label: txt_piece = '{0}\n\\label{{{1}}}'.format(str(piece),piece.label) return txt_piece else: return str(piece)
def format(piece): if piece.label: txt_piece = '{0}\n\\label{{{1}}}'.format(str(piece), piece.label) return txt_piece else: return str(piece)
expected_output = { "hsrp_common_process_state": "not running", "hsrp_ha_state": "capable", "hsrp_ipv4_process_state": "not running", "hsrp_ipv6_process_state": "not running", "hsrp_timer_wheel_state": "running", "mac_address_table": { 166: {"group": 10, "interface": "gi2/0/3", "mac_addr...
expected_output = {'hsrp_common_process_state': 'not running', 'hsrp_ha_state': 'capable', 'hsrp_ipv4_process_state': 'not running', 'hsrp_ipv6_process_state': 'not running', 'hsrp_timer_wheel_state': 'running', 'mac_address_table': {166: {'group': 10, 'interface': 'gi2/0/3', 'mac_address': '0000.0cff.b311'}, 169: {'gr...
######################################## # CS/CNS/EE 155 2017 # Problem Set 5 # # Author: Avishek Dutta # Description: Set 5 ######################################## class Utility: ''' Utility for the problem files. ''' def __init__(): pass @staticmethod def load_poem(): ...
class Utility: """ Utility for the problem files. """ def __init__(): pass @staticmethod def load_poem(): """ Loads the file 'shake_words.txt'. Returns: states: Sequnces of states, i.e. a list of lists. E...
def factorial(num): if num == 0: return 1 return num * factorial(num-1) print(factorial(int(input())))
def factorial(num): if num == 0: return 1 return num * factorial(num - 1) print(factorial(int(input())))
#! /usr/bin/python # create a list of float # creating list of single data types fam = [1.73, 1.68, 1.72, 1.89] print(fam) # creating list of different data types
fam = [1.73, 1.68, 1.72, 1.89] print(fam)
# flake8: noqa # Edit this file to override the default graphite settings, do not edit settings.py # Turn on debugging and restart apache if you ever see an "Internal Server Error" page # DEBUG = True # Set your local timezone (django will try to figure this out automatically) TIME_ZONE = 'Europe/Zurich' # Secret ke...
time_zone = 'Europe/Zurich' secret_key = '%%SECRET_KEY%%' url_prefix = '/graphite/'
# 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 ( n ) : table = [ 0 for i in range ( n + 1 ) ] table [ 0 ] = 1 for i in range ( 3 , n + 1 ) : tab...
def f_gold(n): table = [0 for i in range(n + 1)] table[0] = 1 for i in range(3, n + 1): table[i] += table[i - 3] for i in range(5, n + 1): table[i] += table[i - 5] for i in range(10, n + 1): table[i] += table[i - 10] return table[n] if __name__ == '__main__': param = ...
# # PySNMP MIB module HUAWEI-BGP-ACCOUNTING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-BGP-ACCOUNTING-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:31:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) ...
class Solution: def intersection(self, nums1, nums2): return list(set(nums1) & set(nums2)) if __name__ == '__main__': print(Solution().intersection([4, 9, 5], [9, 4, 9, 8, 4])) # [9, 4]
class Solution: def intersection(self, nums1, nums2): return list(set(nums1) & set(nums2)) if __name__ == '__main__': print(solution().intersection([4, 9, 5], [9, 4, 9, 8, 4]))
class Solution: def hammingDistance(self, x, y): result = x^y return bin(result).count('1')
class Solution: def hamming_distance(self, x, y): result = x ^ y return bin(result).count('1')
trunk_capacity = float(input()) is_trunk_full = False number_of_baggage = 0 command = input() while command != 'End': current_luggage = float(command) trunk_capacity -= current_luggage number_of_baggage += 1 if number_of_baggage % 3 == 0: trunk_capacity -= current_luggage * 0.1 if trunk_ca...
trunk_capacity = float(input()) is_trunk_full = False number_of_baggage = 0 command = input() while command != 'End': current_luggage = float(command) trunk_capacity -= current_luggage number_of_baggage += 1 if number_of_baggage % 3 == 0: trunk_capacity -= current_luggage * 0.1 if trunk_capa...
name1 = input("Write your name: ").lower() name2 = input("Write other person's name: ").lower() joinedName = name1 + name2 def loveCounter(countParameter): count1 = 0 for i in countParameter: count1 += joinedName.count(i) return count1 trueCount = loveCounter("true") loveCount = loveCounter("lov...
name1 = input('Write your name: ').lower() name2 = input("Write other person's name: ").lower() joined_name = name1 + name2 def love_counter(countParameter): count1 = 0 for i in countParameter: count1 += joinedName.count(i) return count1 true_count = love_counter('true') love_count = love_counter('...
def add3(x, y=0, z=0): return x + y + z def mul3(x=1, y=1, z=1): return x * y * z def doubler_premier_kwds(votre, signature): # TODO: votre code pass
def add3(x, y=0, z=0): return x + y + z def mul3(x=1, y=1, z=1): return x * y * z def doubler_premier_kwds(votre, signature): pass
name_list= ['Sharon','Mic','Josh','Hannah','Hansel'] height_list = [172,166,187,200,166] weight_list = [59.5,65.6,49.8,64.2,47.5] size_list = ['M','L','S','M','S']\ details_list = [['Sharon', 'F', 33], ['Mic', 'M', 24], ['Josh', 'M', 25 ], ['Hannah', 'F', 30], ['Hanzel', 'M', 26]] gender = [] age = [] bmi_list = [] b...
name_list = ['Sharon', 'Mic', 'Josh', 'Hannah', 'Hansel'] height_list = [172, 166, 187, 200, 166] weight_list = [59.5, 65.6, 49.8, 64.2, 47.5] size_list = ['M', 'L', 'S', 'M', 'S'] details_list = [['Sharon', 'F', 33], ['Mic', 'M', 24], ['Josh', 'M', 25], ['Hannah', 'F', 30], ['Hanzel', 'M', 26]] gender = [] age = [] bm...
def fib(n): if (n <= 2): return 1 else: return fib(n-1) + fib(n-2)
def fib(n): if n <= 2: return 1 else: return fib(n - 1) + fib(n - 2)
i, j, k = (int(x) for x in input().split()) day = 0 for num in range(i, j+1): rev_num = int(str(num)[::-1]) if (num - rev_num) % k == 0: day += 1 print(day)
(i, j, k) = (int(x) for x in input().split()) day = 0 for num in range(i, j + 1): rev_num = int(str(num)[::-1]) if (num - rev_num) % k == 0: day += 1 print(day)
# Paths # Fill this according to own setup BACKGROUND_DIR = 'input/backgrounds/' BACKGROUND_GLOB_STRING = '*.jpg' POISSON_BLENDING_DIR = './pb' SELECTED_LIST_FILE = 'input/selected.txt' DISTRACTOR_LIST_FILE = 'input/neg_list.txt' DISTRACTOR_DIR = 'input/distractor_objects_dir/' DISTRACTOR_GLOB_STRING = '*.jpg' INVERTE...
background_dir = 'input/backgrounds/' background_glob_string = '*.jpg' poisson_blending_dir = './pb' selected_list_file = 'input/selected.txt' distractor_list_file = 'input/neg_list.txt' distractor_dir = 'input/distractor_objects_dir/' distractor_glob_string = '*.jpg' inverted_mask = True number_of_workers = 4 blending...
def poiEmails(): ''' find e-mail list ''' email_list = ["kenneth_lay@enron.net", "kenneth_lay@enron.com", "klay.enron@enron.com", "kenneth.lay@enron.com", "klay@enron.com", "layk@enron.com", "chairman.ken@enron.com", "jeffr...
def poi_emails(): """ find e-mail list """ email_list = ['kenneth_lay@enron.net', 'kenneth_lay@enron.com', 'klay.enron@enron.com', 'kenneth.lay@enron.com', 'klay@enron.com', 'layk@enron.com', 'chairman.ken@enron.com', 'jeffreyskilling@yahoo.com', 'jeff_skilling@enron.com', 'jskilling@enron.com', 'effrey.skillin...
def alternatives(expected_result, indices): return { idx: expected_result for idx in indices } class ExpectedResult: def __init__(self, segment_list, non_empty): self.segment_list = segment_list self.non_empty = {} for index_type in ['a', 'ab', 'abc', 'tuple']: if index_typ...
def alternatives(expected_result, indices): return {idx: expected_result for idx in indices} class Expectedresult: def __init__(self, segment_list, non_empty): self.segment_list = segment_list self.non_empty = {} for index_type in ['a', 'ab', 'abc', 'tuple']: if index_type ...
class GPIO: PUD_UP = 0 BCM = 1000 FALLING = 2000 IN = 3000 # This is the GPIO state: add a value [16, 20, 21, 26] to simulate a # button that is pressed, remove it to indicate release. clear_gpios = set() @classmethod def setup(cls, port, mode, pull_up_down): pass @c...
class Gpio: pud_up = 0 bcm = 1000 falling = 2000 in = 3000 clear_gpios = set() @classmethod def setup(cls, port, mode, pull_up_down): pass @classmethod def setmode(cls, mode): pass @classmethod def add_event_detect(cls, port, edge, callback): pass ...
test = { 'name': 'q1f', 'points': 2, 'suites': [ { 'cases': [ { 'code': '>>> ' 'FGpercent_table.index.values\n' 'array([1, 2, 3, 4, 5])', 'hidden': False, ...
test = {'name': 'q1f', 'points': 2, 'suites': [{'cases': [{'code': '>>> FGpercent_table.index.values\narray([1, 2, 3, 4, 5])', 'hidden': False, 'locked': False}, {'code': '>>> FGpercent_table.shape\n(5, 15)', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
types_of_people = 10 # number x = f"There are {types_of_people} types of people." # f-string binary = "binary" # string do_not = "don't" # string y = f"Those who know {binary} and those who {do_not}." # f-string print(x) # print f-string print(y) # print f-string print(f"I said: {x}") # capsule f-string in f...
types_of_people = 10 x = f'There are {types_of_people} types of people.' binary = 'binary' do_not = "don't" y = f'Those who know {binary} and those who {do_not}.' print(x) print(y) print(f'I said: {x}') print(f"I also said: '{y}'") hilarious = False joke_evaluation = "Isn't that joke so funny?! {}" print(joke_evaluatio...
class Solution: def numComponents(self, head: ListNode, G: List[int]) -> int: ans = 0 G = set(G) while head: if head.val in G and (head.next == None or head.next.val not in G): ans += 1 head = head.next return ans
class Solution: def num_components(self, head: ListNode, G: List[int]) -> int: ans = 0 g = set(G) while head: if head.val in G and (head.next == None or head.next.val not in G): ans += 1 head = head.next return ans
class SimpleIter: def __init__(self): pass def __iter__(self): return 'Nope' s = SimpleIter() print('__iter__' in dir(s) ) # => True def is_iterable(obj): try: iter(obj) return True except TypeError: return False obj = 100 if is_iterable(obj): for i in o...
class Simpleiter: def __init__(self): pass def __iter__(self): return 'Nope' s = simple_iter() print('__iter__' in dir(s)) def is_iterable(obj): try: iter(obj) return True except TypeError: return False obj = 100 if is_iterable(obj): for i in obj: p...
def firstDuplicate(a): counts = {} for c in a: if c in counts: return c counts[c] = 1 return -1 # a = [2, 1, 3, 5, 3, 2]
def first_duplicate(a): counts = {} for c in a: if c in counts: return c counts[c] = 1 return -1
description = 'memograph readout' tango_base = 'tango://ictrlfs.ictrl.frm2.tum.de:10000/memograph09/KWS123/' devices = dict( t_in_memograph_kws123 = device('nicos.devices.entangle.Sensor', description = 'inlet temperature memograph', tangodevice = tango_base + 'T_in', ), t_out_memograph_kw...
description = 'memograph readout' tango_base = 'tango://ictrlfs.ictrl.frm2.tum.de:10000/memograph09/KWS123/' devices = dict(t_in_memograph_kws123=device('nicos.devices.entangle.Sensor', description='inlet temperature memograph', tangodevice=tango_base + 'T_in'), t_out_memograph_kws123=device('nicos.devices.entangle.Sen...
def mul_inv(a, b): b0 = b x0, x1 = 0, 1 if b == 1: return 1 while a > 1: q = a / b a, b = b, a%b x0, x1 = x1 - q * x0, x0 if x1 < 0: x1 += b0 return x1 def chinese_remainder(n, a, lena): p = i = prod = 1; sm = 0 for i in range(lena): prod *= n[i] for i in ran...
def mul_inv(a, b): b0 = b (x0, x1) = (0, 1) if b == 1: return 1 while a > 1: q = a / b (a, b) = (b, a % b) (x0, x1) = (x1 - q * x0, x0) if x1 < 0: x1 += b0 return x1 def chinese_remainder(n, a, lena): p = i = prod = 1 sm = 0 for i in range(len...
def treat_results(result_file, out_file, begin_index): out = open(out_file, 'w') ind = begin_index out.write('ID;intention\n') with open(result_file, 'r') as f: for line in f: new_line = line.replace('\n', '') out.write(str(ind) + ';' + new_line) out.write('\n...
def treat_results(result_file, out_file, begin_index): out = open(out_file, 'w') ind = begin_index out.write('ID;intention\n') with open(result_file, 'r') as f: for line in f: new_line = line.replace('\n', '') out.write(str(ind) + ';' + new_line) out.write('\n...
class Base: def __init__(self, func=None): if func is not None: self.execute = func def execute(self): print("Original execution") def constantFunction(self): print("This function won't change across derived classes") class DerivedA(Base): def __init__(self): super().__init__(executeReplacement1) cla...
class Base: def __init__(self, func=None): if func is not None: self.execute = func def execute(self): print('Original execution') def constant_function(self): print("This function won't change across derived classes") class Deriveda(Base): def __init__(self): ...
x = input().split() horainicial, minutoinicial, horafinal, minutofinal = x horainicial = int(x[0]) minutoinicial = int(x[1]) horafinal = int(x[2]) minutofinal = int(x[3]) if horainicial < horafinal: h = horafinal - horainicial if minutoinicial < minutofinal: m = minutofinal - minutoinicial if m...
x = input().split() (horainicial, minutoinicial, horafinal, minutofinal) = x horainicial = int(x[0]) minutoinicial = int(x[1]) horafinal = int(x[2]) minutofinal = int(x[3]) if horainicial < horafinal: h = horafinal - horainicial if minutoinicial < minutofinal: m = minutofinal - minutoinicial if minu...
QB_NAME = input("What is the QB's name?") print(QB_NAME) RUSH_ATTEMPTS = 0 PASS_ATTEMPTS = 0 PASS_YARDS = 0 CURRENT_PASS_YARDS = 0 RUSH_YARDS = 0 CURRENT_RUSH_YARDS = 0 PASS_TD = 0 RUSH_TD = 0 SACKS = 0 SS = 0 INTC = 0 INC = 0 COM = 0 FUM = 0 TD = 0 QBR = 0 SACK_LIST = ["Number", "Of", "Sacks", "="]...
qb_name = input("What is the QB's name?") print(QB_NAME) rush_attempts = 0 pass_attempts = 0 pass_yards = 0 current_pass_yards = 0 rush_yards = 0 current_rush_yards = 0 pass_td = 0 rush_td = 0 sacks = 0 ss = 0 intc = 0 inc = 0 com = 0 fum = 0 td = 0 qbr = 0 sack_list = ['Number', 'Of', 'Sacks', '='] fum_list = ['Number...
''' A list rotation consists of taking the last element and moving it to the front. For instance, if we rotate the list [1,2,3,4,5], we get [5,1,2,3,4]. If we rotate it again, we get [4,5,1,2,3]. Write a Python function rotatelist(l,k) that takes a list l and a positive integer k and returns the list l after k rotation...
""" A list rotation consists of taking the last element and moving it to the front. For instance, if we rotate the list [1,2,3,4,5], we get [5,1,2,3,4]. If we rotate it again, we get [4,5,1,2,3]. Write a Python function rotatelist(l,k) that takes a list l and a positive integer k and returns the list l after k rotation...
# # PySNMP MIB module CISCO-SME-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SME-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:12:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint) ...
default_az_parameters = { "azure_cluster" : { "subscription": "Bing DLTS", "infra_node_num": 1, "worker_node_num": 2, "mysqlserver_node_num": 0, "nfs_node_num": 1, "azure_location": "westus2", "infra_vm_size" : "Standard_D1_v2", "worker_vm_size": "Sta...
default_az_parameters = {'azure_cluster': {'subscription': 'Bing DLTS', 'infra_node_num': 1, 'worker_node_num': 2, 'mysqlserver_node_num': 0, 'nfs_node_num': 1, 'azure_location': 'westus2', 'infra_vm_size': 'Standard_D1_v2', 'worker_vm_size': 'Standard_NC6', 'mysqlserver_vm_size': 'Standard_D1_v2', 'nfs_vm_size': 'Stan...
train_config = {} # # MODEL PARAMETERS ## # # MNIST train_config['A'] = 28 # image width train_config['B'] = 28 # image height train_config['img_size'] = train_config['B'] * train_config['A'] # the canvas size train_config['draw_with_white'] = True # draw with white ink or black ink train_config['enc_rnn_mod...
train_config = {} train_config['A'] = 28 train_config['B'] = 28 train_config['img_size'] = train_config['B'] * train_config['A'] train_config['draw_with_white'] = True train_config['enc_rnn_mode'] = 'BASIC' train_config['enc_size'] = 256 train_config['n_enc_layers'] = 1 train_config['dec_rnn_mode'] = 'BASIC' train_conf...
def required_fuel(mass): return int(mass / 3) - 2 def fuel_calc(initial_fuel): fuel_on_fuel = required_fuel(initial_fuel) if (fuel_on_fuel) > 0: return fuel_on_fuel + fuel_calc(fuel_on_fuel) else: return 0 def calc(modules): return sum(required_fuel(int(x)) for x in modules) de...
def required_fuel(mass): return int(mass / 3) - 2 def fuel_calc(initial_fuel): fuel_on_fuel = required_fuel(initial_fuel) if fuel_on_fuel > 0: return fuel_on_fuel + fuel_calc(fuel_on_fuel) else: return 0 def calc(modules): return sum((required_fuel(int(x)) for x in modules)) def c...
class Node: def __init__(self, value): self.value = value self.next = None def __repr__(self): return str(self.value) class LinkedList: def __init__(self): self.head = None def __str__(self): cur_head = self.head out_string = "" ...
class Node: def __init__(self, value): self.value = value self.next = None def __repr__(self): return str(self.value) class Linkedlist: def __init__(self): self.head = None def __str__(self): cur_head = self.head out_string = '' while cur_head...
class Board: def __init__(self, row = 6, column = 7): self.board = [['.' for x in range(column)]for y in range(row)] self.__row = row self.__column = column def __str__(self): string = "" for item in self.board: for position in item: string += position string += ' ' string += "\n" return s...
class Board: def __init__(self, row=6, column=7): self.board = [['.' for x in range(column)] for y in range(row)] self.__row = row self.__column = column def __str__(self): string = '' for item in self.board: for position in item: string += p...
## ## # File auto-generated against equivalent DynamicSerialize Java class # Jul 27, 2015 4654 skorolev Added filters class AlertVizRequest(object): def __init__(self): self.message = None self.machine = None self.priority = None self.sourceKey = None self.category...
class Alertvizrequest(object): def __init__(self): self.message = None self.machine = None self.priority = None self.sourceKey = None self.category = None self.audioFile = None self.filters = None def get_message(self): return self.message d...
def get_button_info(number): with open("songs.csv", "r") as fp: for i, line in enumerate(fp, start=1): if i == number: line = line.strip() line = line.split(", ") return line def create_empty_file(): with open("songs.csv", "w") as f...
def get_button_info(number): with open('songs.csv', 'r') as fp: for (i, line) in enumerate(fp, start=1): if i == number: line = line.strip() line = line.split(', ') return line def create_empty_file(): with open('songs.csv', 'w') as fp: ...
# String concatenation # Suppose we want to create a string that says "subscript to ____" # Few ways to do this # youtuber = "FreeCodeCamp" # print("Subscribe to " + youtuber) # print("Subscribe to {}".format(youtuber)) # print(f"Subscribe to {youtuber}") adj = input("Adjective: ") verb1 = input("Verb 1: ") verb2 = i...
adj = input('Adjective: ') verb1 = input('Verb 1: ') verb2 = input('Verb 2: ') famous_person = input('Famous person: ') madlib = f'Computer programming is so {adj}! It makes me so excited all the time because I love to {verb1}. Stay hidrated and {verb2} like you are {famous_person}!' print(madlib)
# -*- coding: utf-8 -*- class AbstractNode(object): def _generic_find(self, node_list_name, **kvargs): found_nodes = self._generic_recursion(node_list_name, kvargs, [], []) return self._check_found_nodes(found_nodes) def _generic_recursion(self, node_list_name, search_clauses, found_nodes, ...
class Abstractnode(object): def _generic_find(self, node_list_name, **kvargs): found_nodes = self._generic_recursion(node_list_name, kvargs, [], []) return self._check_found_nodes(found_nodes) def _generic_recursion(self, node_list_name, search_clauses, found_nodes, visited_nodes): vis...
''' Failed complexity test, the code below returt O(N*N) yet the question wants O(N) ''' # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 lengthy = len(A) if (lengthy == 0 or lengthy == 1): return 0 ...
""" Failed complexity test, the code below returt O(N*N) yet the question wants O(N) """ def solution(A): lengthy = len(A) if lengthy == 0 or lengthy == 1: return 0 diffies = [] for i in range(1, lengthy, 1): (lefty, righty) = (A[:i], A[-(lengthy - i):]) (sumlefty, sumrighty) = ...
# # PySNMP MIB module CISCO-DATA-COLLECTION-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DATA-COLLECTION-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:36:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pyt...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ...
# # PySNMP MIB module APPIAN-PPORT-COMMON-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APPIAN-PPORT-COMMON-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:07:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(ac_slot_number, ac_port_number, ac_op_status, ac_node_id, ac_admin_status, ac_pport) = mibBuilder.importSymbols('APPIAN-SMI-MIB', 'AcSlotNumber', 'AcPortNumber', 'AcOpStatus', 'AcNodeId', 'AcAdminStatus', 'acPport') (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentif...
class MidasConfig(object): def __init__(self, linked: bool): self.linked = linked IS_DEBUG = True
class Midasconfig(object): def __init__(self, linked: bool): self.linked = linked is_debug = True
# Python program showing # a use of input() val = input("Enter your value: ") print(val) # Program to check input # type in Python num = input("Enter number :") print(num) name1 = input("Enter name : ") print(name1) # Printing type of input value print("type of number", type(num)) print("type of name", type(name1))...
val = input('Enter your value: ') print(val) num = input('Enter number :') print(num) name1 = input('Enter name : ') print(name1) print('type of number', type(num)) print('type of name', type(name1))
listOfIntegers = [1, 2, 3, 4, 5, 6] for integer in listOfIntegers: if (integer % 2 == 0): print (integer) print ("All done.")
list_of_integers = [1, 2, 3, 4, 5, 6] for integer in listOfIntegers: if integer % 2 == 0: print(integer) print('All done.')
TYPES = ['exact', 'ava', 'like', 'text'] PER_PAGE_MAX = 50 DBS = ['dehkhoda', 'moein', 'amid', 'motaradef', 'farhangestan', 'sareh', 'ganjvajeh', 'wiki', 'slang', 'quran', 'name', 'thesis', 'isfahani', 'bakhtiari', 'tehrani', 'dezfuli', 'gonabadi', 'mazani'] ERROR_CODES = { "400": "f...
types = ['exact', 'ava', 'like', 'text'] per_page_max = 50 dbs = ['dehkhoda', 'moein', 'amid', 'motaradef', 'farhangestan', 'sareh', 'ganjvajeh', 'wiki', 'slang', 'quran', 'name', 'thesis', 'isfahani', 'bakhtiari', 'tehrani', 'dezfuli', 'gonabadi', 'mazani'] error_codes = {'400': 'failed to parse parameters', '401': 'i...
# Script: software_sales # Description: A software company sells a package that retails for $99. # This program asks the user to enter the number of packages purchased. The program # should then display the amount of the discount (if any) and the total amount of the # purchase aft...
discount1 = 50 discount2 = 40 discount3 = 30 discount4 = 20 def main(): print('A software company sells a package that retails for $99.') print('This program asks the user to enter the number of packages purchased. The program') print('should then display the amount of the discount (if any) and the total a...
# https://app.codesignal.com/arcade/code-arcade/lab-of-transformations/dB9drnfWzpiWznESA/ def alphanumericLess(s1, s2): tokens_1 = list(re.findall(r"[0-9]+|[a-z]", s1)) tokens_2 = list(re.findall(r"[0-9]+|[a-z]", s2)) idx = 0 # Tie breakers, if all compared values are the same then the first # diffe...
def alphanumeric_less(s1, s2): tokens_1 = list(re.findall('[0-9]+|[a-z]', s1)) tokens_2 = list(re.findall('[0-9]+|[a-z]', s2)) idx = 0 t_1_zeros = 0 t_2_zeros = 0 while idx < len(tokens_1) and idx < len(tokens_2): (token_1, token_2) = (tokens_1[idx], tokens_2[idx]) if token_1.isd...
# coding:utf-8 def redprint(str): print("\033[1;31m {0}\033[0m".format(str)) def greenprint(str): print("\033[1;32m {0}\033[0m".format(str)) def blueprint(str): print("\033[1;34m {0}\033[0m".format(str)) def yellowprint(str): print("\033[1;33m {0}\033[0m".format(str))
def redprint(str): print('\x1b[1;31m {0}\x1b[0m'.format(str)) def greenprint(str): print('\x1b[1;32m {0}\x1b[0m'.format(str)) def blueprint(str): print('\x1b[1;34m {0}\x1b[0m'.format(str)) def yellowprint(str): print('\x1b[1;33m {0}\x1b[0m'.format(str))
# ----------------------------------------------------- # Trust Game # Licensed under the MIT License # Written by Ye Liu (ye-liu at whu.edu.cn) # ----------------------------------------------------- cfg = { # Initial number of coins the user has 'initial_coins': 100, # Number of total rounds 'num_ro...
cfg = {'initial_coins': 100, 'num_rounds': 10, 'multiplier': 3, 'agent': {'use_same_gender': True, 'use_same_ethnic': True, 'means': [-0.8, -0.4, 0, 0.4, 0.8], 'variances': [1, 1.5, 2]}}
class Piece: def __init__(self, t, s): self.t = t self.blocks = [] rows = s.split('\n') for i in range(len(rows)): for j in range(len(rows[i])): if rows[i][j] == '+': self.blocks.append((i, j)) def get_color(t, active=False): return...
class Piece: def __init__(self, t, s): self.t = t self.blocks = [] rows = s.split('\n') for i in range(len(rows)): for j in range(len(rows[i])): if rows[i][j] == '+': self.blocks.append((i, j)) def get_color(t, active=False): retu...
# Enter your code here. Read input from STDIN. Print output to STDOUT def getMean(list): sum = 0 for i in list: sum += i mean = float(sum) / len(list) return mean def getMedian(list): median = 0.0 list.sort() if (len(list) % 2 == 0): median = float(list[len(list)//2 - 1] + li...
def get_mean(list): sum = 0 for i in list: sum += i mean = float(sum) / len(list) return mean def get_median(list): median = 0.0 list.sort() if len(list) % 2 == 0: median = float(list[len(list) // 2 - 1] + list[len(list) // 2]) / 2 else: median = list[(len(list) ...
# Enumerated constants for voice tokens. SMART, STUPID, ORCISH, ELVEN, DRACONIAN, DWARVEN, GREEK, KITTEH, GNOMIC, \ HURTHISH = list(range( 10))
(smart, stupid, orcish, elven, draconian, dwarven, greek, kitteh, gnomic, hurthish) = list(range(10))
{ 'model_dir': '{this_dir}/model_data/', 'out_dir': 'output/masif_peptides/shape_only/', 'feat_mask': [1.0, 1.0, 0.0, 0.0, 0.0], }
{'model_dir': '{this_dir}/model_data/', 'out_dir': 'output/masif_peptides/shape_only/', 'feat_mask': [1.0, 1.0, 0.0, 0.0, 0.0]}
def to_rna(dna_strand): rna_dict = { 'C':'G', 'G':'C', 'T':'A', 'A':'U' } ret = '' for char in dna_strand: ret += rna_dict[char] return ret
def to_rna(dna_strand): rna_dict = {'C': 'G', 'G': 'C', 'T': 'A', 'A': 'U'} ret = '' for char in dna_strand: ret += rna_dict[char] return ret