content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- """ gcrlm/core/exceptions/crlm """ class NoRoiClusters(RuntimeError): """ Exception to be raised by Data/Prepare_patches/CRLM.CRLM.extract_annotations_and_masks setting inside_roi to True but not providing roi_clusters """ def __init__(self, message=''): """ In...
""" gcrlm/core/exceptions/crlm """ class Noroiclusters(RuntimeError): """ Exception to be raised by Data/Prepare_patches/CRLM.CRLM.extract_annotations_and_masks setting inside_roi to True but not providing roi_clusters """ def __init__(self, message=''): """ Initializes the instance wi...
#deleting duplicate elements from lists def delete(a): temp=[] for i in range(0,len(a)): if a[i] not in temp: temp.append(a[i]) print(temp) a=[] ac=input("enter count of array") for i in range(0,ac): a.append(input()) delete(a)
def delete(a): temp = [] for i in range(0, len(a)): if a[i] not in temp: temp.append(a[i]) print(temp) a = [] ac = input('enter count of array') for i in range(0, ac): a.append(input()) delete(a)
class NDBC: """NDBC class provides convenient access to NDBC's API. Instances of this class are the gateway to interacting with National Data Buoy Center (NDBC) through `buoy-py`. The canonical way to obtain an instance of this class is via: .. code-block:: python import buoypy as bp ...
class Ndbc: """NDBC class provides convenient access to NDBC's API. Instances of this class are the gateway to interacting with National Data Buoy Center (NDBC) through `buoy-py`. The canonical way to obtain an instance of this class is via: .. code-block:: python import buoypy as bp ...
""" input your key and secret for neurio here """ key = None secret = None
""" input your key and secret for neurio here """ key = None secret = None
""" Intersection and Union of Two Arrays: Another approach would be to create one set and check from other array """ def intersection(arr, arr2) -> int: set1 = set(arr) set2 = set(arr2) print(set1.intersection(set2)) return len(set1.intersection(set2)) def union(arr, arr2) -> int: set1 = set(ar...
""" Intersection and Union of Two Arrays: Another approach would be to create one set and check from other array """ def intersection(arr, arr2) -> int: set1 = set(arr) set2 = set(arr2) print(set1.intersection(set2)) return len(set1.intersection(set2)) def union(arr, arr2) -> int: set1 = set(arr) ...
_base_ = [ '../../_base_/models/swav/r18.py', '../../_base_/datasets/imagenet/swav_mcrop-2-6_sz224_96_bs32.py', '../../_base_/default_runtime.py', ] # interval for accumulate gradient update_interval = 8 # total: 8 x bs64 x 8 accumulates = bs4096 # additional hooks custom_hooks = [ dict(type='SwAVHoo...
_base_ = ['../../_base_/models/swav/r18.py', '../../_base_/datasets/imagenet/swav_mcrop-2-6_sz224_96_bs32.py', '../../_base_/default_runtime.py'] update_interval = 8 custom_hooks = [dict(type='SwAVHook', priority='VERY_HIGH', batch_size=64, epoch_queue_starts=15, crops_for_assign=[0, 1], feat_dim=128, queue_length=3840...
def verify(isbn): characters = list(isbn.replace("-", "")) if characters and characters[-1] == "X": characters[-1] = "10" if not len(characters) == 10 or not all(char.isdigit() for char in characters): return False indices = range(10, 0, -1) return sum(int(char) * index for char, ...
def verify(isbn): characters = list(isbn.replace('-', '')) if characters and characters[-1] == 'X': characters[-1] = '10' if not len(characters) == 10 or not all((char.isdigit() for char in characters)): return False indices = range(10, 0, -1) return sum((int(char) * index for (char,...
#!/usr/local/bin/python3 """Task The AdvancedArithmetic interface and the method declaration for the abstract divisorSum(n) method are provided for you in the editor below. Complete the implementation of Calculator class, which implements the AdvancedArithmetic interface. The implementation for the divisorSum(n) me...
"""Task The AdvancedArithmetic interface and the method declaration for the abstract divisorSum(n) method are provided for you in the editor below. Complete the implementation of Calculator class, which implements the AdvancedArithmetic interface. The implementation for the divisorSum(n) method must return the sum o...
# Write a Python program to find the type of the progression (arithmetic progression/geometric progression) and the next successive member of a given three successive members of a sequence. # According to Wikipedia, an arithmetic progression (AP) is a sequence of numbers such that the difference of any two successive m...
def ap_gp_sequence(arr): if arr[0] == arr[1] == arr[2] == 0: return 'Wrong Numbers' elif arr[1] - arr[0] == arr[2] - arr[1]: n = 2 * arr[2] - arr[1] return 'AP sequence, ' + 'Next number of the sequence: ' + str(n) else: n = arr[2] ** 2 / arr[1] return 'GP sequence, '...
X, Y = map(int, input().split()) if abs(X-Y) <= 2: print('Yes') else: print('No')
(x, y) = map(int, input().split()) if abs(X - Y) <= 2: print('Yes') else: print('No')
class TimeInForceEnum: TIF_UNSET = 0 TIF_DAY = 1 TIF_GOOD_TILL_CANCELED = 2 TIF_GOOD_TILL_DATE_TIME = 3 TIF_IMMEDIATE_OR_CANCEL = 4 TIF_ALL_OR_NONE = 5 TIF_FILL_OR_KILL = 6
class Timeinforceenum: tif_unset = 0 tif_day = 1 tif_good_till_canceled = 2 tif_good_till_date_time = 3 tif_immediate_or_cancel = 4 tif_all_or_none = 5 tif_fill_or_kill = 6
OVER5_HEALTH_INDICATORS = dict( app="mvp_over5", indicators=dict( over5_health=dict( over5_positive_rdt=dict( description="No. Over5 who received positive RDT Result", title="# Over5 who received positive RDT Result", indicator_key="over5_posit...
over5_health_indicators = dict(app='mvp_over5', indicators=dict(over5_health=dict(over5_positive_rdt=dict(description='No. Over5 who received positive RDT Result', title='# Over5 who received positive RDT Result', indicator_key='over5_positive_rdt'), over5_positive_rdt_medicated=dict(description='No. Over5 who received...
''' Created on Nov 11, 2018 @author: nilson.nieto ''' lst = [1,4,431,24,1,4,234,2,1,128] print(list(filter(lambda a : a%2==0,lst)))
""" Created on Nov 11, 2018 @author: nilson.nieto """ lst = [1, 4, 431, 24, 1, 4, 234, 2, 1, 128] print(list(filter(lambda a: a % 2 == 0, lst)))
#!/usr/bin/env python # coding: utf-8 # In[3]: n = int(input()) hobbits = 0 humanos = 0 elfos = 0 anoes = 0 magos = 0 for _ in range(0, n): raca = input().split()[1] if raca == 'X': hobbits += 1 elif raca == 'H': humanos += 1 elif raca == 'E': elfos += 1 elif raca == 'A'...
n = int(input()) hobbits = 0 humanos = 0 elfos = 0 anoes = 0 magos = 0 for _ in range(0, n): raca = input().split()[1] if raca == 'X': hobbits += 1 elif raca == 'H': humanos += 1 elif raca == 'E': elfos += 1 elif raca == 'A': anoes += 1 elif raca == 'M': m...
# # PySNMP MIB module FRDTE-OPT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FRDTE-OPT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:02:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ...
""" [07/01/13] Challenge #131 [Easy] Who tests the tests? https://www.reddit.com/r/dailyprogrammer/comments/1heozl/070113_challenge_131_easy_who_tests_the_tests/ # [](#EasyIcon) *(Easy)*: Who tests the tests? [Unit Testing](http://en.wikipedia.org/wiki/Unit_testing) is one of the more basic, but effective, tools for ...
""" [07/01/13] Challenge #131 [Easy] Who tests the tests? https://www.reddit.com/r/dailyprogrammer/comments/1heozl/070113_challenge_131_easy_who_tests_the_tests/ # [](#EasyIcon) *(Easy)*: Who tests the tests? [Unit Testing](http://en.wikipedia.org/wiki/Unit_testing) is one of the more basic, but effective, tools for ...
with open("input2.txt", "r") as f: tx = f.read() base_program = list(map(int, tx.split(","))) # only solution 2 is here but solution 1 can be found by setting noun and verb def run_to_halt(program, noun, verb): program[1] = noun program[2] = verb for index, opcode in list(enumerate(program))[::4]: if opco...
with open('input2.txt', 'r') as f: tx = f.read() base_program = list(map(int, tx.split(','))) def run_to_halt(program, noun, verb): program[1] = noun program[2] = verb for (index, opcode) in list(enumerate(program))[::4]: if opcode == 99: break in1 = program[index + 1] ...
nombres=["Juan", "murcielago", "Alejandro"] vocales=["a","e","i","o","u"] conteo_vocales =[] for nombre in nombres: for letra in nombre: if letra not in vocales: continue else: print(letra) conteo_vocales.append(letra) print(conteo_voca...
nombres = ['Juan', 'murcielago', 'Alejandro'] vocales = ['a', 'e', 'i', 'o', 'u'] conteo_vocales = [] for nombre in nombres: for letra in nombre: if letra not in vocales: continue else: print(letra) conteo_vocales.append(letra) print(conteo_vocales) print(len(cont...
# This is here to allow a sub-object that contains all of our crud information within the # peewee model and avoid messing with model object data as much as possible class ResponseMessages: # Errors ErrorDoesNotExist = 'Resource with id \'{0}\' does not exist' ErrorTypeInteger = 'Value \'{0}\' must be an ...
class Responsemessages: error_does_not_exist = "Resource with id '{0}' does not exist" error_type_integer = "Value '{0}' must be an integer" error_type_boolean = "Value '{0}' must be a boolean: 0 or 1" error_type_datetime = "Value '{0}' must be a datetime: YYYY-mm-dd HH:MM:SS or integer" error_type_...
# # PySNMP MIB module BAY-STACK-RADIUS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAY-STACK-RADIUS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:36:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ...
d = int(input()) if d == 25: ans = 'Christmas' elif d == 24: ans = 'Christmas Eve' elif d == 23: ans = 'Christmas Eve Eve' elif d == 22: ans = 'Christmas Eve Eve Eve' print(ans)
d = int(input()) if d == 25: ans = 'Christmas' elif d == 24: ans = 'Christmas Eve' elif d == 23: ans = 'Christmas Eve Eve' elif d == 22: ans = 'Christmas Eve Eve Eve' print(ans)
pkgname = "gperf" pkgver = "3.1" pkgrel = 0 build_style = "gnu_configure" make_cmd = "gmake" hostmakedepends = ["gmake"] pkgdesc = "Perfect hash function generator" maintainer = "q66 <q66@chimera-linux.org>" license = "GPL-3.0-or-later" url = "https://www.gnu.org/software/gperf" source = f"$(GNU_SITE)/{pkgname}/{pkgnam...
pkgname = 'gperf' pkgver = '3.1' pkgrel = 0 build_style = 'gnu_configure' make_cmd = 'gmake' hostmakedepends = ['gmake'] pkgdesc = 'Perfect hash function generator' maintainer = 'q66 <q66@chimera-linux.org>' license = 'GPL-3.0-or-later' url = 'https://www.gnu.org/software/gperf' source = f'$(GNU_SITE)/{pkgname}/{pkgnam...
''' Author: Jon Ormond Created: October 10th, 2021 Description: Simplified dragon text game, example of room movement. Created for week 6 of the IT-140 class at SNHU. Version: 1.0 ''' # A dictionary for the simplified dragon text game # The dictionary links a room to other rooms. rooms = { 'Great ...
""" Author: Jon Ormond Created: October 10th, 2021 Description: Simplified dragon text game, example of room movement. Created for week 6 of the IT-140 class at SNHU. Version: 1.0 """ rooms = {'Great Hall': {'South': 'Bedroom'}, 'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'}, 'Cellar': {'West': 'Bedr...
def merge2(lista1, lista2): i1 = i2 = 0 lista3 = [] while i1 < len(lista1) and i2 < len(lista2): if lista1[i1] < lista2[i2]: if len(lista3) == 0 or lista3[-1] != lista1[i1]: lista3.append(lista1[i1]) i1 += 1 else: if len(lista3) == 0 or l...
def merge2(lista1, lista2): i1 = i2 = 0 lista3 = [] while i1 < len(lista1) and i2 < len(lista2): if lista1[i1] < lista2[i2]: if len(lista3) == 0 or lista3[-1] != lista1[i1]: lista3.append(lista1[i1]) i1 += 1 else: if len(lista3) == 0 or lis...
""" A traits-aware documentation tool. Part of the ETSDevTools project of the Enthought Tool Suite. :Author: David Baer :Contact: dbaer@14853.net :Organization: `Enthought, Inc.`_ :Copyright: Copyright (C) 2005 by `Enthought, Inc.`_ :Date: 2005-08-17 .. _`Enthought, Inc.` : http://www.enthought.com/ """
""" A traits-aware documentation tool. Part of the ETSDevTools project of the Enthought Tool Suite. :Author: David Baer :Contact: dbaer@14853.net :Organization: `Enthought, Inc.`_ :Copyright: Copyright (C) 2005 by `Enthought, Inc.`_ :Date: 2005-08-17 .. _`Enthought, Inc.` : http://www.enthought.com/ """
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next # https://skyyen999.gitbooks.io/-leetcode-with-javascript/content/questions/24md.html class Solution: def swapPairs(self, head: ListNode) -> ListNode: prev_p...
class Solution: def swap_pairs(self, head: ListNode) -> ListNode: prev_p = dummy = list_node(0) dummy.next = cur_p = head while cur_p and cur_p.next: keep_p = cur_p.next.next cur_p.next.next = cur_p prev_p.next = cur_p.next cur_p.next = keep_p...
''' Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you do this in one pass? ''' def check_2_numbers(anum, alist): for x in alist: #print(f'Start {x}') for y ...
""" Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you do this in one pass? """ def check_2_numbers(anum, alist): for x in alist: for y in alist[alist.index(x) + 1:]:...
#! /usr/bin/python HOME_PATH = './' CACHE_PATH = '/var/cache/obmc/' FLASH_DOWNLOAD_PATH = "/tmp" GPIO_BASE = 320 SYSTEM_NAME = "Palmetto" ## System states ## state can change to next state in 2 ways: ## - a process emits a GotoSystemState signal with state name to goto ## - objects specified in EXIT_STATE_DEPE...
home_path = './' cache_path = '/var/cache/obmc/' flash_download_path = '/tmp' gpio_base = 320 system_name = 'Palmetto' system_states = ['BASE_APPS', 'BMC_STARTING', 'BMC_READY', 'HOST_POWERING_ON', 'HOST_POWERED_ON', 'HOST_BOOTING', 'HOST_BOOTED', 'HOST_POWERED_OFF'] exit_state_depend = {'BASE_APPS': {'/org/openbmc/sen...
public_key = b"\x30\x82\x01\x22\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x00\x30\x82\x01\x0a\x02\x82\x01\x01" + \ b"\x00\xc0\x86\x99\x9a\x76\x74\x9a\xf5\x04\xb8\x48\xf0\x7e\x67\xc3\x90\x51\x17\xe6\xcd\xb3\x97\x6b\x41\xbc\x4e\x4e\x0c\x30\xff\x57" + \ b"\xf1\x4...
public_key = b'0\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01' + b'\x00\xc0\x86\x99\x9avt\x9a\xf5\x04\xb8H\xf0~g\xc3\x90Q\x17\xe6\xcd\xb3\x97kA\xbcNN\x0c0\xffW' + b'\xf1G\x99\xd5\xc3*g&l(\x1e\x18\x03\x0f\xaf\xd2p\xd2\xb2\xab\xaeDz\x1c\xcd\xceo\xcb\xfbV\x96\x1b' + ...
""" pertinent_user.py -------------- This class represents a pertinent user. """ __author__ = "Steven M. Satterfield" class PertinentUser: def __init__(self): self._id = "" self._participantid = "" self._group = "" self._userid = "" def getId(self): ...
""" pertinent_user.py -------------- This class represents a pertinent user. """ __author__ = 'Steven M. Satterfield' class Pertinentuser: def __init__(self): self._id = '' self._participantid = '' self._group = '' self._userid = '' def get_id(self): retu...
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ dict = {} for n in nums2: if n not in dict: dict[n] = 1 else: dict[n] +=...
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ dict = {} for n in nums2: if n not in dict: dict[n] = 1 else: dict[n] +=...
class Solution: def canVisitAllRooms(self, rooms: List[List[int]]) -> bool: # we use this below list for checking whether all list have been visited or not visited=[False]*len(rooms) # per condition room 0 is always unlocked visited[0]=True #we use stack for acquiring key to ...
class Solution: def can_visit_all_rooms(self, rooms: List[List[int]]) -> bool: visited = [False] * len(rooms) visited[0] = True stack = [0] while stack: node = stack.pop() for key in rooms[node]: if not visited[key]: visite...
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation, obj[3]: Restaurant20to50, obj[4]: Distance # {"feature": "Coupon", "instances": 85, "metric_value": 0.9637, "depth": 1} if obj[0]>1: # {"feature": "Occupation", "instances": 56, "metric_value": 0.8384, "depth": 2} if obj[2]<=7: # {"...
def find_decision(obj): if obj[0] > 1: if obj[2] <= 7: if obj[3] > -1.0: if obj[1] <= 2: if obj[4] <= 2: return 'True' elif obj[4] > 2: return 'True' else: ...
arr1= [50,60] array = [1,2,3,4,5,6,7,8] arr = [] arr.append(arr1[1]) print(arr)
arr1 = [50, 60] array = [1, 2, 3, 4, 5, 6, 7, 8] arr = [] arr.append(arr1[1]) print(arr)
print(15 != 15) print(10 > 11) print(10 > 9)
print(15 != 15) print(10 > 11) print(10 > 9)
def sortedSquaredArray(array): # Write your code here. negatives = [] # This simulates a stack squares = [] i = 0 while i < len(array): if array[i] < 0: # If negative negatives.append(abs(array[i])) else: if len(negatives) > 0: # If negatives stack has elements and current element is positive top...
def sorted_squared_array(array): negatives = [] squares = [] i = 0 while i < len(array): if array[i] < 0: negatives.append(abs(array[i])) elif len(negatives) > 0: top = negatives[-1] if i + 1 == len(array): if top >= array[i]: ...
class Car: models = [] count = 0 def __init__(self, make, model): self.make = make self.model = model Car.count += 1 @classmethod def add_models(cls, make): cls.models.append(make) @staticmethod def convert_km_to_mile(value): return value / 1.609344...
class Car: models = [] count = 0 def __init__(self, make, model): self.make = make self.model = model Car.count += 1 @classmethod def add_models(cls, make): cls.models.append(make) @staticmethod def convert_km_to_mile(value): return value / 1.609344...
alphabets=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] #function to apply the algorithm def encode_decode(start_text, shift_amount, cipher_direction): ...
alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] def encode_decode(start_text, shift_amount, ci...
# # @lc app=leetcode id=24 lang=python3 # # [24] Swap Nodes in Pairs # # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def swapPairs(self, head: ListNode) -> ListNode: temp = ListNode(0) temp.nex...
class Solution: def swap_pairs(self, head: ListNode) -> ListNode: temp = list_node(0) temp.next = head prev = temp curr = temp.next if curr: nxt = curr.next while curr and curr.next and nxt: curr.next = nxt.next nxt.next = curr ...
class AsyncBaseCache: def __init__(self, location, params, loop=None): self._params = params self._location = location self._loop = loop self._key_prefix = self._params.get('PREFIX', '') async def init(self, *args, **kwargs): return self async def get(self, key: st...
class Asyncbasecache: def __init__(self, location, params, loop=None): self._params = params self._location = location self._loop = loop self._key_prefix = self._params.get('PREFIX', '') async def init(self, *args, **kwargs): return self async def get(self, key: st...
def Read(filename): file = open("lists.txt",'r') line = file.readlines() l=[] for i in range(len(line)): p = line[i].replace("\n","") q = p.split(',') l.append(q) for j in range(len(l)): # changing price & quantity into int data type for k in range(len(l[j])...
def read(filename): file = open('lists.txt', 'r') line = file.readlines() l = [] for i in range(len(line)): p = line[i].replace('\n', '') q = p.split(',') l.append(q) for j in range(len(l)): for k in range(len(l[j])): if k != 0: l[j][k] = i...
# SUMPOS for i in range(int(input())): x,y,z=map(int,input().split()) if((x+y==z)or(x+z==y)or(y+z==x)): print("YES") else: print("NO")
for i in range(int(input())): (x, y, z) = map(int, input().split()) if x + y == z or x + z == y or y + z == x: print('YES') else: print('NO')
class BinaryTree: def __init__(self, key=None): self.key = key self.left = None self.right = None def set_root(self, key): self.key = key def insert_left(self, new_node): self.left = new_node def insert_right(self, new_node): self.right = new_node ...
class Binarytree: def __init__(self, key=None): self.key = key self.left = None self.right = None def set_root(self, key): self.key = key def insert_left(self, new_node): self.left = new_node def insert_right(self, new_node): self.right = new_node ...
MISSING_DATAGRABBER = "Either *data_grabber* or *base_dir* inputs must be provided to {object_name} object's instansiation." MUTUALLY_EXCLUSIVE = """Inputs {in1} and {in2} are mutually exclusive""" BASE_DIR_AND_PARTICIPANT_REQUIRED = """If derivatives is not provided, base_dir and participant_label are required"""
missing_datagrabber = "Either *data_grabber* or *base_dir* inputs must be provided to {object_name} object's instansiation." mutually_exclusive = 'Inputs {in1} and {in2} are mutually exclusive' base_dir_and_participant_required = 'If derivatives is not provided, base_dir and participant_label are required'
# For the code which builds PDFs we need to give it a directory where # it can find the custom font. FONT_DIRECTORY = '/usr/share/fonts/TTF' # Which accounts are sending approval requests to managers via e-mail. SENDING_APPROVAL_MANAGERS = { "BF": True } # Which accounts are sending approval requests via e-mail. S...
font_directory = '/usr/share/fonts/TTF' sending_approval_managers = {'BF': True} sending_approval = SENDING_APPROVAL_MANAGERS sending_approval_tl = {'BF': True} extra_activities = {'BF': ['CZAP']} can_view_jobcodes = ['thunder@cats.com'] zeroing_hours = {'CZ': True} override_calculation = {'BF': some_other_calculation}...
def can_sum_basic(target, numbers): if target == 0: return True if target < 0: return False for i in numbers: reminder = target - i if can_sum_basic(reminder, numbers): return True return False def can_sum_memo(target, numbers, memo=dict()): if targ...
def can_sum_basic(target, numbers): if target == 0: return True if target < 0: return False for i in numbers: reminder = target - i if can_sum_basic(reminder, numbers): return True return False def can_sum_memo(target, numbers, memo=dict()): if target == ...
def ask_until_y_or_n(question): var = '' while not var in ['Y', 'y', 'N', 'n', 0, 1]: var = input(question + ' (Y/N) ') return var in ['y', 'Y', 1] def delete_duplicate(list): seen = set() seen_add = seen.add return [x for x in list if not (x in seen or seen_add(x))] def delete_non_nu...
def ask_until_y_or_n(question): var = '' while not var in ['Y', 'y', 'N', 'n', 0, 1]: var = input(question + ' (Y/N) ') return var in ['y', 'Y', 1] def delete_duplicate(list): seen = set() seen_add = seen.add return [x for x in list if not (x in seen or seen_add(x))] def delete_non_num...
def solve(): n = int(input()) a = list(map(int,input().split())) s = int(input()) limit = 1 << n subset = 0 flag = True for mask in range(limit): subset = 0 for i in range(n): f = 1 << i if f&mask: subset += a[i] if subset =...
def solve(): n = int(input()) a = list(map(int, input().split())) s = int(input()) limit = 1 << n subset = 0 flag = True for mask in range(limit): subset = 0 for i in range(n): f = 1 << i if f & mask: subset += a[i] if subset ==...
# -*- coding: utf-8 -*- """ Project @author: Michael Howden (michael@sahanafoundation.org) @date-created: 2010-08-25 Project Management """ prefix = request.controller resourcename = request.function response.menu_options = [ [T("Home"), False, URL(r=request, f="index")], [T("Gap...
""" Project @author: Michael Howden (michael@sahanafoundation.org) @date-created: 2010-08-25 Project Management """ prefix = request.controller resourcename = request.function response.menu_options = [[t('Home'), False, url(r=request, f='index')], [t('Gap Analysis'), False, url(r=request, f='gap_report'),...
a = 5 # 5 is an object b = {'x': 5, 'y': 3} # dicts are objects c = "hello" # strings are objects too d = c # two variables sharing an object e = c.lower() # should generate a new object f = 8 * b['y'] - 19 # what happens here? for obj in (a, b, b['x'], b['y']...
a = 5 b = {'x': 5, 'y': 3} c = 'hello' d = c e = c.lower() f = 8 * b['y'] - 19 for obj in (a, b, b['x'], b['y'], c, d, e, f): print(id(obj))
class Solution: def rob(self, nums: List[int]) -> int: if not nums: return 0 preMax = 0 curMax = nums[0] idx = 1 while idx < len(nums): preMax, curMax = curMax, max(preMax + nums[idx], curMax) idx += 1 return max(preMax, curMax) ...
class Solution: def rob(self, nums: List[int]) -> int: if not nums: return 0 pre_max = 0 cur_max = nums[0] idx = 1 while idx < len(nums): (pre_max, cur_max) = (curMax, max(preMax + nums[idx], curMax)) idx += 1 return max(preMax, cu...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: # iterate over list take the target for comparison # store the index in an output array # store the diff in another variable # iterate over the other elements and check if the diff is there in the given list...
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: output: List[int] = [] for i in range(0, len(nums)): diff = target - nums[i] for j in range(i + 1, len(nums)): if nums[j] == diff: output.append(i) ...
# This data was taken from: # https://github.com/fivethirtyeight/data/blob/master/hate-crimes/hate_crimes.csv # # Data info: # Index | Attribute Name | Details # --------------------------------------------------------------------------------------------------- # 0 | state ...
data = [['Alab', 42278, 0.06, 0.64, 0.821, 0.02, 0.12, 0.472, 0.35, 0.63, 0.125838926, 1.806410489], ['Alaska', 67629, 0.064, 0.63, 0.914, 0.04, 0.06, 0.422, 0.42, 0.53, 0.143740118, 1.656700109], ['Arizona', 49254, 0.063, 0.9, 0.842, 0.1, 0.09, 0.455, 0.49, 0.5, 0.225319954, 3.413927994], ['Arkansas', 44922, 0.052, 0....
# Created by MechAviv # [Lilin] | [1202000] # Snow Island : Ice Cave if "clear" not in sm.getQuestEx(21019, "helper"): sm.setSpeakerID(1202000) sm.flipSpeaker() sm.sendNext("You've finally awoken...!") sm.setSpeakerID(1202000) sm.setPlayerAsSpeaker() sm.sendSay("And you are...?") sm.se...
if 'clear' not in sm.getQuestEx(21019, 'helper'): sm.setSpeakerID(1202000) sm.flipSpeaker() sm.sendNext("You've finally awoken...!") sm.setSpeakerID(1202000) sm.setPlayerAsSpeaker() sm.sendSay('And you are...?') sm.setSpeakerID(1202000) sm.flipSpeaker() sm.sendSay("The hero who fough...
def compute_likelihood_normal(x, mean_val, standard_dev_val): """ Computes the log-likelihood values given a observed data sample x, and potential mean and variance values for a normal distribution Args: x (ndarray): 1-D array with all the observed data mean_val (scalar): value of mean for which t...
def compute_likelihood_normal(x, mean_val, standard_dev_val): """ Computes the log-likelihood values given a observed data sample x, and potential mean and variance values for a normal distribution Args: x (ndarray): 1-D array with all the observed data mean_val (scalar): value of mean for which ...
class WWSHCError(BaseException): pass class WWSHCNotExistingError(WWSHCError): pass class NoSuchGroup(WWSHCNotExistingError): pass class NoSuchClass(WWSHCNotExistingError): pass class NoSuchUser(WWSHCNotExistingError): pass class AlreadyInContacts(WWSHCError): pass
class Wwshcerror(BaseException): pass class Wwshcnotexistingerror(WWSHCError): pass class Nosuchgroup(WWSHCNotExistingError): pass class Nosuchclass(WWSHCNotExistingError): pass class Nosuchuser(WWSHCNotExistingError): pass class Alreadyincontacts(WWSHCError): pass
""" Terrarium Library The pallete module contains visualization parameters """ # Sentinel-2 L2A RGB Visualization Parameters S2TRUECOLOR = { 'min': 0, 'max': 255, 'bands': ['TCI_R', 'TCI_G', 'TCI_B'] } # NDVI color palette ndvipalette = [ 'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', ...
""" Terrarium Library The pallete module contains visualization parameters """ s2_truecolor = {'min': 0, 'max': 255, 'bands': ['TCI_R', 'TCI_G', 'TCI_B']} ndvipalette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01',...
class CModel_robot_input(): def __init__(self): self.gACT = 0 self.gGTO = 0 self.gSTA = 0 self.gOBJ = 0 self.gFLT = 0 self.gPR = 0 self.gPO = 0 self.gCU = 0
class Cmodel_Robot_Input: def __init__(self): self.gACT = 0 self.gGTO = 0 self.gSTA = 0 self.gOBJ = 0 self.gFLT = 0 self.gPR = 0 self.gPO = 0 self.gCU = 0
# -*- coding: utf-8 -*- # Ingestion service: create a metaproject (tag) with user-defined name in given space def process(transaction, parameters, tableBuilder): """Create a project with user-defined name in given space. """ # Prepare the return table tableBuilder.addHeader("success") tableBuilde...
def process(transaction, parameters, tableBuilder): """Create a project with user-defined name in given space. """ tableBuilder.addHeader('success') tableBuilder.addHeader('message') row = tableBuilder.addRow() username = parameters.get('userName') metaproject_code = parameters.get('metaproj...
#!/usr/bin/python DIR = "data_tmp/" FILES = [] FILES.append("02_attk1_avg20_test") FILES.append("02_attk1_avg40_test") FILES.append("02_attk1_avg50_test") FILES.append("02_attk1_avg60_test") FILES.append("02_attk1_avg80_test") FILES.append("03_attk1_opt20_test") FILES.append("03_attk1_opt40_test") FILES.append("03_a...
dir = 'data_tmp/' files = [] FILES.append('02_attk1_avg20_test') FILES.append('02_attk1_avg40_test') FILES.append('02_attk1_avg50_test') FILES.append('02_attk1_avg60_test') FILES.append('02_attk1_avg80_test') FILES.append('03_attk1_opt20_test') FILES.append('03_attk1_opt40_test') FILES.append('03_attk1_opt50_test') FIL...
def coord(): i = mc.ls(sl=1, fl=1) cp = [] for j in i: val = tuple(mc.xform(j, q=1, t=1, ws=True)) cp.append(val) print('___________________________\n') cp = [tuple([round(x/2, 3) for x in j]) for j in cp] cp = str(cp) cp = cp.replace('.0)', ')') cp = cp.replace('.0,', ',...
def coord(): i = mc.ls(sl=1, fl=1) cp = [] for j in i: val = tuple(mc.xform(j, q=1, t=1, ws=True)) cp.append(val) print('___________________________\n') cp = [tuple([round(x / 2, 3) for x in j]) for j in cp] cp = str(cp) cp = cp.replace('.0)', ')') cp = cp.replace('.0,', ...
# Copyright 2022 The Magma Authors. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARR...
""" This file holds constants that are used for bazel test definitions. Especially for test-tagging, this is meant to ensure that tags are used consistently. Constants can be imported in a build file via load("//bazel:test_constants.bzl", "CONSTANT1", "CONSTANT2") Tags are defined as lists, i.e., you can add them in ...
def tribonacci(n): if n < 4: return 1 return tribonacci(n-1) + tribonacci(n-2) + tribonacci(n-3) def tallest_player(nba_player_data): list = [] max_pies, max_pulgadas = [0,0] for key, value in nba_player_data.items(): pies, pulgadas = value[3].split('-') if(int(pies) > ma...
def tribonacci(n): if n < 4: return 1 return tribonacci(n - 1) + tribonacci(n - 2) + tribonacci(n - 3) def tallest_player(nba_player_data): list = [] (max_pies, max_pulgadas) = [0, 0] for (key, value) in nba_player_data.items(): (pies, pulgadas) = value[3].split('-') if int(...
# -*- coding: utf-8 -*- """ This package contains all the knowledge compilation to be used by the interpreter, represented as abstraction patterns. """
""" This package contains all the knowledge compilation to be used by the interpreter, represented as abstraction patterns. """
"""Provide exception classes""" class PipenException(Exception): """Base exception class for pipen""" class PipenSetDataError(PipenException, ValueError): """When trying to set input data to processes with input_data already set using Pipen.set_data().""" class ProcInputTypeError(PipenException, TypeE...
"""Provide exception classes""" class Pipenexception(Exception): """Base exception class for pipen""" class Pipensetdataerror(PipenException, ValueError): """When trying to set input data to processes with input_data already set using Pipen.set_data().""" class Procinputtypeerror(PipenException, TypeErro...
""" PASSENGERS """ numPassengers = 4240 passenger_arriving = ( (6, 15, 5, 5, 5, 0, 5, 11, 6, 6, 3, 0), # 0 (8, 9, 4, 8, 4, 0, 10, 5, 10, 3, 4, 0), # 1 (2, 12, 9, 1, 2, 0, 12, 8, 10, 7, 3, 0), # 2 (6, 9, 9, 2, 3, 0, 12, 14, 4, 4, 6, 0), # 3 (9, 11, 16, 5, 2, 0, 7, 9, 7, 3, 2, 0), # 4 (3, 9, 8, 8, 2, 0, 9, ...
""" PASSENGERS """ num_passengers = 4240 passenger_arriving = ((6, 15, 5, 5, 5, 0, 5, 11, 6, 6, 3, 0), (8, 9, 4, 8, 4, 0, 10, 5, 10, 3, 4, 0), (2, 12, 9, 1, 2, 0, 12, 8, 10, 7, 3, 0), (6, 9, 9, 2, 3, 0, 12, 14, 4, 4, 6, 0), (9, 11, 16, 5, 2, 0, 7, 9, 7, 3, 2, 0), (3, 9, 8, 8, 2, 0, 9, 14, 5, 3, 3, 0), (5, 12, 7, 5, 2, ...
a=list(map(int,input().split())) n=len(a) lo=0 h=1 prod=0 for i in range(0,n): m=1 for j in range(i,n): m=m*a[j] prod=max(prod,m) #print(prod) print(prod)
a = list(map(int, input().split())) n = len(a) lo = 0 h = 1 prod = 0 for i in range(0, n): m = 1 for j in range(i, n): m = m * a[j] prod = max(prod, m) print(prod)
AUTHOR = 'Nathan Shafer' SITENAME = 'Lotechnica' SITESUBTITLE = "Technical writings by Nathan Shafer" SITEURL = 'https://blog.lotech.org' PATH = 'content' STATIC_PATHS = ['images', 'static'] STATIC_EXCLUDES = ['.sass-cache'] AUTHOR_SAVE_AS = '' USE_FOLDER_AS_CATEGORY = True # Locale settings TIMEZONE = 'America/Phoe...
author = 'Nathan Shafer' sitename = 'Lotechnica' sitesubtitle = 'Technical writings by Nathan Shafer' siteurl = 'https://blog.lotech.org' path = 'content' static_paths = ['images', 'static'] static_excludes = ['.sass-cache'] author_save_as = '' use_folder_as_category = True timezone = 'America/Phoenix' default_lang = '...
# 19. Write a program in Python to enter length in centimeter and convert it into meter and kilometer. len_cm=int(input("Enter length in centimeter: ")) len_m=len_cm/100 len_km=len_cm/100000 print("Length in meter= ",len_m,"\nLength in kilometer= ",len_km)
len_cm = int(input('Enter length in centimeter: ')) len_m = len_cm / 100 len_km = len_cm / 100000 print('Length in meter= ', len_m, '\nLength in kilometer= ', len_km)
#Binary Search Tree #BST OPERATIONS #INSERT --> FIND --> DELETE-->GET SIZE -->TRAVERSALS #BST INSERT #START AT ROOT #ALWAYS INSERT NODE AS LEAF #BST FIND #START AT ROOT #RETURN DATA IF FOUND : # ELSE RETURN FALSE #DELETE #3 POSSIBLE CASES #LEAF NODE #1 CHILD #2 CHILDR...
class Tree: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right def insert(self, data): if self.data == data: return False elif self.data > data: if self.left is not None: return s...
class ParkingPermitBaseException(Exception): pass class PermitLimitExceeded(ParkingPermitBaseException): pass class PriceError(ParkingPermitBaseException): pass class InvalidUserZone(ParkingPermitBaseException): pass class InvalidContractType(ParkingPermitBaseException): pass class NonDraf...
class Parkingpermitbaseexception(Exception): pass class Permitlimitexceeded(ParkingPermitBaseException): pass class Priceerror(ParkingPermitBaseException): pass class Invaliduserzone(ParkingPermitBaseException): pass class Invalidcontracttype(ParkingPermitBaseException): pass class Nondraftperm...
# Finding duplicate articles # this will print out articles that have # the same titles. for each match, it will print 2x -> 1,5 & 5,1 def dedupe(n): a = d[n] for key,value in d.items(): if a == value and key != n: print(f'{key} <-> {n}') articles = u.articles.all() d = {} for a in articl...
def dedupe(n): a = d[n] for (key, value) in d.items(): if a == value and key != n: print(f'{key} <-> {n}') articles = u.articles.all() d = {} for a in articles: d[a.id] = a.title for (k, v) in d.items(): dedupe(k) a = Article.query.filter_by(id=173).first() a.title a.highlights.count...
def for_five(): """We are creating user defined function with numerical pattern of five with "*" symbol""" row=7 col=5 for i in range(row): for j in range(col): if i==0 or j==0 and i<4 or ((i==3 or i==6) and j%4!=0) or j==4 and (i>3 and i<6) or i==5 and j==0: p...
def for_five(): """We are creating user defined function with numerical pattern of five with "*" symbol""" row = 7 col = 5 for i in range(row): for j in range(col): if i == 0 or (j == 0 and i < 4) or ((i == 3 or i == 6) and j % 4 != 0) or (j == 4 and (i > 3 and i < 6)) or (i == 5 and...
fib = [0,1] i = 1 print(fib[0]) while fib[i]<=842040: print(fib[i]) i +=1 fib.append(fib[i-1] + fib[i-2])
fib = [0, 1] i = 1 print(fib[0]) while fib[i] <= 842040: print(fib[i]) i += 1 fib.append(fib[i - 1] + fib[i - 2])
############################ # General Settings ############################ # crop_size: crop size for the input image, center crop crop_size = 178 # image_size: input/output image resolution, test output is 2x image_size = 64 # Establish convention for real and fake probability labels during training real_prob = 1...
crop_size = 178 image_size = 64 real_prob = 1 fake_prob = 0 train_batch_size = 128 test_batch_size = 64 num_workers = 4 n_epochs = 80 random_seed = 1111 selected_attr = None g_input_dim = len(selected_attr) if selected_attr else 40 g_num_blocks = 6 g_conv_channels = [512, 256, 128, 64] g_out_channels = 3 g_wd = 0 g_lr ...
text_errors=["error","Error","Failed","failed"] purple_text=[" ____", " / _ | Frida 15.0.13 - A world-class dynamic instrumentation toolkit", " | (_| |", " > _ | Commands:", " /_/ |_| help -> Displays the help system", #" . . . . object? -> Display information about 'obj...
text_errors = ['error', 'Error', 'Failed', 'failed'] purple_text = [' ____', ' / _ | Frida 15.0.13 - A world-class dynamic instrumentation toolkit', ' | (_| |', ' > _ | Commands:', ' /_/ |_| help -> Displays the help system'] text_1 = '\nGraphical User Interface (ATK-UI) provided by Gelja...
''' Created on Feb 12, 2019 @author: jcorley ''' class Recipe: ''' Stores basic information for a recipe. ''' def __init__(self, name, categories, timeToCook, timeToPrep, ingredients, instructions, servings): ''' Create a new recipe with the provided information. ...
""" Created on Feb 12, 2019 @author: jcorley """ class Recipe: """ Stores basic information for a recipe. """ def __init__(self, name, categories, timeToCook, timeToPrep, ingredients, instructions, servings): """ Create a new recipe with the provided information. ...
x = float(input()) if x >= 0 and x <= 25: print("Intervalo [0,25]") elif x > 25 and x <= 50: print("Intervalo (25,50]") elif x > 50 and x <= 75: print("Intervalo (50,75]") elif x > 75 and x <= 100: print("Intervalo (75,100]") else: print("Fora de intervalo")
x = float(input()) if x >= 0 and x <= 25: print('Intervalo [0,25]') elif x > 25 and x <= 50: print('Intervalo (25,50]') elif x > 50 and x <= 75: print('Intervalo (50,75]') elif x > 75 and x <= 100: print('Intervalo (75,100]') else: print('Fora de intervalo')
# Hidden Street : Destroyed Temple of Time Entrance (927020000) | Used in Luminous' Intro PHANTOM = 2159353 sm.lockInGameUI(True) sm.curNodeEventEnd(True) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.sendNext("The heavens have set the perfect stage for our final confrontation.") sm.sendDelay(500) sm.f...
phantom = 2159353 sm.lockInGameUI(True) sm.curNodeEventEnd(True) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.sendNext('The heavens have set the perfect stage for our final confrontation.') sm.sendDelay(500) sm.forcedInput(1)
class VidscraperError(Exception): """Base error for :mod:`vidscraper`.""" pass class UnhandledVideo(VidscraperError): """ Raised by :class:`.VideoLoader`\ s and :doc:`suites </api/suites>` if a given video can't be handled. """ pass class UnhandledFeed(VidscraperError): """ Rais...
class Vidscrapererror(Exception): """Base error for :mod:`vidscraper`.""" pass class Unhandledvideo(VidscraperError): """ Raised by :class:`.VideoLoader`\\ s and :doc:`suites </api/suites>` if a given video can't be handled. """ pass class Unhandledfeed(VidscraperError): """ Raise...
# Problem: Counting the number of negative numbers. # You are given a 2-dimensional array with integers. # Example Input: # [[-4, -3, -1, 1], # [-2, -2, 1, 2], # [-1, 1, 2, 3], # [ 1, 2, 4, 5]] # Write a function, count_negatives(input), which finds and returns the number of negative integers in th array. # ...
def count_negatives(given_array): n = len(given_array) count = 0 for i in range(n): for j in range(n): if given_array[i][j] < 0: count += 1 return count if __name__ == '__main__': print('\n How many negative numbers are there in the following array?\n (There...
# LeetCode 824. Goat Latin `E` # acc | 99% | 14' # A~0h19 class Solution: def toGoatLatin(self, S: str) -> str: vowels = ("a", "e", "i", "o", "u", "A", "E", "I", "O", "U") S = [w+"ma"+"a"*(i+1) if w[0] in vowels else w[1:] + w[0]+"ma"+"a"*(i+1) for i, w in enumerate(S.split())] ...
class Solution: def to_goat_latin(self, S: str) -> str: vowels = ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U') s = [w + 'ma' + 'a' * (i + 1) if w[0] in vowels else w[1:] + w[0] + 'ma' + 'a' * (i + 1) for (i, w) in enumerate(S.split())] return ' '.join(S)
#!c:\Python36\python.exe print ("Content-Type: text/html") # Header print () print ("<html><head><title>Server test</title></head>") print ("<b>Hello</b>") print ("</html>")
print('Content-Type: text/html') print() print('<html><head><title>Server test</title></head>') print('<b>Hello</b>') print('</html>')
class DummyTransport(object): def __init__(self, *args, **kargs): self.called_count = 0 def perform_request(self, method, url, params=None, body=None): self.called_count += 1 self.url = url self.params = params self.body = body class DummyTracer(object): def __init...
class Dummytransport(object): def __init__(self, *args, **kargs): self.called_count = 0 def perform_request(self, method, url, params=None, body=None): self.called_count += 1 self.url = url self.params = params self.body = body class Dummytracer(object): def __ini...
""" This file changes the global settings logic. Do not do any changes here, unless you know what you are doing. """ # Mode standard is 'f' MODE='f' FILE_TARGET='your file.ext' # Target file, where the software writes the buffer. LOG=True
""" This file changes the global settings logic. Do not do any changes here, unless you know what you are doing. """ mode = 'f' file_target = 'your file.ext' log = True
# Enter your code here. Read input from STDIN. Print output to STDOUT n = int(input()) stack = [] for i in range(n): x = [int(i) for i in input().split(' ')] if x[0]==1: if stack: m = max(stack[-1],x[1]) stack.append(m) else: stack.append(x[1]) elif x...
n = int(input()) stack = [] for i in range(n): x = [int(i) for i in input().split(' ')] if x[0] == 1: if stack: m = max(stack[-1], x[1]) stack.append(m) else: stack.append(x[1]) elif x[0] == 2: stack.pop() elif x[0] == 3: print(stack[-1...
# Harmonica notes and holes. dic_notes = { 'E3': 164.81, 'F3': 174.61, 'F#3': 185.00, 'G3': 196.00, 'G#3': 207.65, 'A3': 220.00, 'A#3': 233.08, 'B3': 246.94, 'C4': 261.63, 'C#4': 277.18, 'D4': 293.66, 'D#4': 311.13, 'E4': 329.63, 'F4': 349.23, 'F#4': 369.99, 'G4': 392.00, 'G#4': 415.30, 'A4': 440.00, 'A#4': 466.16,...
dic_notes = {'E3': 164.81, 'F3': 174.61, 'F#3': 185.0, 'G3': 196.0, 'G#3': 207.65, 'A3': 220.0, 'A#3': 233.08, 'B3': 246.94, 'C4': 261.63, 'C#4': 277.18, 'D4': 293.66, 'D#4': 311.13, 'E4': 329.63, 'F4': 349.23, 'F#4': 369.99, 'G4': 392.0, 'G#4': 415.3, 'A4': 440.0, 'A#4': 466.16, 'B4': 493.88, 'C5': 523.25, 'C#5': 554....
"""DEPICTION initialization module.""" name = 'depiction' __version__ = '0.0.1'
"""DEPICTION initialization module.""" name = 'depiction' __version__ = '0.0.1'
'''stub for savings.py exercise.''' def savingGrowth(deposit, interestPercentage, goal): '''Print the account balance for each year until it reaches or passes the goal. >>> savingGrowth(100, 8.0, 125) Year 0: $100.00 Year 1: $108.00 Year 2: $116.64 Year 3: $125.97 ''' # code here! ...
"""stub for savings.py exercise.""" def saving_growth(deposit, interestPercentage, goal): """Print the account balance for each year until it reaches or passes the goal. >>> savingGrowth(100, 8.0, 125) Year 0: $100.00 Year 1: $108.00 Year 2: $116.64 Year 3: $125.97 """ saving_growth(100...
def transformacion(c): t = (c * (9/5))+32 print(t) transformacion(100)
def transformacion(c): t = c * (9 / 5) + 32 print(t) transformacion(100)
# # PySNMP MIB module CT-FASTPATH-DHCPSERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CT-FASTPATH-DHCPSERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:13:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection) ...
''' Backward and forward ==================== The sign outside reads: Name no one man. "Escape. We must escape." Staring at the locked door of his cage, Beta Rabbit, spy and brilliant mathematician, has a revelation. "Of course! Name no one man - it's a palindrome! Palindromes are the key to opening this lock!" To ...
""" Backward and forward ==================== The sign outside reads: Name no one man. "Escape. We must escape." Staring at the locked door of his cage, Beta Rabbit, spy and brilliant mathematician, has a revelation. "Of course! Name no one man - it's a palindrome! Palindromes are the key to opening this lock!" To ...
def upload_file_to_bucket(client, file, bucket): client.upload_file(file, bucket) def get_objecturls_from_bucket(client, bucket): """ params: - bucket: s3 bucket with target contents - client: initialized s3 client object """ next_token = '' urls = [] base_kwargs = { 'Buck...
def upload_file_to_bucket(client, file, bucket): client.upload_file(file, bucket) def get_objecturls_from_bucket(client, bucket): """ params: - bucket: s3 bucket with target contents - client: initialized s3 client object """ next_token = '' urls = [] base_kwargs = {'Bucket': bucket...
class Solution: def findMaxForm(self, strs, m, n): """ :type strs: List[str] :type m: int :type n: int :rtype: int """ strs.sort(key=len) dic = {} dic[(0, 0)] = 0 for s in strs: zeroes = s.count('0') ones = len(s...
class Solution: def find_max_form(self, strs, m, n): """ :type strs: List[str] :type m: int :type n: int :rtype: int """ strs.sort(key=len) dic = {} dic[0, 0] = 0 for s in strs: zeroes = s.count('0') ones = len(...
class CalcEvent(): __handlers = None def __init__(self): self.__handlers = [] def add_handler(self, handler): self.__handlers.append(handler) def button_clicked(self, text: str): for handler in self.__handlers: handler(text)
class Calcevent: __handlers = None def __init__(self): self.__handlers = [] def add_handler(self, handler): self.__handlers.append(handler) def button_clicked(self, text: str): for handler in self.__handlers: handler(text)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- for n in range (2,25): for i in range(2, n): if n % i == 0: break else: print(n)
for n in range(2, 25): for i in range(2, n): if n % i == 0: break else: print(n)
def ordena(lista): tamanho_lista = len(lista) for i in range(tamanho_lista - 1): menor_visto = i for j in range(i + 1, tamanho_lista): if lista[j] < lista[menor_visto]: menor_visto = j lista[i], lista[menor_visto] = lista[menor_visto], lista[i] return lis...
def ordena(lista): tamanho_lista = len(lista) for i in range(tamanho_lista - 1): menor_visto = i for j in range(i + 1, tamanho_lista): if lista[j] < lista[menor_visto]: menor_visto = j (lista[i], lista[menor_visto]) = (lista[menor_visto], lista[i]) return ...
f = open('raven.txt', 'r') # create an empty dictionary count = {} for line in f: for word in line.split(): # remove punctuation word = word.replace('_', '').replace('"', '').replace(',', '').replace('.', '') word = word.replace('-', '').replace('?', '').replace('!', '').replace("'", "") ...
f = open('raven.txt', 'r') count = {} for line in f: for word in line.split(): word = word.replace('_', '').replace('"', '').replace(',', '').replace('.', '') word = word.replace('-', '').replace('?', '').replace('!', '').replace("'", '') word = word.replace('(', '').replace(')', '').replace...
def whitenoise_add_middleware(MIDDLEWARE): insert_after = "django.middleware.security.SecurityMiddleware" index = 0 MIDDLEWARE = list(MIDDLEWARE) if insert_after in MIDDLEWARE: index = MIDDLEWARE.index(insert_after) + 1 MIDDLEWARE.insert(index, "whitenoise.middleware.WhiteNoiseMiddleware") ...
def whitenoise_add_middleware(MIDDLEWARE): insert_after = 'django.middleware.security.SecurityMiddleware' index = 0 middleware = list(MIDDLEWARE) if insert_after in MIDDLEWARE: index = MIDDLEWARE.index(insert_after) + 1 MIDDLEWARE.insert(index, 'whitenoise.middleware.WhiteNoiseMiddleware') ...
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") load("@build_stack_rules_proto//:deps.bzl", "bazel_skylib", "build_bazel_rules_swift" ) load("//swift:zlib.bzl", "ZLIB_BUILD_FILE_CONTENT") load("//swift:grpc_swift.bzl", "GRPC_SWIFT_BUILD_FILE_CONTENT") load("//swift:swift_protobuf.bzl",...
load('@bazel_tools//tools/build_defs/repo:git.bzl', 'new_git_repository') load('@build_stack_rules_proto//:deps.bzl', 'bazel_skylib', 'build_bazel_rules_swift') load('//swift:zlib.bzl', 'ZLIB_BUILD_FILE_CONTENT') load('//swift:grpc_swift.bzl', 'GRPC_SWIFT_BUILD_FILE_CONTENT') load('//swift:swift_protobuf.bzl', 'SWIFT_P...