content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. Example 1: coins = [1, 2, 5], amount = 11 return 3 (1...
""" You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. Example 1: coins = [1, 2, 5], amount = 11 return 3 (1...
a=int(input('enter a?')); b=int(input('enter b?')); c=int(input('enter c?')); if a>b and a>c: print('a is largest'); if b>a and b>c: print('b is largest'); if c>a and c>b: print('c is largest');
a = int(input('enter a?')) b = int(input('enter b?')) c = int(input('enter c?')) if a > b and a > c: print('a is largest') if b > a and b > c: print('b is largest') if c > a and c > b: print('c is largest')
# -*- coding: utf-8 -*- """ Created on Sun Apr 23 23:04:01 2017 @author: LI YUXIN """ ''' ResNet Placeholder '''
""" Created on Sun Apr 23 23:04:01 2017 @author: LI YUXIN """ '\nResNet Placeholder\n'
# -*- coding: utf-8 -*- """ 119. Pascal's Triangle II Given an integer rowIndex, return the rowIndexth row of the Pascal's triangle. Notice that the row index starts from 0. In Pascal's triangle, each number is the sum of the two numbers directly above it. Follow up: Could you optimize your algorithm to use only O...
""" 119. Pascal's Triangle II Given an integer rowIndex, return the rowIndexth row of the Pascal's triangle. Notice that the row index starts from 0. In Pascal's triangle, each number is the sum of the two numbers directly above it. Follow up: Could you optimize your algorithm to use only O(k) extra space? Constr...
class Solution: def missingNumber(self, nums: List[int]) -> int: arr = list(range(0, len(nums), 1)) for i in range(0, len(nums), 1): if nums[i] in arr: arr.remove(nums[i]) else: continue try: return arr[0] except Ind...
class Solution: def missing_number(self, nums: List[int]) -> int: arr = list(range(0, len(nums), 1)) for i in range(0, len(nums), 1): if nums[i] in arr: arr.remove(nums[i]) else: continue try: return arr[0] except I...
""" The MIT License (MIT) Copyright (c) 2017 Roland Jaeger 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...
""" The MIT License (MIT) Copyright (c) 2017 Roland Jaeger 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...
''' Created on Sep 26, 2016 @author: matth ''' #plan # auto find com port (atelast ask for port number) # verify that port is good # background thread the serial read ''' import serial import threading from threading import Thread from queue import Queue import AFSK.afsk as afsk class AudioTNC(): def...
""" Created on Sep 26, 2016 @author: matth """ '\n\n\nimport serial\nimport threading\nfrom threading import Thread\nfrom queue import Queue\nimport AFSK.afsk as afsk\n\nclass AudioTNC():\n def __init__(self,portname,baud):\n self.qin=Queue()\n self.qout=Queue()\n self.AudioReader=AudioThread(s...
#!/usr/bin/python3 #Copyright 2018 Jim Van Fleet #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 ...
class Searchannofile: def get_link_data(self, annoParse, annoLink, symData, machine): anno_parse_names = [] for ii in annoParse: annoParseNames.append(ii[1]) annoParseNames.append(ii[3]) link_anno_parse = [] for lnk in annoLink: lnk_name = self.fi...
__author__ = 'Elias Haroun' class Node(object): def __init__(self, data, next, previous): self.data = data self.next = next self.previous = previous def getData(self): return self.data def getNext(self): return self.next def getPrevious(self): return ...
__author__ = 'Elias Haroun' class Node(object): def __init__(self, data, next, previous): self.data = data self.next = next self.previous = previous def get_data(self): return self.data def get_next(self): return self.next def get_previous(self): retu...
# #1 # def generateShape(int): # str = [] # for i in range(int): # str.append('+' * int) # return "\n".join(str) # #2 # def generateShape(n): # return "\n".join("+" * n for i in range(n)) def generateShape(int): # 3 return (("+" * int + "\n") * int)[:-1]
def generate_shape(int): return (('+' * int + '\n') * int)[:-1]
#!/usr/bin/env python # -*- mode: python; coding: utf-8; fill-column: 80; -*- """Simple linked list implementation. """ class CircDblLnkList: """Circular, doubly linked list.""" def __init__(self): """Instantiate a circular, doubly linked list.""" self.__head = None self.__tail = None...
"""Simple linked list implementation. """ class Circdbllnklist: """Circular, doubly linked list.""" def __init__(self): """Instantiate a circular, doubly linked list.""" self.__head = None self.__tail = None self.__sz = 0 self.__min = None def ins(self, elem): ...
''' Created on 2019/02/14 @author: tom_uda ''' def search4letters(phrase:str,letters:str) -> set: return set(letters).intersection(set(phrase))
""" Created on 2019/02/14 @author: tom_uda """ def search4letters(phrase: str, letters: str) -> set: return set(letters).intersection(set(phrase))
# # PySNMP MIB module SYMMCOMMON10M (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/neermitt/Dev/kusanagi/mibs.snmplabs.com/asn1/SYMMCOMMON10M # Produced by pysmi-0.3.4 at Tue Jul 30 11:34:48 2019 # On host NEERMITT-M-J0NV platform Darwin version 18.6.0 by user neermitt # Using Python version 3.7.4 (default, J...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ...
class DataExtracter(): def extract(self): """ override for own implementation """
class Dataextracter: def extract(self): """ override for own implementation """
''' Parameters of this project. This file is used for storing the parameters that would not be changed frequently. ''' # Lengths of input and output traces num_input = 2500 num_output = 2500 # Batch size batch_size = 16 # Zoom range, should be in the range of (1, num_output) zoom_range = (500, 1000) # Input and out...
""" Parameters of this project. This file is used for storing the parameters that would not be changed frequently. """ num_input = 2500 num_output = 2500 batch_size = 16 zoom_range = (500, 1000) num_input_complex = 150 * 2 num_output_complex = 46 * 2 freq_range_1_40 = (5, 201) freq_range_1_10 = (0, 56) time_step = 0.00...
class ReskinUnlockPacket: def __init__(self): self.type = "RESKINUNLOCK" self.skinID = 0 self.isPetSkin = 0 def read(self, reader): self.skinID = reader.readInt32() self.isPetSkin = reader.readInt32()
class Reskinunlockpacket: def __init__(self): self.type = 'RESKINUNLOCK' self.skinID = 0 self.isPetSkin = 0 def read(self, reader): self.skinID = reader.readInt32() self.isPetSkin = reader.readInt32()
class Crafting: def __init__(self, json=None): self.discipline = None self.rating = None self.active = None if(json is not None): self.load_from_json(json) def load_from_json(self, json: dict): self.discipline = json.get("discipline", None) self.rati...
class Crafting: def __init__(self, json=None): self.discipline = None self.rating = None self.active = None if json is not None: self.load_from_json(json) def load_from_json(self, json: dict): self.discipline = json.get('discipline', None) self.ratin...
""" # Copyright 2022 Red Hat # # 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 agr...
""" # Copyright 2022 Red Hat # # 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 agr...
"""Line Encoding Given a string, return its encoding defined as follows: First, the string is divided into the least possible number of disjoint substrings consisting of identical characters Next, each substring with length greater than one is replaced with a concatenation of its length...
"""Line Encoding Given a string, return its encoding defined as follows: First, the string is divided into the least possible number of disjoint substrings consisting of identical characters Next, each substring with length greater than one is replaced with a concatenation of its length...
''' Created on Apr 15, 2016 @author: dj ''' # Use Meta class to help. class Product(object): def __init__(self): self.name = None self.internal_name = None print("class, name, internal_name = {0}, {1}, {2}".format( self.__class__.__name__, self.name, self.inte...
""" Created on Apr 15, 2016 @author: dj """ class Product(object): def __init__(self): self.name = None self.internal_name = None print('class, name, internal_name = {0}, {1}, {2}'.format(self.__class__.__name__, self.name, self.internal_name)) def __get__(self, instance, instance_ty...
class Solution: def maxChunksToSorted(self, arr): max_so_far = arr[0] result = 0 for i, num in enumerate(arr): max_so_far = max(max_so_far, num) if max_so_far == i: result += 1 return result
class Solution: def max_chunks_to_sorted(self, arr): max_so_far = arr[0] result = 0 for (i, num) in enumerate(arr): max_so_far = max(max_so_far, num) if max_so_far == i: result += 1 return result
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Sep 1 22:47:54 2018 @author: tanjeremy """ def network_forward(network, input_data, label_data=None, phase='train'): for layer in network: if type(layer) is not SoftmaxOutput_CrossEntropyLossLayer: input_data = layer.forward(inp...
""" Created on Sat Sep 1 22:47:54 2018 @author: tanjeremy """ def network_forward(network, input_data, label_data=None, phase='train'): for layer in network: if type(layer) is not SoftmaxOutput_CrossEntropyLossLayer: input_data = layer.forward(input_data) else: layer.eval(...
clock.addListener("clockStarted", "python", "clock_start") def clock_start(): print("The clock has started")
clock.addListener('clockStarted', 'python', 'clock_start') def clock_start(): print('The clock has started')
class PreflightFailure(Exception): pass class MasterTimeoutExpired(Exception): pass
class Preflightfailure(Exception): pass class Mastertimeoutexpired(Exception): pass
class UniqueStringFinder: def find_unique(self, list_of_strings: list): list_of_strings.sort(key=lambda element: element.lower()) sorted_list = [set(element.lower()) for element in list_of_strings] if sorted_list.count(sorted_list[0]) == 1 and str(sorted_list[0]) != 'set()': ret...
class Uniquestringfinder: def find_unique(self, list_of_strings: list): list_of_strings.sort(key=lambda element: element.lower()) sorted_list = [set(element.lower()) for element in list_of_strings] if sorted_list.count(sorted_list[0]) == 1 and str(sorted_list[0]) != 'set()': ret...
def main(): with open('../data/states.txt') as f: lines = f.read().splitlines() states = [line.split('\t')[0] for line in lines] states_with_spaces = [state for state in states if ' ' in state] # Print the states_with_spaces list for i, state_name in enumerate(states_with_spaces, 1): ...
def main(): with open('../data/states.txt') as f: lines = f.read().splitlines() states = [line.split('\t')[0] for line in lines] states_with_spaces = [state for state in states if ' ' in state] for (i, state_name) in enumerate(states_with_spaces, 1): print(f'{i}. {state_name}') main()
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres...
def taumBday(b: int, w: int, bc: int, wc: int, z: int) -> int: if abs(bc-wc)<=z: return b*bc+w*wc elif bc < wc: return b * bc + w * (bc + z) else: return w*wc+b*(wc+z) if __name__ == "__main__": for _ in range(int(input())): b,w = (int(x) for x in input().split()) ...
def taum_bday(b: int, w: int, bc: int, wc: int, z: int) -> int: if abs(bc - wc) <= z: return b * bc + w * wc elif bc < wc: return b * bc + w * (bc + z) else: return w * wc + b * (wc + z) if __name__ == '__main__': for _ in range(int(input())): (b, w) = (int(x) for x in in...
x = 1 y = 2 def f1(): x, y = 3, 4 print [x, y] def f2(): global y x, y = 5, 6 print [x, y] def f3(): global x x, y = 7, 8 print [x, y] def f4(): global x, y x, y = 9, 10 print [x, y] print [x, y] f1() print [x, y] f2() print [x, y] f3() print [x, y] f4() print [x, y]
x = 1 y = 2 def f1(): (x, y) = (3, 4) print[x, y] def f2(): global y (x, y) = (5, 6) print[x, y] def f3(): global x (x, y) = (7, 8) print[x, y] def f4(): global x, y (x, y) = (9, 10) print[x, y] print[x, y] f1() print[x, y] f2() print[x, y] f3() print[x, y] f4() print[x, ...
hour = int(input()) day = input() if day == "Monday" or day == "Tuesday" or day == "Wednesday" or day == "Thursday" or day == "Friday" \ or day == "Saturday": if hour == 10 or hour == 11 or hour == 12 or hour == 13 or hour == 14 or hour == 15 \ or hour == 16 or hour == 17 or hour == 18: print("op...
hour = int(input()) day = input() if day == 'Monday' or day == 'Tuesday' or day == 'Wednesday' or (day == 'Thursday') or (day == 'Friday') or (day == 'Saturday'): if hour == 10 or hour == 11 or hour == 12 or (hour == 13) or (hour == 14) or (hour == 15) or (hour == 16) or (hour == 17) or (hour == 18): print(...
__author__ = 'gk' # Implements look up Table for user to ID and ID to user, as the end Result class for storing user rank and score class ScreenNameIndex: nameToIdMap = dict() idToNameMap = dict() def __init__(self,screen_names): super().__init__() id = 0 for item in screen_names:...
__author__ = 'gk' class Screennameindex: name_to_id_map = dict() id_to_name_map = dict() def __init__(self, screen_names): super().__init__() id = 0 for item in screen_names: self.nameToIdMap[item] = id self.idToNameMap[id] = item id += 1 de...
# Two to One.py #! python3 ''' Take 2 strings s1 and s2 including only letters from a to z. Return a new sorted string, the longest possible, containing distinct letters, each taken only once - coming from s1 or s2. Examples: a = 'xyaabbbccccdefww' b = 'xxxxyyyyabklmopq' longest(a, b) -> 'abcdefklmopqwxy' a = 'abcdefg...
""" Take 2 strings s1 and s2 including only letters from a to z. Return a new sorted string, the longest possible, containing distinct letters, each taken only once - coming from s1 or s2. Examples: a = 'xyaabbbccccdefww' b = 'xxxxyyyyabklmopq' longest(a, b) -> 'abcdefklmopqwxy' a = 'abcdefghijklmnopqrstuvwxyz' longes...
# # PySNMP MIB module CISCO-MODEM-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-MODEM-MGMT-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:07:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) ...
pay = float(input('Enter your salary: ')) if pay <= 1250: newpay1 = pay + (pay * 0.15) print('Your new salary is {:.2f}'.format(newpay1)) else: newpay2 = pay + (pay * 0.10) print('Your new salary is {:.2f}'.format(newpay2))
pay = float(input('Enter your salary: ')) if pay <= 1250: newpay1 = pay + pay * 0.15 print('Your new salary is {:.2f}'.format(newpay1)) else: newpay2 = pay + pay * 0.1 print('Your new salary is {:.2f}'.format(newpay2))
################### 3 UZD ################################################### def get_city_year(population_now, perc, delta, population_to_reach, verbose=False): perc = perc / 100 years = 0 population_prev = population_now if population_now < population_to_reach: # if delta < 0: # i...
def get_city_year(population_now, perc, delta, population_to_reach, verbose=False): perc = perc / 100 years = 0 population_prev = population_now if population_now < population_to_reach: while population_now < population_to_reach: population_now = population_now + population_now * per...
# Game that generates a story from random user input color = input("Enter a color: ") pluralNoun = input("Enter a noun plural: ") celebrity = input("Enter a celebrity: ") print("Roses are red ", color) print(pluralNoun, " are blue ") print("I love ", celebrity)
color = input('Enter a color: ') plural_noun = input('Enter a noun plural: ') celebrity = input('Enter a celebrity: ') print('Roses are red ', color) print(pluralNoun, ' are blue ') print('I love ', celebrity)
while True: n = input() if n == '0': break cnt = len(n)+1 for i in n: if i == '1': cnt += 2 elif i == '0': cnt += 4 else: cnt += 3 print(cnt)
while True: n = input() if n == '0': break cnt = len(n) + 1 for i in n: if i == '1': cnt += 2 elif i == '0': cnt += 4 else: cnt += 3 print(cnt)
class Solution: def summaryRanges(self, nums: List[int]) -> List[str]: if not nums: return [] res, i, start = [], 0, 0 while i < len(nums)-1: if nums[i]+1 != nums[i+1]: res.append(self.printRange(nums[start], nums[i])) ...
class Solution: def summary_ranges(self, nums: List[int]) -> List[str]: if not nums: return [] (res, i, start) = ([], 0, 0) while i < len(nums) - 1: if nums[i] + 1 != nums[i + 1]: res.append(self.printRange(nums[start], nums[i])) start...
class Solution: def reverse(self, x): """ :type x: int :rtype: int """ flag = False if x < 0: flag = True if flag: n = int("-" + str(x)[1:][::-1]) else : n = int(str(x)[::-1]) if n < -2**31 or n ...
class Solution: def reverse(self, x): """ :type x: int :rtype: int """ flag = False if x < 0: flag = True if flag: n = int('-' + str(x)[1:][::-1]) else: n = int(str(x)[::-1]) if n < -2 ** 31 or n > 2 ** 31 -...
DICE_FMT = '<dice_fmt>' PLAYER = '<player>' TRAIT = '<trait>' ITEM_ID = '<item_id>' PLAYERS_ITEM = '<players_item>' ABILITY_ID = '<ability_id>' PLAYERS_ABILITY = '<players_ability>' EFFECT_ID = '<effect_id>' PLAYERS_EFFECT = '<players_effect>' ANY_ID = '<any_id>' VALUE = '<value>' OBJ_TYPE = '<obj_type>'
dice_fmt = '<dice_fmt>' player = '<player>' trait = '<trait>' item_id = '<item_id>' players_item = '<players_item>' ability_id = '<ability_id>' players_ability = '<players_ability>' effect_id = '<effect_id>' players_effect = '<players_effect>' any_id = '<any_id>' value = '<value>' obj_type = '<obj_type>'
EXCLUDE_LIST = ("C:\\Program Files\\Veritas\\NetBackup\\bin\\*.lock", "C:\\Program Files\\Veritas\\NetBackup\\bin\\bprd.d\\*.lock", "C:\\Program Files\\Veritas\\NetBackup\\bin\\bpsched.d\\*.lock", "C:\\Program Files\\Veritas\\Volmgr\\misc\\*", "C:\\Progra...
exclude_list = ('C:\\Program Files\\Veritas\\NetBackup\\bin\\*.lock', 'C:\\Program Files\\Veritas\\NetBackup\\bin\\bprd.d\\*.lock', 'C:\\Program Files\\Veritas\\NetBackup\\bin\\bpsched.d\\*.lock', 'C:\\Program Files\\Veritas\\Volmgr\\misc\\*', 'C:\\Program Files\\Veritas\\NetBackupDB\\data\\*', 'D:\\privatedata\\exclud...
class Solution: """ @param nums: the given array @param k: the given k @return: the k most frequent elements """ def topKFrequent(self, nums, k): countMap = {} uniqueNums = []; for num in nums : if num in countMap : countMap[num] += 1 ...
class Solution: """ @param nums: the given array @param k: the given k @return: the k most frequent elements """ def top_k_frequent(self, nums, k): count_map = {} unique_nums = [] for num in nums: if num in countMap: countMap[num] += 1 ...
"""aiocasambi errors.""" class AiocasambiException(Exception): """Base error for aiocasambi.""" class RequestError(AiocasambiException): """Unable to fulfill request. Raised when host or API cannot be reached. """ class ResponseError(AiocasambiException): """Invalid response.""" class Unauth...
"""aiocasambi errors.""" class Aiocasambiexception(Exception): """Base error for aiocasambi.""" class Requesterror(AiocasambiException): """Unable to fulfill request. Raised when host or API cannot be reached. """ class Responseerror(AiocasambiException): """Invalid response.""" class Unauthoriz...
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
batch_size = 32 epochs = 10 model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs)
''' base class for a WES Client''' class WESClient: def __init__(self, api_url_base): self.api_url_base = api_url_base def runWorkflow(self, fileurl): # use a temporary file to write out the input file inputJson = {"md5Sum.inputFile":fileurl} return None
""" base class for a WES Client""" class Wesclient: def __init__(self, api_url_base): self.api_url_base = api_url_base def run_workflow(self, fileurl): input_json = {'md5Sum.inputFile': fileurl} return None
def enumize(obj, enum_type): if isinstance(obj, enum_type): return obj else: try: return enum_type(obj) except ValueError as exc: try: return enum_type[obj] except KeyError: raise exc def deenumize(obj): return obj.value if hasattr(obj, "value") else obj def norm_...
def enumize(obj, enum_type): if isinstance(obj, enum_type): return obj else: try: return enum_type(obj) except ValueError as exc: try: return enum_type[obj] except KeyError: raise exc def deenumize(obj): return obj....
# remainder Of any number while True: a = int(input("Enter The Dividend Number : ")) b = int(input("Enter The Divisor Number : ")) Quotient = "Quotient Number", (a / b) % 2 * 2 print(Quotient)
while True: a = int(input('Enter The Dividend Number : ')) b = int(input('Enter The Divisor Number : ')) quotient = ('Quotient Number', a / b % 2 * 2) print(Quotient)
class Solution: def longestPalindrome(self, s): """ :type s: str :rtype: str """ def helper(l, r): "Compute longest palindrome substring centered at index (l, r)." while l >= 0 and r < len(s) and s[l] == s[r]: l -= 1 r +...
class Solution: def longest_palindrome(self, s): """ :type s: str :rtype: str """ def helper(l, r): """Compute longest palindrome substring centered at index (l, r).""" while l >= 0 and r < len(s) and (s[l] == s[r]): l -= 1 ...
class NoRulesForTaskException(Exception): def __init__(self, message="at least one rule needs to be defined for task"): super().__init__(message) self.message = message class NoValidActionFoundException(Exception): def __init__(self, message="rule at least has to have one valid action"): ...
class Norulesfortaskexception(Exception): def __init__(self, message='at least one rule needs to be defined for task'): super().__init__(message) self.message = message class Novalidactionfoundexception(Exception): def __init__(self, message='rule at least has to have one valid action'): ...
v = [int(input()) for x in range(20)] maior, menor = v[0], v[0] for i in range(20): if v[i] < menor: menor = v[i] elif v[i] > maior: maior = v[i] print(f'Menor: {menor}\nMaior: {maior}')
v = [int(input()) for x in range(20)] (maior, menor) = (v[0], v[0]) for i in range(20): if v[i] < menor: menor = v[i] elif v[i] > maior: maior = v[i] print(f'Menor: {menor}\nMaior: {maior}')
class MockMessage: def __init__( self, exchange=None, routing_key=None, queue=None): """__init__ :param exchange: mock exchange name :param routing_key: mock routing key :param queue: mock queue """ self.state = "NOTRU...
class Mockmessage: def __init__(self, exchange=None, routing_key=None, queue=None): """__init__ :param exchange: mock exchange name :param routing_key: mock routing key :param queue: mock queue """ self.state = 'NOTRUN' self.delivery_info = {'exchange': exch...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right # Time Complexity: O(N), N is the number of nodes # Space Complexity: O(h), h is the height of the tree class Solution: ...
class Solution: def is_same_tree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: if not p and (not q): return True if not p or not q: return False return p.val == q.val and self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right)
GMUSIC_EMAIL = 'g_email' GMUSIC_PASSWORD = 'g_password' SPOTIFY_CLIENT_ID = 'id' SPOTIFY_CLIENT_SECRET = 'secret' SPOTIFY_REDIRECT_URI = 'redirect' SPOTIFY_USER = 's_user'
gmusic_email = 'g_email' gmusic_password = 'g_password' spotify_client_id = 'id' spotify_client_secret = 'secret' spotify_redirect_uri = 'redirect' spotify_user = 's_user'
class Term(object): literal = None def __init__(self, literal): self.literal = literal # Here be extensions (as per the task) def __eq__(self, other): if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ # Dictionary of class m...
class Term(object): literal = None def __init__(self, literal): self.literal = literal def __eq__(self, other): if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ else: return False def __ne__(self, other): return not s...
# Operators a = 5 b = 7 r = a + b print("r:", r, type(r)) r = a * b print("r:", r, type(r)) r = a / b print("r:", r, type(r)) a = 2 * b r = a / b print("r:", r, type(r))
a = 5 b = 7 r = a + b print('r:', r, type(r)) r = a * b print('r:', r, type(r)) r = a / b print('r:', r, type(r)) a = 2 * b r = a / b print('r:', r, type(r))
# Changing and adding Dictionary Elements my_dict = {'name': 'Nguyen Khang', 'age': 17} # update value my_dict['age'] = 18 #Output: {'name': 'Nguyen Khang', 'age': 18} print(my_dict) # add item my_dict['address'] = 'Ho Chi Minh' # Output: {'name': 'Nguyen Khang', 'age': 18, 'address': 'Ho Chi Minh'} print(my_dict)
my_dict = {'name': 'Nguyen Khang', 'age': 17} my_dict['age'] = 18 print(my_dict) my_dict['address'] = 'Ho Chi Minh' print(my_dict)
class Solution: def exist(self, board: List[List[str]], word: str) -> bool: visited = set() for i in range(len(board)): for j in range(len(board[0])): if board[i][j] == word[0]: visited.add((i, j)) if self._dfs(board, word, 1, i, j,...
class Solution: def exist(self, board: List[List[str]], word: str) -> bool: visited = set() for i in range(len(board)): for j in range(len(board[0])): if board[i][j] == word[0]: visited.add((i, j)) if self._dfs(board, word, 1, i, j...
# MenuTitle: Enable Alignment for Selected Glyphs __doc__ = """ Enables automatic alignment for all components in all selected glyphs. """ thisFont = Glyphs.font # frontmost font listOfSelectedLayers = ( thisFont.selectedLayers ) # active layers of selected glyphs def process(thisLayer): for thisComp in ...
__doc__ = '\nEnables automatic alignment for all components in all selected glyphs.\n' this_font = Glyphs.font list_of_selected_layers = thisFont.selectedLayers def process(thisLayer): for this_comp in thisLayer.components: thisComp.setDisableAlignment_(False) thisFont.disableUpdateInterface() for this_lay...
BRIGHTON = 2151001 sm.setSpeakerID(2151001) sm.sendNext("What is it?\r\n\r\n#L0##bI want to talk to you.") sm.sendNext("Well... I'm not really that good with words, you see... I'm not the best person to hang around with.")
brighton = 2151001 sm.setSpeakerID(2151001) sm.sendNext('What is it?\r\n\r\n#L0##bI want to talk to you.') sm.sendNext("Well... I'm not really that good with words, you see... I'm not the best person to hang around with.")
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def distanceK(self, root: TreeNode, target: TreeNode, k: int) -> List[int]: def dfs( node, par=None ): if no...
class Solution: def distance_k(self, root: TreeNode, target: TreeNode, k: int) -> List[int]: def dfs(node, par=None): if node: node.par = par dfs(node.left, node) dfs(node.right, node) dfs(root) queue = collections.deque([(target,...
RAMSIZE=128 iochannel = CoramIoChannel(idx=0, datawidth=32) ram = CoramMemory(idx=0, datawidth=32, size=RAMSIZE, length=1, scattergather=False) channel = CoramChannel(idx=0, datawidth=32, size=16) def main(): sum = 0 addr = iochannel.read() read_size = iochannel.read() size = 0 while size < read_s...
ramsize = 128 iochannel = coram_io_channel(idx=0, datawidth=32) ram = coram_memory(idx=0, datawidth=32, size=RAMSIZE, length=1, scattergather=False) channel = coram_channel(idx=0, datawidth=32, size=16) def main(): sum = 0 addr = iochannel.read() read_size = iochannel.read() size = 0 while size < r...
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
"""Linear Program Constraints to simulate different energy assumptions. This package was originally written to support understanding of energy solutions within Google Research. It has subsequently been used to generate scenarios for a website http://energystrategies.org to help show policy makers, and other interes...
class Animal(object): def run(self): print(self.__class__.__name__, ' is running...') class Dog(Animal): pass class Cat(Animal): pass dog = Dog() dog.run() cat = Cat() cat.run() print(isinstance(dog, Dog)) print(isinstance(dog, Animal)) print(isinstance(dog, Cat)) class Plant: def run(...
class Animal(object): def run(self): print(self.__class__.__name__, ' is running...') class Dog(Animal): pass class Cat(Animal): pass dog = dog() dog.run() cat = cat() cat.run() print(isinstance(dog, Dog)) print(isinstance(dog, Animal)) print(isinstance(dog, Cat)) class Plant: def run(self)...
text = "Order: pizza, fries, milkshake" encoded = text.replace("pizza", "1").replace("fries", "2").replace("milkshake", "3") print(encoded) # Order: 1, 2, 3 codes = {"pizza": "1", "fries": "2", "milkshake": "3"} text = "Order: pizza, fries, milkshake" encoded = text for value, code in codes.items(): encoded = en...
text = 'Order: pizza, fries, milkshake' encoded = text.replace('pizza', '1').replace('fries', '2').replace('milkshake', '3') print(encoded) codes = {'pizza': '1', 'fries': '2', 'milkshake': '3'} text = 'Order: pizza, fries, milkshake' encoded = text for (value, code) in codes.items(): encoded = encoded.replace(valu...
def scan_dependencies(project, env, files): if 'USE_DEP_SCANNER' not in env.toolchain_options: with open(f'{project.build_dir}/skipped_files.txt', 'w') as out: out.write('none') return files deps = {f: [] for f in files} def strip_name(name): return name.split('/')...
def scan_dependencies(project, env, files): if 'USE_DEP_SCANNER' not in env.toolchain_options: with open(f'{project.build_dir}/skipped_files.txt', 'w') as out: out.write('none') return files deps = {f: [] for f in files} def strip_name(name): return name.split('/')[-1][:...
# -*- coding: utf-8 -*- description = "Denex common detector setup" group = "lowlevel" includes = ["counter", "shutter", "detector_sinks"] tango_base = "tango://phys.maria.frm2:10000/maria/" devices = dict( full = device("nicos.devices.generic.RateChannel", description = "Full detector cts and rate", ...
description = 'Denex common detector setup' group = 'lowlevel' includes = ['counter', 'shutter', 'detector_sinks'] tango_base = 'tango://phys.maria.frm2:10000/maria/' devices = dict(full=device('nicos.devices.generic.RateChannel', description='Full detector cts and rate'), roi1=device('nicos.devices.generic.RateRectROI...
# NAME AGE FUNCTION: def str_spaces(fstring,sstring): print(fstring + ' ' + sstring) mstring = input() nstring = input() str_spaces(mstring,nstring) def nage(string,string2): print(string,end=' ') print(string2,end='') nstr = input() astr = input() nage(nstr,astr) #REVERSE STRING 39: def revstr(fstri...
def str_spaces(fstring, sstring): print(fstring + ' ' + sstring) mstring = input() nstring = input() str_spaces(mstring, nstring) def nage(string, string2): print(string, end=' ') print(string2, end='') nstr = input() astr = input() nage(nstr, astr) def revstr(fstring): string = '' for i in fstrin...
class GenericObj: def __init__(self, obj): self.type = obj['type'] self.id = obj['id'] self.uri = obj['uri'] self.tracks = obj['tracks'] class GenericAlbumObj: def __init__(self, album): self.id = album['id'] self.uri = album['uri'] self.name = album['na...
class Genericobj: def __init__(self, obj): self.type = obj['type'] self.id = obj['id'] self.uri = obj['uri'] self.tracks = obj['tracks'] class Genericalbumobj: def __init__(self, album): self.id = album['id'] self.uri = album['uri'] self.name = album['n...
#: E201:5 spam( ham[1], {eggs: 2}) #: E201:9 spam(ham[ 1], {eggs: 2}) #: E201:14 spam(ham[1], { eggs: 2}) # Okay spam(ham[1], {eggs: 2}) #: E202:22 spam(ham[1], {eggs: 2} ) #: E202:21 spam(ham[1], {eggs: 2 }) #: E202:10 spam(ham[1 ], {eggs: 2}) # Okay spam(ham[1], {eggs: 2}) result = func( arg1='some value', ...
spam(ham[1], {eggs: 2}) spam(ham[1], {eggs: 2}) spam(ham[1], {eggs: 2}) spam(ham[1], {eggs: 2}) spam(ham[1], {eggs: 2}) spam(ham[1], {eggs: 2}) spam(ham[1], {eggs: 2}) spam(ham[1], {eggs: 2}) result = func(arg1='some value', arg2='another value') result = func(arg1='some value', arg2='another value') result = [item for...
""" Base classes and utilities for TGN applications classes. @author yoram@ignissoft.com """ class TgnApp: """ Base class for all TGN applications classes. """ def __init__(self, logger, api_wrapper): self.logger = logger self.api = api_wrapper
""" Base classes and utilities for TGN applications classes. @author yoram@ignissoft.com """ class Tgnapp: """ Base class for all TGN applications classes. """ def __init__(self, logger, api_wrapper): self.logger = logger self.api = api_wrapper
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def reverseKGroup(self, head: ListNode, k: int) -> ListNode: dummyhead = ListNode(None) dummyhead.next = head start, end = head, dummyhead ...
class Solution: def reverse_k_group(self, head: ListNode, k: int) -> ListNode: dummyhead = list_node(None) dummyhead.next = head (start, end) = (head, dummyhead) flag = True while True: count = k while count and end: end = end.next ...
# OpenWeatherMap API Key weather_api_key = "164b9f7c3b721e89f1f4f14974c7b483" # Google API Key g_key = "AIzaSyAayBobFwssdE52dGXGCHY1_vddvDVUX34"
weather_api_key = '164b9f7c3b721e89f1f4f14974c7b483' g_key = 'AIzaSyAayBobFwssdE52dGXGCHY1_vddvDVUX34'
def duplicate_encode(word): #your code here b=[] word = word.lower() for char in word: if word.count(char) == 1: b.append('(') else: b.append(')') result = "".join(b) return result
def duplicate_encode(word): b = [] word = word.lower() for char in word: if word.count(char) == 1: b.append('(') else: b.append(')') result = ''.join(b) return result
#!/usr/bin/env python # # description: First Unique Character in a String # difficulty: Easy # leetcode_num: 387 # leetcode_url: https://leetcode.com/problems/first-unique-character-in-a-string/ # # Given a string s, return the first non-repeating character in it and return # its index. If it does not exist, return -1....
def first_unique_char(text): char_ctr = [0] * 26 for c in text: idx = ord(c) - ord('a') char_ctr[idx] += 1 for (i, c) in enumerate(list(text)): idx = ord(c) - ord('a') if char_ctr[idx] == 1: return i return -1 def first_unique_char_dict(text): char_ctr = ...
def handler(context, inputs): greeting = "Hello, {0}!".format(inputs["target"]) print(greeting) outputs = { "greeting": greeting } return outputs
def handler(context, inputs): greeting = 'Hello, {0}!'.format(inputs['target']) print(greeting) outputs = {'greeting': greeting} return outputs
# # PySNMP MIB module WWP-LEOS-8021X-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-8021X-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:30:55 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ...
""" Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None """ class Solution: """ @param: root: The root of the BST. @param: p: You need find the successor node of p. @return: Successor of p. ""...
""" Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None """ class Solution: """ @param: root: The root of the BST. @param: p: You need find the successor node of p. @return: Successor of p. """...
def regEX(ref, char_comp): test_passed = True for i in ref: if i == char_comp: test_passed = False return test_passed
def reg_ex(ref, char_comp): test_passed = True for i in ref: if i == char_comp: test_passed = False return test_passed
def sod(n): ans = 0 while n: rem = n%10 ans += rem n = n // 10 return ans t = int(input()) while t: n = int(input()) a_score = 0 b_score = 0 while n: a,b = map(int, input().split()) a_sum = sod(a) b_sum = sod(b) # print(a_sum...
def sod(n): ans = 0 while n: rem = n % 10 ans += rem n = n // 10 return ans t = int(input()) while t: n = int(input()) a_score = 0 b_score = 0 while n: (a, b) = map(int, input().split()) a_sum = sod(a) b_sum = sod(b) if a_sum > b_sum: ...
class MeterInfo(object): def __init__(self, address: int , dbid: int, devStr: str , mBrand: str, mModel: str): # - - - - - - - - - - self.modbusAddress: int = address self.meterDBID: int = dbid self.deviceSystemString: str = devStr self.meterBrand: str...
class Meterinfo(object): def __init__(self, address: int, dbid: int, devStr: str, mBrand: str, mModel: str): self.modbusAddress: int = address self.meterDBID: int = dbid self.deviceSystemString: str = devStr self.meterBrand: str = mBrand self.meterModel: str = mModel
class Solution: def chalkReplacer(self, chalk: List[int], k: int) -> int: gg = sum(chalk) k = k%gg for i,n in enumerate(chalk): if n>k: return i k-=n return len(chalk)-1
class Solution: def chalk_replacer(self, chalk: List[int], k: int) -> int: gg = sum(chalk) k = k % gg for (i, n) in enumerate(chalk): if n > k: return i k -= n return len(chalk) - 1
''' Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ACE" is a ...
""" Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ACE" is a ...
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: mo-mo- # # Created: 23/09/2018 # Copyright: (c) mo-mo- 2018 # Licence: <your licence> #------------------------------------------------------------------------------- ...
a = list(map(int, input().split())) a.sort() ans = a[2] * 10 + a[1] + a[0] print(ans)
# Write simple .camelCase method (camel_case function in PHP, CamelCase in C# or camelCase in Java) for strings. All # words must have their first letter capitalized without spaces. # # For instance: # # camelcase("hello case") => HelloCase # camelcase("camel case word") => CamelCaseWord # Don't forget to rate this kat...
def camel_case(string): output_string = '' first_letter = True for x in string: if x != ' ': if first_letter: output_string += x.upper() first_letter = False else: output_string += x.lower() else: first_lette...
""" None """ class Solution: def countElements(self, arr: List[int]) -> int: res = 0 ss = set(arr) for a in arr: if a + 1 in ss: res += 1 return res
""" None """ class Solution: def count_elements(self, arr: List[int]) -> int: res = 0 ss = set(arr) for a in arr: if a + 1 in ss: res += 1 return res
load("@io_bazel_rules_dotnet//dotnet/private:rules/nuget.bzl", "nuget_package") def dotnet_repositories_xunit(): ### Generated by the tool nuget_package( name = "xunit.runner.console", package = "xunit.runner.console", version = "2.4.1", sha256 = "23f0b49edbfe5be8f8554e7f4317a39...
load('@io_bazel_rules_dotnet//dotnet/private:rules/nuget.bzl', 'nuget_package') def dotnet_repositories_xunit(): nuget_package(name='xunit.runner.console', package='xunit.runner.console', version='2.4.1', sha256='23f0b49edbfe5be8f8554e7f4317a390949bb96bdb2f8309ebe27c6855fad38f', core_lib={'netcoreapp2.0': 'tools/n...
def test(tested_mod, Assert): test_cases = [ # (expected, inputs) ([], []), ([1, 3, 5, 6], [1, 3, 5, 6]), ([1], [1, 1, 1]), ([3, 1, 5, 2], [3, 1, 1, 5, 2, 2, 2]) ] return Assert.all(tested_mod.loesche_doppelte, test_cases)
def test(tested_mod, Assert): test_cases = [([], []), ([1, 3, 5, 6], [1, 3, 5, 6]), ([1], [1, 1, 1]), ([3, 1, 5, 2], [3, 1, 1, 5, 2, 2, 2])] return Assert.all(tested_mod.loesche_doppelte, test_cases)
class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: trans_list=[] if root==None: return [] else: trans_list+=self.inorderTraversal(root.left) trans_list.append(root.val) trans_list+=self.inorderTraversal(root.right) ...
class Solution: def inorder_traversal(self, root: TreeNode) -> List[int]: trans_list = [] if root == None: return [] else: trans_list += self.inorderTraversal(root.left) trans_list.append(root.val) trans_list += self.inorderTraversal(root.righ...
# ======================== # Information # ======================== # Direct Link: https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem # Difficulty: Easy # Max Score: 10 # Language: Python # ======================== # Solution # ======================== N = int(input()) A...
n = int(input()) array = map(int, input().split()) my_list = list(ARRAY) MY_LIST.sort() highest_number = max(MY_LIST) for i in range(len(MY_LIST) - 1, -1, -1): if MY_LIST[i] < HIGHEST_NUMBER: break print(MY_LIST[i])
# Copyright (c) Vera Galstyan Feb 2018 restaurant = input("How many people are in your group: ") if int(restaurant)>=8: print("You have to wait for a table, because you are " + restaurant) else: print("Your table is ready, because you are " + restaurant)
restaurant = input('How many people are in your group: ') if int(restaurant) >= 8: print('You have to wait for a table, because you are ' + restaurant) else: print('Your table is ready, because you are ' + restaurant)
if exists("1580195068422.png"): click("1580195068422.png") if exists("1580196282023.png"): click("1580196282023.png") click("1580193456450.png") sleep(1) click("1580193473300.png") sleep(1) click("1580193506111.png") sleep(1) click("1580193456450.png") click("1580193641655.png") click("158019...
if exists('1580195068422.png'): click('1580195068422.png') if exists('1580196282023.png'): click('1580196282023.png') click('1580193456450.png') sleep(1) click('1580193473300.png') sleep(1) click('1580193506111.png') sleep(1) click('1580193456450.png') click('1580193641655.png') click('1580193668585.png') click...
lines = [] with open("input.txt") as f: lines = f.readlines() width = 31 def calc_hits(right_steps, down_steps, lines): right_pos = right_steps down_pos = down_steps trees_hit = 0 while down_pos < len(lines): if lines[down_pos][right_pos] == '#': trees_hit += 1 down_po...
lines = [] with open('input.txt') as f: lines = f.readlines() width = 31 def calc_hits(right_steps, down_steps, lines): right_pos = right_steps down_pos = down_steps trees_hit = 0 while down_pos < len(lines): if lines[down_pos][right_pos] == '#': trees_hit += 1 down_pos ...
#import urllib #from lxml import html #url = "https://material-ui.com/customization/color/" #page = html.fromstring(urllib.urlopen(url).read()) #colors={} #for color in page.xpath("//*[@class='jss260']"): # colorName = color.xpath(".//*[@class='jss257']/text()")[0] # value = {} # for val in color.xpath(".//...
colors = {'pink': {'200': '#f48fb1', '900': '#880e4f', '600': '#d81b60', 'A100': '#ff80ab', '300': '#f06292', 'A400': '#f50057', '700': '#c2185b', '50': '#fce4ec', 'A700': '#c51162', '400': '#ec407a', '100': '#f8bbd0', '800': '#ad1457', 'A200': '#ff4081', '500': '#e91e63'}, 'blue': {'200': '#90caf9', '900': '#0d47a1', ...
class PyVistaImportError(ImportError): message = """Trouble importing PyVista.""" def __init__(self): """Empty init.""" ImportError.__init__(self, self.message)
class Pyvistaimporterror(ImportError): message = 'Trouble importing PyVista.' def __init__(self): """Empty init.""" ImportError.__init__(self, self.message)
# # PySNMP MIB module CISCO-DYNAMIC-ARP-INSPECTION-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DYNAMIC-ARP-INSPECTION-CAPABILITY # Produced by pysmi-0.3.4 at Wed May 1 11:56:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwan...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
#!/usr/bin/env python3 digits = input() skip = len(digits) // 2 print(sum(int(a) for a, b in zip(digits, digits[skip:]+digits[:skip]) if a == b))
digits = input() skip = len(digits) // 2 print(sum((int(a) for (a, b) in zip(digits, digits[skip:] + digits[:skip]) if a == b)))
with open('input.txt', 'r') as file: input = file.readlines() input = [ line.strip() for line in input ] def part1(): return def part2(): return print(part1()) print(part2())
with open('input.txt', 'r') as file: input = file.readlines() input = [line.strip() for line in input] def part1(): return def part2(): return print(part1()) print(part2())
#!/usr/bin/env python # -*- coding: utf-8 -*- # default settings for database schema router DATABASE_ROUTERS = [ 'navigator.pgschema.routers.schemaRouter' ] DATABASE_STATEMENT_TIMEOUT = 60000 # on milliseconds DATABASE_COLLATION = 'UTF8' DEBUG_SQL = True DATABASE_TZ = 'UTC'
database_routers = ['navigator.pgschema.routers.schemaRouter'] database_statement_timeout = 60000 database_collation = 'UTF8' debug_sql = True database_tz = 'UTC'
""" A package allowing cleanup of import changes after migrating to Django 2. This package is structured such that form corehq.util.django2_shim.x.x import y will work in both Django 1 and Django 2, and that once we are on django 2 we can replace `from corehq.util.django2_shim.` with `from django.` throughout an...
""" A package allowing cleanup of import changes after migrating to Django 2. This package is structured such that form corehq.util.django2_shim.x.x import y will work in both Django 1 and Django 2, and that once we are on django 2 we can replace `from corehq.util.django2_shim.` with `from django.` throughout an...
n = int(input()) value = n * (n - 1) // 2 if n % 2 == 0: print('Even' if value % 2 == 0 else 'Odd') else: print('Either')
n = int(input()) value = n * (n - 1) // 2 if n % 2 == 0: print('Even' if value % 2 == 0 else 'Odd') else: print('Either')