content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Generated from 'Events.h' nullEvent = 0 mouseDown = 1 mouseUp = 2 keyDown = 3 keyUp = 4 autoKey = 5 updateEvt = 6 diskEvt = 7 activateEvt = 8 osEvt = 15 kHighLevelEvent = 23 mDownMask = 1 << mouseDown mUpMask = 1 << mouseUp keyDownMask = 1 << keyDown keyUpMask = 1 << keyUp autoKeyMask = 1 << autoKey updateMask = 1 <...
null_event = 0 mouse_down = 1 mouse_up = 2 key_down = 3 key_up = 4 auto_key = 5 update_evt = 6 disk_evt = 7 activate_evt = 8 os_evt = 15 k_high_level_event = 23 m_down_mask = 1 << mouseDown m_up_mask = 1 << mouseUp key_down_mask = 1 << keyDown key_up_mask = 1 << keyUp auto_key_mask = 1 << autoKey update_mask = 1 << upd...
SOLUTIONS = '/view' STATUS = '/status' DOWNLOADS = '/download' SHARED = '/shared' GIT = '/git/<int:course_id>/<int:exercise_number>.git'
solutions = '/view' status = '/status' downloads = '/download' shared = '/shared' git = '/git/<int:course_id>/<int:exercise_number>.git'
# GATES OGORK # SPRING 2021 FINAL PROJECT # IS 3220 # PASSWORD GENERATOR # MAY 2, 2021 def reverse(app_name): # this function reverses whatever word the user inputs app_name = app_name.lower() return app_name[::-1] def a_replace(name): # this function replaces every "a" with "@" ret...
def reverse(app_name): app_name = app_name.lower() return app_name[::-1] def a_replace(name): return name.replace('a', '@') def o_replace(name): return name.replace('o', '0') def fifth_replace(name): name = list(name) name[4] = '#' name = ''.join(name) return name def duplicate(name)...
#!/usr/bin/python def read_file(file, delimiter): """Reads data from a file, separated via delimiter Args: file: Path to file. delimiter: Data value separator, similar to using CSV. Returns: An array of dict records. """ f = open(file, 'r') lines = f.readlines() records = [] f...
def read_file(file, delimiter): """Reads data from a file, separated via delimiter Args: file: Path to file. delimiter: Data value separator, similar to using CSV. Returns: An array of dict records. """ f = open(file, 'r') lines = f.readlines() records = [] for line i...
# Copyright (c) 2017-present, Facebook, 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 o...
def cityscapes_to_coco(cityscapes_id): lookup = {0: 0, 1: 2, 2: 3, 3: 1, 4: 7, 5: 8, 6: 4, 7: 6, 8: -1} return lookup[cityscapes_id] def cityscapes_to_coco_with_rider(cityscapes_id): lookup = {0: 0, 1: 2, 2: 3, 3: 1, 4: 7, 5: 8, 6: 4, 7: 6, 8: 1} return lookup[cityscapes_id] def cityscapes_to_coco_wit...
__author__ = 'roland' NORMAL = "/_/_/_/normal" IDMAP = { # Webfinger "rp-discovery-webfinger-url": NORMAL, "rp-discovery-webfinger-acct": NORMAL, 'rp-discovery-webfinger-http-href': '/_/_/httphref/normal', 'rp-discovery-webfinger-unknown-member': '/_/_/wfunknown/normal', # Discovery "rp-di...
__author__ = 'roland' normal = '/_/_/_/normal' idmap = {'rp-discovery-webfinger-url': NORMAL, 'rp-discovery-webfinger-acct': NORMAL, 'rp-discovery-webfinger-http-href': '/_/_/httphref/normal', 'rp-discovery-webfinger-unknown-member': '/_/_/wfunknown/normal', 'rp-discovery-openid-configuration': NORMAL, 'rp-discovery-jw...
lista = ['A', 'B', 'C'] for i, itens in enumerate(lista): print (i + 1, ' = ', itens) lista[-1] = 'D' lista[-2] = 'F' lista[-3] = 'M' for e, itens in enumerate(lista): print (e + 1, ' -> ', itens) lista.remove('F') for d, itens in enumerate(lista): print(d + 1, ' == ', itens) lista.extend(['B', 'C', 'A']) l...
lista = ['A', 'B', 'C'] for (i, itens) in enumerate(lista): print(i + 1, ' = ', itens) lista[-1] = 'D' lista[-2] = 'F' lista[-3] = 'M' for (e, itens) in enumerate(lista): print(e + 1, ' -> ', itens) lista.remove('F') for (d, itens) in enumerate(lista): print(d + 1, ' == ', itens) lista.extend(['B', 'C', 'A'...
"""Error classes for Pydactyl.""" class PydactylError(Exception): """Base error class.""" pass class BadRequestError(PydactylError): """Raised when a request is passed invalid parameters.""" pass class ClientConfigError(PydactylError): """Raised when a client configuration error exists.""" ...
"""Error classes for Pydactyl.""" class Pydactylerror(Exception): """Base error class.""" pass class Badrequesterror(PydactylError): """Raised when a request is passed invalid parameters.""" pass class Clientconfigerror(PydactylError): """Raised when a client configuration error exists.""" pa...
class Register: def __init__(self, id): self.id = id regs = [Register(i) for i in range(16)] RG0, RG1, RG2, RG3, RG4, RG5, RG6, RG7, RG8, RG9, RG10, RG11, RG12, RG13, RIP, RBANK = regs
class Register: def __init__(self, id): self.id = id regs = [register(i) for i in range(16)] (rg0, rg1, rg2, rg3, rg4, rg5, rg6, rg7, rg8, rg9, rg10, rg11, rg12, rg13, rip, rbank) = regs
oscar_number = int(input()) message = '' if oscar_number == 88: message = 'Leo finally won the Oscar! Leo is happy' elif oscar_number == 86: message = 'Not even for Wolf of Wall Street?!' elif oscar_number < 88 and oscar_number != 86: message = 'When will you give Leo an Oscar?' elif oscar_number ...
oscar_number = int(input()) message = '' if oscar_number == 88: message = 'Leo finally won the Oscar! Leo is happy' elif oscar_number == 86: message = 'Not even for Wolf of Wall Street?!' elif oscar_number < 88 and oscar_number != 86: message = 'When will you give Leo an Oscar?' elif oscar_number > 88: ...
test_cases = int(input().strip()) for t in range(1, test_cases + 1): N, M = map(int, input().strip().split()) binary = bin(M)[2:].zfill(N)[-N:] result = 'ON' if '0' in binary: result = 'OFF' print('#{} {}'.format(t, result))
test_cases = int(input().strip()) for t in range(1, test_cases + 1): (n, m) = map(int, input().strip().split()) binary = bin(M)[2:].zfill(N)[-N:] result = 'ON' if '0' in binary: result = 'OFF' print('#{} {}'.format(t, result))
# # Project Euler Math Functions # Soren Rasmussen 5/14/2015 # #!/usr/bin/python def sieveOfEratosthenes(n): primes = [0]*n output = [] for i in range(2,n): if primes[i] == 0: output.append(i) j=2*i while j < n: primes[j] = 1 ...
def sieve_of_eratosthenes(n): primes = [0] * n output = [] for i in range(2, n): if primes[i] == 0: output.append(i) j = 2 * i while j < n: primes[j] = 1 j += i return output
a=int(input()) b=int(input()) c=int(input()) d=int(input()) print((a^b)&(c|d)^((b&c)|(a^d)))
a = int(input()) b = int(input()) c = int(input()) d = int(input()) print((a ^ b) & (c | d) ^ (b & c | a ^ d))
def map(nums_list, operation): ''' Return a sequence of values obtained by applying the operation function to each number in nums_list. ''' return [operation(num) for num in nums_list] def double(num): return num * 2 def triple(num): return num * 3 nums_list = (1, 3, -10) for operation in (doubl...
def map(nums_list, operation): """ Return a sequence of values obtained by applying the operation function to each number in nums_list. """ return [operation(num) for num in nums_list] def double(num): return num * 2 def triple(num): return num * 3 nums_list = (1, 3, -10) for operation in (double,...
# -*- coding: utf-8 -*- if __name__ == '__main__': crawl_name = 'maomi_china_selfie' cmd = 'scrapy crawl {0}'.format(crawl_name) # cmdline.execute(['scrapy','crawl','csgbidding']) cmdline.execute(cmd.split())
if __name__ == '__main__': crawl_name = 'maomi_china_selfie' cmd = 'scrapy crawl {0}'.format(crawl_name) cmdline.execute(cmd.split())
# -*- coding: utf-8 -*- """Model config in json format""" kaggle_config = { "dataset": { "download": False, "data_dir": "~/tensorflow_datasets", }, "data": { "class_names": ["PNEUMONIA"], "image_dimension": (224, 224, 3), "image_height": 224, "image_width": 2...
"""Model config in json format""" kaggle_config = {'dataset': {'download': False, 'data_dir': '~/tensorflow_datasets'}, 'data': {'class_names': ['PNEUMONIA'], 'image_dimension': (224, 224, 3), 'image_height': 224, 'image_width': 224, 'image_channel': 3}, 'train': {'train_base': False, 'use_chexnet_weights': False, 'aug...
# oop/mro.simple.py class A: label = 'a' class B(A): label = 'b' class C(A): label = 'c' class D(B, C): pass d = D() print(d.label) # Hypothetically this could be either 'b' or 'c' print(d.__class__.mro()) # notice another way to get the MRO # prints: # [<class '__main__.D'>, <class '__main__....
class A: label = 'a' class B(A): label = 'b' class C(A): label = 'c' class D(B, C): pass d = d() print(d.label) print(d.__class__.mro()) "\n$ python mro.simple.py\nb\n[\n <class '__main__.D'>, <class '__main__.B'>,\n <class '__main__.C'>, <class '__main__.A'>,\n <class 'object'>\n]\n"
""" Constants for websites """ CONTENT_TYPE_PAGE = "page" CONTENT_TYPE_RESOURCE = "resource" CONTENT_TYPE_INSTRUCTOR = "instructor" CONTENT_TYPE_METADATA = "sitemetadata" CONTENT_TYPE_NAVMENU = "navmenu" COURSE_PAGE_LAYOUTS = ["instructor_insights"] COURSE_RESOURCE_LAYOUTS = ["pdf", "video"] CONTENT_FILENAME_MAX_LEN...
""" Constants for websites """ content_type_page = 'page' content_type_resource = 'resource' content_type_instructor = 'instructor' content_type_metadata = 'sitemetadata' content_type_navmenu = 'navmenu' course_page_layouts = ['instructor_insights'] course_resource_layouts = ['pdf', 'video'] content_filename_max_len = ...
class TestApplication: # Will the application start? def test_start(self, application): application.start()
class Testapplication: def test_start(self, application): application.start()
class Error(Exception): """Base class for other exceptions""" pass class ConfigNotFound(Error): """Raise when config file is required but not present""" print(f"ERROR:FileNotFound: Please provide configuration file using '-c' argument or check file path") exit(1)
class Error(Exception): """Base class for other exceptions""" pass class Confignotfound(Error): """Raise when config file is required but not present""" print(f"ERROR:FileNotFound: Please provide configuration file using '-c' argument or check file path") exit(1)
class ProviderException(Exception): pass class NoProviderException(ProviderException): def __init__(self, hostname) -> None: self.hostname = hostname def __str__(self) -> str: return "No provider for {0}".format(self.hostname)
class Providerexception(Exception): pass class Noproviderexception(ProviderException): def __init__(self, hostname) -> None: self.hostname = hostname def __str__(self) -> str: return 'No provider for {0}'.format(self.hostname)
#!/usr/bin/env python NAME = 'Alert Logic (Alert Logic)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return _, page = r if all(i in page for i in (b'<title>Requested URL cannot be found</title>', b'Proceed to homepage', ...
name = 'Alert Logic (Alert Logic)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return (_, page) = r if all((i in page for i in (b'<title>Requested URL cannot be found</title>', b'Proceed to homepage', b'Back to previous page', b'We are so...
load( ":common.bzl", "dart_filetypes", "filter_files", "has_dart_sources", "make_dart_context", "make_package_uri", "api_summary_extension", ) def ddc_action(ctx, dart_ctx, ddc_output, source_map_output): """ddc compile action.""" flags = [] if ctx.attr.force_ddc_compile: print("...
load(':common.bzl', 'dart_filetypes', 'filter_files', 'has_dart_sources', 'make_dart_context', 'make_package_uri', 'api_summary_extension') def ddc_action(ctx, dart_ctx, ddc_output, source_map_output): """ddc compile action.""" flags = [] if ctx.attr.force_ddc_compile: print('Force compile %s?' % c...
str = "This is string example" print("Reversed string is: "+str[::-1]) ss = str.split(" ") print("Reversed words are: "+ss[0][::-1]+" "+ss[1][::-1]+" "+ss[2][::-1]+" "+ss[3][::-1]) print("Reversed letters are: "+ss[0][0:2][::-1]) print("*".join(ss)) print("Replaced by was is: "+ss[0]+" "+ss[1].replace("is","was")+...
str = 'This is string example' print('Reversed string is: ' + str[::-1]) ss = str.split(' ') print('Reversed words are: ' + ss[0][::-1] + ' ' + ss[1][::-1] + ' ' + ss[2][::-1] + ' ' + ss[3][::-1]) print('Reversed letters are: ' + ss[0][0:2][::-1]) print('*'.join(ss)) print('Replaced by was is: ' + ss[0] + ' ' + ss[1].r...
# -*- coding: utf-8 -*- """ Statistics collector helper class for pdf2xlsx """ class StatLogger(): """ Collect statistic about the zip to xlsx process. Assembles a list containin invoice number of items. Every item is the number of entries found during the invoice parsing. It implements a simple API: ne...
""" Statistics collector helper class for pdf2xlsx """ class Statlogger: """ Collect statistic about the zip to xlsx process. Assembles a list containin invoice number of items. Every item is the number of entries found during the invoice parsing. It implements a simple API: new_invo(), new_entr() and ...
# -*- coding: utf-8 -*- """ Written by Daniel M. Aukes Email: danaukes<at>gmail.com Please see LICENSE for full license. """ class NameGenerator(object): @classmethod def generate_name(cls): try: name = cls._generate_name() except AttributeError: cls._ii = 0 ...
""" Written by Daniel M. Aukes Email: danaukes<at>gmail.com Please see LICENSE for full license. """ class Namegenerator(object): @classmethod def generate_name(cls): try: name = cls._generate_name() except AttributeError: cls._ii = 0 name = cls._generate_na...
#!/usr/bin/env python """ Expression Add Operators Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the digits so they evaluate to the target value. Examples: "123", 6 -> ["1+2+3", "1*2*3"] "232", 8 -> ["2*3+2"...
""" Expression Add Operators Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the digits so they evaluate to the target value. Examples: "123", 6 -> ["1+2+3", "1*2*3"] "232", 8 -> ["2*3+2", "2+3*2"] "105", 5 -> ["1*0+5",...
class Solution: def lengthOfLastWord(self, s): s=s.split() if len(s)==0: return 0 return len(s[-1])
class Solution: def length_of_last_word(self, s): s = s.split() if len(s) == 0: return 0 return len(s[-1])
schema = { 'user': [ { 'mail_id': 'string', 'patient': [ { 'name': 'string', 'mob': 9929929922, 'address': 'string', 'stats': {...}, }, {...} ], 're...
schema = {'user': [{'mail_id': 'string', 'patient': [{'name': 'string', 'mob': 9929929922, 'address': 'string', 'stats': {...}}, {...}], 'reports': {'heart': [{'patient_id': 932003, 'time': 'datetime', 'stats': {}}, {...}], 'diabetes': [{'patient_id': 392, 'time': 'datetime'}]}}, {...}], 'suggestions': {'heart': ['poin...
buildcode=""" function Get-SystemTime(){ $time_mask = @() $the_time = Get-Date $time_mask += [string]$the_time.Year + "0000" $time_mask += [string]$the_time.Year + [string]$the_time.Month + "00" $time_mask += [string]$the_time.Year + [string]$the_time.Month + [string]$the_time.Day return $time_mask } """ callco...
buildcode = '\nfunction Get-SystemTime(){\n\t$time_mask = @()\n\t$the_time = Get-Date\n\t$time_mask += [string]$the_time.Year + "0000"\n\t$time_mask += [string]$the_time.Year + [string]$the_time.Month + "00"\n\t$time_mask += [string]$the_time.Year + [string]$the_time.Month + [string]$the_time.Day\n\treturn $time_mask\n...
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\xcc\xb5(e\x9f\xabO\r,\xe6J\x922\x85M\xb7' _lr_action_items = {'LOGOR':([6,11,12,17,20,21,22,28,32,33,35,47,48,49,50,51,80,81,88,89,92,100,101,102,103,104,105,106,107,108,109,110,111,112,1...
_tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '̵(e\x9f«O\r,æJ\x922\x85M·' _lr_action_items = {'LOGOR': ([6, 11, 12, 17, 20, 21, 22, 28, 32, 33, 35, 47, 48, 49, 50, 51, 80, 81, 88, 89, 92, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 118, 122, 124, 129, 132, 135, 136], ...
class JobResultExample(object): IN_PROGRESS = { "status": { "state": "IN PROGRESS" }, "configuration": { "copy": { "sourceTable": { "projectId": "source_project_id", "tableId": "source_table_id$123", ...
class Jobresultexample(object): in_progress = {'status': {'state': 'IN PROGRESS'}, 'configuration': {'copy': {'sourceTable': {'projectId': 'source_project_id', 'tableId': 'source_table_id$123', 'datasetId': 'source_dataset_id'}, 'destinationTable': {'projectId': 'target_project_id', 'tableId': 'target_table_id', 'd...
mongo = { 'server': '127.0.0.1', 'database': 'geodigger', 'collection': 'data', } email = { 'server': '', 'username': '', 'address': '', 'password': '', } ui = { 'tmp': '/tmp/geodiggerui', }
mongo = {'server': '127.0.0.1', 'database': 'geodigger', 'collection': 'data'} email = {'server': '', 'username': '', 'address': '', 'password': ''} ui = {'tmp': '/tmp/geodiggerui'}
#Conditions sur les nombres pairs et impairs a = int(input("saisir nombre : ")) if a%2 == 0: print("le nombre est pair") else: print("le nombre est impair")
a = int(input('saisir nombre : ')) if a % 2 == 0: print('le nombre est pair') else: print('le nombre est impair')
myBag = 'shiny gold' rules = [] midBags = set() midBags.add(myBag) #i've the feeling that never attended an algo class is making this too much fucking difficult #pradella i'm ready def part2(string): numberTemp = 1 if string == myBag: numberTemp = 0 for line in rules: outerBag, innerBags = line.spl...
my_bag = 'shiny gold' rules = [] mid_bags = set() midBags.add(myBag) def part2(string): number_temp = 1 if string == myBag: number_temp = 0 for line in rules: (outer_bag, inner_bags) = line.split(' bags contain ') inner_bags = innerBags.replace(', ', '.').replace('bags', '').replace...
s = input() a = 2 b = a + a x = 1 y = x print(y) if not ((s)): print('bar')
s = input() a = 2 b = a + a x = 1 y = x print(y) if not s: print('bar')
# coding:utf-8 ''' @Copyright:LintCode @Author: lilsweetcaligula @Problem: http://www.lintcode.com/problem/reverse-words-in-a-string @Language: Python @Datetime: 17-02-15 15:03 ''' class Solution: # @param s : A string # @return : A string def reverseWords(self, s): return ' '.join(reversed(s.sp...
""" @Copyright:LintCode @Author: lilsweetcaligula @Problem: http://www.lintcode.com/problem/reverse-words-in-a-string @Language: Python @Datetime: 17-02-15 15:03 """ class Solution: def reverse_words(self, s): return ' '.join(reversed(s.split()))
class DBRouter(object): """ A router to control all database operations on models in the auth application. """ radiusmodels = ( 'freeradius' ) def db_for_read(self, model, **hints): """ Attempts to read radius models go to radius """ if model._meta.app_...
class Dbrouter(object): """ A router to control all database operations on models in the auth application. """ radiusmodels = 'freeradius' def db_for_read(self, model, **hints): """ Attempts to read radius models go to radius """ if model._meta.app_label in self....
# -*- coding: utf-8 -*- """ Created on Tue Feb 15 22:58:31 2022 @author: ACER """ class clientes: def __init__(self,nombre): self.nombre=nombre def showCliente(self): print("show el clientes ", self.nombre)
""" Created on Tue Feb 15 22:58:31 2022 @author: ACER """ class Clientes: def __init__(self, nombre): self.nombre = nombre def show_cliente(self): print('show el clientes ', self.nombre)
dict={11:"th",12:"th",13:"th",1:"st",2:"nd",3:"rd"} def number_to_ordinal(n): if n>10: check=int(str(n)[-2:]) temp=dict.get(check%10, "th") return f"{n}{dict[check]}" if check in dict else f"{n}{temp}" else: temp=dict.get(n%10, "th") return f"{n}{temp}" if n else "0"
dict = {11: 'th', 12: 'th', 13: 'th', 1: 'st', 2: 'nd', 3: 'rd'} def number_to_ordinal(n): if n > 10: check = int(str(n)[-2:]) temp = dict.get(check % 10, 'th') return f'{n}{dict[check]}' if check in dict else f'{n}{temp}' else: temp = dict.get(n % 10, 'th') return f'{n}...
#quiz game def check_guess(guess, answer): global score still_guessing = True attempt = 0 while still_guessing and attempt < 3: if guess.lower() == answer.lower(): print("Correct Answer") score = score + 1 still_guessing = False else: if a...
def check_guess(guess, answer): global score still_guessing = True attempt = 0 while still_guessing and attempt < 3: if guess.lower() == answer.lower(): print('Correct Answer') score = score + 1 still_guessing = False else: if attempt < 2: ...
# # PySNMP MIB module HIPATH-WIRELESS-HWC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HIPATH-WIRELESS-HWC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:30:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ...
"""Contains the methods for reading and writing of files. All modules and classes involved in the reading or writing of files are included within this module. Default methods used for writing files (such as images) do not need to have further definition here, but it is recommended to obtain the path used for writing t...
"""Contains the methods for reading and writing of files. All modules and classes involved in the reading or writing of files are included within this module. Default methods used for writing files (such as images) do not need to have further definition here, but it is recommended to obtain the path used for writing t...
ans = [] while True: a, b = list(map(int, input().split())) if a == 0 and b == 0: break ans.append(a + b) for a in ans: print(a)
ans = [] while True: (a, b) = list(map(int, input().split())) if a == 0 and b == 0: break ans.append(a + b) for a in ans: print(a)
# -*- coding: utf-8 -*- major = 0 minor = 0 patch = 1 semantic = '{}.{}.{}'.format(major, minor, patch)
major = 0 minor = 0 patch = 1 semantic = '{}.{}.{}'.format(major, minor, patch)
#Ermittle alle denkbaren Sequenzen mit den vier Basenpaaren AT, TA, CG, GC paare="AT","TA","CG","GC" for a in paare: for b in paare: for c in paare: for d in paare: print(a+b+c+d,end=" ")
paare = ('AT', 'TA', 'CG', 'GC') for a in paare: for b in paare: for c in paare: for d in paare: print(a + b + c + d, end=' ')
class QuotaExceptionExceeded(Exception): pass class QuotaMaxSimultaneousExceeded(QuotaExceptionExceeded): pass class QuotaCpuExceeded(QuotaExceptionExceeded): pass class QuotaMemoryExceeded(QuotaExceptionExceeded): pass class QuotaHddExceeded(QuotaExceptionExceeded): pass class ResourceAlr...
class Quotaexceptionexceeded(Exception): pass class Quotamaxsimultaneousexceeded(QuotaExceptionExceeded): pass class Quotacpuexceeded(QuotaExceptionExceeded): pass class Quotamemoryexceeded(QuotaExceptionExceeded): pass class Quotahddexceeded(QuotaExceptionExceeded): pass class Resourcealreadyl...
class QueryReader: def __init__(self, delim="\t"): self.delim = delim def __call__(self, query_path, include_relevancy=False): with open(query_path, "r") as fp: for line in fp: if include_relevancy == True: line = line.st...
class Queryreader: def __init__(self, delim='\t'): self.delim = delim def __call__(self, query_path, include_relevancy=False): with open(query_path, 'r') as fp: for line in fp: if include_relevancy == True: line = line.strip() ...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Codec: def __init__(self): self.array = [] def serialize(self, root): """Encodes a tree to a single string. ...
class Codec: def __init__(self): self.array = [] def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str """ def helper(node): if not node: self.array.append('#') else: ...
def gangs(divisors,k): res=set() for i in range(1, k+1): res.add(helper(divisors, i)) return len(res) def helper(divisors, n): res=tuple() for i in divisors: if n%i==0: res+=(i, ) return res
def gangs(divisors, k): res = set() for i in range(1, k + 1): res.add(helper(divisors, i)) return len(res) def helper(divisors, n): res = tuple() for i in divisors: if n % i == 0: res += (i,) return res
"""Rules for importing a Go toolchain from Nixpkgs. **NOTE: The following rules must be loaded from `@io_tweag_rules_nixpkgs//nixpkgs:toolchains/go.bzl` to avoid unnecessary dependencies on rules_go for those who don't need go toolchain. `io_bazel_rules_go` must be available for loading before loading of `@io_tweag_ru...
"""Rules for importing a Go toolchain from Nixpkgs. **NOTE: The following rules must be loaded from `@io_tweag_rules_nixpkgs//nixpkgs:toolchains/go.bzl` to avoid unnecessary dependencies on rules_go for those who don't need go toolchain. `io_bazel_rules_go` must be available for loading before loading of `@io_tweag_ru...
def word_break2(s, word_dict): """ :type s: str :type goal: str :rtype: bool """ dp = [] for i in range(0, len(s)): # print(i, s[:i+1] , dp) if s[:i+1] in word_dict: dp.append(i+1) else: for j in dp: if s[j:i+1] in word_dict: ...
def word_break2(s, word_dict): """ :type s: str :type goal: str :rtype: bool """ dp = [] for i in range(0, len(s)): if s[:i + 1] in word_dict: dp.append(i + 1) else: for j in dp: if s[j:i + 1] in word_dict: dp.append(i + 1) ...
#!/usr/bin/env python3 # ***************************************** # PiFire Display Prototype Interface Library # ***************************************** # # Description: This library simulates a display. # # ***************************************** # ***************************************** # Imported Libraries ...
class Display: def __init__(self): self.DisplaySplash() def display_status(self, in_data, status_data): print('====[Display]=====') print('* Grill Temp: ' + str(in_data['GrillTemp'])[:5] + 'F') print('* Grill SetPoint: ' + str(in_data['GrillSetPoint']) + 'F') print('* P...
# 4-6. Odd Numbers odd_numbers = list(range(1,21,2)) print(odd_numbers)
odd_numbers = list(range(1, 21, 2)) print(odd_numbers)
def proCategorization(pros, preferences): pref_dict = {} for i in range(len(pros)): name = pros[i] prefs = preferences[i] for j in range(len(prefs)): p = prefs[j] if p not in pref_dict: pref_dict[p] = [name] else: pr...
def pro_categorization(pros, preferences): pref_dict = {} for i in range(len(pros)): name = pros[i] prefs = preferences[i] for j in range(len(prefs)): p = prefs[j] if p not in pref_dict: pref_dict[p] = [name] else: pref_...
def app(): # pragma: no cover return None def returns_app(): # pragma: no cover return app
def app(): return None def returns_app(): return app
def test_success(): assert True def add_and_del(startnum, addnum, delnum): return startnum + addnum - delnum
def test_success(): assert True def add_and_del(startnum, addnum, delnum): return startnum + addnum - delnum
# dp + recursion (top to down) # Runtime: 688 ms, faster than 26.38% of Python3 online submissions for Burst Balloons. # Memory Usage: 13.6 MB, less than 55.82% of Python3 online submissions for Burst Balloons. class Solution: def maxCoins(self, nums: List[int]) -> int: nums = [1] + nums + [1] n = l...
class Solution: def max_coins(self, nums: List[int]) -> int: nums = [1] + nums + [1] n = len(nums) dp = [[0 for _ in range(n)] for _ in range(n)] def calculate(nums, dp, left, right): if dp[left][right] or right == left + 1: return dp[left][right] ...
"""Constants for Skoda Connect library.""" BASE_SESSION = 'https://msg.volkswagen.de' BASE_AUTH = 'https://identity.vwgroup.io' BRAND = 'skoda' COUNTRY = 'CZ' # Headers used in communication CLIENT_ID = '7f045eee-7003-4379-9968-9355ed2adb06%40apps_vw-dilab_com' XCLIENT_ID = '28cd30c6-dee7-4529-a0e6-b1e07ff90b79' XAPP...
"""Constants for Skoda Connect library.""" base_session = 'https://msg.volkswagen.de' base_auth = 'https://identity.vwgroup.io' brand = 'skoda' country = 'CZ' client_id = '7f045eee-7003-4379-9968-9355ed2adb06%40apps_vw-dilab_com' xclient_id = '28cd30c6-dee7-4529-a0e6-b1e07ff90b79' xappversion = '3.2.6' xappname = 'cz.s...
class Solution(object): def repeatedSubstringPattern(self, s): for l in range(1, len(s)//2+1): if len(s)%l == 0: str_sub = s[:l] n = len(s)//l if str_sub * n == s: return True return False print(Solution().repeatedSubs...
class Solution(object): def repeated_substring_pattern(self, s): for l in range(1, len(s) // 2 + 1): if len(s) % l == 0: str_sub = s[:l] n = len(s) // l if str_sub * n == s: return True return False print(solution().rep...
# AutoRead Configuration File default """ AUTOREAD CONFIG File Author: James Cooper Contact: james@jcooper.tech Description: Shared code for many parts of AutoRead. This project was made for the Guildhall School of Music and Drama. Developed with the Milton Court TAIT eChameleon Automation installation in ...
""" AUTOREAD CONFIG File Author: James Cooper Contact: james@jcooper.tech Description: Shared code for many parts of AutoRead. This project was made for the Guildhall School of Music and Drama. Developed with the Milton Court TAIT eChameleon Automation installation in mind. """ 'Leave these first sections ...
# n = A.length # time = O(n) # space = O(n) # done time = 30m class Solution: def prefixesDivBy5(self, A: List[int]) -> List[bool]: num = 0 ret = [] for a in A: num = (num << 1) + a ret.append(num % 5 == 0) return ret
class Solution: def prefixes_div_by5(self, A: List[int]) -> List[bool]: num = 0 ret = [] for a in A: num = (num << 1) + a ret.append(num % 5 == 0) return ret
# -*- coding: utf-8 -*- """ Wanini's Python Sample Project ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ wPyProj is a template of Python project. :copyright: (c) 2021 by Ting-Hsu Chang. :license: MIT, see LICENSE for more details. """
""" Wanini's Python Sample Project ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ wPyProj is a template of Python project. :copyright: (c) 2021 by Ting-Hsu Chang. :license: MIT, see LICENSE for more details. """
""" We are given an array containing n distinct numbers taken from the range 0 to n. Since the array has only n numbers out of the total n+1 numbers, find the missing number.""" def find_missing_number(nums): i = 0 while i < len(nums): j = nums[i] if j < len(nums) and i != nums[i]: ...
""" We are given an array containing n distinct numbers taken from the range 0 to n. Since the array has only n numbers out of the total n+1 numbers, find the missing number.""" def find_missing_number(nums): i = 0 while i < len(nums): j = nums[i] if j < len(nums) and i != nums[i]: ...
author_activate = ''' mutation { upsertAuthor(name: "Paulinna", author: { active: true }) { successful messages { field message } result { name active } } } ''' author_set_active = ''' mutation SetActive($active: Boolean!){ upsertAuthor(na...
author_activate = '\n mutation {\n upsertAuthor(name: "Paulinna", author: { active: true }) {\n successful\n messages {\n field\n message\n }\n result {\n name\n active\n }\n }\n }\n' author_set_active = '\n mutation SetActive($active: Boolean!){\n upsert...
class Solution: def minDistance(self, word1: str, word2: str) -> int: m, n = len(word1), len(word2) if m * n == 0: return max(m, n) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): dp[i][0] = i for i in range(1, n + 1): ...
class Solution: def min_distance(self, word1: str, word2: str) -> int: (m, n) = (len(word1), len(word2)) if m * n == 0: return max(m, n) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): dp[i][0] = i for i in range(1, n + 1): ...
"""Factories for the redirect_plus app.""" # import factory # from ..models import YourModel
"""Factories for the redirect_plus app."""
''' SNMP Device Defines ''' BMCSTATUS = { 1: 'ok', 2: 'minor', 3: 'major', 4: 'critical', 5: 'absence', 6: 'unknown', } BMCPRESENCE = { 1: 'absence', 2: 'presence', 3: 'unknown', } BMCPCESTATUS = { 1: 'disable', 2: 'enable', } BMCPCFA = { 1: '...
""" SNMP Device Defines """ bmcstatus = {1: 'ok', 2: 'minor', 3: 'major', 4: 'critical', 5: 'absence', 6: 'unknown'} bmcpresence = {1: 'absence', 2: 'presence', 3: 'unknown'} bmcpcestatus = {1: 'disable', 2: 'enable'} bmcpcfa = {1: 'eventlog(1)', 2: 'eventlogAndPowerOff(2)'} bmcbootstr = {1: 'No override', 2: 'PXE', 3:...
""" @file @brief Shortcut to *algorithms*. """
""" @file @brief Shortcut to *algorithms*. """
def getData(): dataset = pd.read_csv('FUTURES MINUTE.txt', header = None) dataset.columns = ['Date','time',"1. open","2. high",'3. low','4. close','5. volume'] dataset['date'] = dataset['Date'] +" "+ dataset['time'] dataset.drop('Date', axis=1, inplace=True) dataset.drop('time', axis=1, inplace...
def get_data(): dataset = pd.read_csv('FUTURES MINUTE.txt', header=None) dataset.columns = ['Date', 'time', '1. open', '2. high', '3. low', '4. close', '5. volume'] dataset['date'] = dataset['Date'] + ' ' + dataset['time'] dataset.drop('Date', axis=1, inplace=True) dataset.drop('time', axis=1, inpla...
class DataOwnerPrediction: def __init__(self, model_id, model_public_key, public_key, encrypted_prediction): self.id = encrypted_prediction.id self.model_id = model_id self.model_public_key = model_public_key self.public_key = public_key self.encrypted_prediction = encrypted...
class Dataownerprediction: def __init__(self, model_id, model_public_key, public_key, encrypted_prediction): self.id = encrypted_prediction.id self.model_id = model_id self.model_public_key = model_public_key self.public_key = public_key self.encrypted_prediction = encrypted...
class SegmentEndsPath(list): """ a list containing {gfapy.SegmentEnd} elements, which defines a path in the graph """ def reverse(self): """ Reverses the direction of the path in place """ self[:] = list(reversed(self)) def __reversed__(self): """ Iterator over the reverse-directio...
class Segmentendspath(list): """ a list containing {gfapy.SegmentEnd} elements, which defines a path in the graph """ def reverse(self): """ Reverses the direction of the path in place """ self[:] = list(reversed(self)) def __reversed__(self): """ Iterator over th...
n = input() s = set(map(int, input().split())) q=int(input()) for x in range(q): t=input().split() try: if(t[0]=="pop"): s.pop() elif(t[0]=="remove"): s.remove(int(t[1])) else: s.discard(int(t[1])) except: continue print(sum(s))
n = input() s = set(map(int, input().split())) q = int(input()) for x in range(q): t = input().split() try: if t[0] == 'pop': s.pop() elif t[0] == 'remove': s.remove(int(t[1])) else: s.discard(int(t[1])) except: continue print(sum(s))
def isIncreasingDigitsSequence(n): s = str(n) for i in range(len(s)-1): if s[i] >= s[i+1]: return False return True """ Call an integer an increasing digits sequence if its digits considered from left to right form a strictly increasing sequence. Given an integer, check if it is an inc...
def is_increasing_digits_sequence(n): s = str(n) for i in range(len(s) - 1): if s[i] >= s[i + 1]: return False return True '\nCall an integer an increasing digits sequence if its digits considered from left to right form a strictly increasing sequence.\n\nGiven an integer, check if it is...
load("//scala:scala.bzl", "scala_test") def analyzer_tests_scala_2(): common_jvm_flags = [ "-Dplugin.jar.location=$(execpath //third_party/dependency_analyzer/src/main:dependency_analyzer)", "-Dscala.library.location=$(rootpath @io_bazel_rules_scala_scala_library)", "-Dscala.reflect.locatio...
load('//scala:scala.bzl', 'scala_test') def analyzer_tests_scala_2(): common_jvm_flags = ['-Dplugin.jar.location=$(execpath //third_party/dependency_analyzer/src/main:dependency_analyzer)', '-Dscala.library.location=$(rootpath @io_bazel_rules_scala_scala_library)', '-Dscala.reflect.location=$(rootpath @io_bazel_ru...
NER_LABEL_TO_ID = { "O": 0, "B-ORG": 1, "I-ORG": 2, "B-PER": 3, "I-PER": 4, "B-LOC": 5, "I-LOC": 6, } ID_TO_NER_LABEL = {value: key for key, value in NER_LABEL_TO_ID.items()} def clean_label(ner_label: str) -> str: """ Clean the ner label from whitespaces :param ner_label: ta...
ner_label_to_id = {'O': 0, 'B-ORG': 1, 'I-ORG': 2, 'B-PER': 3, 'I-PER': 4, 'B-LOC': 5, 'I-LOC': 6} id_to_ner_label = {value: key for (key, value) in NER_LABEL_TO_ID.items()} def clean_label(ner_label: str) -> str: """ Clean the ner label from whitespaces :param ner_label: takes a ner label :type ner_l...
# This __about__.py file for storing project metadata is inspired by # - github.com/delph-in/pydelphin/blob/master/delphin/__about__.py # referencing (apud) # - github.com/pypa/warehouse/blob/master/warehouse/__about__.py __name__ = "Delphin RDF" __summary__ = "DELPH-IN formats in RDF" __version__ = "1.0.4" __aut...
__name__ = 'Delphin RDF' __summary__ = 'DELPH-IN formats in RDF' __version__ = '1.0.4' __author__ = 'foo' __email__ = 'foo' __url__ = 'foo' __license__ = 'MIT'
#### USEFUL FUNCTIONS FOR CLAUSES AND LITERALS #### # Return true if the clause is unit, false otherwise. def is_unit_clause(clause): return len(clause) == 1 # Return true if the clause is empty, false otherwise. def is_empty_clause(clause): return len(clause) == 0 # Return true if the literal is positive, fal...
def is_unit_clause(clause): return len(clause) == 1 def is_empty_clause(clause): return len(clause) == 0 def is_positive_literal(lit): return lit > 0 def lit_to_var(lit): return abs(lit) if __name__ == '__main__': (unused1, unused2, v, c) = input().split() v = int(V) c = int(C) lit_to...
if __name__ == "__main__": s = input() new_s = "" for i in range(len(s)-1, -1, -1): new_s += s[i] print(new_s) if s == new_s: print("haha got ya !") else: print("NOpe")
if __name__ == '__main__': s = input() new_s = '' for i in range(len(s) - 1, -1, -1): new_s += s[i] print(new_s) if s == new_s: print('haha got ya !') else: print('NOpe')
n = int(input()) total = [] for i in range(n): a = [int(item) for item in input().split()] temp = 0 for j in range(a[0]): temp +=a[j + 1] temp -= (a[0] - 1) total.append(temp) a = [] for i in total: print(i)
n = int(input()) total = [] for i in range(n): a = [int(item) for item in input().split()] temp = 0 for j in range(a[0]): temp += a[j + 1] temp -= a[0] - 1 total.append(temp) a = [] for i in total: print(i)
class main: def __init__(self): pass def draw(self): print("Welcome to Friend_Tracker_2.0") print("-----------------------------") print("Type in read if you want to read a profile,\nand write if you want to add something to the profile,\nor type in help if you need help. Type i...
class Main: def __init__(self): pass def draw(self): print('Welcome to Friend_Tracker_2.0') print('-----------------------------') print('Type in read if you want to read a profile,\nand write if you want to add something to the profile,\nor type in help if you need help. Type ...
# !/usr/bin/env python3 # -*- coding: utf-8 -*- """ Common helper functions. This will represent the bread and butter of the application. """ def add_two_numbers(x_val: int, y_val: int) -> int: """Just adds two numbers together.""" return x_val + y_val def return_string() -> str: """Return the string ...
""" Common helper functions. This will represent the bread and butter of the application. """ def add_two_numbers(x_val: int, y_val: int) -> int: """Just adds two numbers together.""" return x_val + y_val def return_string() -> str: """Return the string doggo.""" return 'string'
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" 0489. Robot Room Cleaner Given a robot cleaner in a room modeled as a grid. Each cell in the grid can be empty or blocked. The robot cleaner with 4 given APIs can move forward, turn left or turn right. Each turn it made is 90 degrees. When it tries to move into a blocked cell, its bumper sensor detects the obsta...
""" 0489. Robot Room Cleaner Given a robot cleaner in a room modeled as a grid. Each cell in the grid can be empty or blocked. The robot cleaner with 4 given APIs can move forward, turn left or turn right. Each turn it made is 90 degrees. When it tries to move into a blocked cell, its bumper sensor detects the obsta...
# microbit.py 15/01/2021 D.J.Whale # Simulator for a micro:bit - will be replaced with BITIO class Radio(): # RCNNABGRR+SS (12 chars) # 0123456789AB TESTDATA = ( "RC0000F99+00", None, None, "RC0000F00+99", "RC0000F99-99", "RC0000S00+00", "RC0000B99...
class Radio: testdata = ('RC0000F99+00', None, None, 'RC0000F00+99', 'RC0000F99-99', 'RC0000S00+00', 'RC0000B99+00', 'RC0000B99-99', 'RC0000B99+99') def __init__(self): self._index = 0 def receive(self): v = self.TESTDATA[self._index] self._index += 1 if self._index >= len(...
class Solution: def pivotIndex(self, nums): left = 0 right = 0 left_sum = 0 right_sum = sum(nums) while right < len(nums): right_sum -= nums[right] right += 1 if right_sum == left_sum: return left else: ...
class Solution: def pivot_index(self, nums): left = 0 right = 0 left_sum = 0 right_sum = sum(nums) while right < len(nums): right_sum -= nums[right] right += 1 if right_sum == left_sum: return left else: ...
A, B = map(int, input().split()) diff = abs(A - B) ans = diff // 10 diff %= 10 ans = ans + [0, 1, 2, 3, 2, 1, 2, 3, 3, 2][diff] print(ans)
(a, b) = map(int, input().split()) diff = abs(A - B) ans = diff // 10 diff %= 10 ans = ans + [0, 1, 2, 3, 2, 1, 2, 3, 3, 2][diff] print(ans)
# https://www.hackerrank.com/challenges/python-quest-1/problem # Condition # 1 <= int(input()) <= 9 # String is not allowed. # More than 1 for-statement is not allowed. # More than 2 lines are not allowed. (Do not leave a blank line also.) """ Mathmatical Answer for i in range(1, int(input())): print(10**i //...
""" Mathmatical Answer for i in range(1, int(input())): print(10**i // 9 * i) """ ' Cheating Answer\n\nfor i in range(1, int(input())):\n print([0, 1, 22, 333, 4444, 55555, 666666, 7777777, 88888888, 999999999][i])\n' for i in range(1, int(input())): print(sum(map(lambda num: i * 10 ** num, range(i)))) ' No...
class RobotException(Exception): pass class UnitGuardCollision(RobotException): def __init__(self, other_robot): self.other_robot = other_robot class UnitMoveCollision(RobotException): def __init__(self, other_robots): self.other_robots = other_robots class UnitBlockCollision(RobotExcepti...
class Robotexception(Exception): pass class Unitguardcollision(RobotException): def __init__(self, other_robot): self.other_robot = other_robot class Unitmovecollision(RobotException): def __init__(self, other_robots): self.other_robots = other_robots class Unitblockcollision(RobotExcep...
""" Asked by: Apple [Medium]. Gray code is a binary code where each successive value differ in only one bit, as well as when wrapping around. Gray code is common in hardware so that we don't see temporary spurious values during transitions. Given a number of bits n, generate a possible gray code for it. For example...
""" Asked by: Apple [Medium]. Gray code is a binary code where each successive value differ in only one bit, as well as when wrapping around. Gray code is common in hardware so that we don't see temporary spurious values during transitions. Given a number of bits n, generate a possible gray code for it. For example...
class Solution: def findPairs(self, nums: List[int], k: int) -> int: result, frequencyMap = 0, Counter(nums) for i in frequencyMap: if k == 0 and frequencyMap[i] > 1: result += 1 elif k > 0 and i + k in frequencyMap: result += 1 return ...
class Solution: def find_pairs(self, nums: List[int], k: int) -> int: (result, frequency_map) = (0, counter(nums)) for i in frequencyMap: if k == 0 and frequencyMap[i] > 1: result += 1 elif k > 0 and i + k in frequencyMap: result += 1 ...
class Scorer(object): def __init__(self, cards): self.cards = cards def flush(self): suits = [card.suit for card in self.cards] if len(set(suits)) == 1: return True return False def straight(self): values = [card.value for card in self.cards] val...
class Scorer(object): def __init__(self, cards): self.cards = cards def flush(self): suits = [card.suit for card in self.cards] if len(set(suits)) == 1: return True return False def straight(self): values = [card.value for card in self.cards] va...
class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ n = len(nums) if n < 2: return True target_i = n - 1 for i in range(n - 2, -1, -1): if nums[i] >= target_i - i: target_i...
class Solution(object): def can_jump(self, nums): """ :type nums: List[int] :rtype: bool """ n = len(nums) if n < 2: return True target_i = n - 1 for i in range(n - 2, -1, -1): if nums[i] >= target_i - i: target...
class InvalidPhoneNumber(Exception): def __init__(self, phone_number): self.phone_number = phone_number self.message = phone_number + ' is an invalid phone number' super().__init__(self.message)
class Invalidphonenumber(Exception): def __init__(self, phone_number): self.phone_number = phone_number self.message = phone_number + ' is an invalid phone number' super().__init__(self.message)
def list(): '''Returns a list of streams ''' return 'TO BE IMPLEMENTED' def add(): '''Set an stream ''' return 'TO BE IMPLEMENTED' def find_by_name(name): '''Returns the named stream Params: name - The name of the stream ''' return 'TO BE IMPLEMENTED' def delete_by_name(name): '''D...
def list(): """Returns a list of streams """ return 'TO BE IMPLEMENTED' def add(): """Set an stream """ return 'TO BE IMPLEMENTED' def find_by_name(name): """Returns the named stream Params: name - The name of the stream """ return 'TO BE IMPLEMENTED' def delete_by_name(name...
# -*- coding: utf-8 -*- """ Created on Thu Jun 20 21:16:13 2019 @author: CLIENTE """ def fatorial(n): if n == 1: return 1 else: return n*fatorial(n-1)
""" Created on Thu Jun 20 21:16:13 2019 @author: CLIENTE """ def fatorial(n): if n == 1: return 1 else: return n * fatorial(n - 1)
# Count Substrings That Differ by One Character class Solution: def countSubstrings(self, s, t): # brute force slen = len(s) tlen = len(t) count = 0 for si in range(slen): for ti in range(tlen): index = 0 diffCount = 0 ...
class Solution: def count_substrings(self, s, t): slen = len(s) tlen = len(t) count = 0 for si in range(slen): for ti in range(tlen): index = 0 diff_count = 0 while si + index < slen and ti + index < tlen: ...
#!/usr/bin/python3 """ Given a non-negative integer N, find the largest number that is less than or equal to N with monotone increasing digits. (Recall that an integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y.) Example 1: Input: N = 10 Output: 9 Example 2: Inpu...
""" Given a non-negative integer N, find the largest number that is less than or equal to N with monotone increasing digits. (Recall that an integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y.) Example 1: Input: N = 10 Output: 9 Example 2: Input: N = 1234 Output:...
# Copyright 2020 Cognite AS # # 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 writ...
""" A module containing utilities meant for use inside the extractor-utils package """ def _resolve_log_level(level: str) -> int: return {'NOTSET': 0, 'DEBUG': 10, 'INFO': 20, 'WARNING': 30, 'ERROR': 40, 'CRITICAL': 50}[level.upper()]
#! /usr/bin/env python class Template: """invite templates""" def __init__(self): self.profile_templates = { 'th invite templates' : u"{{{{subst:Wikipedia:Teahouse/HostBot_Invitation|personal=The Teahouse is a friendly space where new editors can ask questions about contributing to Wikipedia and ge...
class Template: """invite templates""" def __init__(self): self.profile_templates = {'th invite templates': u'{{{{subst:Wikipedia:Teahouse/HostBot_Invitation|personal=The Teahouse is a friendly space where new editors can ask questions about contributing to Wikipedia and get help from experienced edito...