content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Method: CHAR = 'char' WORD = 'word' SPECTROGRAM = 'spectrogram' AUDIO = 'audio' FLOW = 'flow' @staticmethod def getall(): return [Method.CHAR, Method.WORD, Method.AUDIO, Method.SPECTROGRAM, Method.FLOW]
class Method: char = 'char' word = 'word' spectrogram = 'spectrogram' audio = 'audio' flow = 'flow' @staticmethod def getall(): return [Method.CHAR, Method.WORD, Method.AUDIO, Method.SPECTROGRAM, Method.FLOW]
#!/usr/bin/env/python inp = open('top-1m.csv', 'r') out = open('top-1m__.csv', 'a+') out.write('"domain_id,"domain_name"') id = '' domain = '' while True: line = inp.readline() if len(line) > 0: cPos = line.find(',') id = line[:cPos] domain = line[cPos+1:] domain = '"'+dom...
inp = open('top-1m.csv', 'r') out = open('top-1m__.csv', 'a+') out.write('"domain_id,"domain_name"') id = '' domain = '' while True: line = inp.readline() if len(line) > 0: c_pos = line.find(',') id = line[:cPos] domain = line[cPos + 1:] domain = '"' + domain.rstrip() + '"' ...
TINY_TEST = False if TINY_TEST: MIN_BOUND = -2 MAX_BOUND = 2 else: MIN_BOUND = -200 MAX_BOUND = 200 WIDTH = (MAX_BOUND - MIN_BOUND) + 3 M = [["."] * WIDTH for i in range(WIDTH)] def setMap(p, v): x, y = p M[y - MIN_BOUND + 1][x - MIN_BOUND + 1] = v def getMap(p): x, y = p return M[...
tiny_test = False if TINY_TEST: min_bound = -2 max_bound = 2 else: min_bound = -200 max_bound = 200 width = MAX_BOUND - MIN_BOUND + 3 m = [['.'] * WIDTH for i in range(WIDTH)] def set_map(p, v): (x, y) = p M[y - MIN_BOUND + 1][x - MIN_BOUND + 1] = v def get_map(p): (x, y) = p return M[...
def even_numbers(func): def wrapper(nums): numbers = func(nums) return [num for num in numbers if num % 2 == 0] return wrapper @even_numbers def get_numbers(numbers): return numbers print(get_numbers([1, 2, 3, 4, 5]))
def even_numbers(func): def wrapper(nums): numbers = func(nums) return [num for num in numbers if num % 2 == 0] return wrapper @even_numbers def get_numbers(numbers): return numbers print(get_numbers([1, 2, 3, 4, 5]))
SEASONS = { 1: { "TITLE" : "Destiny 2", "EXPANSION" : "Destiny 2", "ACTIVE" : False, "YEAR" : "1", "START" : '2017-09-06 17:00:00', "END" : '2017-12-05 17:00:00', }, 2: { "TITLE" : "Curse of Osiris", "EXPANSION" : "Destiny 2", ...
seasons = {1: {'TITLE': 'Destiny 2', 'EXPANSION': 'Destiny 2', 'ACTIVE': False, 'YEAR': '1', 'START': '2017-09-06 17:00:00', 'END': '2017-12-05 17:00:00'}, 2: {'TITLE': 'Curse of Osiris', 'EXPANSION': 'Destiny 2', 'ACTIVE': False, 'YEAR': '1', 'START': '2017-12-05 17:00:01', 'END': '2018-05-08 17:00:00'}, 3: {'TITLE': ...
#Day 6 : Lets Review for i in range(int(input())): char = input() print("".join(char[::2]),"".join(char[1::2]))
for i in range(int(input())): char = input() print(''.join(char[::2]), ''.join(char[1::2]))
# Copyright 2017 Therp BV, ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Client side message boxes", "version": "13.0.1.0.0", "author": "Therp BV, " "ACSONE SA/NV, " "Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Hidden/Dependency", ...
{'name': 'Client side message boxes', 'version': '13.0.1.0.0', 'author': 'Therp BV, ACSONE SA/NV, Odoo Community Association (OCA)', 'license': 'AGPL-3', 'category': 'Hidden/Dependency', 'summary': 'Show a message box to users', 'depends': ['web'], 'data': ['views/templates.xml'], 'qweb': ['static/src/xml/web_ir_action...
def linked_sort(a,b,kf=''): mapped = sorted([(i,j) for i,j in zip(a,b)], key=kf or standard) bsr=[j for i,j in mapped] a.sort(key=(kf or standard)) b.sort(key=lambda x: bsr.index(x)) return a standard = lambda x: str(x)
def linked_sort(a, b, kf=''): mapped = sorted([(i, j) for (i, j) in zip(a, b)], key=kf or standard) bsr = [j for (i, j) in mapped] a.sort(key=kf or standard) b.sort(key=lambda x: bsr.index(x)) return a standard = lambda x: str(x)
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education # {"feature": "Education", "instances": 34, "metric_value": 0.9597, "depth": 1} if obj[1]>1: # {"feature": "Coupon", "instances": 19, "metric_value": 0.998, "depth": 2} if obj[0]<=3: return 'True' elif obj[0]>3: return 'False' else: return 'False...
def find_decision(obj): if obj[1] > 1: if obj[0] <= 3: return 'True' elif obj[0] > 3: return 'False' else: return 'False' elif obj[1] <= 1: if obj[0] > 2: return 'True' elif obj[0] <= 2: return 'False' el...
one = ['1'] two = ['3'] three = ['9'] a = '1' b = '3' c = '9' v = [0,0,0] for i in range(1000): v[0] = int(a) v[1] = int(b) v[2] = int(c) for i in range(len(a)) : v[0] += int(a[i]) for i in range(len(b)) : v[1] += int(b[i]) for i in range(len(a)) : v[2] += int(c[i]) one.app...
one = ['1'] two = ['3'] three = ['9'] a = '1' b = '3' c = '9' v = [0, 0, 0] for i in range(1000): v[0] = int(a) v[1] = int(b) v[2] = int(c) for i in range(len(a)): v[0] += int(a[i]) for i in range(len(b)): v[1] += int(b[i]) for i in range(len(a)): v[2] += int(c[i]) on...
class MovieTrackingCamera: distortion_model = None division_k1 = None division_k2 = None focal_length = None focal_length_pixels = None k1 = None k2 = None k3 = None pixel_aspect = None principal = None sensor_width = None units = None
class Movietrackingcamera: distortion_model = None division_k1 = None division_k2 = None focal_length = None focal_length_pixels = None k1 = None k2 = None k3 = None pixel_aspect = None principal = None sensor_width = None units = None
print("digite um numero para consultar seu intervalo") x = int(input()) if 0 <= x <= 25: print('Intervalo [0,25]') if 25 < x <= 50: print('Intervalo (25,50]') if 50 < x <= 75: print('Intervalo (50,75]') if 75 < x <= 100: print('Intervalo (75,100]') else: print('Fora de intervalo')
print('digite um numero para consultar seu intervalo') x = int(input()) if 0 <= x <= 25: print('Intervalo [0,25]') if 25 < x <= 50: print('Intervalo (25,50]') if 50 < x <= 75: print('Intervalo (50,75]') if 75 < x <= 100: print('Intervalo (75,100]') else: print('Fora de intervalo')
dbodydict = dict() # dtitle, dbody fdbody = open("sample_alldoc_fake_body.dict") while 1: line = fdbody.readline() if not line: break tks = line.strip().split(' ') dbodydict[tks[0]]=tks[1] fclean = open("sample_valid_cqexp.cleaned") fexp = open("sample_valid_cqbody.cleaned",'w') while 1: ...
dbodydict = dict() fdbody = open('sample_alldoc_fake_body.dict') while 1: line = fdbody.readline() if not line: break tks = line.strip().split(' ') dbodydict[tks[0]] = tks[1] fclean = open('sample_valid_cqexp.cleaned') fexp = open('sample_valid_cqbody.cleaned', 'w') while 1: line = fclean.re...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def viterbi(obs, states, start_p, trans_p, emit_p): V = [{}] # list of dictionaries for st in states: V[0][st] = {"prob": start_p[st] * emit_p[st][obs[0]], "prev": None} # Run Viterbi when t > 0 for t in range(1, len(obs)): V.append({}) ...
def viterbi(obs, states, start_p, trans_p, emit_p): v = [{}] for st in states: V[0][st] = {'prob': start_p[st] * emit_p[st][obs[0]], 'prev': None} for t in range(1, len(obs)): V.append({}) for st in states: max_tr_prob = max((V[t - 1][prev_st]['prob'] * trans_p[prev_st][s...
# username and password # import sys # import msvcrt # passwor = '' # while True: # x = msvcrt.getch() # if x == '\r': # break # sys.stdout.write('*') # passwor +=x # print '\n'+pass username= input ("enter your username: \n") password = input ("enter your password: \n") print (" you complet...
username = input('enter your username: \n') password = input('enter your password: \n') print(' you completed your rwgestration \n welcome to the access world') user = input('what is your user name? : \n') passw = input('what is your passsword? :\n') if username == user and password == passw: print('welcome to next...
customers = [ dict(id=1, total=200, coupon_code='F20'), dict(id=2, total=150, coupon_code='P30'), dict(id=3, total=100, coupon_code='P50'), dict(id=4, total=110, coupon_code='F15'), ] for customer in customers: code = customer['coupon_code'] if code == 'F20': customer['discount'] = 20.0...
customers = [dict(id=1, total=200, coupon_code='F20'), dict(id=2, total=150, coupon_code='P30'), dict(id=3, total=100, coupon_code='P50'), dict(id=4, total=110, coupon_code='F15')] for customer in customers: code = customer['coupon_code'] if code == 'F20': customer['discount'] = 20.0 elif code == 'F...
def count_substring(string, sub_string): counter = 0; while (string.find(sub_string) >= 0): counter += 1 string = string[string.find(sub_string) + 1:] return counter if __name__ == '__main__': string = input().strip() sub_string = input().strip() count = count_substring(strin...
def count_substring(string, sub_string): counter = 0 while string.find(sub_string) >= 0: counter += 1 string = string[string.find(sub_string) + 1:] return counter if __name__ == '__main__': string = input().strip() sub_string = input().strip() count = count_substring(string, sub_...
# # PySNMP MIB module ZYXEL-BRIDGE-CONTROL-PROTOCOL-TRANSPARENCY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-BRIDGE-CONTROL-PROTOCOL-TRANSPARENCY-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:49:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ...
a = int(input()) b = int(input()) c = int(input()) d = int(input()) if b == c and a in {8, 9} and d in {8, 9}: print("ignore") else: print("answer")
a = int(input()) b = int(input()) c = int(input()) d = int(input()) if b == c and a in {8, 9} and (d in {8, 9}): print('ignore') else: print('answer')
PREFERENCES = [ ['Delivery driver', 'Haifa', 'No experience', 'Flexible'], ['Web developer', 'Tel Aviv', '5+ years', 'Full-time'], ]
preferences = [['Delivery driver', 'Haifa', 'No experience', 'Flexible'], ['Web developer', 'Tel Aviv', '5+ years', 'Full-time']]
# is_prime(9); //Is a number Prime? # //H: 5 => True, 7 => True, 11 => True, 6 => False def is_prime(number): if(number < 2): return False # check if number is divisible by 2 to number - 1 for divisor in range(2,number): if number % divisor == 0: return False return True ...
def is_prime(number): if number < 2: return False for divisor in range(2, number): if number % divisor == 0: return False return True def sum_upto_n(number): sum = 0 for i in range(1, number + 1): sum = sum + i return sum def calculate_sum_of_divisors(number...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class HelloWorld(object): def __init__(self, id, name): self.idx = id self.namex = name def play(self): print('idx: {}, namex: {}', self.idx, self.namex) if __name__ == '__main__': HelloWorld(1, '12') print('hello world')
class Helloworld(object): def __init__(self, id, name): self.idx = id self.namex = name def play(self): print('idx: {}, namex: {}', self.idx, self.namex) if __name__ == '__main__': hello_world(1, '12') print('hello world')
#! n=int(input("Enter a number")) for i in range(1,n): print(i)
n = int(input('Enter a number')) for i in range(1, n): print(i)
#a stub module to have a group of functions class test_module_1(object): name = None def __init__(self, name): self.name= name def log(self, info): print('{}{}'.format('test_module_1: ',info)) def function_1(self,*args, **kwargs): self.log('args: '+'{}'.format(args)) sel...
class Test_Module_1(object): name = None def __init__(self, name): self.name = name def log(self, info): print('{}{}'.format('test_module_1: ', info)) def function_1(self, *args, **kwargs): self.log('args: ' + '{}'.format(args)) self.log('kwargs:') for k in kwa...
# -*- coding: utf-8 -*- # @Author: Damien FERRERE # @Date: 2018-05-22 21:14:37 # @Last Modified by: Damien FERRERE # @Last Modified time: 2018-05-22 21:16:10 class IPXRelaysConfig: 'IPX800 Relays configuration class' enabled_relays = [] # List of relays user want to control names_retrieved = False # indic...
class Ipxrelaysconfig: """IPX800 Relays configuration class""" enabled_relays = [] names_retrieved = False def __init__(self, enabled_relays): self.enabled_relays = enabled_relays class Ipxrelay: number = 0 name = '' _ipx = None def __init__(self, ipx, relay_no, name='', curre...
def onRequest(request, response, modules): response.send({ "urlParams": request.getQueryParams(), "bodyParams": request.getParams(), "headers": request.getHeaders(), "method": request.getMethod(), "path": request.getPath() })
def on_request(request, response, modules): response.send({'urlParams': request.getQueryParams(), 'bodyParams': request.getParams(), 'headers': request.getHeaders(), 'method': request.getMethod(), 'path': request.getPath()})
WEBSOCKET_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ" class NewDataEvent: def __init__(self, id, topic, payload, timestamp, qos): self._type = "data-sensor" self._id = id self._topic = topic self._payload = payload self._timestamp = timestamp self._qos = qos @...
websocket_datetime_format = '%Y-%m-%dT%H:%M:%S.%fZ' class Newdataevent: def __init__(self, id, topic, payload, timestamp, qos): self._type = 'data-sensor' self._id = id self._topic = topic self._payload = payload self._timestamp = timestamp self._qos = qos @pro...
a = int(input()) c = [] for i in range(a): b = [] for x in range(4): c = input().split()[-1][::-1].lower() for n in c: if n == "a" or n == "e" or n == "i" or n == "o" or n == "u": b.append(c[:c.index(n) + 1]) break if len(b) < x + 1: ...
a = int(input()) c = [] for i in range(a): b = [] for x in range(4): c = input().split()[-1][::-1].lower() for n in c: if n == 'a' or n == 'e' or n == 'i' or (n == 'o') or (n == 'u'): b.append(c[:c.index(n) + 1]) break if len(b) < x + 1: ...
def merge_sort(alist): print(f'Splitting {alist}') if len(alist) > 1: mid = len(alist) // 2 # slice operator is O(k), this can be avoided by passing start, end # indexes into merge sort left = alist[:mid] right = alist[mid:] # Assume list is sorted merge...
def merge_sort(alist): print(f'Splitting {alist}') if len(alist) > 1: mid = len(alist) // 2 left = alist[:mid] right = alist[mid:] merge_sort(left) merge_sort(right) i = 0 j = 0 k = 0 while i < len(left) and j < len(right): if l...
def main(): a,b = map(int,input().split()) ans = ["",0] h = ["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW","N"] a = (a*10 + 1125) // 2250 b /= 60 ans[0] = h[a] if 0 <= b and b < 0.25: ans[1] = 0 elif b < 1.55: ans[1] = 1 elif b < ...
def main(): (a, b) = map(int, input().split()) ans = ['', 0] h = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N'] a = (a * 10 + 1125) // 2250 b /= 60 ans[0] = h[a] if 0 <= b and b < 0.25: ans[1] = 0 elif b < 1.55: a...
# using classes class Wing(object): #NOTE use __slots__ to avoid unintended mistakes __slots__ = ['coordroot', 'coordtip', 'span', 'sweepdeg'] def __init__(self): self.coordroot = 2 self.coordtip = 1 self.span = 20 self.sweepdeg = 30 class Fuselage(object): #NOTE use __s...
class Wing(object): __slots__ = ['coordroot', 'coordtip', 'span', 'sweepdeg'] def __init__(self): self.coordroot = 2 self.coordtip = 1 self.span = 20 self.sweepdeg = 30 class Fuselage(object): __slots__ = ['radius', 'length'] def __init__(self): self.radius = 1...
word2int_en = { "animosity":10581, "tearing":6525, "blivet":33424, "fomentation":25039, "triennial":22152, "cybercrud":33456, "flower":2250, "tlingit":29988, "invade":9976, "lamps":4886, "watercress":22874, "than":164, "woozy":28419, "lice":16885, "chirp":16036, "gracefulness":17688, "sundew":28491, "kenyan":27735, "re...
word2int_en = {'animosity': 10581, 'tearing': 6525, 'blivet': 33424, 'fomentation': 25039, 'triennial': 22152, 'cybercrud': 33456, 'flower': 2250, 'tlingit': 29988, 'invade': 9976, 'lamps': 4886, 'watercress': 22874, 'than': 164, 'woozy': 28419, 'lice': 16885, 'chirp': 16036, 'gracefulness': 17688, 'sundew': 28491, 'ke...
def isHappy(n): if len(str(n))==1 and n==1: return True seen=set() while n!=1: num = str(n) n=0 for i in range(len(num)): n +=int(num[i])**2 if n not in seen: seen.add(n) else: return False return True i...
def is_happy(n): if len(str(n)) == 1 and n == 1: return True seen = set() while n != 1: num = str(n) n = 0 for i in range(len(num)): n += int(num[i]) ** 2 if n not in seen: seen.add(n) else: return False return True if _...
# database class to manage all database related info class database: # used to setup variables with self to be used in the class def __init__(self): # student accounts self.students = [ ['anthony', 'rangers20', False, False], ["stephanie",...
class Database: def __init__(self): self.students = [['anthony', 'rangers20', False, False], ['stephanie', '2kool4school', False, False]] self.teachers = [['jack', 'JacK', True, False], ['ruth', 'iloveu', True, False], ['max', 'p@ssword!', True, False]] self.supervisors = [['principle', 'me...
entity_to_index = {} summary_to_entity = {} summary_to_entity['Shipping Date'] = 'shipped' summary_to_entity['Results Received/ NRC-PBI LIMS Request #'] = 'received' summary_to_entity['Project'] = 'project' summary_to_entity['SFF'] = 'sff' summary_to_entity['Mid Set'] = 'mid_set' summary_to_entity['Plate'] = 'plate' s...
entity_to_index = {} summary_to_entity = {} summary_to_entity['Shipping Date'] = 'shipped' summary_to_entity['Results Received/ NRC-PBI LIMS Request #'] = 'received' summary_to_entity['Project'] = 'project' summary_to_entity['SFF'] = 'sff' summary_to_entity['Mid Set'] = 'mid_set' summary_to_entity['Plate'] = 'plate' su...
class DirectiveImporter(): def extract(): pass
class Directiveimporter: def extract(): pass
# -*- coding: utf-8 -*- X1, Y1 = map(float, input().split()) X2, Y2 = map(float, input().split()) DISTANCE = ( (X2 - X1)**2 + (Y2 - Y1)**2 ) ** (0.5) print("%.4f" % (DISTANCE))
(x1, y1) = map(float, input().split()) (x2, y2) = map(float, input().split()) distance = ((X2 - X1) ** 2 + (Y2 - Y1) ** 2) ** 0.5 print('%.4f' % DISTANCE)
class Solution: def fizzBuzz(self, n: int) -> list: res = [] maps = {3: "Fizz", 5: "Buzz"} for i in range(1, n + 1): ans = "" for k, v in maps.items(): if i % k == 0: ans += v if not ans: ans = str(i) ...
class Solution: def fizz_buzz(self, n: int) -> list: res = [] maps = {3: 'Fizz', 5: 'Buzz'} for i in range(1, n + 1): ans = '' for (k, v) in maps.items(): if i % k == 0: ans += v if not ans: ans = str(i)...
''' Questions 1. is modulus, add, subtract, square root allowed? Observations 1. define what it means to be a power of 4 - any number of 4s must be multiplied to get that number 2. We do not need to know how many times we need to multiple 4 to get number. Only need to return true or False 3. Multiplying by 4 is the s...
""" Questions 1. is modulus, add, subtract, square root allowed? Observations 1. define what it means to be a power of 4 - any number of 4s must be multiplied to get that number 2. We do not need to know how many times we need to multiple 4 to get number. Only need to return true or False 3. Multiplying by 4 is the s...
# http://www.codewars.com/kata/5500d54c2ebe0a8e8a0003fd/ def mygcd(x, y): remainder = max(x, y) % min(x, y) if remainder == 0: return min(x, y) else: return mygcd(min(x, y), remainder)
def mygcd(x, y): remainder = max(x, y) % min(x, y) if remainder == 0: return min(x, y) else: return mygcd(min(x, y), remainder)
# Copyright 2016 Nidium Inc. All rights reserved. # Use of this source code is governed by a MIT license # that can be found in the LICENSE file. { 'targets': [{ 'target_name': 'nidium-server', 'type': 'executable', 'product_dir': '<(nidium_exec_path)', 'dependencies': [ ...
{'targets': [{'target_name': 'nidium-server', 'type': 'executable', 'product_dir': '<(nidium_exec_path)', 'dependencies': ['libnidiumcore.gyp:*', '<(nidium_network_path)/gyp/network.gyp:*'], 'include_dirs': ['<(third_party_path)/linenoise/', '<(nidium_src_path)'], 'cflags': ['-Wno-expansion-to-defined'], 'sources': ['<...
def print_accuracy(cur_s, cur_ans): cur_true = cur_ans[cur_s] == 1 G_sub = G.subgraph(to_double_format(cur_ans[cur_true].index)) print("components in DESMAN subgraph:", nx.number_weakly_connected_components(G_sub)) right_answers = df_ref[cur_s] == cur_ans[cur_s] print("Accuracy on all edges: %.2f"...
def print_accuracy(cur_s, cur_ans): cur_true = cur_ans[cur_s] == 1 g_sub = G.subgraph(to_double_format(cur_ans[cur_true].index)) print('components in DESMAN subgraph:', nx.number_weakly_connected_components(G_sub)) right_answers = df_ref[cur_s] == cur_ans[cur_s] print('Accuracy on all edges: %.2f' ...
#!/usr/bin/env python3 grid = [[1]] def iter_ring(size): x = size - 1 y = size - 2 while y > 0: yield x, y y -= 1 while x > 0: yield x, y x -= 1 while y < size - 1: yield x, y y += 1 while x < size - 1: yield x, y x += 1 yiel...
grid = [[1]] def iter_ring(size): x = size - 1 y = size - 2 while y > 0: yield (x, y) y -= 1 while x > 0: yield (x, y) x -= 1 while y < size - 1: yield (x, y) y += 1 while x < size - 1: yield (x, y) x += 1 yield (x, y) def ite...
REGIONS = ( (1, "Northeast"), (2, "Midwest"), (3, "South"), (4, "West"), (9, "Puerto Rico and the Island Areas"), ) DIVISIONS = ( (0, "Puerto Rico and the Island Areas"), (1, "New England"), (2, "Middle Atlantic"), (3, "East North Central"), (4, "West North Central"), (5, "...
regions = ((1, 'Northeast'), (2, 'Midwest'), (3, 'South'), (4, 'West'), (9, 'Puerto Rico and the Island Areas')) divisions = ((0, 'Puerto Rico and the Island Areas'), (1, 'New England'), (2, 'Middle Atlantic'), (3, 'East North Central'), (4, 'West North Central'), (5, 'South Atlantic'), (6, 'East South Central'), (7, '...
def foo(x,y=10): z = x * y return z print(foo(10))
def foo(x, y=10): z = x * y return z print(foo(10))
img_enhanc_alg = "" input_img = [] with open("input/day20.txt") as inp: flag = True for vrst in inp: if flag: flag = False img_enhanc_alg = vrst[:-1] elif vrst == "\n": continue else: input_img.append(list(vrst[:-1])) def bin_to_int(b): ...
img_enhanc_alg = '' input_img = [] with open('input/day20.txt') as inp: flag = True for vrst in inp: if flag: flag = False img_enhanc_alg = vrst[:-1] elif vrst == '\n': continue else: input_img.append(list(vrst[:-1])) def bin_to_int(b): ...
# # PySNMP MIB module COLUBRIS-SYSTEM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/COLUBRIS-SYSTEM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:10:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
# todo: some way to automate/automatically update this algo = dict([ (0, 'Scrypt'), (1, 'SHA256'), (2, 'ScryptNf'), (3, 'X11'), (4, 'X13'), (5, 'Keccak'), (6, 'X15'), (7, 'Nist5'), (8, 'NeoScrypt'), (9, 'Lyra2RE'), (10, 'WhirlpoolX'), (11, 'Qubit'), (1...
algo = dict([(0, 'Scrypt'), (1, 'SHA256'), (2, 'ScryptNf'), (3, 'X11'), (4, 'X13'), (5, 'Keccak'), (6, 'X15'), (7, 'Nist5'), (8, 'NeoScrypt'), (9, 'Lyra2RE'), (10, 'WhirlpoolX'), (11, 'Qubit'), (12, 'Quark'), (13, 'Axiom'), (14, 'Lyra2REv2'), (15, 'ScryptJaneNf16'), (16, 'Blake256r8'), (17, 'Blake256r14'), (18, 'Blake2...
def func(a=None, b=None, /): pass func(None, 2) func()
def func(a=None, b=None, /): pass func(None, 2) func()
anchor = Input((60, 60, 3), name='anchor') positive = Input((60, 60, 3), name='positive') negative = Input((60, 60, 3), name='negative') a = shared_conv2(anchor) p = shared_conv2(positive) n = shared_conv2(negative) pos_sim = Dot(axes=-1, normalize=True)([a,p]) neg_sim = Dot(axes=-1, normalize=True)([a,n]) loss = La...
anchor = input((60, 60, 3), name='anchor') positive = input((60, 60, 3), name='positive') negative = input((60, 60, 3), name='negative') a = shared_conv2(anchor) p = shared_conv2(positive) n = shared_conv2(negative) pos_sim = dot(axes=-1, normalize=True)([a, p]) neg_sim = dot(axes=-1, normalize=True)([a, n]) loss = lam...
# Moving zeros to the end def move_zeros(arr): zero = 0 for elements in range(len(arr)): if arr[elements] != 0 or arr[elements] is False: arr[elements], arr[zero] = arr[zero], arr[elements] zero += 1 return arr x = [0, 1, 0, 3, False, 12, 5, 7, 0 ,12, 2, 3, 4] print(move_z...
def move_zeros(arr): zero = 0 for elements in range(len(arr)): if arr[elements] != 0 or arr[elements] is False: (arr[elements], arr[zero]) = (arr[zero], arr[elements]) zero += 1 return arr x = [0, 1, 0, 3, False, 12, 5, 7, 0, 12, 2, 3, 4] print(move_zeros(x))
class Question: def __init__(self,prompt,answer): self.prompt = prompt self.answer = answer
class Question: def __init__(self, prompt, answer): self.prompt = prompt self.answer = answer
class Singleton(object): def __new__(cls): if not hasattr(cls, 'instance') or not cls.instance: cls.instance = super().__new__(cls) return cls.instance obj1 = Singleton() obj2 = Singleton() print(obj1 is obj2) # True print(obj1 == obj2) # True print(type(obj1) == type(ob...
class Singleton(object): def __new__(cls): if not hasattr(cls, 'instance') or not cls.instance: cls.instance = super().__new__(cls) return cls.instance obj1 = singleton() obj2 = singleton() print(obj1 is obj2) print(obj1 == obj2) print(type(obj1) == type(obj2)) print(id(obj1) == id(obj2...
def magic(): return 'foo' # OK, returns u''' unicode() # Not OK, no encoding supplied unicode('foo') # Also not OK, no encoding supplied unicode('foo' + 'bar') # OK, positional encoding supplied unicode('foo', 'utf-8') # OK, positional encoding and error argument supplied unicode('foo', 'utf-8', 'ignore') # N...
def magic(): return 'foo' unicode() unicode('foo') unicode('foo' + 'bar') unicode('foo', 'utf-8') unicode('foo', 'utf-8', 'ignore') unicode(magic()) unicode(1, 2, 3, 4) args = ['utf-8'] unicode('foo', *ARGS) kwargs = {'encoding': 'utf-8'} unicode('foo', **KWARGS)
class Script: @staticmethod def main(): crime_rates = [749, 371, 828, 503, 1379, 425, 408, 542, 1405, 835, 1288, 647, 974, 1383, 455, 658, 675, 615, 2122, 423, 362, 587, 543, 563, 168, 992, 1185, 617, 734, 1263, 784, 352, 397, 575, 481, 598, 1750, 399, 1172, 1294, 992, 522, 1216, 815, 639, 1154, 1993, 919, 594, 11...
class Script: @staticmethod def main(): crime_rates = [749, 371, 828, 503, 1379, 425, 408, 542, 1405, 835, 1288, 647, 974, 1383, 455, 658, 675, 615, 2122, 423, 362, 587, 543, 563, 168, 992, 1185, 617, 734, 1263, 784, 352, 397, 575, 481, 598, 1750, 399, 1172, 1294, 992, 522, 1216, 815, 639, 1154, 1993, ...
#__getitem__ not implemented yet #a = bytearray(b'abc') #assert a[0] == b'a' #assert a[1] == b'b' assert len(bytearray([1,2,3])) == 3 assert bytearray(b'1a23').isalnum() assert not bytearray(b'1%a23').isalnum() assert bytearray(b'abc').isalpha() assert not bytearray(b'abc1').isalpha() # travis doesn't like this #as...
assert len(bytearray([1, 2, 3])) == 3 assert bytearray(b'1a23').isalnum() assert not bytearray(b'1%a23').isalnum() assert bytearray(b'abc').isalpha() assert not bytearray(b'abc1').isalpha() assert bytearray(b'1234567890').isdigit() assert not bytearray(b'12ab').isdigit() assert bytearray(b'lower').islower() assert not ...
N = int(input()) W = list(map(int, input().split())) diff = [0 for i in range(N-1)] for i in range(N-1): S1 = sum(W[:i+1]) S2 = sum(W[i+1:]) diff[i] = abs(S1 - S2) print(min(diff))
n = int(input()) w = list(map(int, input().split())) diff = [0 for i in range(N - 1)] for i in range(N - 1): s1 = sum(W[:i + 1]) s2 = sum(W[i + 1:]) diff[i] = abs(S1 - S2) print(min(diff))
# coding=utf-8 # *** WARNING: this file was generated by crd2pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** SNAKE_TO_CAMEL_CASE_TABLE = { "api_version": "apiVersion", "container_id": "containerID", "container_statuses": "containerStatuses", "ephemeral_conta...
snake_to_camel_case_table = {'api_version': 'apiVersion', 'container_id': 'containerID', 'container_statuses': 'containerStatuses', 'ephemeral_container_statuses': 'ephemeralContainerStatuses', 'exit_code': 'exitCode', 'finished_at': 'finishedAt', 'host_ip': 'hostIP', 'image_id': 'imageID', 'init_container_statuses': '...
num, rotation = map(int, input().split()) arr = list(map(str, input().split())) if rotation < 0: value = abs(rotation) arr = arr[value:] + arr[:value] if rotation > 0: value = abs(rotation) arr = [arr[(i - value) % len(arr)] for i, x in enumerate(arr)] arr2 = [int(i) for i in arr] for i in arr2: ...
(num, rotation) = map(int, input().split()) arr = list(map(str, input().split())) if rotation < 0: value = abs(rotation) arr = arr[value:] + arr[:value] if rotation > 0: value = abs(rotation) arr = [arr[(i - value) % len(arr)] for (i, x) in enumerate(arr)] arr2 = [int(i) for i in arr] for i in arr2: ...
class MyClass: def func3(self): pass def func2(self, a): a() def func1(self, a, b): a(b) a = MyClass() a.func1(a.func2, a.func3)
class Myclass: def func3(self): pass def func2(self, a): a() def func1(self, a, b): a(b) a = my_class() a.func1(a.func2, a.func3)
def main(): my_list = [1,"hello",True,4.5] my_dict = {'fistname' : 'luis', 'lastname':'martinez'} super_list = [ {'firstname' : 'luis', 'lastname':'martinez'}, {'firstname' : 'lizette', 'lastname':'martinez'}, {'firstname' : 'dalia', 'lastname':'martinez'} ] for i in super_...
def main(): my_list = [1, 'hello', True, 4.5] my_dict = {'fistname': 'luis', 'lastname': 'martinez'} super_list = [{'firstname': 'luis', 'lastname': 'martinez'}, {'firstname': 'lizette', 'lastname': 'martinez'}, {'firstname': 'dalia', 'lastname': 'martinez'}] for i in super_list: for (key, value...
with open('../input.txt','rt') as f: cur_line = 0 cur_shift = 0 answ = 0 tree_map = list(map(lambda line: line.rstrip('\n'), f.readlines())) for line in tree_map: if line[cur_shift%len(tree_map[0])]=='#': answ+=1 cur_line+=1 cur_shift+=3 print(answ)
with open('../input.txt', 'rt') as f: cur_line = 0 cur_shift = 0 answ = 0 tree_map = list(map(lambda line: line.rstrip('\n'), f.readlines())) for line in tree_map: if line[cur_shift % len(tree_map[0])] == '#': answ += 1 cur_line += 1 cur_shift += 3 print(answ)
# Perform a 75% training and 25% test data split X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=0) # Fit the random forest model to the training data rf = RandomForestClassifier(random_state=0) rf.fit(X_train, y_train) # Calculate the accuracy acc = accuracy_score(y_test, rf.pr...
(x_train, x_test, y_train, y_test) = train_test_split(X, y, test_size=0.25, random_state=0) rf = random_forest_classifier(random_state=0) rf.fit(X_train, y_train) acc = accuracy_score(y_test, rf.predict(X_test)) print(dict(zip(X.columns, rf.feature_importances_.round(2)))) print('{0:.1%} accuracy on test set.'.format(a...
''' In this module, we implement a function which gets the intersection of two sorted arrays. ''' def intersection_sorted_arrays(arr_1, arr_2): ''' Return the intersection of two sorted arrays ''' result = [] i,j = 0,0 while i < len(arr_1) and j < len(arr_2): if arr_1[i] == arr_2[j]: result.append(arr_1[...
""" In this module, we implement a function which gets the intersection of two sorted arrays. """ def intersection_sorted_arrays(arr_1, arr_2): """ Return the intersection of two sorted arrays """ result = [] (i, j) = (0, 0) while i < len(arr_1) and j < len(arr_2): if arr_1[i] == arr_2[j]:...
def greet(): print("Hello") greet() print("------") def add_sub(x, y): c = x + y d = x - y return c, d r1, r2 = add_sub(4, 5) print(r1, r2) print("------") def sum(**three): for i, j in three.items(): print(i, j) sum(Name="'Jatin'", Age=19, Address="Delhi") # def odd_even(odd...
def greet(): print('Hello') greet() print('------') def add_sub(x, y): c = x + y d = x - y return (c, d) (r1, r2) = add_sub(4, 5) print(r1, r2) print('------') def sum(**three): for (i, j) in three.items(): print(i, j) sum(Name="'Jatin'", Age=19, Address='Delhi') x = int(input('Enter a num...
FSenterSecretTextPos = (0, 0, -0.25) FSgotSecretPos = (0, 0, 0.46999999999999997) FSgetSecretButton = 0.059999999999999998 FSnextText = 1.0 FSgetSecret = (1.55, 1, 1) FSok1 = (1.55, 1, 1) FSok2 = (0.59999999999999998, 1, 1) FScancel = (0.59999999999999998, 1, 1) LTPDdirectButtonYesText = 0.050000000000000003 LTPDdirect...
f_senter_secret_text_pos = (0, 0, -0.25) f_sgot_secret_pos = (0, 0, 0.47) f_sget_secret_button = 0.06 f_snext_text = 1.0 f_sget_secret = (1.55, 1, 1) f_sok1 = (1.55, 1, 1) f_sok2 = (0.6, 1, 1) f_scancel = (0.6, 1, 1) ltp_ddirect_button_yes_text = 0.05 ltp_ddirect_button_no_text = 0.05 ltp_ddirect_frame_text = 0.06 sc_o...
n=int(input("enter the number")) x=[] a,b=0,1 x.append(a) x.append(b) if n==0: print(0) else: for i in range(2,n): c=a+b a=b b=c x.append(c) print(x)
n = int(input('enter the number')) x = [] (a, b) = (0, 1) x.append(a) x.append(b) if n == 0: print(0) else: for i in range(2, n): c = a + b a = b b = c x.append(c) print(x)
# Space: O(1) # Time: O(n) class Solution: def merge(self, intervals): length = len(intervals) if length <= 1: return intervals intervals.sort(key=lambda x: (x[0], x[1])) res = [] for i in range(length): if len(res) == 0: res.append(intervals[i]) ...
class Solution: def merge(self, intervals): length = len(intervals) if length <= 1: return intervals intervals.sort(key=lambda x: (x[0], x[1])) res = [] for i in range(length): if len(res) == 0: res.append(intervals[i]) eli...
x = 0 while x <= 10: print(f" 6 x {x} = {6*x}") x = x + 1
x = 0 while x <= 10: print(f' 6 x {x} = {6 * x}') x = x + 1
validSettings = { "password": ".*", "cache": "^\d+$", "allow-force": "^(true|false)$", "allow-user-unregistered": "^(true|false)$", "duration": "^(year|eternity)$", "dark-mode-default": "^(true|false)$", "show-commit-mail": "^(true|false)$" }
valid_settings = {'password': '.*', 'cache': '^\\d+$', 'allow-force': '^(true|false)$', 'allow-user-unregistered': '^(true|false)$', 'duration': '^(year|eternity)$', 'dark-mode-default': '^(true|false)$', 'show-commit-mail': '^(true|false)$'}
n = int(input()) for i in range(n): (x, y) = map(int, input().split(' ')) soma = 0 if x % 2 == 0: x += 1 j = 0 while j < y * 2: soma += x + j j += 2 print(soma)
n = int(input()) for i in range(n): (x, y) = map(int, input().split(' ')) soma = 0 if x % 2 == 0: x += 1 j = 0 while j < y * 2: soma += x + j j += 2 print(soma)
scores = [ 9.5, 8.5, 7.0, 9.5, 10, 6.5, 7.5, 9.0, 10 ] sum = 0 for score in scores: sum += score average = sum/(len(scores)) print('Average Scores: ' + str(average))
scores = [9.5, 8.5, 7.0, 9.5, 10, 6.5, 7.5, 9.0, 10] sum = 0 for score in scores: sum += score average = sum / len(scores) print('Average Scores: ' + str(average))
numero = 4 fracao = 6.1 online = False texto = "Armando" if numero == 5: print("Hello 5") elif numero == 4 or online: print("Hello 4") else: print("Final") print("Ola estou online" if online else "Ola estou offline")
numero = 4 fracao = 6.1 online = False texto = 'Armando' if numero == 5: print('Hello 5') elif numero == 4 or online: print('Hello 4') else: print('Final') print('Ola estou online' if online else 'Ola estou offline')
dna_seq1 = 'ACCT GATC' a_count = 0 c_count = 0 g_count = 0 t_count = 0 valid_count = 0 for nucl in dna_seq1: if nucl == 'G': g_count += 1 valid_count += 1 elif nucl == 'C': c_count += 1 valid_count += 1 elif nucl == 'A': a_count += 1 valid_count += 1 el...
dna_seq1 = 'ACCT GATC' a_count = 0 c_count = 0 g_count = 0 t_count = 0 valid_count = 0 for nucl in dna_seq1: if nucl == 'G': g_count += 1 valid_count += 1 elif nucl == 'C': c_count += 1 valid_count += 1 elif nucl == 'A': a_count += 1 valid_count += 1 elif...
def min_max_sum_function(sequence): sequence_int = list(map(int, sequence)) min_value = min(sequence_int) max_value = max(sequence_int) sum_value = sum(sequence_int) print (f"The minimum number is {min_value}") print(f"The maximum number is {max_value}") print(f"The sum number is: {sum_value...
def min_max_sum_function(sequence): sequence_int = list(map(int, sequence)) min_value = min(sequence_int) max_value = max(sequence_int) sum_value = sum(sequence_int) print(f'The minimum number is {min_value}') print(f'The maximum number is {max_value}') print(f'The sum number is: {sum_value}...
##rotational constant in ground state in wavenumbers B_dict = {'O2': 1.4297, 'N2': 1.99, 'N2O': 0.4190, 'CO2': 0.3902, 'D2': 30.442, 'OCS': .2039} ##Centrifugal Distortion in ground state in wavenumbers D_dict = {'O2': 4.839e-6, 'N2': 5.7e-6, 'N2O': 0.176e-6, 'CO2': 0.135e-6, 'D2': 0, 'OCS': 0...
b_dict = {'O2': 1.4297, 'N2': 1.99, 'N2O': 0.419, 'CO2': 0.3902, 'D2': 30.442, 'OCS': 0.2039} d_dict = {'O2': 4.839e-06, 'N2': 5.7e-06, 'N2O': 1.76e-07, 'CO2': 1.35e-07, 'D2': 0, 'OCS': 0} d_alpha_dict = {'O2': 1.1e-30, 'N2': 9.3e-31, 'N2O': 2.8e-30, 'CO2': 2.109e-30, 'D2': 2.82e-31, 'OCS': 4.1e-30} jmax_dict = {'O2': ...
with open("haiku.txt", "a") as file: file.write("APPENDING LATER!") with open("haiku.txt") as file: data = file.read() print(data) with open("haiku.txt", "r+") as file: file.write("\nADDED USING r+") file.seek(20) file.write(":)") data = file.read() print(data)
with open('haiku.txt', 'a') as file: file.write('APPENDING LATER!') with open('haiku.txt') as file: data = file.read() print(data) with open('haiku.txt', 'r+') as file: file.write('\nADDED USING r+') file.seek(20) file.write(':)') data = file.read() print(data)
GOOD_MORNING="Good Morning, %s" GOOD_AFTERNOON="Good Afternoon, %s" GOOD_EVENING="Good Evening, %s" DEFAULT_MESSAGE="Hello, World! %s" MESSAGE_REFRESH_RATE = 3600000 # 1 hour MESSAGE_TEXT_SIZE = 70
good_morning = 'Good Morning, %s' good_afternoon = 'Good Afternoon, %s' good_evening = 'Good Evening, %s' default_message = 'Hello, World! %s' message_refresh_rate = 3600000 message_text_size = 70
# This is created from Notebook++ print("Hello, I am SKL") print("Welcome to my learning space")
print('Hello, I am SKL') print('Welcome to my learning space')
#Reading lines from file and putting in a list contents = [] for line in open('rosalind_ini5.txt', 'r').readlines(): contents.append(line.strip('\n')) #Printing the even numbered lines, starting by one for i in range(1, len(contents), 2): print(contents[i])
contents = [] for line in open('rosalind_ini5.txt', 'r').readlines(): contents.append(line.strip('\n')) for i in range(1, len(contents), 2): print(contents[i])
class BaseUrlNotDefined(Exception): pass class InvalidCurrencyCode(Exception): pass class InvalidDate(Exception): pass class InvalidAmount(Exception): pass class APICallError(Exception): pass class HelperNotDefined(Exception): pass
class Baseurlnotdefined(Exception): pass class Invalidcurrencycode(Exception): pass class Invaliddate(Exception): pass class Invalidamount(Exception): pass class Apicallerror(Exception): pass class Helpernotdefined(Exception): pass
## Escreva um programa que converta uma temperatura digitando em graus Celsius e converta para graus Fahrenheit.## c = float(input('Informe a temperatura em C:')) f = 9 * c / 5 +32 print('A temperatura em {}C corresponde a {}F!'.format(c,f))
c = float(input('Informe a temperatura em C:')) f = 9 * c / 5 + 32 print('A temperatura em {}C corresponde a {}F!'.format(c, f))
# Copyright (c) 2018, EPFL/Human Brain Project PCO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
class Pagination(object): def __init__(self, start_from: int=0, size: int=50): self.start_from = start_from self.size = size class Stage(str): in_progress = 'IN_PROGRESS' released = 'RELEASED' class Responseconfiguration(object): def __init__(self, return_payload=True, return_permiss...
def iguais (l1,l2): same=0 for i in range (len(l1)): if l1[i]==l2[i]: same += 1 return same testea=[1,5,6,3,2,4,8,9,6,5,3,7,5,6,4,8,3,2,5,6,4,5,4,8,9,9] testeb=[5,4,6,9,8,7,5,5,3,2,1,4,6,5,7,8,9,6,3,2,1,4,5,6,9,8] print(iguais(testea,testeb))
def iguais(l1, l2): same = 0 for i in range(len(l1)): if l1[i] == l2[i]: same += 1 return same testea = [1, 5, 6, 3, 2, 4, 8, 9, 6, 5, 3, 7, 5, 6, 4, 8, 3, 2, 5, 6, 4, 5, 4, 8, 9, 9] testeb = [5, 4, 6, 9, 8, 7, 5, 5, 3, 2, 1, 4, 6, 5, 7, 8, 9, 6, 3, 2, 1, 4, 5, 6, 9, 8] print(iguais(test...
#!/usr/bin/env python3 a = int(input()) b = int(input()) if a // 2 == b or (3 * a) + 1 == b: print("yes") else: print("no")
a = int(input()) b = int(input()) if a // 2 == b or 3 * a + 1 == b: print('yes') else: print('no')
class Cell(): def __init__(self): self.touched = False self.has_mine = False self.marked = False self.value = 0 def _place_mine(self): self.has_mine = True def touch(self): if not self.marked: self.touched = True return self.has_mine ...
class Cell: def __init__(self): self.touched = False self.has_mine = False self.marked = False self.value = 0 def _place_mine(self): self.has_mine = True def touch(self): if not self.marked: self.touched = True return self.has_mine ...
# # PySNMP MIB module RUCKUS-VF2825-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RUCKUS-VF2825-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:50:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
# Created by MechAviv # ID :: [865090001] # Commerci Republic : Berry if sm.hasQuest(17613): # [Commerci Republic] The Minister's Son sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.setSpeakerID(9390241) sm.rem...
if sm.hasQuest(17613): sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendNext('Hey! Keep your paws away from...
class Solution: def totalMoney(self, n: int) -> int: s, m, p, t = 0, 0, 0, 0 while t < n: if t % 7 == 0: m += 1 s += m p = m else: p += 1 s += p t += 1 return s
class Solution: def total_money(self, n: int) -> int: (s, m, p, t) = (0, 0, 0, 0) while t < n: if t % 7 == 0: m += 1 s += m p = m else: p += 1 s += p t += 1 return s
SIG_START_DEFAULT = 0 SIG_UNDEF = 'undefined' class Signal(object): def __init__(self, name, start_state=None): self.name = name if start_state is not None: self.state = start_state else: self.state = SIG_START_DEFAULT self.previous = self.state self...
sig_start_default = 0 sig_undef = 'undefined' class Signal(object): def __init__(self, name, start_state=None): self.name = name if start_state is not None: self.state = start_state else: self.state = SIG_START_DEFAULT self.previous = self.state self...
# # PySNMP MIB module DE-OPT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DE-OPT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:21:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ...
# Ingredient Adjuster # Ask user how many cookies he or she wants cookie = int(input("Enter the amount of cookies you want: ")) sugar = 1.5 oil = 1 pounder = 2.75 print(sugar * cookie, ' gr. sugar.\n', oil * cookie, ' gr. butter.\n', pounder * cookie, ' gr. flour.', sep="")
cookie = int(input('Enter the amount of cookies you want: ')) sugar = 1.5 oil = 1 pounder = 2.75 print(sugar * cookie, ' gr. sugar.\n', oil * cookie, ' gr. butter.\n', pounder * cookie, ' gr. flour.', sep='')
# Advent of Code 2021, Day 17 # # Simple projectile simulation, with search for # velocities that achieve highest position, and total # number of possible velocity values that reach target # area; just used a simple grid search. # # AK, 17/12/2021 # Target area (x range and y range) T = ((20,30), (-10, -5)) # Samp...
t = ((20, 30), (-10, -5)) t = ((192, 251), (-89, -59)) def within_target(x, y): return x >= T[0][0] and x <= T[0][1] and (y >= T[1][0]) and (y <= T[1][1]) def simulate(xv, yv): x = y = 0 highest = -99999 hit_target = False iter = 0 while iter < 300: iter += 1 x += xv y ...
class Person(object): def __init__(self, name, age): self.name=name self.age=age def get_person(self,): return "Hi" print("hi")
class Person(object): def __init__(self, name, age): self.name = name self.age = age def get_person(self): return 'Hi' print('hi')
class Book: def __init__(self, title, price, author): self.title = title self.author = author self.price = price def __eq__(self, other): if not isinstance(other,Book): raise ValueError("Couldn't compare book to non-book") return (self.title == other.title an...
class Book: def __init__(self, title, price, author): self.title = title self.author = author self.price = price def __eq__(self, other): if not isinstance(other, Book): raise value_error("Couldn't compare book to non-book") return self.title == other.title ...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012, Piston Cloud Computing, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
def validate(filter, value): return FILTER_FUNCTIONS.get(filter, lambda v: True)(value) def validate_int_in_range(min=0, max=None): def _validator(v): try: if max is None: return min <= int(v) return min <= int(v) <= max except ValueError: re...
''' Example 1: Input: N = 5, arr = {1, 2, 3, 2, 1} Output: 3 Explaination: Only the number 3 is single. Example 2: Input: N = 11, arr = {1, 2, 3, 5, 3, 2, 1, 4, 5, 6, 6} Output: 4 Explaination: 4 is the only single. ''' class Solution: def findSingle(self, N, arr): # code here m...
""" Example 1: Input: N = 5, arr = {1, 2, 3, 2, 1} Output: 3 Explaination: Only the number 3 is single. Example 2: Input: N = 11, arr = {1, 2, 3, 5, 3, 2, 1, 4, 5, 6, 6} Output: 4 Explaination: 4 is the only single. """ class Solution: def find_single(self, N, arr): m = 0 for i...
class RecordNotFound(Exception): pass class InvalidLEI(Exception): pass class InvalidISIN(Exception): pass class NotFound(Exception): pass
class Recordnotfound(Exception): pass class Invalidlei(Exception): pass class Invalidisin(Exception): pass class Notfound(Exception): pass
N=int(input("Ingresa un numero base pls:")) M=int(input("Ingresa una potencia pls:")) print("LOS RESULTADOS SON:") for i in range(0,M+1): print(f"{N}^{i} = " + str(N**i))
n = int(input('Ingresa un numero base pls:')) m = int(input('Ingresa una potencia pls:')) print('LOS RESULTADOS SON:') for i in range(0, M + 1): print(f'{N}^{i} = ' + str(N ** i))
def main(): print("Please enter filename:") filename = input() f = open('..\\src\\main\\resources\\assets\\forbidden\\models\\item\\' + filename + '.json', mode='xt') f.write('{\n') f.write(' "parent": "forbidden:item/base_item",\n') f.write(' "textures": {\n') f.write(' "layer0": "for...
def main(): print('Please enter filename:') filename = input() f = open('..\\src\\main\\resources\\assets\\forbidden\\models\\item\\' + filename + '.json', mode='xt') f.write('{\n') f.write(' "parent": "forbidden:item/base_item",\n') f.write(' "textures": {\n') f.write(' "layer0": "forb...