content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# # PySNMP MIB module HUAWEI-MGMD-STD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-MGMD-STD-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:46:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_intersection, constraints_union, value_range_constraint) ...
def test_get_cpu_times(device): result = device.cpu_times() assert result is not None def test_get_cpu_percent(device): percent = device.cpu_percent(interval=1) assert percent is not None assert percent != 0 def test_get_cpu_count(device): assert device.cpu_count() == 2
def test_get_cpu_times(device): result = device.cpu_times() assert result is not None def test_get_cpu_percent(device): percent = device.cpu_percent(interval=1) assert percent is not None assert percent != 0 def test_get_cpu_count(device): assert device.cpu_count() == 2
# Normal way def userEntity(item) -> dict: return { "fname":item["fname"], "lname":item["lname"], "email":item["email"], } def usersEntity(entity) -> list: return [userEntity(item) for item in entity]
def user_entity(item) -> dict: return {'fname': item['fname'], 'lname': item['lname'], 'email': item['email']} def users_entity(entity) -> list: return [user_entity(item) for item in entity]
# Copyright (c) 2013-2018 LG Electronics, Inc. # # 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 t...
{'variables': {'sysroot%': ''}, 'targets': [{'target_name': 'webos-sysbus', 'include_dirs': ['<!@(pkg-config --cflags-only-I glib-2.0 | sed s/-I//g)'], 'sources': ['src/node_ls2.cpp', 'src/node_ls2_base.cpp', 'src/node_ls2_call.cpp', 'src/node_ls2_error_wrapper.cpp', 'src/node_ls2_handle.cpp', 'src/node_ls2_message.cpp...
"""@package This package enables the document usage for the database. """ class Document: """ This class defines a document (description, pdf file...). """ def __init__(self, document_id, html_content_eng, html_content_nl): """ Document initializer. :param document_id: The ID ...
"""@package This package enables the document usage for the database. """ class Document: """ This class defines a document (description, pdf file...). """ def __init__(self, document_id, html_content_eng, html_content_nl): """ Document initializer. :param document_id: The ID o...
def bool_func(i, w, a): if i == 0: if w == 0: return True else: return False # in case not choosing a[i-1] if bool_func(i-1, w, a): return True # in case choosing a[i-1] if bool_func(i-1, w-a[i-1], a): return True # return False if both cas...
def bool_func(i, w, a): if i == 0: if w == 0: return True else: return False if bool_func(i - 1, w, a): return True if bool_func(i - 1, w - a[i - 1], a): return True return False def main(): (n, w) = map(int, input().split()) a = list(map(...
""" Working on planning a large event (like a wedding or graduation) is often really difficult, and requires a large number of dependant tasks. However, doing all the tasks linearly isn't always the most efficient use of your time. Especially if you have multiple individuals helping, sometimes multiple people could do ...
""" Working on planning a large event (like a wedding or graduation) is often really difficult, and requires a large number of dependant tasks. However, doing all the tasks linearly isn't always the most efficient use of your time. Especially if you have multiple individuals helping, sometimes multiple people could do ...
def mid(word: str | list | tuple) -> str: return "" if len(word) % 2 == 0 else word[round(len(word) // 2)] def tests() -> None: print(mid("hello")) # "l" print(mid("12345")) # "3" print(mid("hello2")) # "" print(mid("abc")) # "b" # It also works with lists! print(mid(["a", "b", "c", "d...
def mid(word: str | list | tuple) -> str: return '' if len(word) % 2 == 0 else word[round(len(word) // 2)] def tests() -> None: print(mid('hello')) print(mid('12345')) print(mid('hello2')) print(mid('abc')) print(mid(['a', 'b', 'c', 'd', 'e'])) print(mid(('1', '2', '3', '4', '5'))) if __nam...
def A(): q = int(input()) for i in range(q): n , a , b = map(int , input().split()) if(2*a<b): print(n*a) continue else: print(n//2*b+(n%2)*a) A()
def a(): q = int(input()) for i in range(q): (n, a, b) = map(int, input().split()) if 2 * a < b: print(n * a) continue else: print(n // 2 * b + n % 2 * a) a()
class AdministrationWarning(Warning): pass class TemporaryDirectoryDeletionWarning(Warning): pass
class Administrationwarning(Warning): pass class Temporarydirectorydeletionwarning(Warning): pass
# -*- coding: utf-8 -*- """ Created on Wed Jan 29 20:01:24 2020 @author: Tushar Saxena """ """ Algo: low:= 0 high:= n-1 while low <= high Do mid = (low + high) / 2 if arr[mid] == value: return mid elif arr[mid] < value: low = mid + 1 ...
""" Created on Wed Jan 29 20:01:24 2020 @author: Tushar Saxena """ '\nAlgo:\n low:= 0 \n high:= n-1\n while low <= high Do\n mid = (low + high) / 2\n if arr[mid] == value:\n return mid\n elif arr[mid] < value:\n low = mid + 1\n elif arr[mid] > value:\n ...
#input # 13 # 19443 576 # 6001842 911503 # 4067 1248 # 6121885 186 # -410349 4955307 # 5375848 874 # 2770998 256 # 18765 1284 # 5813 1630 # 8212240 77 # 293304 -4580549 # 7956897 3420372 # 6775023 846 n = int(input()) for k in range(0, n): num = None for i in input().split(): if not(num): ...
n = int(input()) for k in range(0, n): num = None for i in input().split(): if not num: num = float(i) continue num /= float(i) print(round(num), ' ', end='')
with open("instructions.txt") as f: content = f.readlines() instrL = [] for line in content: if ";" in line: instr = line.split(";")[0] instr = instr.replace(" ", "") instr = instr.replace("()", "") instr = instr.replace("void", "") nr = line.split("/")[2] ...
with open('instructions.txt') as f: content = f.readlines() instr_l = [] for line in content: if ';' in line: instr = line.split(';')[0] instr = instr.replace(' ', '') instr = instr.replace('()', '') instr = instr.replace('void', '') nr = l...
""" Merge sort uses auxiliary storage """ def merge_sort(A): """Merge Sort implementation using auxiliary storage.""" aux = [None] * len(A) def rsort(lo, hi): if hi <= lo: return mid = (lo+hi) // 2 rsort(lo, mid) rsort(mid+1, hi) merge(lo, mid, hi) ...
""" Merge sort uses auxiliary storage """ def merge_sort(A): """Merge Sort implementation using auxiliary storage.""" aux = [None] * len(A) def rsort(lo, hi): if hi <= lo: return mid = (lo + hi) // 2 rsort(lo, mid) rsort(mid + 1, hi) merge(lo, mid, hi) ...
# this is an example trial file # each line in this file is one command # there are two type of commands, phase commands and robot commands #all comamands share the same format: # name_of_command(time_to_run_command, <some number of arguments>) # time_to_run_command is the numver of seconds afte rth trial starts # ...
phase(0, '1') skee(3, 9) phase(60, '2') phase(60, '3')
""" Let's use decorators to build a name directory! You are given some information about people. Each person has a first name, last name, age and sex. Print their names in a specific format sorted by their age in ascending order i.e. the youngest person's name should be printed first. For two people of the same age, p...
""" Let's use decorators to build a name directory! You are given some information about people. Each person has a first name, last name, age and sex. Print their names in a specific format sorted by their age in ascending order i.e. the youngest person's name should be printed first. For two people of the same age, p...
def mittelwert(liste): return sum(liste)/len(liste) def mittelwert2(*liste): return sum(liste)/len(liste) print(mittelwert([3, 4, 5])) print(mittelwert2(3, 4, 5)) def ausgabe(Liste, ende="\n"): for element in Liste: print(element, end=ende) def ausgabe2(Liste, **kwargs): ende...
def mittelwert(liste): return sum(liste) / len(liste) def mittelwert2(*liste): return sum(liste) / len(liste) print(mittelwert([3, 4, 5])) print(mittelwert2(3, 4, 5)) def ausgabe(Liste, ende='\n'): for element in Liste: print(element, end=ende) def ausgabe2(Liste, **kwargs): ende = '\n' if 'e...
class DDSDeliveryPreview(object): """ A class to represent a delivery preview, without persistence. Has many of the same properties as a Delivery, and can be provided to the email generation code """ def __init__(self, from_user_id, to_user_id, project_id, transfer_id, user_message): self.f...
class Ddsdeliverypreview(object): """ A class to represent a delivery preview, without persistence. Has many of the same properties as a Delivery, and can be provided to the email generation code """ def __init__(self, from_user_id, to_user_id, project_id, transfer_id, user_message): self.f...
# Copyright 2021 The BladeDISC Authors. 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/licenses/LICENSE-2.0 # Unless required by applicable law or ...
class Unionset: def __init__(self, num_elems: int): self._num_elems = num_elems self._num_sets = num_elems self._group_id = dict([(g, g) for g in range(0, num_elems)]) def same_group(self, x: int, y: int): pid_x = self.find(x) pid_y = self.find(x) if pid_x == pi...
''' Runtime: 56 ms, faster than 75.06% of Python3 online submissions for Longest Substring Without Repeating Characters. Memory Usage: 12.8 MB, less than 100.00% of Python3 online submissions for Longest Substring Without Repeating Characters. ''' ''' Given a string, find the length of the longest substring with...
""" Runtime: 56 ms, faster than 75.06% of Python3 online submissions for Longest Substring Without Repeating Characters. Memory Usage: 12.8 MB, less than 100.00% of Python3 online submissions for Longest Substring Without Repeating Characters. """ '\nGiven a string, find the length of the longest substring without repe...
n, m, k = map(int, input().split()) if k < n: print(k + 1, 1) else: k -= n r = n - k // (m - 1) if r & 1: print(r, m - k % (m - 1)) else: print(r, k % (m - 1) + 2)
(n, m, k) = map(int, input().split()) if k < n: print(k + 1, 1) else: k -= n r = n - k // (m - 1) if r & 1: print(r, m - k % (m - 1)) else: print(r, k % (m - 1) + 2)
TASK_NAME = 'ReviewTask' JS_ASSETS = [''] JS_ASSETS_OUTPUT = 'scripts/vulyk-declarations-review.js' JS_ASSETS_FILTERS = 'yui_js' CSS_ASSETS = [''] CSS_ASSETS_OUTPUT = 'styles/vulyk-declarations-review.css' CSS_ASSETS_FILTERS = 'yui_css'
task_name = 'ReviewTask' js_assets = [''] js_assets_output = 'scripts/vulyk-declarations-review.js' js_assets_filters = 'yui_js' css_assets = [''] css_assets_output = 'styles/vulyk-declarations-review.css' css_assets_filters = 'yui_css'
#!/usr/bin/python3 # -*-coding:utf-8-*- __author__ = "Bannings" class Solution: def decodeString(self, s: str) -> str: ans, stack, num = "", [], 0 for char in s: if char.isdigit(): num = num * 10 + int(char) elif char == "[": stack.append((nu...
__author__ = 'Bannings' class Solution: def decode_string(self, s: str) -> str: (ans, stack, num) = ('', [], 0) for char in s: if char.isdigit(): num = num * 10 + int(char) elif char == '[': stack.append((num, ans)) (num, ans)...
''' Given a target A on an infinite number line, i.e. -infinity to +infinity. You are currently at position 0 and you need to reach the target by moving according to the below rule: In ith move you can take i steps forward or backward. Find the minimum number of moves required to reach the target. ''' class Solutio...
""" Given a target A on an infinite number line, i.e. -infinity to +infinity. You are currently at position 0 and you need to reach the target by moving according to the below rule: In ith move you can take i steps forward or backward. Find the minimum number of moves required to reach the target. """ class Solution...
input = """ 3 7 61 146 73 112 115 127 130 0 0 1 146 2 0 155 73 1 155 2 0 146 73 1 148 2 0 150 115 1 150 2 0 148 115 1 148 2 0 152 112 1 152 2 0 148 112 1 152 2 0 158 127 1 158 2 0 152 127 1 155 2 0 157 61 1 157 2 0 155 61 1 158 2 0 160 130 1 160 2 0 158 130 0 0 B+ 0 B- 1 0 1 """ output = """ {} {} {} {} {} {} {} {} {} ...
input = '\n3 7 61 146 73 112 115 127 130 0 0\n1 146 2 0 155 73\n1 155 2 0 146 73\n1 148 2 0 150 115\n1 150 2 0 148 115\n1 148 2 0 152 112\n1 152 2 0 148 112\n1 152 2 0 158 127\n1 158 2 0 152 127\n1 155 2 0 157 61\n1 157 2 0 155 61\n1 158 2 0 160 130\n1 160 2 0 158 130\n0\n0\nB+\n0\nB-\n1\n0\n1\n' output = '\n{}\n{}\n{}...
def format_name(first_name,last_name): if first_name == "" and last_name == "": return "You didn't provide valid inputs" first_name = first_name.title() last_name = last_name.title() return first_name + " " + last_name name = format_name(input("Enter your first name : "),input("Enter your last...
def format_name(first_name, last_name): if first_name == '' and last_name == '': return "You didn't provide valid inputs" first_name = first_name.title() last_name = last_name.title() return first_name + ' ' + last_name name = format_name(input('Enter your first name : '), input('Enter your last...
class AnalistaContable(): def sueldo(self, horas, precio, comisiones): print("el sueldo del analista contable es:", (horas*precio)- comisiones) def Datos(self, nombre, apellido, edad): print("el nombre del analista contable es: ", nombre ," ", apellido, "\n su edad es: ", edad) ...
class Analistacontable: def sueldo(self, horas, precio, comisiones): print('el sueldo del analista contable es:', horas * precio - comisiones) def datos(self, nombre, apellido, edad): print('el nombre del analista contable es: ', nombre, ' ', apellido, '\n su edad es: ', edad) def labores...
class Person: def __init__(self, first_name: str, last_name: str, age: int) -> None: self.first_name = first_name self.last_name = last_name self.age = age def __repr__(self) -> str: return f"{self.first_name} {self.last_name}, {self.age} y.o."
class Person: def __init__(self, first_name: str, last_name: str, age: int) -> None: self.first_name = first_name self.last_name = last_name self.age = age def __repr__(self) -> str: return f'{self.first_name} {self.last_name}, {self.age} y.o.'
asdasdasd asdasdasdsa asdasd
asdasdasd asdasdasdsa asdasd
class CastLibraryTable: #------------------------------ def __init__(self, castlibs): self.by_nr = {} self.by_assoc_id = {} for cl in castlibs: self.by_nr[cl.nr] = cl if cl.assoc_id>0: self.by_assoc_id[cl.assoc_id] = cl def iter_by_nr(self): ...
class Castlibrarytable: def __init__(self, castlibs): self.by_nr = {} self.by_assoc_id = {} for cl in castlibs: self.by_nr[cl.nr] = cl if cl.assoc_id > 0: self.by_assoc_id[cl.assoc_id] = cl def iter_by_nr(self): return self.by_nr.itervalu...
class TimeRecord: def __init__(self,ID,startHour,endHour,projectID,recordTypeID,description,statusID,minutes,oneNoteLink,km): self.ID = ID self.StartHour = startHour self.EndHour = endHour self.ProjectID = projectID self.RecordTypeID = recordTypeID self.Description =...
class Timerecord: def __init__(self, ID, startHour, endHour, projectID, recordTypeID, description, statusID, minutes, oneNoteLink, km): self.ID = ID self.StartHour = startHour self.EndHour = endHour self.ProjectID = projectID self.RecordTypeID = recordTypeID self.Des...
class Multi(object): ITEMS = (1, 3), (5, 8) def __getitem__(self, i): return self.ITEMS[i[0]][i[1]] def __setitem__(self, i, x): self.ITEMS[i[0]][i[1]] = x def __len__(self): return 2, 2
class Multi(object): items = ((1, 3), (5, 8)) def __getitem__(self, i): return self.ITEMS[i[0]][i[1]] def __setitem__(self, i, x): self.ITEMS[i[0]][i[1]] = x def __len__(self): return (2, 2)
"""Initialization Module""" __version__ = "0.0.1" __version_info__ = tuple(__version__.split("."))
"""Initialization Module""" __version__ = '0.0.1' __version_info__ = tuple(__version__.split('.'))
#!/usr/bin/env python3 def read_val(): return int(input()) def count_three_addend_decompositions(n): # https://www.wolframalpha.com/input/?i=sum_k%3D0%5En+(n+-+k+%2B+1) return (n + 1) * (n + 2) // 2 for _ in range(read_val()): print(count_three_addend_decompositions(read_val()))
def read_val(): return int(input()) def count_three_addend_decompositions(n): return (n + 1) * (n + 2) // 2 for _ in range(read_val()): print(count_three_addend_decompositions(read_val()))
class Solution: """ @param n: a non-negative integer @return: the total number of full staircase rows that can be formed """ def arrangeCoins(self, n): start = 0 end = n while start + 1 < end: mid = start + (end - start) // 2 if mid * (mid + 1) // 2 > ...
class Solution: """ @param n: a non-negative integer @return: the total number of full staircase rows that can be formed """ def arrange_coins(self, n): start = 0 end = n while start + 1 < end: mid = start + (end - start) // 2 if mid * (mid + 1) // 2 ...
ALLOWLIST_ACTIONS = [ "ip_allow_list.enable", "ip_allow_list.disable", "ip_allow_list.enable_for_installed_apps", "ip_allow_list.disable_for_installed_apps", "ip_allow_list_entry.create", "ip_allow_list_entry.update", "ip_allow_list_entry.destroy", ] def rule(event): return ( e...
allowlist_actions = ['ip_allow_list.enable', 'ip_allow_list.disable', 'ip_allow_list.enable_for_installed_apps', 'ip_allow_list.disable_for_installed_apps', 'ip_allow_list_entry.create', 'ip_allow_list_entry.update', 'ip_allow_list_entry.destroy'] def rule(event): return event.get('action').startswith('ip_allow_li...
class SolutionTLE: """ Solution with Time Limit Exceeded """ def maxEvents(self, events: List[List[int]]) -> int: queue = [] heapq.heapify(queue) for event in events: start, end = event heapq.heappush(queue, (start, end)) event_cnt = 0 ...
class Solutiontle: """ Solution with Time Limit Exceeded """ def max_events(self, events: List[List[int]]) -> int: queue = [] heapq.heapify(queue) for event in events: (start, end) = event heapq.heappush(queue, (start, end)) event_cnt = 0 ...
# https://leetcode-cn.com/problems/lru-cache/ class LRUCache: def __init__(self, capacity: int): self.c = capacity self.l = [] self.d = {} def get(self, key: int) -> int: if key in self.d: self.l.pop(self.l.index(key)) self.l.append(key) ret...
class Lrucache: def __init__(self, capacity: int): self.c = capacity self.l = [] self.d = {} def get(self, key: int) -> int: if key in self.d: self.l.pop(self.l.index(key)) self.l.append(key) return self.d[key] else: retur...
cost = 14.99 taxperc = 23 tax = taxperc / 100.00 salepr = cost * (1.0 + tax) print("sale price:", salepr)
cost = 14.99 taxperc = 23 tax = taxperc / 100.0 salepr = cost * (1.0 + tax) print('sale price:', salepr)
{ "targets": [ { "target_name": "fortuna", "sources": [ "src/main.cpp", "src/libfortuna.cpp", "src/libfortuna/blf.c", "src/libfortuna/fortuna.c", "src/libfortuna/internal.c", "src/libfortuna/md5.c", "src/libfortuna/px.c", "src/libfortuna/random.c", "s...
{'targets': [{'target_name': 'fortuna', 'sources': ['src/main.cpp', 'src/libfortuna.cpp', 'src/libfortuna/blf.c', 'src/libfortuna/fortuna.c', 'src/libfortuna/internal.c', 'src/libfortuna/md5.c', 'src/libfortuna/px.c', 'src/libfortuna/random.c', 'src/libfortuna/rijndael.c', 'src/libfortuna/sha1.c', 'src/libfortuna/sha2....
a=list() with open('db.txt', 'r') as file: for i in file: a.append(i.strip()) b=input() interval=len(a) shift=0 while interval>=1: t=interval%2 interval//=2 i=interval+t print('1 - ', a[i+shift-1], ' | 2 - ', b) r=input() while r!='1' and r!='2': r=input() if r=='1': shift+=i else: if not t: inte...
a = list() with open('db.txt', 'r') as file: for i in file: a.append(i.strip()) b = input() interval = len(a) shift = 0 while interval >= 1: t = interval % 2 interval //= 2 i = interval + t print('1 - ', a[i + shift - 1], ' | 2 - ', b) r = input() while r != '1' and r != '2': ...
# Training and prediction prediction_window = 7 # How many days in single prediction # Window optimization n_optimizer_predictions = 100 # Num of predictions to make during window optimization smallest_possible_training_window = 25 ...
prediction_window = 7 n_optimizer_predictions = 100 smallest_possible_training_window = 25 largest_possible_training_window = 2025 training_window_test_increase = 25 n_reservoir = 200 spectral_radius = 1.5 sparsity = 0.2 noise = 0.03 input_scaling = 1.0 n_generations = 10 n_population = 100 mutation_rate = 0.5 crossove...
# Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there are more than 1 duplicated numbers, return the number for which the second occurrence has a smaller index than the second occurr...
def first_duplicate(a): new = set() for i in range(len(a)): if a[i] in new: return a[i] else: new.add(a[i]) return -1 a = [2, 1, 3, 5, 3, 2] print(first_duplicate(a))
testcase = int(input()) for i in range(testcase+1): if i == 0: continue strlist = input() strlen = len(strlist) j = 0 decodestr = "Case {}: ".format(i) while j < strlen: ch = strlist[j] if ch == '\n': break else: cnt = 0 k = j + 1 while(k < strlen and strlist[k].isdigit()): cnt *= 10 c...
testcase = int(input()) for i in range(testcase + 1): if i == 0: continue strlist = input() strlen = len(strlist) j = 0 decodestr = 'Case {}: '.format(i) while j < strlen: ch = strlist[j] if ch == '\n': break else: cnt = 0 k = j...
# -*- coding: utf-8 -*- #: Following the versioning system at http://semver.org/ #: See also docs/contributing.rst, section ``Versioning`` #: MAJOR: incremented for incompatible API changes MAJOR = 1 #: MINOR: incremented for adding functionality in a backwards-compatible manner MINOR = 0 #: PATCH: incremented for bac...
major = 1 minor = 0 patch = 0 __version__ = '{0:d}.{1:d}.{2:d}'.format(MAJOR, MINOR, PATCH)
def logical_calc(array,op): while len(array) > 1: inp1 = array.pop(0) inp2 = array.pop(0) if op == "AND": array.insert(0,a(inp1,inp2)) elif op == "OR": array.insert(0,o(inp1,inp2)) elif op == "XOR": array.insert(0,x(inp1,i...
def logical_calc(array, op): while len(array) > 1: inp1 = array.pop(0) inp2 = array.pop(0) if op == 'AND': array.insert(0, a(inp1, inp2)) elif op == 'OR': array.insert(0, o(inp1, inp2)) elif op == 'XOR': array.insert(0, x(inp1, inp2)) r...
def add_native_methods(clazz): def getTotalSwapSpaceSize____(a0): raise NotImplementedError() def getFreeSwapSpaceSize____(a0): raise NotImplementedError() def getProcessCpuTime____(a0): raise NotImplementedError() def getFreePhysicalMemorySize____(a0): raise NotImplem...
def add_native_methods(clazz): def get_total_swap_space_size____(a0): raise not_implemented_error() def get_free_swap_space_size____(a0): raise not_implemented_error() def get_process_cpu_time____(a0): raise not_implemented_error() def get_free_physical_memory_size____(a0): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Custom colorise exceptions.""" class NotSupportedError(Exception): """Raised when functionality is not supported."""
"""Custom colorise exceptions.""" class Notsupportederror(Exception): """Raised when functionality is not supported."""
""" imutils/ml/optimizer/__init__.py """
""" imutils/ml/optimizer/__init__.py """
#You Source Code Very Good print("Good") for i in range(1,20+1): print("It works Great!")
print('Good') for i in range(1, 20 + 1): print('It works Great!')
#!/usr/bin/env python class FLVError(Exception): pass class F4VError(Exception): pass class AMFError(Exception): pass __all__ = ["FLVError", "F4VError", "AMFError"]
class Flverror(Exception): pass class F4Verror(Exception): pass class Amferror(Exception): pass __all__ = ['FLVError', 'F4VError', 'AMFError']
def check_cnpj(value): if value == '99999999999999': is_valid = False else: # Checks if is in pattern NNNNNNNNNNNNNN is_valid_len = len(value) == 14 is_valid_num = all(char.isnumeric() for char in value) is_valid = is_valid_len and is_valid_num return not is_valid de...
def check_cnpj(value): if value == '99999999999999': is_valid = False else: is_valid_len = len(value) == 14 is_valid_num = all((char.isnumeric() for char in value)) is_valid = is_valid_len and is_valid_num return not is_valid def check_cpf(value): if value == '0000000000...
class Solution(object): def rotateMatrixCounterClockwise(self, mat): if len(mat) == 0: return # To asses the size of N*M matrix top = 0 bottom = len(mat) - 1 left = 0 right = len(mat[0]) - 1 while left < right and top < bottom: pre...
class Solution(object): def rotate_matrix_counter_clockwise(self, mat): if len(mat) == 0: return top = 0 bottom = len(mat) - 1 left = 0 right = len(mat[0]) - 1 while left < right and top < bottom: prev = mat[top][right] for i in ra...
# 1st solution class Solution: def findLadders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]: if endWord not in wordList: return [] wordSet = set(wordList) # faster checks against dictionary layer = {} layer[beginWord] = [[beginWord]] # ...
class Solution: def find_ladders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]: if endWord not in wordList: return [] word_set = set(wordList) layer = {} layer[beginWord] = [[beginWord]] while layer: newlayer = collection...
#!/usr/bin/env python3 # https://abc099.contest.atcoder.jp/tasks/abc099_b a, b = map(int, input().split()) d = b - a k = d * (d - 1) // 2 print(k - a)
(a, b) = map(int, input().split()) d = b - a k = d * (d - 1) // 2 print(k - a)
class StringUtilities(str): def longest_word(self): word_list = self.split() longest_word_length = 0 for word in word_list: word = StringUtilities.remove_symbols(word) if len(word) > longest_word_length: longest_word_length = len(word) ...
class Stringutilities(str): def longest_word(self): word_list = self.split() longest_word_length = 0 for word in word_list: word = StringUtilities.remove_symbols(word) if len(word) > longest_word_length: longest_word_length = len(word) return ...
""" Importing modules When we run a statement such as import fractions what is python doing The first thing to note is that Python """
""" Importing modules When we run a statement such as import fractions what is python doing The first thing to note is that Python """
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def convertBST(self, root): """ :type root: TreeNode :rtype: TreeNode """ self.pre = Non...
class Treenode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def convert_bst(self, root): """ :type root: TreeNode :rtype: TreeNode """ self.pre = None def helper(root): ...
""" Batching support. """ def batched(resources, batch_size, **kwargs): """ Chunk resources into batches with a common type. """ previous = 0 for index, resource in enumerate(resources): different_type = resource.type != resources[previous].type too_many = index - previous >= bat...
""" Batching support. """ def batched(resources, batch_size, **kwargs): """ Chunk resources into batches with a common type. """ previous = 0 for (index, resource) in enumerate(resources): different_type = resource.type != resources[previous].type too_many = index - previous >= ba...
def result(G_ab,kmeans,kmeans_cluster_centers_mag,of_idx,of_min_x,of_min_y,n_clusters,knn,dataset): dist = np.ones(n_clusters)*100 valid = np.ones(n_clusters) for i in range(0,n_clusters): # get pixel coordinates of VP point plane cantidate y_idx,x_idx = np.unravel_index(np.argmax(G_ab[:,:,i], axis=None)...
def result(G_ab, kmeans, kmeans_cluster_centers_mag, of_idx, of_min_x, of_min_y, n_clusters, knn, dataset): dist = np.ones(n_clusters) * 100 valid = np.ones(n_clusters) for i in range(0, n_clusters): (y_idx, x_idx) = np.unravel_index(np.argmax(G_ab[:, :, i], axis=None), G_ab[:, :, i].shape) ...
#!/usr/bin/env python # coding=utf-8 def ClassSchedule(DB, pam): json_data = { "code": 0, "msg": "" } if pam == "": json_data["code"] = "0" json_data["msg"] = "false" return json_data classid = pam["Pam"] # &Schedule.WID, &Schedule.Chapter, &Schedule.CourseN...
def class_schedule(DB, pam): json_data = {'code': 0, 'msg': ''} if pam == '': json_data['code'] = '0' json_data['msg'] = 'false' return json_data classid = pam['Pam'] sql_str = 'select * from (SELECT T3.*,T4.ID as tid,T4.`start` as tstart,t4.`end` as tend from(select t1.*,t2.User...
def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello world!") decorated = decor(print_text) decorated()
def decor(func): def wrap(): print('============') func() print('============') return wrap def print_text(): print('Hello world!') decorated = decor(print_text) decorated()
for i in range(100, 1000): base9 = '' base10 = i # Convert to base 9 for j in range(0,3): r = base10 % 9 base10 = (base10 - r) / 9 base9 = str(int(r)) + base9 # compare base 10 to reversed base9 if str(i) == str(base9)[::-1]: print('Found...
for i in range(100, 1000): base9 = '' base10 = i for j in range(0, 3): r = base10 % 9 base10 = (base10 - r) / 9 base9 = str(int(r)) + base9 if str(i) == str(base9)[::-1]: print('Found: ' + str(i) + '^10 == ' + str(base9) + '^9') break
# # PySNMP MIB module EQLCONTROLLER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EQLCONTROLLER-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:05:16 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, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
#!/bin/python num = int(input()) possibilities = 0 while num >= 0: if num % 4 == 0: possibilities += 1 num -= 5 print(possibilities)
num = int(input()) possibilities = 0 while num >= 0: if num % 4 == 0: possibilities += 1 num -= 5 print(possibilities)
class Mouse(object): def __init__(self, browser): self.browser = browser def left_click( self, element=None, by_id=None, by_xpath=None, by_link=None, by_partial_link=None, by_name=None, by_tag=None, by_css=None, by_class=No...
class Mouse(object): def __init__(self, browser): self.browser = browser def left_click(self, element=None, by_id=None, by_xpath=None, by_link=None, by_partial_link=None, by_name=None, by_tag=None, by_css=None, by_class=None): self.left_click_by_offset(element, 0, 0, by_id=by_id, by_xpath=by_x...
# Theory: Kwargs # With *args you can create more flexible functions that accept # a varying number of positional arguments. You may now wonder # how to do the same with named arguments. Fortunately, in # Python, you can work with keyword arguments in a similar way. # Multiple keyword arguments # Let's get acquianted...
def capital(**kwargs): for (key, value) in kwargs.items(): print(value, 'is the capital city of', key) capital(Canada='Ottawa', Estonia='Tallinn', Venezuela='Caracas', Finland='Helsinki') def func(positional_args, defaults, *args, **kwargs): pass def say_bye(**names): for name in names: pr...
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ x = 42 y = 73 # Compares the vallue of x and y if x < y: print('x < y: x is {} and y is {}'.format(x, y)) elif x > y: print("x is greater than y") else: print("x and y are equal") if x > y: print('x > y: x is {} and y is {}'.format(x, y)...
x = 42 y = 73 if x < y: print('x < y: x is {} and y is {}'.format(x, y)) elif x > y: print('x is greater than y') else: print('x and y are equal') if x > y: print('x > y: x is {} and y is {}'.format(x, y)) print('Inside Condition') x = 10 print(x)
__title__ = 'Generative FSL for Covid Prediction' __version__ = '1.0.0' __author__ = 'Suvarna Kadam' __license__ = 'MIT' __copyright__ = 'Copyright 2021'
__title__ = 'Generative FSL for Covid Prediction' __version__ = '1.0.0' __author__ = 'Suvarna Kadam' __license__ = 'MIT' __copyright__ = 'Copyright 2021'
print('Temperature conversion program') print(' press 1 for convert from celcius to another \n press 2 for convert from faremhit to another \n press 3 for convert from kelvin to another') choice = int(input('enter your choice number : ')) if choice >3: print('invalid choice optino...please enter from 1 to 3...
print('Temperature conversion program') print(' press 1 for convert from celcius to another \n press 2 for convert from faremhit to another \n press 3 for convert from kelvin to another') choice = int(input('enter your choice number : ')) if choice > 3: print('invalid choice optino...please enter from 1 to 3') if c...
# coding: utf-8 """***************************************************************************** * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * re...
"""***************************************************************************** * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
def cipher(text, shift, encrypt=True): """ Encrypts/decrypts the alphabetical portion of python strings according to a given shift integer value Parameters ---------- text: str A python string that you wish to encrypt/decrypt shift: int A python integer which determines the valu...
def cipher(text, shift, encrypt=True): """ Encrypts/decrypts the alphabetical portion of python strings according to a given shift integer value Parameters ---------- text: str A python string that you wish to encrypt/decrypt shift: int A python integer which determines the valu...
class Solution(object): def compareVersion(self, version1, version2): """ :type version1: str :type version2: str :rtype: int """ versionList1 = version1.split(".") versionList2 = version2.split(".") total_level_revisions = max([len(versionList1), len(...
class Solution(object): def compare_version(self, version1, version2): """ :type version1: str :type version2: str :rtype: int """ version_list1 = version1.split('.') version_list2 = version2.split('.') total_level_revisions = max([len(versionList1), ...
#!/usr/bin/env python3 def primer3_input(header, sequence, args): """ Generates a primer3 input file with specified arguments. Args: header (string): The primer header string sequence (string): the sequence used to design primers args (Namespace): Arparse results. Returns: p...
def primer3_input(header, sequence, args): """ Generates a primer3 input file with specified arguments. Args: header (string): The primer header string sequence (string): the sequence used to design primers args (Namespace): Arparse results. Returns: primer3_input_string (str...
a=int(input('enter a :')) b=int(input('enter a :')) c=int(input('enter a :')) def largest_num(x,y,z): if x>y and x>z: print(x) elif y>x and y>z: print(y) else: print(z) print('largest :',end="") largest_num(a,b,c)
a = int(input('enter a :')) b = int(input('enter a :')) c = int(input('enter a :')) def largest_num(x, y, z): if x > y and x > z: print(x) elif y > x and y > z: print(y) else: print(z) print('largest :', end='') largest_num(a, b, c)
"""The Decisions module contains the command parsing logic.""" validCommands = ["h", "w"] def processCommand(command: str): # NOTE: that type hinting is still used above """Processes the gamer's input. (below is the Google docstrings example) Args: command (str): The command to process ...
"""The Decisions module contains the command parsing logic.""" valid_commands = ['h', 'w'] def process_command(command: str): """Processes the gamer's input. (below is the Google docstrings example) Args: command (str): The command to process """ print('User entered : ' + command)
# List in Python # from typing import Tuple name = ["Anirban", "Rangan", "Miko", "UK NK", "Lucifer"] print(name) # mixed List mixing1 = ["ISHITA ROY", 143, 0.99, 'E'] print(mixing1) print(mixing1[2]) # list shorting num1 = [2, 5, 78, 3, 88, 23, 1, 94, 33, 21, 5, 3, 67, 27] print(num1) num2 = num1.copy() num1.sort() pr...
name = ['Anirban', 'Rangan', 'Miko', 'UK NK', 'Lucifer'] print(name) mixing1 = ['ISHITA ROY', 143, 0.99, 'E'] print(mixing1) print(mixing1[2]) num1 = [2, 5, 78, 3, 88, 23, 1, 94, 33, 21, 5, 3, 67, 27] print(num1) num2 = num1.copy() num1.sort() print(num1) num1.reverse() num1.remove(33) num1.pop() num1.append(101) num1....
# -*- coding: utf-8 -*- """ @author: zhoujiagen Created on 2020/8/21 5:14 PM """
""" @author: zhoujiagen Created on 2020/8/21 5:14 PM """
class Drivers: def __init__(self, client): self.client = client def find_by_context(self, context, filter=None, observations=False, participation=False, interval=None): """ Fetches driver data from the specified context id :param context: Context id to fetch the data ...
class Drivers: def __init__(self, client): self.client = client def find_by_context(self, context, filter=None, observations=False, participation=False, interval=None): """ Fetches driver data from the specified context id :param context: Context id to fetch the data :...
def gcd(a, b): """ Returns the greatest common divisor of and b. """ if a < b: a, b = b,a while b > 0: a, b = b, a % b return a print(gcd(50, 20)) print(gcd(22,143))
def gcd(a, b): """ Returns the greatest common divisor of and b. """ if a < b: (a, b) = (b, a) while b > 0: (a, b) = (b, a % b) return a print(gcd(50, 20)) print(gcd(22, 143))
#ex_086 m = [[],[],[]] for j in range(3): for i in range(3): n = int(input(f'digite o valor para o bloco[{j},{i}]:')) m[j].append(n) for l in range(3): print(m[l]) #ex_087 soma = soma3 = 0 for j in range(3): for i in range(3): if int(m[j][i])%2==0: soma += int(m[j][i]) p...
m = [[], [], []] for j in range(3): for i in range(3): n = int(input(f'digite o valor para o bloco[{j},{i}]:')) m[j].append(n) for l in range(3): print(m[l]) soma = soma3 = 0 for j in range(3): for i in range(3): if int(m[j][i]) % 2 == 0: soma += int(m[j][i]) print(f'letr...
class AiManager: def __init__(self, modstring): self.modlines = modstring self.fn = self.get_fn() self.edits = self.get_edits() def get_fn(self): return self.modlines[0].split("# ")[1].strip() def get_edits(self): return [{"offset": int(e.split(" ")[0], 16)...
class Aimanager: def __init__(self, modstring): self.modlines = modstring self.fn = self.get_fn() self.edits = self.get_edits() def get_fn(self): return self.modlines[0].split('# ')[1].strip() def get_edits(self): return [{'offset': int(e.split(' ')[0], 16), 'value...
"""General definitions for the AmigaOS Hunk format""" HUNK_UNIT = 999 HUNK_NAME = 1000 HUNK_CODE = 1001 HUNK_DATA = 1002 HUNK_BSS = 1003 HUNK_ABSRELOC32 = 1004 HUNK_RELRELOC16 = 1005 HUNK_RELRELOC8 = 1006 HUNK_EXT = 1007 HUNK_SYMBOL = 1008 HUNK_DEBUG = 1009 HUNK_END = 1010 HUNK_HEADER = 1011 HUNK_OVERLAY = 1013 HUNK_...
"""General definitions for the AmigaOS Hunk format""" hunk_unit = 999 hunk_name = 1000 hunk_code = 1001 hunk_data = 1002 hunk_bss = 1003 hunk_absreloc32 = 1004 hunk_relreloc16 = 1005 hunk_relreloc8 = 1006 hunk_ext = 1007 hunk_symbol = 1008 hunk_debug = 1009 hunk_end = 1010 hunk_header = 1011 hunk_overlay = 1013 hunk_br...
# Given an array of integers that is already sorted in ascending order, # find two numbers such that they add up to a specific target number. # # The function twoSum should return indices of the two numbers such # that they add up to the target, where index1 must be less than index2. # # Note: # # Your returned answers...
class Solution: def two_sum(self, numbers, target): left = 0 right = len(numbers) - 1 while left < right: total = numbers[left] + numbers[right] if total == target: return [left + 1, right + 1] elif total > target: right -=...
companies = {} command = input() while not command == "End": company, emp_id = command.split(" -> ") if company not in companies: companies[company] = [emp_id] else: if emp_id not in companies[company]: companies[company].append(emp_id) command = input() for company, emp_id...
companies = {} command = input() while not command == 'End': (company, emp_id) = command.split(' -> ') if company not in companies: companies[company] = [emp_id] elif emp_id not in companies[company]: companies[company].append(emp_id) command = input() for (company, emp_ids) in sorted(co...
tup = ("apple", "banana", "cherry") it = iter(tup) print(next(it)) print(next(it)) print(next(it)) #using class class numbers: def __iter__(self): self.a = 1 return self def __next__(self): x = self.a self.a += 1 return x myclass = numbers() myiter = iter(myclass) print(next(myiter)) print...
tup = ('apple', 'banana', 'cherry') it = iter(tup) print(next(it)) print(next(it)) print(next(it)) class Numbers: def __iter__(self): self.a = 1 return self def __next__(self): x = self.a self.a += 1 return x myclass = numbers() myiter = iter(myclass) print(next(myiter...
# -*- coding: utf-8 -*- def main(): a, b, k = map(int, input().split()) takahashi = a aoki = b for i in range(k): if i % 2 == 0: if takahashi % 2 == 1: takahashi -= 1 takahashi -= takahashi // 2 aoki += takahashi else...
def main(): (a, b, k) = map(int, input().split()) takahashi = a aoki = b for i in range(k): if i % 2 == 0: if takahashi % 2 == 1: takahashi -= 1 takahashi -= takahashi // 2 aoki += takahashi else: if aoki % 2 == 1: ...
""" LC 406 You are given an array of people, people, which are the attributes of some people in a queue (not necessarily in order). Each people[i] = [hi, ki] represents the ith person of height hi with exactly ki other people in front who have a height greater than or equal to hi. Reconstruct and return the queue that...
""" LC 406 You are given an array of people, people, which are the attributes of some people in a queue (not necessarily in order). Each people[i] = [hi, ki] represents the ith person of height hi with exactly ki other people in front who have a height greater than or equal to hi. Reconstruct and return the queue that...
w1 = [[ 0.21188451, -0.07536257, -1.50488397, 1.07709642, -1.00670164, 0.70171048, 0.46828757, 1.61520523, -0.61159711, 0.62985384], [ 2.62728329, -2.12787044, -0.37743212, -0.03947755, -0.52624001, -1.86089361, -0.83215303, 0.08603709, -2.79556013, -3.05423877], [-2.74150917, 2.20029538, -0.66665525, -2.7...
w1 = [[0.21188451, -0.07536257, -1.50488397, 1.07709642, -1.00670164, 0.70171048, 0.46828757, 1.61520523, -0.61159711, 0.62985384], [2.62728329, -2.12787044, -0.37743212, -0.03947755, -0.52624001, -1.86089361, -0.83215303, 0.08603709, -2.79556013, -3.05423877], [-2.74150917, 2.20029538, -0.66665525, -2.73734087, -1.440...
DEBUG = True TABLE_NAME = "users" PERMANENT_SESSION_LIFETIME = 1260 TIMEOUT_WARNING_MS = 900000 TIMEOUT_LOGOUT_MS = 1200000 KEEPALIVE_INTERVAL_MS = 60000 SITE_NAME = 'GREP Annotation Viewer'
debug = True table_name = 'users' permanent_session_lifetime = 1260 timeout_warning_ms = 900000 timeout_logout_ms = 1200000 keepalive_interval_ms = 60000 site_name = 'GREP Annotation Viewer'
class preprocess: words_0 = {} words_1 = {} cnt_0 = 0 cnt_1 = 0 content = [] def __init__(self,file1): self.file1 = file1 def split_file_test_train(self,a,b): f1 = open("train.txt", "w") f2 = open("test.txt", "w") lines = [] with open(self.file1.name) ...
class Preprocess: words_0 = {} words_1 = {} cnt_0 = 0 cnt_1 = 0 content = [] def __init__(self, file1): self.file1 = file1 def split_file_test_train(self, a, b): f1 = open('train.txt', 'w') f2 = open('test.txt', 'w') lines = [] with open(self.file1.n...
''' This program will take multiple inputs from the user and when he enters done as his last input it will return largest and smallest values of user's respective inputs ''' #we are using none as in the loop first value will replace them automatically largest = None smallest = None while True: num = input('Inp...
""" This program will take multiple inputs from the user and when he enters done as his last input it will return largest and smallest values of user's respective inputs """ largest = None smallest = None while True: num = input('Input Number: ') if num == 'done': break try: fnum = float(...
{ 'variables' : { 'xmpmeta_dir': '<(DEPTH)/third_party/xmpmeta/internal/xmpmeta', }, 'target_defaults': { 'include_dirs' : [ '<(xmpmeta_dir)/external', '<(xmpmeta_dir)/external/miniglog', ], }, 'targets': [ { 'target_name': 'xmpmeta_strings', 'dependencies': [ '...
{'variables': {'xmpmeta_dir': '<(DEPTH)/third_party/xmpmeta/internal/xmpmeta'}, 'target_defaults': {'include_dirs': ['<(xmpmeta_dir)/external', '<(xmpmeta_dir)/external/miniglog']}, 'targets': [{'target_name': 'xmpmeta_strings', 'dependencies': ['<(xmpmeta_dir)/external/miniglog/glog/glog.gyp:xmpmeta_glog'], 'type': 's...
# These CPC codes are international classifiers for patents. # This dict is imported by patenttools.lookup and is used to provide the "patent class". cpc_codes = { 'B29L': 'INDEXING SCHEME ASSOCIATED WITH SUBCLASS B29C, RELATING TO PARTICULAR ARTICLES', 'D01D': 'MECHANICAL METHODS OR APPARATUS IN THE MANUFACTUR...
cpc_codes = {'B29L': 'INDEXING SCHEME ASSOCIATED WITH SUBCLASS B29C, RELATING TO PARTICULAR ARTICLES', 'D01D': 'MECHANICAL METHODS OR APPARATUS IN THE MANUFACTURE OF ARTIFICIAL FILAMENTS, THREADS, FIBRES, BRISTLES OR RIBBONS', 'A47F': 'SPECIAL FURNITURE, FITTINGS, OR ACCESSORIES FOR SHOPS, STOREHOUSES, BARS, RESTAURANT...
class Antecedent(): def __init__(self, template, template_property, value): self.template = template self.template_property = template_property self.value = value class TestAntecedent(): def __init__(self, operation, *parametres): self.parameters = [] self.oper...
class Antecedent: def __init__(self, template, template_property, value): self.template = template self.template_property = template_property self.value = value class Testantecedent: def __init__(self, operation, *parametres): self.parameters = [] self.operation = oper...
n = int(input()) for i in range(n): nota01, nota02, nota03 = map(float, input().split()) total = ((nota01*2) + (nota02*3) + (nota03*5))/10 print('%.1f' % round(total, 1))
n = int(input()) for i in range(n): (nota01, nota02, nota03) = map(float, input().split()) total = (nota01 * 2 + nota02 * 3 + nota03 * 5) / 10 print('%.1f' % round(total, 1))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next # https://leetcode.com/problems/merge-k-sorted-lists # Other solutions: ''' https://leetcode.com/problems/merge-k-sorted-lists/discuss/1810642/C%2B%2B-oror-Priority-Queu...
""" https://leetcode.com/problems/merge-k-sorted-lists/discuss/1810642/C%2B%2B-oror-Priority-Queue-oror-23.-Merge-k-Sorted-Lists 1. Creates a priority queue, inserting all input linked lists, sorted based on node values: HOW?? 1.1. Each node in the queue is <value, node-pointer> 1.2. How q.push({list->val,list});...
"""https://open.kattis.com/problems/avion""" codes = [] for _ in range(5): codes.append(input()) found = False for i in range(5): if "FBI" in codes[i]: print(i + 1, end=' ') found = True if not found: print("HE GOT AWAY!")
"""https://open.kattis.com/problems/avion""" codes = [] for _ in range(5): codes.append(input()) found = False for i in range(5): if 'FBI' in codes[i]: print(i + 1, end=' ') found = True if not found: print('HE GOT AWAY!')
CARD_SUITS = ("SPADES", "HEARTS", "DIAMONDS", "CLUBS") PLAYERS_DEFAULT = 2 DECKS_AMOUNT = 1 RANDOM_NAMES = [ "Geralt of Rivia", "Ciri of Cintra", "Yennefer of Vengerberg", "Triss Merigold", "Dandelion", "Mousesack", "Gaunter O'Dimm", "Keira Metz", "Emhyr var Emreis", "The Angry S...
card_suits = ('SPADES', 'HEARTS', 'DIAMONDS', 'CLUBS') players_default = 2 decks_amount = 1 random_names = ['Geralt of Rivia', 'Ciri of Cintra', 'Yennefer of Vengerberg', 'Triss Merigold', 'Dandelion', 'Mousesack', "Gaunter O'Dimm", 'Keira Metz', 'Emhyr var Emreis', 'The Angry Shiba Inu'] default_turn_time_seconds = 1
# from fuzzywuzzy import fuzz class Collection(): """ Base class for collection of data objects **Arguments:** :``datafile``: `str` Filename for local datafile :``base_class``: `class` Class to instantiate for entires in this collection **Keyword Arguments:** ...
class Collection: """ Base class for collection of data objects **Arguments:** :``datafile``: `str` Filename for local datafile :``base_class``: `class` Class to instantiate for entires in this collection **Keyword Arguments:** :``local``: `bool` If true, load...