content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def lambda_handler(event): try: first_num = event["queryStringParameters"]["firstNum"] except KeyError: first_num = 0 try: second_num = event["queryStringParameters"]["secondNum"] except KeyError: second_num = 0 try: operation_type = event["queryStringParame...
def lambda_handler(event): try: first_num = event['queryStringParameters']['firstNum'] except KeyError: first_num = 0 try: second_num = event['queryStringParameters']['secondNum'] except KeyError: second_num = 0 try: operation_type = event['queryStringParamete...
input1 = int(input("Enter the first number: ")) input2 = int(input("Enter the second number: ")) input3 = int(input("Enter the third number: ")) input4 = int(input("Enter the fourth number: ")) input5 = int(input("Enter the fifth number: ")) tuple_num = [] tuple_num.append(input1) tuple_num.append(input2) tuple_nu...
input1 = int(input('Enter the first number: ')) input2 = int(input('Enter the second number: ')) input3 = int(input('Enter the third number: ')) input4 = int(input('Enter the fourth number: ')) input5 = int(input('Enter the fifth number: ')) tuple_num = [] tuple_num.append(input1) tuple_num.append(input2) tuple_nu...
#Longest Common Prefix in python #Implementation of python program to find the longest common prefix amongst the given list of strings. #If there is no common prefix then returning 0. #define the function to evaluate the longest common prefix def longestCommonPrefix(s): p = '' #declare an empty s...
def longest_common_prefix(s): p = '' for i in range(len(min(s, key=len))): f = s[0][i] for j in s[1:]: if j[i] != f: return p p += f return p n = int(input('Enter the number of names in list for input:')) print('Enter the Strings:') s = [input() for i in r...
#!/usr/bin/env python P = int(input()) for _ in range(P): N, n, m = [int(i) for i in input().split()] print(f"{N} {(n - m) * m + 1}")
p = int(input()) for _ in range(P): (n, n, m) = [int(i) for i in input().split()] print(f'{N} {(n - m) * m + 1}')
def handler(event, context): return { "statusCode": 302, "headers": { "Location": "https://www.nhsx.nhs.uk/covid-19-response/data-and-covid-19/national-covid-19-chest-imaging-database-nccid/" }, }
def handler(event, context): return {'statusCode': 302, 'headers': {'Location': 'https://www.nhsx.nhs.uk/covid-19-response/data-and-covid-19/national-covid-19-chest-imaging-database-nccid/'}}
__name__ = 'factory_djoy' __version__ = '2.2.0' __author__ = 'James Cooke' __copyright__ = '2021, {}'.format(__author__) __description__ = 'Factories for Django, creating valid model instances every time.' __email__ = 'github@jamescooke.info'
__name__ = 'factory_djoy' __version__ = '2.2.0' __author__ = 'James Cooke' __copyright__ = '2021, {}'.format(__author__) __description__ = 'Factories for Django, creating valid model instances every time.' __email__ = 'github@jamescooke.info'
class CyclesMeshSettings: pass
class Cyclesmeshsettings: pass
l = ["+", "-"] def backRec(x): for j in l: x.append(j) if consistent(x): if solution(x): solutionFound(x) backRec(x) x.pop() def consistent(s): return len(s) < n def solution(s): summ = list2[0] if not len(s) == n -...
l = ['+', '-'] def back_rec(x): for j in l: x.append(j) if consistent(x): if solution(x): solution_found(x) back_rec(x) x.pop() def consistent(s): return len(s) < n def solution(s): summ = list2[0] if not len(s) == n - 1: return ...
# block between mission & 6th and howard & 5th in SF. # appears to have lots of buses. # https://www.openstreetmap.org/way/88572932 -- Mission St # https://www.openstreetmap.org/relation/3406710 -- 14X to Daly City # https://www.openstreetmap.org/relation/3406709 -- 14X to Downtown # https://www.openstreetmap.org/relat...
(z, x, y) = (16, 10484, 25329) while z >= 12: assert_has_feature(z, x, y, 'roads', {'is_bus_route': True}) (z, x, y) = (z - 1, x / 2, y / 2) assert_no_matching_feature(z, x, y, 'roads', {'is_bus_route': True})
class Zoo: def __init__(self, name, locations): self.name = name self.stillActive = True self.locations = locations self.currentLocation = self.locations[1] def changeLocation(self, direction): neighborID = self.currentLocation.neighbors[direction] self.currentLo...
class Zoo: def __init__(self, name, locations): self.name = name self.stillActive = True self.locations = locations self.currentLocation = self.locations[1] def change_location(self, direction): neighbor_id = self.currentLocation.neighbors[direction] self.curren...
def test_get_news(sa_session, sa_backend, sa_child_news): assert(sa_child_news == sa_backend.get_news(sa_child_news.id)) assert(sa_backend.get_news(None) is None) def test_get_news_list(sa_session, sa_backend, sa_child_news): assert(sa_child_news in sa_backend.get_news_list()) assert(sa_child_news in ...
def test_get_news(sa_session, sa_backend, sa_child_news): assert sa_child_news == sa_backend.get_news(sa_child_news.id) assert sa_backend.get_news(None) is None def test_get_news_list(sa_session, sa_backend, sa_child_news): assert sa_child_news in sa_backend.get_news_list() assert sa_child_news in sa_b...
# Implemented from: https://stackoverflow.com/questions/9501337/binary-search-algorithm-in-python def binary_search(sequence, value): lo, hi = 0, len(sequence) - 1 while lo <= hi: mid = (lo + hi) // 2 if sequence[mid] < value: lo = mid + 1 elif value < sequence[mid]: ...
def binary_search(sequence, value): (lo, hi) = (0, len(sequence) - 1) while lo <= hi: mid = (lo + hi) // 2 if sequence[mid] < value: lo = mid + 1 elif value < sequence[mid]: hi = mid - 1 else: return mid return None def dfs(graph, node, vi...
''' Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution. Example: Given array nums = [-1, 2, 1, -4], and target = 1. The sum that is closest to...
""" Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution. Example: Given array nums = [-1, 2, 1, -4], and target = 1. The sum that is closest to...
def print_lol(arr): for row in arr: if (isinstance(row, list)): print_lol(row) else: print row
def print_lol(arr): for row in arr: if isinstance(row, list): print_lol(row) else: print row
def cwinstart(callobj, *args, **kwargs): print('cwinstart') print(' args', repr(args)) for arg in args: print(' ', arg) print(' kwargs', len(kwargs)) for k, v in kwargs.items(): print(' ', k, v) w = callobj(*args, **kwargs) print(' callobj()->', w) return w def cwincall(req1, req2, ...
def cwinstart(callobj, *args, **kwargs): print('cwinstart') print(' args', repr(args)) for arg in args: print(' ', arg) print(' kwargs', len(kwargs)) for (k, v) in kwargs.items(): print(' ', k, v) w = callobj(*args, **kwargs) print(' callobj()->', w) return w de...
#!/usr/bin/env python3 # Copyright (C) 2020-2021 The btclib developers # # This file is part of btclib. It is subject to the license terms in the # LICENSE file found in the top-level directory of this distribution. # # No part of btclib including this file, may be copied, modified, propagated, # or distributed except...
"""__init__ module for the btclib package.""" name = 'btclib' __version__ = '2021.1' __author__ = 'The btclib developers' __author_email__ = 'devs@btclib.org' __copyright__ = 'Copyright (C) 2017-2021 The btclib developers' __license__ = 'MIT License'
for num in range(1,6): #code inside for loop if num == 4: continue #code inside for loop print(num) #code outside for loop print("continue statement executed on num = 4")
for num in range(1, 6): if num == 4: continue print(num) print('continue statement executed on num = 4')
def get_remain(cpf: str, start: int, upto: int) -> int: total = 0 for count, num in enumerate(cpf[:upto]): try: total += int(num) * (start - count) except ValueError: return None remain = (total * 10) % 11 remain = remain if remain != 10 else 0 ...
def get_remain(cpf: str, start: int, upto: int) -> int: total = 0 for (count, num) in enumerate(cpf[:upto]): try: total += int(num) * (start - count) except ValueError: return None remain = total * 10 % 11 remain = remain if remain != 10 else 0 return remain ...
class Student: def __init__(self, name, hours, qpoints): self.name = name self.hours = float(hours) self.qpoints = float(qpoints) def get_name(self): return self.name def get_hours(self): return self.hours def get_qpoints(self): return self.qpoints ...
class Student: def __init__(self, name, hours, qpoints): self.name = name self.hours = float(hours) self.qpoints = float(qpoints) def get_name(self): return self.name def get_hours(self): return self.hours def get_qpoints(self): return self.qpoints ...
class Solution: def firstUniqChar(self, s): table = {} for ele in s: table[ele] = table.get(ele, 0) + 1 # for i in range(len(s)): # if table[s[i]] == 1: # return i for ele in s: if table[ele] == 1: return s.index(ele...
class Solution: def first_uniq_char(self, s): table = {} for ele in s: table[ele] = table.get(ele, 0) + 1 for ele in s: if table[ele] == 1: return s.index(ele) return -1 if __name__ == '__main__': s = 'leetcode' print(solution().firstU...
#program to compute and print sum of two given integers (more than or equal to zero). # If given integers or the sum have more than 80 digits, print "overflow". print("Input first integer:") x = int(input()) print("Input second integer:") y = int(input()) if x >= 10 ** 80 or y >= 10 ** 80 or x + y >= 10 ** 80: pri...
print('Input first integer:') x = int(input()) print('Input second integer:') y = int(input()) if x >= 10 ** 80 or y >= 10 ** 80 or x + y >= 10 ** 80: print('Overflow!') else: print('Sum of the two integers: ', x + y)
{ "targets": [ { "target_name": "allofw", "include_dirs": [ "<!@(pkg-config liballofw --cflags-only-I | sed s/-I//g)", "<!(node -e \"require('nan')\")" ], "libraries": [ "<!@(pkg-config liballofw --libs)", "<!@(pkg-config glew --libs)", ], "cflag...
{'targets': [{'target_name': 'allofw', 'include_dirs': ['<!@(pkg-config liballofw --cflags-only-I | sed s/-I//g)', '<!(node -e "require(\'nan\')")'], 'libraries': ['<!@(pkg-config liballofw --libs)', '<!@(pkg-config glew --libs)'], 'cflags!': ['-fno-exceptions', '-fno-rtti'], 'cflags_cc!': ['-fno-exceptions', '-fno-rtt...
TOKEN_PREALTA_CLIENTE = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJhdWx0ckBnbWFpbC5jb20iLCJleHAiOjQ3MzM1MTA0MDAsIm93bmVyX25hbWUiOiJSYXVsIEVucmlxdWUgVG9ycmVzIFJleWVzIiwidHlwZSI6ImVtYWlsX2NvbmZpcm1hdGlvbl9uZXdfY2xpZW50In0.R-nXh1nXvlBABfEdV1g81mdIzJqMFLvFV7FAP7PQRCM' TOKEN_PREALTA_CLIENTE_CADUCO = 'eyJ0eXAiOiJ...
token_prealta_cliente = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJhdWx0ckBnbWFpbC5jb20iLCJleHAiOjQ3MzM1MTA0MDAsIm93bmVyX25hbWUiOiJSYXVsIEVucmlxdWUgVG9ycmVzIFJleWVzIiwidHlwZSI6ImVtYWlsX2NvbmZpcm1hdGlvbl9uZXdfY2xpZW50In0.R-nXh1nXvlBABfEdV1g81mdIzJqMFLvFV7FAP7PQRCM' token_prealta_cliente_caduco = 'eyJ0eXAiOiJKV...
SRM_TO_HEX = { "0": "#FFFFFF", "1": "#F3F993", "2": "#F5F75C", "3": "#F6F513", "4": "#EAE615", "5": "#E0D01B", "6": "#D5BC26", "7": "#CDAA37", "8": "#C1963C", "9": "#BE8C3A", "10": "#BE823A", "11": "#C17A37", "12": "#BF7138", "13": "#BC6733", "14": "#B26033", ...
srm_to_hex = {'0': '#FFFFFF', '1': '#F3F993', '2': '#F5F75C', '3': '#F6F513', '4': '#EAE615', '5': '#E0D01B', '6': '#D5BC26', '7': '#CDAA37', '8': '#C1963C', '9': '#BE8C3A', '10': '#BE823A', '11': '#C17A37', '12': '#BF7138', '13': '#BC6733', '14': '#B26033', '15': '#A85839', '16': '#985336', '17': '#8D4C32', '18': '#7C...
# ------ [ API ] ------ API = '/api' # ---------- [ BLOCKCHAIN ] ---------- API_BLOCKCHAIN = f'{API}/blockchain' API_BLOCKCHAIN_LENGTH = f'{API_BLOCKCHAIN}/length' API_BLOCKCHAIN_BLOCKS = f'{API_BLOCKCHAIN}/blocks' # ---------- [ BROADCASTS ] ---------- API_BROADCASTS = f'{API}/broadcasts' API_BROADCASTS_NEW_BLOCK =...
api = '/api' api_blockchain = f'{API}/blockchain' api_blockchain_length = f'{API_BLOCKCHAIN}/length' api_blockchain_blocks = f'{API_BLOCKCHAIN}/blocks' api_broadcasts = f'{API}/broadcasts' api_broadcasts_new_block = f'{API_BROADCASTS}/new_block' api_broadcasts_new_transaction = f'{API_BROADCASTS}/new_transaction' api_t...
#tables or h5py libname="h5py" #tables" #libname="tables" def setlib(name): global libname libname = name
libname = 'h5py' def setlib(name): global libname libname = name
if __name__ == "__main__": pages = [5, 4, 3, 2, 1, 4, 3, 5, 4, 3, 2, 1, 5] faults = {3: 0, 4: 0} for frames in faults: memory = [] for page in pages: out = None if page not in memory: if len(memory) == frames: out =...
if __name__ == '__main__': pages = [5, 4, 3, 2, 1, 4, 3, 5, 4, 3, 2, 1, 5] faults = {3: 0, 4: 0} for frames in faults: memory = [] for page in pages: out = None if page not in memory: if len(memory) == frames: out = memory.pop(0) ...
a={'a':'hello','b':'1','c':'jayalatha','d':[1,2]} d={} val=list(a.values()) val.sort(key=len) print(val) for i in val: for j in a: if(i==a[j]): d.update({j:a[j]}) print(d)
a = {'a': 'hello', 'b': '1', 'c': 'jayalatha', 'd': [1, 2]} d = {} val = list(a.values()) val.sort(key=len) print(val) for i in val: for j in a: if i == a[j]: d.update({j: a[j]}) print(d)
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "core_library", "core_resx", "core_xunit_test") core_resx( name = "core_resource", src = ":src/Moq/Properties/Resources.resx", identifier = "Moq.Properties.Resources.resources", ) core_library( name = "Moq.dll", srcs = glob(["src/Moq/**/*.cs"]), ...
load('@io_bazel_rules_dotnet//dotnet:defs.bzl', 'core_library', 'core_resx', 'core_xunit_test') core_resx(name='core_resource', src=':src/Moq/Properties/Resources.resx', identifier='Moq.Properties.Resources.resources') core_library(name='Moq.dll', srcs=glob(['src/Moq/**/*.cs']), defines=['NETCORE'], keyfile=':Moq.snk',...
# Iterations: Definite Loops ''' Use the 'for' word there is a iteration variable like 'i' or 'friend' ''' # for i in [5, 4, 3, 2, 1] : # print(i) # print('Blastoff!') # friends = ['matheus', 'wataru', 'mogli'] # for friend in friends : # print('happy new year:', friend) # print('Done!')
""" Use the 'for' word there is a iteration variable like 'i' or 'friend' """
class formstruct(): name = str() while True: name = input("\n.bot >> enter your first name:") if not name.isalpha(): print(".bot >> your first name must have alphabets only!") continue else: name = name.upper() break city = str() while True: c...
class Formstruct: name = str() while True: name = input('\n.bot >> enter your first name:') if not name.isalpha(): print('.bot >> your first name must have alphabets only!') continue else: name = name.upper() break city = str() whil...
# # @lc app=leetcode id=719 lang=python3 # # [719] Find K-th Smallest Pair Distance # # https://leetcode.com/problems/find-k-th-smallest-pair-distance/description/ # # algorithms # Hard (30.99%) # Likes: 827 # Dislikes: 30 # Total Accepted: 29.9K # Total Submissions: 96.4K # Testcase Example: '[1,3,1]\n1' # # Gi...
class Solution: def smallest_distance_pair(self, nums: List[int], k: int) -> int: n = len(nums) nums = sorted(nums) low = 0 high = nums[n - 1] - nums[0] while low < high: mid = int((low + high) / 2) (left, count) = (0, 0) for right in rang...
def chess_knight(start, moves): def knight_can_move(from_pos, to_pos): return set(map(lambda x: abs(ord(x[0]) - ord(x[1])), zip(from_pos, to_pos))) == {1, 2} def knight_moves(pos): return {f + r for f in 'abcdefgh' for r in '12345678' if knight_can_move(pos, f + r)} # till ...
def chess_knight(start, moves): def knight_can_move(from_pos, to_pos): return set(map(lambda x: abs(ord(x[0]) - ord(x[1])), zip(from_pos, to_pos))) == {1, 2} def knight_moves(pos): return {f + r for f in 'abcdefgh' for r in '12345678' if knight_can_move(pos, f + r)} res = knight_moves(star...
n = str(input()) if("0000000" in n): print("YES") elif("1111111" in n): print("YES") else: print("NO")
n = str(input()) if '0000000' in n: print('YES') elif '1111111' in n: print('YES') else: print('NO')
list = ['a','b','c'] print(list)
list = ['a', 'b', 'c'] print(list)
# # Copyright 2017 ABSA Group Limited # # 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 applicable law or agreed to in ...
sc._jvm.za.co.absa.spline.harvester.SparkLineageInitializer.enableLineageTracking(spark._jsparkSession) spark.read.option('header', 'true').option('inferschema', 'true').csv('data/input/batch/wikidata.csv').write.mode('overwrite').csv('data/output/batch/python-sample.csv')
file = open("input.txt", "r") num_valid = 0 for line in file: # policy = part before colon policy = line.strip().split(":")[0] # get min/max number allowed for given letter min_max = policy.split(" ")[0] letter = policy.split(" ")[1] min = int(min_max.split("-")[0]) max = int(min_max.split("-")[1]) ...
file = open('input.txt', 'r') num_valid = 0 for line in file: policy = line.strip().split(':')[0] min_max = policy.split(' ')[0] letter = policy.split(' ')[1] min = int(min_max.split('-')[0]) max = int(min_max.split('-')[1]) password = line.strip().split(':')[1] if password.count(letter) >= ...
# Problem code def search(nums, target): return search_helper(nums, target, 0, len(nums) - 1) def search_helper(nums, target, left, right): if left > right: return -1 mid = (left + right) // 2 # right part is good if nums[mid] <= nums[right]: # we fall for it if target >= ...
def search(nums, target): return search_helper(nums, target, 0, len(nums) - 1) def search_helper(nums, target, left, right): if left > right: return -1 mid = (left + right) // 2 if nums[mid] <= nums[right]: if target >= nums[mid] and target <= nums[right]: return binary_sear...
# # PySNMP MIB module CISCO-EMBEDDED-EVENT-MGR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-EMBEDDED-EVENT-MGR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:39:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python vers...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ...
screen_resX=1920 screen_resY=1080 img_id=['1.JPG_HIGH_', '2.JPG_HIGH_', '7.JPG_HIGH_', '12.JPG_HIGH_', '13.JPG_HIGH_', '15.JPG_HIGH_', '19.JPG_HIGH_', '25.JPG_HIGH_', '27.JPG_HIGH_', '29.JPG_HIGH_', '41.JPG_HIGH_', '42.JPG_HIGH_',...
screen_res_x = 1920 screen_res_y = 1080 img_id = ['1.JPG_HIGH_', '2.JPG_HIGH_', '7.JPG_HIGH_', '12.JPG_HIGH_', '13.JPG_HIGH_', '15.JPG_HIGH_', '19.JPG_HIGH_', '25.JPG_HIGH_', '27.JPG_HIGH_', '29.JPG_HIGH_', '41.JPG_HIGH_', '42.JPG_HIGH_', '43.JPG_HIGH_', '44.JPG_HIGH_', '48.JPG_HIGH_', '49.JPG_HIGH_', '51.JPG_HIGH_', '...
def create_matrix(rows_count): matrix = [] for _ in range(rows_count): matrix.append([int(x) for x in input().split(', ')]) return matrix def get_square_sum(row, col, matrix): square_sum = 0 for r in range(row, row + 2): for c in range(col, col + 2): square_sum += matri...
def create_matrix(rows_count): matrix = [] for _ in range(rows_count): matrix.append([int(x) for x in input().split(', ')]) return matrix def get_square_sum(row, col, matrix): square_sum = 0 for r in range(row, row + 2): for c in range(col, col + 2): square_sum += matrix...
#!/usr/bin/env python3 # Diodes "1N4148" "1N5817G" "BAT43" # Zener "1N457" # bc junction of many transistors can also be used as dioded, i.e. 2SC1815, 2SA9012, etc. with very small leakage current (~1pA at -4V).
"""1N4148""" '1N5817G' 'BAT43' '1N457'
clientId = 'CLIENT_ID' clientSecret = 'CLIENT_SECRET' geniusToken = 'GENIUS_TOKEN' bitrate = '320'
client_id = 'CLIENT_ID' client_secret = 'CLIENT_SECRET' genius_token = 'GENIUS_TOKEN' bitrate = '320'
''' Created on Jun 15, 2016 @author: eze ''' class NotFoundException(Exception): ''' classdocs ''' def __init__(self, element): ''' Constructor ''' self.elementNotFound = element def __str__(self, *args, **kwargs): return "NotFoundException(%s)" %...
""" Created on Jun 15, 2016 @author: eze """ class Notfoundexception(Exception): """ classdocs """ def __init__(self, element): """ Constructor """ self.elementNotFound = element def __str__(self, *args, **kwargs): return 'NotFoundException(%s)' % self.ele...
class Contact: def __init__(self, first_name = None, last_name = None, mobile_phone = None): self.first_name = first_name self.last_name = last_name self.mobile_phone = mobile_phone
class Contact: def __init__(self, first_name=None, last_name=None, mobile_phone=None): self.first_name = first_name self.last_name = last_name self.mobile_phone = mobile_phone
# Optional solution with tidy data representation (providing x and y) monthly_victim_counts_melt = monthly_victim_counts.reset_index().melt( id_vars="datetime", var_name="victim_type", value_name="count" ) sns.relplot( data=monthly_victim_counts_melt, x="datetime", y="count", hue="victim_type", ...
monthly_victim_counts_melt = monthly_victim_counts.reset_index().melt(id_vars='datetime', var_name='victim_type', value_name='count') sns.relplot(data=monthly_victim_counts_melt, x='datetime', y='count', hue='victim_type', kind='line', palette='colorblind', height=3, aspect=4)
def findSmallest(arr): smallest = arr[0] smallest_index = 0 for i in range(1, len(arr)): if arr[i] < smallest: smallest = arr[i] smallest_index = i return smallest_index def selection_sort(arr): newarr = [] for i in range(len(arr)): smallest...
def find_smallest(arr): smallest = arr[0] smallest_index = 0 for i in range(1, len(arr)): if arr[i] < smallest: smallest = arr[i] smallest_index = i return smallest_index def selection_sort(arr): newarr = [] for i in range(len(arr)): smallest_index = find...
{ 'Hello World':'Salve Mondo', 'Welcome to web2py':'Ciao da wek2py', }
{'Hello World': 'Salve Mondo', 'Welcome to web2py': 'Ciao da wek2py'}
domain='https://monbot.hopto.org' apm_id='admin' apm_pw='New1234!' apm_url='https://monbot.hopto.org:3000' db_host='monbot.hopto.org' db_user='izyrtm' db_pw='new1234!' db_datadbase='monbot'
domain = 'https://monbot.hopto.org' apm_id = 'admin' apm_pw = 'New1234!' apm_url = 'https://monbot.hopto.org:3000' db_host = 'monbot.hopto.org' db_user = 'izyrtm' db_pw = 'new1234!' db_datadbase = 'monbot'
def load(): with open("input") as f: yield next(f).strip() next(f) for x in f: yield x.strip().split(" -> ") def pair_insertion(): data = list(load()) polymer, rules = list(data[0]), dict(data[1:]) for _ in range(10): new_polymer = [polymer[0]] for...
def load(): with open('input') as f: yield next(f).strip() next(f) for x in f: yield x.strip().split(' -> ') def pair_insertion(): data = list(load()) (polymer, rules) = (list(data[0]), dict(data[1:])) for _ in range(10): new_polymer = [polymer[0]] fo...
class Colors: END = '\033[0m' ERROR = '\033[91m[ERROR] ' INFO = '\033[94m[INFO] ' WARN = '\033[93m[WARN] ' def get_color(msg_type): if msg_type == 'ERROR': return Colors.ERROR elif msg_type == 'INFO': return Colors.INFO elif msg_type == 'WARN': return Colors.WARN else: return Colors.END...
class Colors: end = '\x1b[0m' error = '\x1b[91m[ERROR] ' info = '\x1b[94m[INFO] ' warn = '\x1b[93m[WARN] ' def get_color(msg_type): if msg_type == 'ERROR': return Colors.ERROR elif msg_type == 'INFO': return Colors.INFO elif msg_type == 'WARN': return Colors.WARN ...
def naive_string_matching(t, w, n, m): for i in range(n - m + 1): j = 0 while j < m and t[i + j + 1] == w[j + 1]: j = j + 1 if j == m: return True return False
def naive_string_matching(t, w, n, m): for i in range(n - m + 1): j = 0 while j < m and t[i + j + 1] == w[j + 1]: j = j + 1 if j == m: return True return False
# Leo colorizer control file for kivy mode. # This file is in the public domain. # Properties for kivy mode. properties = { "ignoreWhitespace": "false", "lineComment": "#", } # Attributes dict for kivy_main ruleset. kivy_main_attributes_dict = { "default": "null", "digit_re": "", "esc...
properties = {'ignoreWhitespace': 'false', 'lineComment': '#'} kivy_main_attributes_dict = {'default': 'null', 'digit_re': '', 'escape': '', 'highlight_digits': 'true', 'ignore_case': 'true', 'no_word_sep': ''} attributes_dict_dict = {'kivy_main': kivy_main_attributes_dict} kivy_main_keywords_dict = {'app': 'keyword2',...
# -*- coding: utf-8 -*- def case_insensitive_string(string, available, default=None): if string is None: return default _available = [each.lower() for each in available] try: index = _available.index(f"{string}".lower()) except ValueError: raise ValueError(f"unrecognised in...
def case_insensitive_string(string, available, default=None): if string is None: return default _available = [each.lower() for each in available] try: index = _available.index(f'{string}'.lower()) except ValueError: raise value_error(f"unrecognised input ('{string}') - must be in...
# What should be printing the next snippet of code? intNum = 10 negativeNum = -5 testString = "Hello " testList = [1, 2, 3] print(intNum * 5) print(intNum - negativeNum) print(testString + 'World') print(testString * 2) print(testString[-1]) print(testString[1:]) print(testList + testList) # The sum of each three fir...
int_num = 10 negative_num = -5 test_string = 'Hello ' test_list = [1, 2, 3] print(intNum * 5) print(intNum - negativeNum) print(testString + 'World') print(testString * 2) print(testString[-1]) print(testString[1:]) print(testList + testList) matrix = [[1, 1, 1, 3], [2, 2, 2, 7], [3, 3, 3, 9], [4, 4, 4, 13]] matrix[1][...
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY short_version = '1.9.0' version = '1.9.0' full_version = '1.9.0' git_revision = '07601a64cdfeb1c0247bde1294ad6380413cab66' release = True if not release: version = full_version
short_version = '1.9.0' version = '1.9.0' full_version = '1.9.0' git_revision = '07601a64cdfeb1c0247bde1294ad6380413cab66' release = True if not release: version = full_version
class Solution: def minRemoveToMakeValid(self, s: str) -> str: if not s : return "" s = list(s) st = [] for i,n in enumerate(s): if n == "(": st.append(i) elif n == ")" : if st : st.pop()...
class Solution: def min_remove_to_make_valid(self, s: str) -> str: if not s: return '' s = list(s) st = [] for (i, n) in enumerate(s): if n == '(': st.append(i) elif n == ')': if st: st.pop() ...
class PoolArgs: def __init__(self, bankerBufCap, bankerMaxBufNumber, signerBufCap, signerBufMaxNumber, broadcasterBufCap, broadcasterMaxNumber, stakingBufCap, stakingMaxNumber, distributionBufCap, distributionMaxNumber, errorBufCap, errorMaxNumber): self.BankerBufCap = bankerBufCap self.BankerMaxBuf...
class Poolargs: def __init__(self, bankerBufCap, bankerMaxBufNumber, signerBufCap, signerBufMaxNumber, broadcasterBufCap, broadcasterMaxNumber, stakingBufCap, stakingMaxNumber, distributionBufCap, distributionMaxNumber, errorBufCap, errorMaxNumber): self.BankerBufCap = bankerBufCap self.BankerMaxBu...
# Signal processing SAMPLE_RATE = 16000 PREEMPHASIS_ALPHA = 0.97 FRAME_LEN = 0.025 FRAME_STEP = 0.01 NUM_FFT = 512 BUCKET_STEP = 1 MAX_SEC = 10 # Model WEIGHTS_FILE = "data/model/weights.h5" COST_METRIC = "cosine" # euclidean or cosine INPUT_SHAPE=(NUM_FFT,None,1) # IO ENROLL_LIST_FILE = "cfg/enroll_list.csv" TEST_L...
sample_rate = 16000 preemphasis_alpha = 0.97 frame_len = 0.025 frame_step = 0.01 num_fft = 512 bucket_step = 1 max_sec = 10 weights_file = 'data/model/weights.h5' cost_metric = 'cosine' input_shape = (NUM_FFT, None, 1) enroll_list_file = 'cfg/enroll_list.csv' test_list_file = 'cfg/test_list.csv' result_file = 'res/resu...
class Mac_Address_Information: par_id = '' case_id = '' evd_id = '' mac_address = '' description = '' backup_flag = '' source_location = [] def MACADDRESS(reg_system): mac_address_list = [] mac_address_count = 0 reg_key = reg_system.find_key(r"ControlSet001\Control\Class\{4d3...
class Mac_Address_Information: par_id = '' case_id = '' evd_id = '' mac_address = '' description = '' backup_flag = '' source_location = [] def macaddress(reg_system): mac_address_list = [] mac_address_count = 0 reg_key = reg_system.find_key('ControlSet001\\Control\\Class\\{4d36...
# *************************************************************************************** # *************************************************************************************** # # Name : processcore.py # Author : Paul Robson (paul@robsons.org.uk) # Date : 22nd December 2018 # Purpose : Convert vocabulary.as...
h_out = open('__words.asm', 'w') for l in [x.rstrip() for x in open('vocabulary.asm').readlines()]: hOut.write(l + '\n') if l[:2] == ';;': name = '_'.join([str(ord(x)) for x in l[2:].strip()]) hOut.write('core_{0}:\n'.format(name)) hOut.close()
class Ledfade: def __init__(self, *args, **kwargs): if 'start' in kwargs: self.start = kwargs.get('start') if 'end' in kwargs: self.end = kwargs.get('end') if 'action' in kwargs: self.action = kwargs.get('action') self.transit = self.end - self.start def ledpwm(self, p): c = 0.181+(0.0482*p)+(0.00...
class Ledfade: def __init__(self, *args, **kwargs): if 'start' in kwargs: self.start = kwargs.get('start') if 'end' in kwargs: self.end = kwargs.get('end') if 'action' in kwargs: self.action = kwargs.get('action') self.transit = self.end - self.st...
def set_material(sg_node, sg_material_node): '''Sets the material on a scenegraph group node and sets the materialid user attribute at the same time. Arguments: sg_node (RixSGGroup) - scene graph group node to attach the material. sg_material_node (RixSGMaterial) - the scene graph material ...
def set_material(sg_node, sg_material_node): """Sets the material on a scenegraph group node and sets the materialid user attribute at the same time. Arguments: sg_node (RixSGGroup) - scene graph group node to attach the material. sg_material_node (RixSGMaterial) - the scene graph material ...
# Debug or not DEBUG = 1 # Trackbar or not CREATE_TRACKBARS = 1 # Display or not DISPLAY = 1 # Image or Video, if "Video" is given as argument, program will use cv2.VideoCapture # If "Image" argument is given the program will use cv2.imread imageType = "Video" # imageType = "Image" # Image/Video source 0 or 1...
debug = 1 create_trackbars = 1 display = 1 image_type = 'Video' image_source = 0 ip_address = '10.99.99.2' os_script = 'v4l2-ctl --device /dev/video0 -c auto_exposure=1 -c exposure_auto_priority=0 -c exposure_time_absolute=20 --set-fmt-video=width=160,height=120,pixelformat=MJPG -p 15 && v4l2-ctl -d1 --get-fmt-video' c...
# Task 09. Hello, France def validate_price(items_and_prices): item = items_and_prices.split('->')[0] prices = float(items_and_prices.split('->')[1]) if item == 'Clothes' and prices <= 50 or \ item == 'Shoes' and prices <= 35.00 or \ item == 'Accessories' and prices <= 20.50: ...
def validate_price(items_and_prices): item = items_and_prices.split('->')[0] prices = float(items_and_prices.split('->')[1]) if item == 'Clothes' and prices <= 50 or (item == 'Shoes' and prices <= 35.0) or (item == 'Accessories' and prices <= 20.5): return True return False items_and_prices = in...
{ 'name': 'Clean Theme', 'description': 'Clean Theme', 'category': 'Theme/Services', 'summary': 'Corporate, Business, Tech, Services', 'sequence': 120, 'version': '2.0', 'author': 'Odoo S.A.', 'depends': ['theme_common', 'website_animate'], 'data': [ 'views/assets.xml', ...
{'name': 'Clean Theme', 'description': 'Clean Theme', 'category': 'Theme/Services', 'summary': 'Corporate, Business, Tech, Services', 'sequence': 120, 'version': '2.0', 'author': 'Odoo S.A.', 'depends': ['theme_common', 'website_animate'], 'data': ['views/assets.xml', 'views/image_content.xml', 'views/snippets/s_cover....
class ValidationException(Exception): pass class NeedsGridType(ValidationException): def __init__(self, ghost_zones=0, fields=None): self.ghost_zones = ghost_zones self.fields = fields def __str__(self): return f"({self.ghost_zones}, {self.fields})" class NeedsOriginalGrid(Needs...
class Validationexception(Exception): pass class Needsgridtype(ValidationException): def __init__(self, ghost_zones=0, fields=None): self.ghost_zones = ghost_zones self.fields = fields def __str__(self): return f'({self.ghost_zones}, {self.fields})' class Needsoriginalgrid(NeedsG...
#import sys #file = sys.stdin file = open( r".\data\nestedlists.txt" ) data = file.read().strip().split()[1:] records = [ [data[i], float(data[i+1])] for i in range(0, len(data), 2) ] print(records) low = min([r[1] for r in records]) dif = min([r[1] - low for r in records if r[1] != low]) print(dif) names = [ r[0] for...
file = open('.\\data\\nestedlists.txt') data = file.read().strip().split()[1:] records = [[data[i], float(data[i + 1])] for i in range(0, len(data), 2)] print(records) low = min([r[1] for r in records]) dif = min([r[1] - low for r in records if r[1] != low]) print(dif) names = [r[0] for r in records if r[1] - dif == lo...
class Int_code: def __init__(self, s, inputs): memory = {} nrs = map(int, s.split(",")) for i, x in enumerate(nrs): memory[i] = x self.memory = memory self.inputs = inputs def set(self, i, x): self.memory[i] = x def one(self, a, b, c, mod...
class Int_Code: def __init__(self, s, inputs): memory = {} nrs = map(int, s.split(',')) for (i, x) in enumerate(nrs): memory[i] = x self.memory = memory self.inputs = inputs def set(self, i, x): self.memory[i] = x def one(self, a, b, c, modes): ...
# model settings model = dict( type='ImageClassifier', backbone=dict( type='OTEMobileNetV3', mode='small', width_mult=1.0), neck=dict(type='GlobalAveragePooling'), head=dict( type='NonLinearClsHead', num_classes=1000, in_channels=576, hid_channels=...
model = dict(type='ImageClassifier', backbone=dict(type='OTEMobileNetV3', mode='small', width_mult=1.0), neck=dict(type='GlobalAveragePooling'), head=dict(type='NonLinearClsHead', num_classes=1000, in_channels=576, hid_channels=1024, act_cfg=dict(type='HSwish'), loss=dict(type='CrossEntropyLoss', loss_weight=1.0)))
class BaseNode: pass class Node(BaseNode): def __init__(self, offset, name=None, **opts): self.offset = offset self.end_offset = None self.name = name self.nodes = [] self.opts = opts def __as_dict__(self): return {"name": self.name, "nodes": [node.__as_dict...
class Basenode: pass class Node(BaseNode): def __init__(self, offset, name=None, **opts): self.offset = offset self.end_offset = None self.name = name self.nodes = [] self.opts = opts def __as_dict__(self): return {'name': self.name, 'nodes': [node.__as_dic...
n, m = [int(e) for e in input().split()] mat = [] for i in range(n): j = [int(e) for e in input().split()] mat.append(j) for i in range(n): for j in range(m): if mat[i][j] == 0: if i == 0: if mat[i][j+1] == 1 and mat[i][j-1] == 1 and mat[i+1][j] == 1: ...
(n, m) = [int(e) for e in input().split()] mat = [] for i in range(n): j = [int(e) for e in input().split()] mat.append(j) for i in range(n): for j in range(m): if mat[i][j] == 0: if i == 0: if mat[i][j + 1] == 1 and mat[i][j - 1] == 1 and (mat[i + 1][j] == 1): ...
CONNECTION_STRING = '/@' CHUNK_SIZE = 100 BORDER_QTY = 5 # minimun matches per year per player for reload player ATP_URL_PREFIX = 'http://www.atpworldtour.com' DC_URL_PREFIX = 'https://www.daviscup.com' ATP_TOURNAMENT_SERIES = ('gs', '1000', 'atp', 'ch') DC_TOURNAMENT_SERIES = ('dc',) DURATION_IN_DAYS = 18 ATP_CSV_PAT...
connection_string = '/@' chunk_size = 100 border_qty = 5 atp_url_prefix = 'http://www.atpworldtour.com' dc_url_prefix = 'https://www.daviscup.com' atp_tournament_series = ('gs', '1000', 'atp', 'ch') dc_tournament_series = ('dc',) duration_in_days = 18 atp_csv_path = '' dc_csv_path = '' sleep_duration = 10 country_code_...
# 15. replace() -> Altera determinado valor de uma string por outro. Troca uma string por outra. texto = 'vou Treinar todo Dia Python' print(texto.replace('vou','Vamos')) print(texto.replace('Python','Algoritmos'))
texto = 'vou Treinar todo Dia Python' print(texto.replace('vou', 'Vamos')) print(texto.replace('Python', 'Algoritmos'))
class Email: def __init__(self): self.from_email = '' self.to_email = '' self.subject = '' self.contents = '' def send_mail(self): print('From: '+ self.from_email) print('To: '+ self.to_email) print('Subject: '+ self.subject) print('Contents: '+ s...
class Email: def __init__(self): self.from_email = '' self.to_email = '' self.subject = '' self.contents = '' def send_mail(self): print('From: ' + self.from_email) print('To: ' + self.to_email) print('Subject: ' + self.subject) print('Contents: ...
n, x = map(int, input().split()) ll = list(map(int, input().split())) ans = 1 d_p = 0 d_c = 0 for i in range(n): d_c = d_p + ll[i] if d_c <= x: ans += 1 d_p = d_c print(ans)
(n, x) = map(int, input().split()) ll = list(map(int, input().split())) ans = 1 d_p = 0 d_c = 0 for i in range(n): d_c = d_p + ll[i] if d_c <= x: ans += 1 d_p = d_c print(ans)
def fill_the_box(*args): height = args[0] length = args[1] width = args[2] cube_size = height * length * width for i in range(3, len(args)): if args[i] == "Finish": return f"There is free space in the box. You could put {cube_size} more cubes." if cube_size < args[i]: ...
def fill_the_box(*args): height = args[0] length = args[1] width = args[2] cube_size = height * length * width for i in range(3, len(args)): if args[i] == 'Finish': return f'There is free space in the box. You could put {cube_size} more cubes.' if cube_size < args[i]: ...
#!/usr/bin/env python3 #Antonio Karlo Mijares # return_text_value function def return_text_value(): name = 'Terry' greeting = 'Good Morning ' + name return greeting # return_number_value function def return_number_value(): num1 = 10 num2 = 5 num3 = num1 + num2 return num3 # Main program if __name__ == '__ma...
def return_text_value(): name = 'Terry' greeting = 'Good Morning ' + name return greeting def return_number_value(): num1 = 10 num2 = 5 num3 = num1 + num2 return num3 if __name__ == '__main__': print('python code') text = return_text_value() print(text) number = return_numbe...
{ "variables": { "HEROKU%": '<!(echo $HEROKU)' }, "targets": [ { "target_name": "gif2webp", "defines": [ ], "sources": [ "src/gif2webp.cpp", "src/webp/example_util.cpp", "src/web...
{'variables': {'HEROKU%': '<!(echo $HEROKU)'}, 'targets': [{'target_name': 'gif2webp', 'defines': [], 'sources': ['src/gif2webp.cpp', 'src/webp/example_util.cpp', 'src/webp/gif2webp_util.cpp', 'src/webp/gif2webpMain.cpp'], 'conditions': [['OS=="mac"', {'include_dirs': ['/usr/local/include', 'src/webp'], 'libraries': ['...
with open("day6_input.txt") as f: initial_fish = list(map(int, f.readline().strip().split(","))) fish = [0] * 9 for initial_f in initial_fish: fish[initial_f] += 1 for day in range(80): new_fish = [0] * 9 for state in range(9): if state == 0: new_fish[...
with open('day6_input.txt') as f: initial_fish = list(map(int, f.readline().strip().split(','))) fish = [0] * 9 for initial_f in initial_fish: fish[initial_f] += 1 for day in range(80): new_fish = [0] * 9 for state in range(9): if state == 0: new_fish[...
# [Root Abyss] Guardians of the World Tree MYSTERIOUS_GIRL = 1064001 # npc Id sm.removeEscapeButton() sm.lockInGameUI(True) sm.setPlayerAsSpeaker() sm.sendNext("We need to find those baddies if we want to get you out of here.") sm.setSpeakerID(MYSTERIOUS_GIRL) sm.sendNext("But... they all left") sm.setPlayerAsSpeake...
mysterious_girl = 1064001 sm.removeEscapeButton() sm.lockInGameUI(True) sm.setPlayerAsSpeaker() sm.sendNext('We need to find those baddies if we want to get you out of here.') sm.setSpeakerID(MYSTERIOUS_GIRL) sm.sendNext('But... they all left') sm.setPlayerAsSpeaker() sm.sendNext('They had to have left some clues behin...
# 11 List Comprehensions products = [ ("Product1", 15), ("Product2", 50), ("Product3", 5) ] print(products) # prices = list(map(lambda item: item[1], products)) # print(prices) prices = [item[1] for item in products] # With list comprehensions we can achive the same result with a clenaer code print(pric...
products = [('Product1', 15), ('Product2', 50), ('Product3', 5)] print(products) prices = [item[1] for item in products] print(prices) filtered_price = [item for item in products if item[1] >= 10] print(filtered_price)
class orgApiPara: setOrg_POST_request = {"host": {"type": str, "default": ''}, "port": {"type": int, "default": 636}, "cer_path": {"type": str, "default": ''}, "use_sll": {"type": bool, "default": True}, "a...
class Orgapipara: set_org_post_request = ({'host': {'type': str, 'default': ''}, 'port': {'type': int, 'default': 636}, 'cer_path': {'type': str, 'default': ''}, 'use_sll': {'type': bool, 'default': True}, 'admin': {'type': str, 'default': ''}, 'admin_pwd': {'type': str, 'default': ''}, 'admin_group': {'type': str,...
#!/usr/bin/python3 #-----------------bot session------------------- UserCancel = 'You have cancel the process.' welcomeMessage = ('User identity conformed, please input gallery urls ' + 'and use space to separate them' ) denyMessage = 'You are not the admin of this bot, conversatio...
user_cancel = 'You have cancel the process.' welcome_message = 'User identity conformed, please input gallery urls ' + 'and use space to separate them' deny_message = 'You are not the admin of this bot, conversation end.' url_comform = 'Received {0} gallery url(s). \nNow begin to download the content. ' + 'Once the dow...
(n,m) = [int(x) for x in input().split()] loop_range = n + m set_m = set() set_n = set() for _ in range(n): set_n.add(int(input())) for _ in range(m): set_m.add(int(input())) uniques = set_n.intersection(set_m) [print(x) for x in (uniques)]
(n, m) = [int(x) for x in input().split()] loop_range = n + m set_m = set() set_n = set() for _ in range(n): set_n.add(int(input())) for _ in range(m): set_m.add(int(input())) uniques = set_n.intersection(set_m) [print(x) for x in uniques]
class bcolors(): HEADER = '\033[95m' OKBLUE = '\033[94m' OK = '\033[92m' WARNING = '\033[96m' FAIL = '\033[91m' TITLE = '\033[93m' ENDC = '\033[0m'
class Bcolors: header = '\x1b[95m' okblue = '\x1b[94m' ok = '\x1b[92m' warning = '\x1b[96m' fail = '\x1b[91m' title = '\x1b[93m' endc = '\x1b[0m'
nz = 512 # noize vector size nsf = 4 # encoded voxel size, scale factor nvx = 32 # output voxel size batch_size = 64 learning_rate = 2e-4 dataset_path_i = "/media/wangyida/D0-P1/database/ShapeNetCore.v2/*/*/*/model_normalized.binvox.thinned" dataset_path_o = "/media/wangyida/D0-P1/database/ShapeNetCore.v2/*/*/*/model_...
nz = 512 nsf = 4 nvx = 32 batch_size = 64 learning_rate = 0.0002 dataset_path_i = '/media/wangyida/D0-P1/database/ShapeNetCore.v2/*/*/*/model_normalized.binvox.thinned' dataset_path_o = '/media/wangyida/D0-P1/database/ShapeNetCore.v2/*/*/*/model_normalized.binvox' params_path = 'params/voxel_dcgan_model.ckpt'
class Fiz_contact: def __init__(self, lastname, firstname, middlename, email, telephone, password, confirmpassword): self.lastname=lastname self.firstname=firstname self.middlename=middlename self.email=email self.telephone=telephone self.password=password sel...
class Fiz_Contact: def __init__(self, lastname, firstname, middlename, email, telephone, password, confirmpassword): self.lastname = lastname self.firstname = firstname self.middlename = middlename self.email = email self.telephone = telephone self.password = passwor...
def main(): with open("number.txt", "r") as file: data = file.read() data = data.split("\n") x = [row.split("\t") for row in data[:5]] print(function(x)) def function(x): sum=0 for el in x[0:]: sum += int(el[0]) return sum if __name__=="__main__": main();
def main(): with open('number.txt', 'r') as file: data = file.read() data = data.split('\n') x = [row.split('\t') for row in data[:5]] print(function(x)) def function(x): sum = 0 for el in x[0:]: sum += int(el[0]) return sum if __name__ == '__main__': main()
a = input() b= input() print(ord(a) + ord(b))
a = input() b = input() print(ord(a) + ord(b))
def prastevila_do_n(n): pra = [2,3,5,7] for x in range(8,n+1): d = True for y in range(2,int(x ** 0.5) + 1): if d == False: break elif x % y == 0: d = False if d == True: pra.append(x) return pra def ...
def prastevila_do_n(n): pra = [2, 3, 5, 7] for x in range(8, n + 1): d = True for y in range(2, int(x ** 0.5) + 1): if d == False: break elif x % y == 0: d = False if d == True: pra.append(x) return pra def euler_50...
args_global = ['server_addr', 'port', 'timeout', 'verbose', 'dry_run', 'conn_retries', 'is_server', 'rpc_plugin', 'called_rpc_name', 'func', 'client'] def strip_globals(kwargs): for arg in args_global: kwargs.pop(arg, None) def remove_null(kwargs): keys = [] for key, value in kwar...
args_global = ['server_addr', 'port', 'timeout', 'verbose', 'dry_run', 'conn_retries', 'is_server', 'rpc_plugin', 'called_rpc_name', 'func', 'client'] def strip_globals(kwargs): for arg in args_global: kwargs.pop(arg, None) def remove_null(kwargs): keys = [] for (key, value) in kwargs.items(): ...
datasetFile = open("datasets/rosalind_ba1e.txt", "r") genome = datasetFile.readline().strip() otherArgs = datasetFile.readline().strip() k, L, t = map(lambda x: int(x), otherArgs.split(" ")) def findClumps(genome, k, L, t): kmerIndex = {} clumpedKmers = set() for i in range(len(genome) - k + 1): km...
dataset_file = open('datasets/rosalind_ba1e.txt', 'r') genome = datasetFile.readline().strip() other_args = datasetFile.readline().strip() (k, l, t) = map(lambda x: int(x), otherArgs.split(' ')) def find_clumps(genome, k, L, t): kmer_index = {} clumped_kmers = set() for i in range(len(genome) - k + 1): ...
class Token: def __init__(self, word, line, start, finish, category, reason=None): self.__word__ = word self.__line__ = line self.__start__ = start self.__finish__ = finish self.__category__ = category self.__reason__ = reason @property def word(self): ...
class Token: def __init__(self, word, line, start, finish, category, reason=None): self.__word__ = word self.__line__ = line self.__start__ = start self.__finish__ = finish self.__category__ = category self.__reason__ = reason @property def word(self): ...
# Node types TYPE_NODE = b'\x10' TYPE_NODE_NR = b'\x11' # Gateway types TYPE_GATEWAY = b'\x20' TYPE_GATEWAY_TIME = b'\x21' # Special types TYPE_PROVISIONING = b'\xFF'
type_node = b'\x10' type_node_nr = b'\x11' type_gateway = b' ' type_gateway_time = b'!' type_provisioning = b'\xff'
class Node: def __init__(self, value): self.value = value self.next = None # Have no idea how to do this # import sys # sys.path.insert(0, '../../data_structures') # import node def intersection(l1: Node, l2: Node) -> Node: l1_end, len1 = get_tail(l1) l2_end, len2 = get_tail(l2) if l...
class Node: def __init__(self, value): self.value = value self.next = None def intersection(l1: Node, l2: Node) -> Node: (l1_end, len1) = get_tail(l1) (l2_end, len2) = get_tail(l2) if l1_end != l2_end: return None if len1 > len2: l1 = move_head(l1, len1 - len2) ...
# NAVI AND MATH def power(base, exp): res = 1 while exp>0: if exp&1: res = (res*base)%1000000007 exp = exp>>1 base = (base*base)%1000000007 return res%1000000007 mod = 1000000007 for i in range(int(input().strip())): ans = "Case #" + str(i+1) + ': ' N = int(inpu...
def power(base, exp): res = 1 while exp > 0: if exp & 1: res = res * base % 1000000007 exp = exp >> 1 base = base * base % 1000000007 return res % 1000000007 mod = 1000000007 for i in range(int(input().strip())): ans = 'Case #' + str(i + 1) + ': ' n = int(input()....
class Manifest: def __init__(self, definition: dict): self._definition = definition def exists(self): return self._definition is not None and self._definition != {} def _resolve_node(self, name: str): key = next((k for k in self._definition["nodes"].keys() if name == k.split(".")[-...
class Manifest: def __init__(self, definition: dict): self._definition = definition def exists(self): return self._definition is not None and self._definition != {} def _resolve_node(self, name: str): key = next((k for k in self._definition['nodes'].keys() if name == k.split('.')[...
load(":import_external.bzl", import_external = "import_external") def dependencies(): import_external( name = "commons_fileupload_commons_fileupload", artifact = "commons-fileupload:commons-fileupload:1.4", artifact_sha256 = "a4ec02336f49253ea50405698b79232b8c5cbf02cb60df3a674d77a749a1def7"...
load(':import_external.bzl', import_external='import_external') def dependencies(): import_external(name='commons_fileupload_commons_fileupload', artifact='commons-fileupload:commons-fileupload:1.4', artifact_sha256='a4ec02336f49253ea50405698b79232b8c5cbf02cb60df3a674d77a749a1def7', srcjar_sha256='2acfe29671daf8c9...
class Node: props = () def __init__(self, **kwargs): for prop in kwargs: if prop not in self.props: raise Exception('Invalid property %r, allowed only: %s' % (prop, self.props)) self.__dict__[prop] = kwargs[prop] for prop...
class Node: props = () def __init__(self, **kwargs): for prop in kwargs: if prop not in self.props: raise exception('Invalid property %r, allowed only: %s' % (prop, self.props)) self.__dict__[prop] = kwargs[prop] for prop in self.props: if pro...