content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python3 def gcd(a, b): if a == 0 : return b return gcd(b%a, a) a = 12000 b = 8642 print(gcd(a, b))
def gcd(a, b): if a == 0: return b return gcd(b % a, a) a = 12000 b = 8642 print(gcd(a, b))
def solve(): n = int(input()) k = list(map(int,input().split())) hashmap = dict() j = 0 ans = 0 c = 0 for i in range(n): if k[i] in hashmap and hashmap[k[i]] > 0: while i > j and k[i] in hashmap and hashmap[k[i]] > 0: hashmap[k[j]] -= 1 ...
def solve(): n = int(input()) k = list(map(int, input().split())) hashmap = dict() j = 0 ans = 0 c = 0 for i in range(n): if k[i] in hashmap and hashmap[k[i]] > 0: while i > j and k[i] in hashmap and (hashmap[k[i]] > 0): hashmap[k[j]] -= 1 ...
# Here the rate is set for Policy flows, local to a compute, which is # lesser than policy flows across computes expected_flow_setup_rate = {} expected_flow_setup_rate['policy'] = { '1.04': 6000, '1.05': 9000, '1.06': 10000, '1.10': 10000, '2.10': 13000} expected_flow_setup_rate['nat'] = { '1.04': 4200, '1.05':...
expected_flow_setup_rate = {} expected_flow_setup_rate['policy'] = {'1.04': 6000, '1.05': 9000, '1.06': 10000, '1.10': 10000, '2.10': 13000} expected_flow_setup_rate['nat'] = {'1.04': 4200, '1.05': 6300, '1.06': 7500, '1.10': 7500, '2.10': 10000}
# Dynamic Programming Python implementation of Min Cost Path # problem R = 3 C = 3 def minCost(cost, m, n): # Instead of following line, we can use int tc[m+1][n+1] or # dynamically allocate memoery to save space. The following # line is used to keep te program simple and make it working #...
r = 3 c = 3 def min_cost(cost, m, n): tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m + 1): tc[i][0] = tc[i - 1][0] + cost[i][0] for j in range(1, n + 1): tc[0][j] = tc[0][j - 1] + cost[0][j] for i in range(1, m + 1): for j in range(1...
def create_box(input_corners): x = (float(input_corners[0][0]), float(input_corners[1][0])) y = (float(input_corners[0][1]), float(input_corners[1][1])) windmill_lats, windmill_lons = zip(*[ (max(x), max(y)), (min(x), max(y)), (min(x), min(y)), (max(x), min(y)), ...
def create_box(input_corners): x = (float(input_corners[0][0]), float(input_corners[1][0])) y = (float(input_corners[0][1]), float(input_corners[1][1])) (windmill_lats, windmill_lons) = zip(*[(max(x), max(y)), (min(x), max(y)), (min(x), min(y)), (max(x), min(y)), (max(x), max(y))]) return (windmill_lats...
class Label: @staticmethod def from_str(value): for l in Label._get_supported_labels(): if l.to_str() == value: return l raise Exception("Label by value '{}' doesn't supported".format(value)) @staticmethod def from_int(value): assert(isinstance(val...
class Label: @staticmethod def from_str(value): for l in Label._get_supported_labels(): if l.to_str() == value: return l raise exception("Label by value '{}' doesn't supported".format(value)) @staticmethod def from_int(value): assert isinstance(value...
'''70. Climbing Stairs Easy 3866 127 Add to List Share You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 ...
"""70. Climbing Stairs Easy 3866 127 Add to List Share You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 Explanation: There ...
RESOURCES = { 'posts': { 'schema': { 'title': { 'type': 'string', 'minlength': 3, 'maxlength': 30, 'required': True, 'unique': False }, 'body': { 'type': 'string', ...
resources = {'posts': {'schema': {'title': {'type': 'string', 'minlength': 3, 'maxlength': 30, 'required': True, 'unique': False}, 'body': {'type': 'string', 'required': True, 'unique': True}, 'published': {'type': 'boolean', 'default': False}, 'category': {'type': 'objectid', 'data_relation': {'resource': 'categories'...
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
"""An example of code submission for the AutoDL challenge. It implements 3 compulsory methods: __init__, train, and test. model.py follows the template of the abstract class algorithm.py found in folder AutoDL_ingestion_program/. To create a valid submission, zip model.py together with an empty file called metadata (...
pkgname = "python-sphinx-removed-in" pkgver = "0.2.1" pkgrel = 0 build_style = "python_module" hostmakedepends = ["python-setuptools"] checkdepends = ["python-sphinx"] depends = ["python-sphinx"] pkgdesc = "Sphinx extension for versionremoved and removed-in directives" maintainer = "q66 <q66@chimera-linux.org>" license...
pkgname = 'python-sphinx-removed-in' pkgver = '0.2.1' pkgrel = 0 build_style = 'python_module' hostmakedepends = ['python-setuptools'] checkdepends = ['python-sphinx'] depends = ['python-sphinx'] pkgdesc = 'Sphinx extension for versionremoved and removed-in directives' maintainer = 'q66 <q66@chimera-linux.org>' license...
class Solution: def canPartition(self, nums: List[int]) -> bool: dp, s = set([0]), sum(nums) if s&1: return False for num in nums: dp.update([v+num for v in dp if v+num <= s>>1]) return s>>1 in dp
class Solution: def can_partition(self, nums: List[int]) -> bool: (dp, s) = (set([0]), sum(nums)) if s & 1: return False for num in nums: dp.update([v + num for v in dp if v + num <= s >> 1]) return s >> 1 in dp
class Solution: def sortLinkedList(self, head: Optional[ListNode]) -> Optional[ListNode]: prev = head curr = head.next while curr: if curr.val < 0: prev.next = curr.next curr.next = head head = curr curr = prev.next else: prev = curr curr = curr...
class Solution: def sort_linked_list(self, head: Optional[ListNode]) -> Optional[ListNode]: prev = head curr = head.next while curr: if curr.val < 0: prev.next = curr.next curr.next = head head = curr curr = prev.ne...
"""Preprocessing Sample.""" __author__ = 'Devon Welcheck' def preprocess(req, resp, resource, params): # pylint: disable=unused-argument """Preprocess skeleton."""
"""Preprocessing Sample.""" __author__ = 'Devon Welcheck' def preprocess(req, resp, resource, params): """Preprocess skeleton."""
""" Profile ../profile-datasets-py/div52/011.py file automaticaly created by prof_gen.py script """ self["ID"] = "../profile-datasets-py/div52/011.py" self["Q"] = numpy.array([ 1.60776800e+00, 5.75602400e+00, 7.00189400e+00, 7.33717600e+00, 6.76175900e+00, 8.41951900e+00, 6.5464...
""" Profile ../profile-datasets-py/div52/011.py file automaticaly created by prof_gen.py script """ self['ID'] = '../profile-datasets-py/div52/011.py' self['Q'] = numpy.array([1.607768, 5.756024, 7.001894, 7.337176, 6.761759, 8.419519, 6.546415, 8.552722, 6.779203, 7.255164, 7.37081, 5.922572, 6.505996, 6.6...
class Pessoa: #substantivo def __init__(self, nome: str, idade: int) -> None: self.nome = nome #substantivo self.idade = idade #substantivo def dirigir(self, veiculo: str) -> None: #verbos print(f'Dirigindo um(a) {veiculo}') def cantar(self) -> None: #verbos print('lalalala...
class Pessoa: def __init__(self, nome: str, idade: int) -> None: self.nome = nome self.idade = idade def dirigir(self, veiculo: str) -> None: print(f'Dirigindo um(a) {veiculo}') def cantar(self) -> None: print('lalalala') def apresentar_idade(self) -> int: ret...
API_GROUPS = { 'authentication': ['/api-auth/', '/api/auth-valimo/',], 'user': ['/api/users/', '/api/user-invitations/', '/api/user-counters/',], 'organization': [ '/api/customers/', '/api/customer-permissions-log/', '/api/customer-permissions-reviews/', '/api/customer-permis...
api_groups = {'authentication': ['/api-auth/', '/api/auth-valimo/'], 'user': ['/api/users/', '/api/user-invitations/', '/api/user-counters/'], 'organization': ['/api/customers/', '/api/customer-permissions-log/', '/api/customer-permissions-reviews/', '/api/customer-permissions/'], 'marketplace': ['/api/marketplace-book...
# -*- coding: utf-8 -*- """Module compliance_suite.functions.update_server_settings.py Functions to update server config/settings based on the response of a previous API request. Each function should accept a Runner object and modify its "retrieved_server_settings" attribute """ def update_supported_filters(runner, ...
"""Module compliance_suite.functions.update_server_settings.py Functions to update server config/settings based on the response of a previous API request. Each function should accept a Runner object and modify its "retrieved_server_settings" attribute """ def update_supported_filters(runner, resource, response_obj):...
df = pd.read_csv(DATA) df = df.sample(frac=1.0) df.reset_index(drop=True, inplace=True) result = df.tail(n=10)
df = pd.read_csv(DATA) df = df.sample(frac=1.0) df.reset_index(drop=True, inplace=True) result = df.tail(n=10)
def to_binary(number): binarynumber="" if (number!=0): while (number>=1): if (number %2==0): binarynumber=binarynumber+"0" number=number/2 else: binarynumber=binarynumber+"1" number=(number-1)/2 else: bi...
def to_binary(number): binarynumber = '' if number != 0: while number >= 1: if number % 2 == 0: binarynumber = binarynumber + '0' number = number / 2 else: binarynumber = binarynumber + '1' number = (number - 1) / 2 ...
x = 5 y = 3 z = x + y print(x) print(y) print(x + y) print(z) w = z print(w)
x = 5 y = 3 z = x + y print(x) print(y) print(x + y) print(z) w = z print(w)
#Calculadora de tabuada n = int(input('Deseja ver tabuada de que numero?')) for c in range(1, 13): print('{} X {:2}= {} '. format(n, c, n * c))
n = int(input('Deseja ver tabuada de que numero?')) for c in range(1, 13): print('{} X {:2}= {} '.format(n, c, n * c))
COLUMNS = [ 'tipo_registro', 'nro_pv_matriz', 'vl_total_bruto', 'qtde_cvnsu', 'vl_total_rejeitado', 'vl_total_rotativo', 'vl_total_parcelado_sem_juros', 'vl_total_parcelado_iata', 'vl_total_dolar', 'vl_total_desconto', 'vl_total_liquido', 'vl_total_gorjeta', 'vl_total...
columns = ['tipo_registro', 'nro_pv_matriz', 'vl_total_bruto', 'qtde_cvnsu', 'vl_total_rejeitado', 'vl_total_rotativo', 'vl_total_parcelado_sem_juros', 'vl_total_parcelado_iata', 'vl_total_dolar', 'vl_total_desconto', 'vl_total_liquido', 'vl_total_gorjeta', 'vl_total_tx_embarque', 'qtde_cvnsu_acatados']
# Ask user to enter their country name. # print out their phone code. l_country_phone_code = ["China","86","Germany","49","Turkey","90"] def country_name_to_phone_code_list(country_name): for index in range(len(l_country_phone_code)): if l_country_phone_code[index] == country_name: return l_country_phone_code[...
l_country_phone_code = ['China', '86', 'Germany', '49', 'Turkey', '90'] def country_name_to_phone_code_list(country_name): for index in range(len(l_country_phone_code)): if l_country_phone_code[index] == country_name: return l_country_phone_code[index + 1] def country_name_to_phone_code_dict(c...
""" EGF string variables for testing. """ # POINT valid_pt = """PT Park Name, City, Pond, Fountain Post office Square, Boston, FALSE, TRUE 42.356243, -71.055631, 2.0 Boston Common, Boston, TRUE, TRUE 42.355465, -71.066412, 10.0 """ invalid_pt_geom = """PTs Park Name, City, Pond, Fountain Post office S...
""" EGF string variables for testing. """ valid_pt = 'PT\n\n\n\nPark Name, City, Pond, Fountain\n\n\n\nPost office Square, Boston, FALSE, TRUE\n42.356243, -71.055631, 2.0\n\n\n\nBoston Common, Boston, TRUE, TRUE\n42.355465, -71.066412, 10.0\n' invalid_pt_geom = 'PTs\n\n\n\nPark Name, City, Pond, Fountain\n\n\n\nPost o...
class GuidAttribute(Attribute,_Attribute): """ Supplies an explicit System.Guid when an automatic GUID is undesirable. GuidAttribute(guid: str) """ def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ f...
class Guidattribute(Attribute, _Attribute): """ Supplies an explicit System.Guid when an automatic GUID is undesirable. GuidAttribute(guid: str) """ def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__._...
def palavras_repetidas(fileName, word): file = open(fileName, 'r') count = 0 for i in file.readlines(): if word in i: count += 1 print(f'{word} aparece no arquivo {fileName} {count} vez(es).')
def palavras_repetidas(fileName, word): file = open(fileName, 'r') count = 0 for i in file.readlines(): if word in i: count += 1 print(f'{word} aparece no arquivo {fileName} {count} vez(es).')
n = int(input()) x = 0 for i in range(n): l = set([j for j in input()]) if "+" in l: x += 1 else : x -= 1 print(x)
n = int(input()) x = 0 for i in range(n): l = set([j for j in input()]) if '+' in l: x += 1 else: x -= 1 print(x)
client = pymongo.MongoClient("mongodb+srv://usermgs:udUnpg6aJnCp9d2W@cluster0.2ivys.mongodb.net/baseteste?retryWrites=true&w=majority") db = client.test
client = pymongo.MongoClient('mongodb+srv://usermgs:udUnpg6aJnCp9d2W@cluster0.2ivys.mongodb.net/baseteste?retryWrites=true&w=majority') db = client.test
class Mammal: x = 10 def walk(self): print("Walking") # class Dog: # def walk(self): # print("Walking") # class Cat: # def walk(self): # print("Walking") class Dog(Mammal): def bark(self): print("Woof, woof!") class Cat(Mammal): pass # Just used here as Py...
class Mammal: x = 10 def walk(self): print('Walking') class Dog(Mammal): def bark(self): print('Woof, woof!') class Cat(Mammal): pass rover = dog() print(rover.x) rover.bark() fluffy = cat() fluffy.walk()
# # @lc app=leetcode.cn id=1203 lang=python3 # # [1203] print-in-order # None # @lc code=end
None
''' Given a binary tree, return the vertical order traversal of its nodes values. For each node at position (X, Y), its left and right children respectively will be at positions (X-1, Y-1) and (X+1, Y-1). Running a vertical line from X = -infinity to X = +infinity, whenever the vertical line touches some nodes, we re...
""" Given a binary tree, return the vertical order traversal of its nodes values. For each node at position (X, Y), its left and right children respectively will be at positions (X-1, Y-1) and (X+1, Y-1). Running a vertical line from X = -infinity to X = +infinity, whenever the vertical line touches some nodes, we re...
def check_hgt(h): if "cm" in h: return 150 <= int(h.replace("cm","")) <= 193 elif "in" in h: return 59 <= int(h.replace("in","")) <= 76 else: return False def check_hcl(h): if h[0] != '#' or len(h) != 7: return False for x in h[1:]: if not x in list("...
def check_hgt(h): if 'cm' in h: return 150 <= int(h.replace('cm', '')) <= 193 elif 'in' in h: return 59 <= int(h.replace('in', '')) <= 76 else: return False def check_hcl(h): if h[0] != '#' or len(h) != 7: return False for x in h[1:]: if not x in list('abcdef...
def test_deploying_contract(client, hex_accounts): pre_balance = client.get_balance(hex_accounts[1]) client.send_transaction( _from=hex_accounts[0], to=hex_accounts[1], value=1234, ) post_balance = client.get_balance(hex_accounts[1]) assert post_balance - pre_balance == 12...
def test_deploying_contract(client, hex_accounts): pre_balance = client.get_balance(hex_accounts[1]) client.send_transaction(_from=hex_accounts[0], to=hex_accounts[1], value=1234) post_balance = client.get_balance(hex_accounts[1]) assert post_balance - pre_balance == 1234
if __name__ == '__main__': _, X = input().split() subjects = list() for _ in range(int(X)): subjects.append(map(float, input().split())) for i in zip(*subjects): print("{0:.1f}".format(sum(i)/len(i)))
if __name__ == '__main__': (_, x) = input().split() subjects = list() for _ in range(int(X)): subjects.append(map(float, input().split())) for i in zip(*subjects): print('{0:.1f}'.format(sum(i) / len(i)))
promt = "Here you can enter" promt += "a series of toppings>>>" message = True while message: message = input(promt) if message == "Quit": print(" I'll add " + message + " to your pizza.") else: break promt = "How old are you?" promt += "\nEnter 'quit' when you a...
promt = 'Here you can enter' promt += 'a series of toppings>>>' message = True while message: message = input(promt) if message == 'Quit': print(" I'll add " + message + ' to your pizza.') else: break promt = 'How old are you?' promt += "\nEnter 'quit' when you are finished >>>" while True:...
def foo(a, b): x = a * b y = 3 return y def foo(a, b): x = __report_assign(7, 8, 3) x = __report_assign(pos, v, 3) y = __report_assign(lineno, col, 3) print("hello world") foo(3, 2) report_call(0, 3, foo, (report_eval(3), report_eval(2),))
def foo(a, b): x = a * b y = 3 return y def foo(a, b): x = __report_assign(7, 8, 3) x = __report_assign(pos, v, 3) y = __report_assign(lineno, col, 3) print('hello world') foo(3, 2) report_call(0, 3, foo, (report_eval(3), report_eval(2)))
class Solution: def addBinary(self, a: str, b: str) -> str: return bin(int(a, 2) + int(b, 2))[2:] if __name__ == '__main__': a = "11" b = "1" solution = Solution() result = solution.addBinary(a, b) print(result) result1 = int(a, 2) result2 = int(b, 2) print(result1) pr...
class Solution: def add_binary(self, a: str, b: str) -> str: return bin(int(a, 2) + int(b, 2))[2:] if __name__ == '__main__': a = '11' b = '1' solution = solution() result = solution.addBinary(a, b) print(result) result1 = int(a, 2) result2 = int(b, 2) print(result1) pri...
""" [intermediate] challenge #5 Source / Reddit Post - https://www.reddit.com/r/dailyprogrammer/comments/pnhtj/2132012_challenge_5_intermediate/ """ words = [] sorted_words = [] with open('intermediate/5/words.txt', 'r') as fp: words = fp.read().split() sorted_words = [''.join(sorted(word)) for word in word...
""" [intermediate] challenge #5 Source / Reddit Post - https://www.reddit.com/r/dailyprogrammer/comments/pnhtj/2132012_challenge_5_intermediate/ """ words = [] sorted_words = [] with open('intermediate/5/words.txt', 'r') as fp: words = fp.read().split() sorted_words = [''.join(sorted(word)) for word in words] ...
a=int(input()) b=int(input()) print (a/b) a=float(a) b=float(b) print (a/b)
a = int(input()) b = int(input()) print(a / b) a = float(a) b = float(b) print(a / b)
# -*- coding: utf-8 -*- """ Individual scratchpad and maybe up-to-date CDP instance scrapers. """
""" Individual scratchpad and maybe up-to-date CDP instance scrapers. """
def test_Dict(): x: dict[i32, i32] x = {1: 2, 3: 4} # x = {1: "2", "3": 4} -> sematic error y: dict[str, i32] y = {"a": -1, "b": -2} z: i32 z = y["a"] z = y["b"] z = x[1] def test_dict_insert(): y: dict[str, i32] y = {"a": -1, "b": -2} y["c"] = -3 def test_dict_get(...
def test__dict(): x: dict[i32, i32] x = {1: 2, 3: 4} y: dict[str, i32] y = {'a': -1, 'b': -2} z: i32 z = y['a'] z = y['b'] z = x[1] def test_dict_insert(): y: dict[str, i32] y = {'a': -1, 'b': -2} y['c'] = -3 def test_dict_get(): y: dict[str, i32] y = {'a': -1, 'b':...
states = {'Pending', 'Ready', 'Creating', 'Running', 'Cancelled', 'Error', 'Failed', 'Success'} complete_states = ('Cancelled', 'Error', 'Failed', 'Success') valid_state_transitions = { 'Pending': {'Ready'}, 'Ready': {'Creating', 'Running', 'Cancelled', 'Error'}, 'Creating': {'Ready', 'Running'}, 'Run...
states = {'Pending', 'Ready', 'Creating', 'Running', 'Cancelled', 'Error', 'Failed', 'Success'} complete_states = ('Cancelled', 'Error', 'Failed', 'Success') valid_state_transitions = {'Pending': {'Ready'}, 'Ready': {'Creating', 'Running', 'Cancelled', 'Error'}, 'Creating': {'Ready', 'Running'}, 'Running': {'Ready', 'C...
def assigned_type_mismatch(): x = 666 x = '666' return x def annotation_type_mismatch(x: int = '666'): return x def assigned_type_mismatch_between_calls(case): if case: x = 666 else: x = '666' return x
def assigned_type_mismatch(): x = 666 x = '666' return x def annotation_type_mismatch(x: int='666'): return x def assigned_type_mismatch_between_calls(case): if case: x = 666 else: x = '666' return x
# https://www.codewars.com/kata/576757b1df89ecf5bd00073b/train/python def tower_builder(n_floors): times = 1 space = ((2*n_floors -1) // 2) tower = [] for _ in range(n_floors): tower.append((' '*space) + ('*' * times) + (' '*space)) times += 2 space -= 1 return tower
def tower_builder(n_floors): times = 1 space = (2 * n_floors - 1) // 2 tower = [] for _ in range(n_floors): tower.append(' ' * space + '*' * times + ' ' * space) times += 2 space -= 1 return tower
#! /usr/bin/env python # Programs that are runnable. ns3_runnable_programs = ['build/src/aodv/examples/ns3.27-aodv-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-one-hop-debug', 'build/src/buildings/examples/ns3.27-buildings-pathloss-profiler-debug', 'build/...
ns3_runnable_programs = ['build/src/aodv/examples/ns3.27-aodv-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-one-hop-debug', 'build/src/buildings/examples/ns3.27-buildings-pathloss-profiler-debug', 'build/src/config-store/examples/ns3.27-config-store-save-deb...
# Arithmetic progression # A + (A+B) + (A+2B) + (A+3B) + ... + (A+(C-1)B)) def main(): N = int(input("data:\n")) l = [] for x in range(0,N): a,b,c = input().split(" ") a,b,c = int(a),int(b),int(c) s = 0 for each in range(0,c): s += a + (b*each) ...
def main(): n = int(input('data:\n')) l = [] for x in range(0, N): (a, b, c) = input().split(' ') (a, b, c) = (int(a), int(b), int(c)) s = 0 for each in range(0, c): s += a + b * each l.append(s) print('\nanswer:') for each in l: print(each...
#!/usr/bin/env python3 # Algorithm: Quick sort # Referrence: https://github.com/TheAlgorithms/Python/blob/master/sorts/quick_sort.py def quick_sort(num_list): """ Quick sort in Python If length of the list is 1 or less, there is no point in sorting it. Hence, the code works on lists with sizes grea...
def quick_sort(num_list): """ Quick sort in Python If length of the list is 1 or less, there is no point in sorting it. Hence, the code works on lists with sizes greater than 1 """ if len(num_list) <= 1: return num_list else: pivot = num_list.pop() less_than = [] ...
col = { "owid": { "Notes": "notes", "Entity": "entity", "Date": "time", "Source URL": "src", "Source label": "src_lb", "Cumulative total": "tot_n_tests", "Daily change in cumulative total": "n_tests", "Cumulative total per thousand": "tot_n_tests_pthab...
col = {'owid': {'Notes': 'notes', 'Entity': 'entity', 'Date': 'time', 'Source URL': 'src', 'Source label': 'src_lb', 'Cumulative total': 'tot_n_tests', 'Daily change in cumulative total': 'n_tests', 'Cumulative total per thousand': 'tot_n_tests_pthab', 'Daily change in cumulative total per thousand': 'n_tests_pthab', '...
# https://codeforces.com/problemset/problem/1030/A n = int(input()) o = list(map(int, input().split())) print('HARD' if o.count(1) != 0 else 'EASY')
n = int(input()) o = list(map(int, input().split())) print('HARD' if o.count(1) != 0 else 'EASY')
class Solution: # @param {integer[]} candidates # @param {integer} target # @return {integer[][]} def combinationSum(self, candidates, target): candidates.sort() return self.combsum(candidates, target) def combsum(self, nums, target): if target == 0: return [[]] ...
class Solution: def combination_sum(self, candidates, target): candidates.sort() return self.combsum(candidates, target) def combsum(self, nums, target): if target == 0: return [[]] if not nums or nums[0] > target or target < 1: return [] res = [...
def decimal2base(num, base): convert_string = "0123456789ABCDEF" if num < base: return convert_string[num] remainder = num % base num = num // base return decimal2base(num, base) + convert_string[remainder] print(decimal2base(1453, 16))
def decimal2base(num, base): convert_string = '0123456789ABCDEF' if num < base: return convert_string[num] remainder = num % base num = num // base return decimal2base(num, base) + convert_string[remainder] print(decimal2base(1453, 16))
# wykys 2019 def bin_print(byte_array: list, num_in_line: int = 8, space: str = ' | '): def bin_to_str(byte_array: list) -> str: return ''.join([ chr(c) if c > 32 and c < 127 else '.' for c in byte_array ]) tmp = '' for i, byte in enumerate(byte_array): tmp = ''.join([t...
def bin_print(byte_array: list, num_in_line: int=8, space: str=' | '): def bin_to_str(byte_array: list) -> str: return ''.join([chr(c) if c > 32 and c < 127 else '.' for c in byte_array]) tmp = '' for (i, byte) in enumerate(byte_array): tmp = ''.join([tmp, f'{byte:02X}']) if (i + 1)...
expected_output = { 'environment-information': { 'environment-item': [{ 'class': 'Temp', 'name': 'PSM 0', 'status': 'OK', 'temperature': { '#text': '25 ' 'degrees ' 'C ' '/ ' '77 '...
expected_output = {'environment-information': {'environment-item': [{'class': 'Temp', 'name': 'PSM 0', 'status': 'OK', 'temperature': {'#text': '25 degrees C / 77 degrees F', '@junos:celsius': '25'}}, {'class': 'Temp', 'name': 'PSM 1', 'status': 'OK', 'temperature': {'#text': '24 degrees C / 75 degrees F', '@junos:cels...
# Declan Barr 19 Mar 2018 # Script that contains function sumultiply that takes two integer arguments and # returns their product. Does this without the * or / operators def sumultiply(x, y): sumof = 0 for i in range(1, x+1): sumof = sumof + y return sumof print(sumultiply(11, 13)) print(sumultip...
def sumultiply(x, y): sumof = 0 for i in range(1, x + 1): sumof = sumof + y return sumof print(sumultiply(11, 13)) print(sumultiply(5, 123))
""" link : https://leetcode.com/problems/koko-eating-bananas/ """ class Solution: def minEatingSpeed(self, piles: List[int], h: int) -> int: def condition(val): hr = 0 for i in piles: hr += (val + i - 1)//val return hr <= h left,right = ...
""" link : https://leetcode.com/problems/koko-eating-bananas/ """ class Solution: def min_eating_speed(self, piles: List[int], h: int) -> int: def condition(val): hr = 0 for i in piles: hr += (val + i - 1) // val return hr <= h (left, right) = (...
class Node: def __init__(self, value, child, parent): self._value = value self._child = child self._parent = parent def get_value(self): #Return the value of a node return self._value def get_child(self): #Return the value of a node return self._chil...
class Node: def __init__(self, value, child, parent): self._value = value self._child = child self._parent = parent def get_value(self): return self._value def get_child(self): return self._child def get_parent(self): return self._parent def set_v...
# -*- coding: utf-8 -*- """ Created on Thu May 28 15:30:04 2020 @author: Christopher Cheng """ class Circle (object): def __init__(self): self.radius = 0 def change_radius(self, radius): self.radius = radius def get_radius (self): return self.radius class Rectangle(object): ...
""" Created on Thu May 28 15:30:04 2020 @author: Christopher Cheng """ class Circle(object): def __init__(self): self.radius = 0 def change_radius(self, radius): self.radius = radius def get_radius(self): return self.radius class Rectangle(object): def __init__(self, lengt...
class AvatarPlugin: """ Abstract interface for all Avatar plugins Upon start() and stop(), plugins are expected to register/unregister their own event handlers by the means of :func:`System.register_event_listener` and :func:`System.unregister_event_listener` """ def __init__(self, system)...
class Avatarplugin: """ Abstract interface for all Avatar plugins Upon start() and stop(), plugins are expected to register/unregister their own event handlers by the means of :func:`System.register_event_listener` and :func:`System.unregister_event_listener` """ def __init__(self, system)...
def find_sum(arr, s): curr_sum = arr[0] start = 0 n = len(arr) - 1 i = 1 while i <= n: while curr_sum > s and start < i: curr_sum = curr_sum - arr[start] start += 1 if curr_sum == s: return "Found between {} and {}".format(start, i ...
def find_sum(arr, s): curr_sum = arr[0] start = 0 n = len(arr) - 1 i = 1 while i <= n: while curr_sum > s and start < i: curr_sum = curr_sum - arr[start] start += 1 if curr_sum == s: return 'Found between {} and {}'.format(start, i - 1) cur...
class HoloResponse: def __init__(self, success, response=None): self.success = success if response != None: self.response = response
class Holoresponse: def __init__(self, success, response=None): self.success = success if response != None: self.response = response
x = float(1) y = float(2.8) z = float("3") w = float("4.2") print(x) print(y) print(z) print(w) # Author: Bryan G
x = float(1) y = float(2.8) z = float('3') w = float('4.2') print(x) print(y) print(z) print(w)
""" Project name: SortingProblem File name: BubbleSort.py Description: version: Author: Jutraman Email: jutraman@hotmail.com Date: 04/07/2021 21:49 LastEditors: Jutraman LastEditTime: 04/07/2021 Github: https://github.com/Jutraman """ def bubble_sort(array): length = len(array) for i in range(length): ...
""" Project name: SortingProblem File name: BubbleSort.py Description: version: Author: Jutraman Email: jutraman@hotmail.com Date: 04/07/2021 21:49 LastEditors: Jutraman LastEditTime: 04/07/2021 Github: https://github.com/Jutraman """ def bubble_sort(array): length = len(array) for i in range(length): ...
def capture_high_res(filename): return "./camerapi/tmp_large.jpg" def capture_low_res(filename): return "./camerapi/tmp_small.jpg" def init(): return def deinit(): return
def capture_high_res(filename): return './camerapi/tmp_large.jpg' def capture_low_res(filename): return './camerapi/tmp_small.jpg' def init(): return def deinit(): return
''' Constants --- Constants used in other scripts. These are mostly interpretations of fields provided in the Face2Gene jsons. ''' HGVS_ERRORDICT_VERSION = 0 # Bucket name, from where Face2Gene vcf and json files will be downloaded AWS_BUCKET_NAME = "fdna-pedia-dump" # caching directory CACHE_DIR = ".cache" # tests...
""" Constants --- Constants used in other scripts. These are mostly interpretations of fields provided in the Face2Gene jsons. """ hgvs_errordict_version = 0 aws_bucket_name = 'fdna-pedia-dump' cache_dir = '.cache' chromosomal_tests = ['CHROMOSOMAL_MICROARRAY', 'FISH', 'KARYOTYPE'] positive_results = ['ABNORMAL', 'ABNO...
def f(x): return ((2*(x**4))+(3*(x**3))-(6*(x**2))+(5*x)-8) def reachEnd(previousm,currentm): if abs(previousm - currentm) <= 10**(-6): return True return False def printFormat(a,b,c,m,count): print("Step %s" %count) print("a=%.6f b=%.6f c=%.6f" %(a,b,c)) print("f(a)=%.6f f(...
def f(x): return 2 * x ** 4 + 3 * x ** 3 - 6 * x ** 2 + 5 * x - 8 def reach_end(previousm, currentm): if abs(previousm - currentm) <= 10 ** (-6): return True return False def print_format(a, b, c, m, count): print('Step %s' % count) print('a=%.6f b=%.6f c=%.6f' % (a, b, c)) print('f(a)...
class Solution: def spiralOrder(self, matrix: List[List[int]]) -> List[int]: result = [] rows, columns = len(matrix), len(matrix[0]) up = left = 0 right = columns-1 down = rows-1 while len(result) < rows*columns: for col in r...
class Solution: def spiral_order(self, matrix: List[List[int]]) -> List[int]: result = [] (rows, columns) = (len(matrix), len(matrix[0])) up = left = 0 right = columns - 1 down = rows - 1 while len(result) < rows * columns: for col in range(left, right + ...
class NoProxy: def get(self, _): return None def ban_proxy(self, proxies): return None class RateLimitProxy: def __init__(self, proxies, paths, default=None): self.proxies = proxies self.proxy_count = len(proxies) self.access_counter = { path: {"limit":...
class Noproxy: def get(self, _): return None def ban_proxy(self, proxies): return None class Ratelimitproxy: def __init__(self, proxies, paths, default=None): self.proxies = proxies self.proxy_count = len(proxies) self.access_counter = {path: {'limit': paths[path]...
months_json = { "1": "January", "2": "February", "3": "March", "4": "April", "5": "May", "6": "June", "7": "July", "8": "August", "9": "September", "01": "January", "02": "February", "03": "March", "04": "April", "05": "May", "06": "June", "07": "July", "08": "August", "09": "Septem...
months_json = {'1': 'January', '2': 'February', '3': 'March', '4': 'April', '5': 'May', '6': 'June', '7': 'July', '8': 'August', '9': 'September', '01': 'January', '02': 'February', '03': 'March', '04': 'April', '05': 'May', '06': 'June', '07': 'July', '08': 'August', '09': 'September', '10': 'October', '11': 'November...
#coding: utf-8 ''' @Time: 2019/4/25 11:15 @Author: fangyoucai '''
""" @Time: 2019/4/25 11:15 @Author: fangyoucai """
__all__ = ['EncryptException', 'DecryptException', 'DefaultKeyNotSet', 'NoValidKeyFound'] class EncryptException(BaseException): pass class DecryptException(BaseException): pass class DefaultKeyNotSet(EncryptException): pass class NoValidKeyFound(DecryptException): pass
__all__ = ['EncryptException', 'DecryptException', 'DefaultKeyNotSet', 'NoValidKeyFound'] class Encryptexception(BaseException): pass class Decryptexception(BaseException): pass class Defaultkeynotset(EncryptException): pass class Novalidkeyfound(DecryptException): pass
SCRABBLE_LETTER_VALUES = { 'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o': 1, 'p': 3, 'q': 10, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 4, 'w': 4, 'x': 8, 'y': 4, 'z': 10 } # The first step is to implement some code that allows us to calculate the sco...
scrabble_letter_values = {'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o': 1, 'p': 3, 'q': 10, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 4, 'w': 4, 'x': 8, 'y': 4, 'z': 10} def get_word_score(word, n): """ Returns the score for a word. Assumes the ...
# # @lc app=leetcode id=86 lang=python3 # # [86] Partition List # # https://leetcode.com/problems/partition-list/description/ # # algorithms # Medium (43.12%) # Likes: 1981 # Dislikes: 384 # Total Accepted: 256.4K # Total Submissions: 585.7K # Testcase Example: '[1,4,3,2,5,2]\n3' # # Given the head of a linked l...
class Solution: def partition(self, head: ListNode, x: int) -> ListNode: if not head: return head smaller_dummy = list_node(0) greater_dummy = list_node(0) smaller = smaller_dummy greater = greater_dummy node = head while node: if node...
with open("input.txt", "r") as input_file: input = input_file.read().split("\n") passwords = list(map(lambda line: [list(map(int, line.split(" ")[0].split("-"))), line.split(" ")[1][0], line.split(" ")[2]], input)) valid = 0 for password in passwords: count_letter = password[2].count(password[1]) if pass...
with open('input.txt', 'r') as input_file: input = input_file.read().split('\n') passwords = list(map(lambda line: [list(map(int, line.split(' ')[0].split('-'))), line.split(' ')[1][0], line.split(' ')[2]], input)) valid = 0 for password in passwords: count_letter = password[2].count(password[1]) if passwor...
music = { 'kb': ''' Instrument(Flute) Piece(Undine, Reinecke) Piece(Carmen, Bourne) (Instrument(x) & Piece(w, c) & Era(c, r)) ==> Program(w) Era(Reinecke, Romantic) Era(Bourne, Romantic) ''', 'queries': ''' Program(x) ''', } life = { 'kb': ''' Musician(x) ==> Stressed(x) (Student(x) & Te...
music = {'kb': '\nInstrument(Flute)\nPiece(Undine, Reinecke)\nPiece(Carmen, Bourne)\n\n\n(Instrument(x) & Piece(w, c) & Era(c, r)) ==> Program(w)\nEra(Reinecke, Romantic)\nEra(Bourne, Romantic)\n\n\n ', 'queries': '\n Program(x)\n '} life = {'kb': '\nMusician(x) ==> Stressed(x)\n(Student(x) & Text(y)) ==> Stre...
"""3.3 Stack of Plates: Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the previous stack exceeds some threshold. Implement a data structure SetOfStacks that mimics this. SetOfStacks should be composed of several stacks a...
"""3.3 Stack of Plates: Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the previous stack exceeds some threshold. Implement a data structure SetOfStacks that mimics this. SetOfStacks should be composed of several stacks a...
myl1 = [] num = int(input("Enter the number of elements: ")) for loop in range(num): myl1.append(input(f"Enter element at index {loop} : ")) print(myl1) print(type(myl1)) myt1 = tuple(myl1) print(myt1) print(type(myt1)) print("The elements of tuple object are: ") for loop in myt1: print(loop)
myl1 = [] num = int(input('Enter the number of elements: ')) for loop in range(num): myl1.append(input(f'Enter element at index {loop} : ')) print(myl1) print(type(myl1)) myt1 = tuple(myl1) print(myt1) print(type(myt1)) print('The elements of tuple object are: ') for loop in myt1: print(loop)
# Scrapy settings for scraper project BOT_NAME = 'scraper' SPIDER_MODULES = ['scraper.spiders'] NEWSPIDER_MODULE = 'scraper.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent USER_AGENT = 'Googlebot-News' # Obey robots.txt rules ROBOTSTXT_OBEY = True # MONGO URI for accessing...
bot_name = 'scraper' spider_modules = ['scraper.spiders'] newspider_module = 'scraper.spiders' user_agent = 'Googlebot-News' robotstxt_obey = True mongo_uri = '' mongo_database = '' sqlite_db = '' item_pipelines = {}
## Data Categorisation ''' 1) Whole Number (Ints) - 100, 1000, -450, 999 2) Real Numbers (Floats) - 33.33, 44.01, -1000.033 3) String - "Bangalore", "India", "Raj", "abc123" 4) Boolean - True, False Variables in python are dynamic in nature ''' a = 10 print(a) print(type(a)) a = 10.33 print(a) print(type(a)) a =...
""" 1) Whole Number (Ints) - 100, 1000, -450, 999 2) Real Numbers (Floats) - 33.33, 44.01, -1000.033 3) String - "Bangalore", "India", "Raj", "abc123" 4) Boolean - True, False Variables in python are dynamic in nature """ a = 10 print(a) print(type(a)) a = 10.33 print(a) print(type(a)) a = 'New Jersey' print(a) prin...
class RelationType(object): ONE_TO_MANY = "one_to_many" ONE_TO_ONE = "one_to_one" class Relation(object): def __init__(self, cls): self.cls = cls class HasOne(Relation): def get(self, id): return self.cls.get(id=id) class HasMany(Relation): def get(self, id): value = []...
class Relationtype(object): one_to_many = 'one_to_many' one_to_one = 'one_to_one' class Relation(object): def __init__(self, cls): self.cls = cls class Hasone(Relation): def get(self, id): return self.cls.get(id=id) class Hasmany(Relation): def get(self, id): value = []...
""" Given an array of integers, find the subset of non-adjacent elements with the maximum sum. Calculate the sum of that subset. It is possible that the maximum sum is , the case when all elements are negative. """ def maxSubsetSum(arr): n = len(arr) # n = length of the array dp = [0]*n # create a dp ...
""" Given an array of integers, find the subset of non-adjacent elements with the maximum sum. Calculate the sum of that subset. It is possible that the maximum sum is , the case when all elements are negative. """ def max_subset_sum(arr): n = len(arr) dp = [0] * n dp[0] = arr[0] dp[1] = max(arr[1], ...
description = 'Alphai alias device' group = 'lowlevel' devices = dict( alphai = device('nicos.devices.generic.DeviceAlias'), )
description = 'Alphai alias device' group = 'lowlevel' devices = dict(alphai=device('nicos.devices.generic.DeviceAlias'))
{ 'targets': [ { 'target_name': 'overlay_window', 'sources': [ 'src/lib/addon.c', 'src/lib/napi_helpers.c' ], 'include_dirs': [ 'src/lib' ], 'conditions': [ ['OS=="win"', { 'defines': [ 'WIN32_LEAN_AND_MEAN' ], ...
{'targets': [{'target_name': 'overlay_window', 'sources': ['src/lib/addon.c', 'src/lib/napi_helpers.c'], 'include_dirs': ['src/lib'], 'conditions': [['OS=="win"', {'defines': ['WIN32_LEAN_AND_MEAN'], 'link_settings': {'libraries': ['oleacc.lib']}, 'sources': ['src/lib/windows.c']}], ['OS=="linux"', {'defines': ['_GNU_S...
# --------------------------------------------------------------------- # Gufo Labs Loader: # a plugin # --------------------------------------------------------------------- # Copyright (C) 2022, Gufo Labs # --------------------------------------------------------------------- class APlugin(object): name = "a" ...
class Aplugin(object): name = 'a' def get_name(self) -> str: return self.name
# -*- coding: utf-8 -*- # ______________________________________________________________________________ def boolean_func(experiment): """Function that returns True when an experiment matches and False otherwise. Args: experiment (:class:`~skassist.Experiment`): Experiment that is to be tested. ...
def boolean_func(experiment): """Function that returns True when an experiment matches and False otherwise. Args: experiment (:class:`~skassist.Experiment`): Experiment that is to be tested. """ def scoring_function(self, model, y_true, y_predicted_probability): """The scoring function ta...
class InvalidProxyType(Exception): pass class ApiConnectionError(Exception): pass class ApplicationNotFound(Exception): pass class SqlmapFailedStart(Exception): pass class SpiderTestFailure(Exception): pass class InvalidInputProvided(Exception): pass class InvalidTamperProvided(Exception): pass class Port...
class Invalidproxytype(Exception): pass class Apiconnectionerror(Exception): pass class Applicationnotfound(Exception): pass class Sqlmapfailedstart(Exception): pass class Spidertestfailure(Exception): pass class Invalidinputprovided(Exception): pass class Invalidtamperprovided(Exception):...
class CreatePickupResponse: def __init__(self, res): """ Initialize new instance from CreatePickupResponse class Parameters: res (dict, str): JSON response object or response text message Returns: instance from CreatePickupResponse """ self.fromR...
class Createpickupresponse: def __init__(self, res): """ Initialize new instance from CreatePickupResponse class Parameters: res (dict, str): JSON response object or response text message Returns: instance from CreatePickupResponse """ self.fromRes...
test = { 'name': 'q1_3', 'points': 1, 'suites': [ { 'cases': [ {'code': '>>> type(max_estimate) in set([int, np.int32, np.int64])\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> max_estimate in observations.column(0)\nTrue', 'hidden': False, 'locked': False}],...
test = {'name': 'q1_3', 'points': 1, 'suites': [{'cases': [{'code': '>>> type(max_estimate) in set([int, np.int32, np.int64])\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> max_estimate in observations.column(0)\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': '...
TYPES = {"int","float","str","bool","list"} MATCH_TYPES = {"int": int, "float": float, "str": str, "bool": bool, "list": list} CONSTRAINTS = { "is_same_type": lambda x, y: type(x) == type(y), "int" :{ "min_inc": lambda integer, min: integer >= min, "min_exc": lambda integer, ...
types = {'int', 'float', 'str', 'bool', 'list'} match_types = {'int': int, 'float': float, 'str': str, 'bool': bool, 'list': list} constraints = {'is_same_type': lambda x, y: type(x) == type(y), 'int': {'min_inc': lambda integer, min: integer >= min, 'min_exc': lambda integer, min: integer > min, 'max_inc': lambda inte...
def main(): video = "NET20070330_thlep_1_2" file_path = "optical_flow_features_train/" + video optical_flow_features_train = open(file_path + "/optical_flow_features_train.txt", "r") clear_of_features_train = open(file_path + "/clear_opt_flow_features_train.txt", "w") visual_ids = [] for line ...
def main(): video = 'NET20070330_thlep_1_2' file_path = 'optical_flow_features_train/' + video optical_flow_features_train = open(file_path + '/optical_flow_features_train.txt', 'r') clear_of_features_train = open(file_path + '/clear_opt_flow_features_train.txt', 'w') visual_ids = [] for line in...
prize_file_1 = open("/Users/MatBook/Downloads/prize3.txt") List = [] prizes = [] for line in prize_file_1: List.append(int(line)) first_line = List.pop(0) for i in List: print(i) for j in List: if i + j == first_line: prizes.append((i,j)) print (...
prize_file_1 = open('/Users/MatBook/Downloads/prize3.txt') list = [] prizes = [] for line in prize_file_1: List.append(int(line)) first_line = List.pop(0) for i in List: print(i) for j in List: if i + j == first_line: prizes.append((i, j)) print(List) print('you can have:', prizes)
#!/usr/bin/env python # -*- coding: utf-8 -*- template = """/* * * search_dipus * * ~~~~~~~~~~~~~~ * * * * Dipus JavaScript utilties for the full-text search. * * This files is based on searchtools.js of Sphinx. * * * * :copyright: Copyright 2007-2012 by the Sphinx team. * * :license: BSD, see LICENSE ...
template = '/*\n * * search_dipus\n * * ~~~~~~~~~~~~~~\n * *\n * * Dipus JavaScript utilties for the full-text search.\n * * This files is based on searchtools.js of Sphinx.\n * *\n * * :copyright: Copyright 2007-2012 by the Sphinx team.\n * * :license: BSD, see LICENSE for details.\n * *\n * */\n\n\n/**\n * ...
def classfinder(k): res=1 while res*(res+1)//2<k: res+=1 return res # cook your dish here for t in range(int(input())): #n=int(input()) n,k=map(int,input().split()) clas=classfinder(k) i=k-clas*(clas-1)//2 str="" for z in range(n): if ...
def classfinder(k): res = 1 while res * (res + 1) // 2 < k: res += 1 return res for t in range(int(input())): (n, k) = map(int, input().split()) clas = classfinder(k) i = k - clas * (clas - 1) // 2 str = '' for z in range(n): if z == n - clas - 1 or z == n - i: ...
class Config: conf = { "labels": { "pageTitle": "Weatherman V0.0.1" }, "db.database": "weatherman", "db.username": "postgres", "db.password": "postgres", "navigation": [ { "url": "/", "name": "Home" }...
class Config: conf = {'labels': {'pageTitle': 'Weatherman V0.0.1'}, 'db.database': 'weatherman', 'db.username': 'postgres', 'db.password': 'postgres', 'navigation': [{'url': '/', 'name': 'Home'}, {'url': '/cakes', 'name': 'Cakes'}, {'url': '/mqtt', 'name': 'MQTT'}]} def get_config(self): return self.co...
#!/usr/bin/python # -*- coding: UTF-8 -*- """ @author:MT @file:__init__.py.py @time:2021/8/21 23:02 """
""" @author:MT @file:__init__.py.py @time:2021/8/21 23:02 """
def is_leap(year): leap = False if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: leap = True else: leap = False else: leap = True return leap year = int(input()) print(is_leap(year)) ''' In the Gregorian calend...
def is_leap(year): leap = False if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: leap = True else: leap = False else: leap = True return leap year = int(input()) print(is_leap(year)) '\nIn the Gregorian calendar, th...
"""HackerEarth docs constants""" DOC_URL_DICT = { # 'doc_name': 'doc_url1', # 'doc_name': 'doc_url2', }
"""HackerEarth docs constants""" doc_url_dict = {}
class Solution(object): def maxSubArray1(self, nums): """ :type nums: List[int] :rtype: int """ this = maxsum = 0 for i in range(len(nums)): this += nums[i] if this > maxsum: maxsum = this elif this < 0: ...
class Solution(object): def max_sub_array1(self, nums): """ :type nums: List[int] :rtype: int """ this = maxsum = 0 for i in range(len(nums)): this += nums[i] if this > maxsum: maxsum = this elif this < 0: ...
""" EVEN IN RANGE: Use range() to print all the even numbers from 0 to 10. """ for number in range(11): if number % 2 == 0: if number == 0: continue print(number)
""" EVEN IN RANGE: Use range() to print all the even numbers from 0 to 10. """ for number in range(11): if number % 2 == 0: if number == 0: continue print(number)
# -*- coding: utf-8 -*- class DummyTile: def __init__(self, pos, label=None): self.pos = pos # Label tells adjacent mine count for this tile. Int between 0...8 or None if unknown self.label = label self.checked = False self.marked = False self.adj_mines = None ...
class Dummytile: def __init__(self, pos, label=None): self.pos = pos self.label = label self.checked = False self.marked = False self.adj_mines = None self.adj_tiles = 0 self.adj_checked = 0 self.adj_unchecked = None def set_label(self, label): ...
##Write code to switch the order of the winners list so that it is now Z to A. Assign this list to the variable z_winners. winners = ['Alice Munro', 'Alvin E. Roth', 'Kazuo Ishiguro', 'Malala Yousafzai', 'Rainer Weiss', 'Youyou Tu'] z_winners = winners z_winners.reverse() print(z_winners)
winners = ['Alice Munro', 'Alvin E. Roth', 'Kazuo Ishiguro', 'Malala Yousafzai', 'Rainer Weiss', 'Youyou Tu'] z_winners = winners z_winners.reverse() print(z_winners)