content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# ------------------------------------------------------------------------------- # Name: palindromes # # Author: mourad mourafiq # ------------------------------------------------------------------------------- def longest_subpalindrome(string): """ Returns the longest subpalindrome string from ...
def longest_subpalindrome(string): """ Returns the longest subpalindrome string from the current string Return (i,j) """ if string == '': return (0, 0) def length(slice): (a, b) = slice return b - a slices = [grow(string, start, end) for start in range(len(string)) f...
""" Description: Provides ESPA specific exceptions to the processing code. License: NASA Open Source Agreement 1.3 """ class ESPAException(Exception): """Provides an ESPA specific exception specifically for ESPA processing""" pass
""" Description: Provides ESPA specific exceptions to the processing code. License: NASA Open Source Agreement 1.3 """ class Espaexception(Exception): """Provides an ESPA specific exception specifically for ESPA processing""" pass
# # PySNMP MIB module INCOGNITO-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INCOGNITO-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:42:01 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, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ...
""" Events are called by the :class:`libres.db.scheduler.Scheduler` whenever something interesting occurs. The implementation is very simple: To add an event:: from libres.modules import events def on_allocations_added(context_name, allocations): pass events.on_allocations_added.append(on_alloc...
""" Events are called by the :class:`libres.db.scheduler.Scheduler` whenever something interesting occurs. The implementation is very simple: To add an event:: from libres.modules import events def on_allocations_added(context_name, allocations): pass events.on_allocations_added.append(on_alloc...
#list example for insertion order and the dupicates l1 = [] print(type(l1)) l1.append(1) l1.append(2) l1.append(3) l1.append(4) l1.append(1) print(l1)
l1 = [] print(type(l1)) l1.append(1) l1.append(2) l1.append(3) l1.append(4) l1.append(1) print(l1)
class Shodan: """Get any Shodan information """ def __init__(self): # TODO: move key to config self.api_key = 'yKIZ2L54cQxIfnebD4V2qgPp0QQsJLpK' # TODO: add shodan api def request(self): pass
class Shodan: """Get any Shodan information """ def __init__(self): self.api_key = 'yKIZ2L54cQxIfnebD4V2qgPp0QQsJLpK' def request(self): pass
def maximum_subarray_sum(lst): '''Finds the maximum sum of all subarrays in lst in O(n) time and O(1) additional space. >>> maximum_subarray_sum([34, -50, 42, 14, -5, 86]) 137 >>> maximum_subarray_sum([-5, -1, -8, -101]) 0 ''' current_sum = 0 maximum_sum = 0 for value in lst: ...
def maximum_subarray_sum(lst): """Finds the maximum sum of all subarrays in lst in O(n) time and O(1) additional space. >>> maximum_subarray_sum([34, -50, 42, 14, -5, 86]) 137 >>> maximum_subarray_sum([-5, -1, -8, -101]) 0 """ current_sum = 0 maximum_sum = 0 for value in lst: ...
""" * Use an input_boolean to change between views, showing or hidding groups. * Check some groups with a connectivity binary_sensor to hide offline devices. """ # Groups visibility (expert_view group / normal view group): GROUPS_EXPERT_MODE = { 'group.salon': 'group.salon_simple', 'group.estudio_rpi2h': 'gro...
""" * Use an input_boolean to change between views, showing or hidding groups. * Check some groups with a connectivity binary_sensor to hide offline devices. """ groups_expert_mode = {'group.salon': 'group.salon_simple', 'group.estudio_rpi2h': 'group.estudio_rpi2h_simple', 'group.dormitorio_rpi2mpd': 'group.dormitorio...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Ce module permet d'obtenir la liste des pays valides, a partir d'un fichier donnee. """ __auteur__ = "Thefuture2092" def obtenirListePays(langue): """ cette fonction prend un argument langue et retourne la liste de pays dans cette langue. ...
""" Ce module permet d'obtenir la liste des pays valides, a partir d'un fichier donnee. """ __auteur__ = 'Thefuture2092' def obtenir_liste_pays(langue): """ cette fonction prend un argument langue et retourne la liste de pays dans cette langue. """ fin = open('countrylist.txt', encoding='utf-8') if...
""" Lab 8 """ #3.1 demo='hello world!' def cal_words(input_str): return len(input_str.split()) #3.2 demo_str='Hello world!' print(cal_words(demo_str)) #3.3 def find_min(inpu_list): min_item = inpu_list[0] for num in inpu_list: if type(num) is not str: if min_item >= num: ...
""" Lab 8 """ demo = 'hello world!' def cal_words(input_str): return len(input_str.split()) demo_str = 'Hello world!' print(cal_words(demo_str)) def find_min(inpu_list): min_item = inpu_list[0] for num in inpu_list: if type(num) is not str: if min_item >= num: min_item ...
# Alternative solution using compound conditional statement in_class_test = int(input('Please enter your mark for the In Class Test: ')) exam_mark = int(input('Please input your mark for the exam: ')) coursework_mark = int(input('Please enter your mark for Component B: ')) # Calculating mark by adding the marks toget...
in_class_test = int(input('Please enter your mark for the In Class Test: ')) exam_mark = int(input('Please input your mark for the exam: ')) coursework_mark = int(input('Please enter your mark for Component B: ')) component_a_mark = in_class_test * 0.25 + exam_mark * 0.75 module_mark = (component_a_mark + coursework_ma...
class SarlaccPlugin: def __init__(self, logger, store): """Init method for SarlaccPlugin. Args: logger -- sarlacc logger object. store -- sarlacc store object. """ self.logger = logger self.store = store def run(self): """Runs the plugi...
class Sarlaccplugin: def __init__(self, logger, store): """Init method for SarlaccPlugin. Args: logger -- sarlacc logger object. store -- sarlacc store object. """ self.logger = logger self.store = store def run(self): """Runs the plugin...
#%% """ - Reverse Nodes in k-group - https://leetcode.com/problems/reverse-nodes-in-k-group/ - Hard Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a mult...
""" - Reverse Nodes in k-group - https://leetcode.com/problems/reverse-nodes-in-k-group/ - Hard Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple...
# Implementation of a singly linked list data structure # By: Jacob Rockland # node class for linked list class Node(object): def __init__(self, data): self.data = data self.next = None # implementation of singly linked list class SinglyLinkedList(object): # initializes linked list def ...
class Node(object): def __init__(self, data): self.data = data self.next = None class Singlylinkedlist(object): def __init__(self, head=None, tail=None): self.head = head self.tail = tail def __repr__(self): return repr(self.array()) def array(self): ...
def print_formatted(number): width = len("{0:b}".format(number)) for num in range(1, number+1): print("{0:{w}}\t{0:{w}o}\t{0:{w}X}\t{0:{w}b}".format(num, w=width)) if __name__ == '__main__': n = int(input()) print_formatted(n)
def print_formatted(number): width = len('{0:b}'.format(number)) for num in range(1, number + 1): print('{0:{w}}\t{0:{w}o}\t{0:{w}X}\t{0:{w}b}'.format(num, w=width)) if __name__ == '__main__': n = int(input()) print_formatted(n)
####################################################### # Author: Mwiza Simbeye # # Institution: African Leadership University Rwanda # # Program: Playing Card Sorting Algorithm # ####################################################### cards = [9, 10, 'J', 'K', 'Q', 'Q', 4, ...
cards = [9, 10, 'J', 'K', 'Q', 'Q', 4, 5, 6, 7, 8, 'A', 2, 3] converted_cards = [] for i in cards: if i == 'A': converted_cards.append(1) elif i == 'J': converted_cards.append(11) elif i == 'K': converted_cards.append(12) elif i == 'Q': converted_cards.append(13) else...
# Copyright: 2005-2008 Brian Harring <ferringb@gmail.com> # License: GPL2/BSD """ repository subsystem """
""" repository subsystem """
def DPLL(B, I): if len(B) == 0: return True, I for i in B: if len(i) == 0: return False, [] x = B[0][0] if x[0] != '!': x = '!' + x Bp = [[j for j in i if j != x] for i in B if not(x[1:] in i)] Ip = [i for i in I] Ip.append('Valor de ' + x[1:] + ': '...
def dpll(B, I): if len(B) == 0: return (True, I) for i in B: if len(i) == 0: return (False, []) x = B[0][0] if x[0] != '!': x = '!' + x bp = [[j for j in i if j != x] for i in B if not x[1:] in i] ip = [i for i in I] Ip.append('Valor de ' + x[1:] + ': ' + ...
#multiplicar a nota pelo peso, depois divide a soma das notas pela soma dos pesos nota1=float(input())*2 nota2=float(input())*3 nota3=float(input())*5 media=float((nota1+nota2+nota3))/10 print("MEDIA =","%.1f"%media)
nota1 = float(input()) * 2 nota2 = float(input()) * 3 nota3 = float(input()) * 5 media = float(nota1 + nota2 + nota3) / 10 print('MEDIA =', '%.1f' % media)
VALUES_CONSTANT = "values" PREVIOUS_NODE_CONSTANT = "previous_vertex" START_NODE = "A" END_NODE = "F" # GRAPH IS 1A graph = { "A": { "B" : 5, "C" : 2 }, "B": { "E" : 4 , "D": 2 , }, "C" : { "B" : 8, "D" : 7 }, "E" : { "F" : 3 , "D" : 6 }, "D" : { "F" : ...
values_constant = 'values' previous_node_constant = 'previous_vertex' start_node = 'A' end_node = 'F' graph = {'A': {'B': 5, 'C': 2}, 'B': {'E': 4, 'D': 2}, 'C': {'B': 8, 'D': 7}, 'E': {'F': 3, 'D': 6}, 'D': {'F': 1}, 'F': {}} def generate_score_table(): score_table = {} queue = [START_NODE] SCORE_TABLE[ST...
# -*- coding: utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the...
csv = 'perf_Us_3' cfg_dict = {'aux_no_0': {'dataset': 'aux_no_0', 'p': 3, 'd': 1, 'q': 1, 'taus': [1533, 8], 'Rs': [5, 5], 'k': 15, 'tol': 0.001, 'testsize': 0.1, 'loop_time': 5, 'info': 'v2', 'Us_mode': 3, 'filename': csv}, 'aux_smooth': {'dataset': 'aux_smooth', 'p': 3, 'd': 1, 'q': 1, 'taus': [319, 8], 'Rs': [5, 5],...
sal = float(input('Qual o seu salario? ')) if sal > 1250.00: print('Com o aumento seu salario sera R${:.2f}'.format(sal + (sal / 100) * 10)) else: print('Com o aumento seu salario sera R${:.2f}'.format(sal + (sal / 100) * 15))
sal = float(input('Qual o seu salario? ')) if sal > 1250.0: print('Com o aumento seu salario sera R${:.2f}'.format(sal + sal / 100 * 10)) else: print('Com o aumento seu salario sera R${:.2f}'.format(sal + sal / 100 * 15))
""" Given a nested list of integers represented as a string, implement a parser to deserialize it. Each element is either an integer, or a list -- whose elements may also be integers or other lists. Note: You may assume that the string is well-formed: String is non-empty. String does not contain white spaces. String...
""" Given a nested list of integers represented as a string, implement a parser to deserialize it. Each element is either an integer, or a list -- whose elements may also be integers or other lists. Note: You may assume that the string is well-formed: String is non-empty. String does not contain white spaces. String...
class QuizQuestion: def __init__(self, text, answer): self.text = text self.answer = answer @property def text(self): return self.__text @text.setter def text(self, text): self.__text = text @property def answer(self): return self.__answer ...
class Quizquestion: def __init__(self, text, answer): self.text = text self.answer = answer @property def text(self): return self.__text @text.setter def text(self, text): self.__text = text @property def answer(self): return self.__answer @an...
class Model: def __init__(self): self._classes = {} self._relations = {} self._generalizations = {} self._associationLinks = {} def addClass(self, _class): self._classes[_class.uid()] = _class def classByUid(self, uid): return self._classes[uid]...
class Model: def __init__(self): self._classes = {} self._relations = {} self._generalizations = {} self._associationLinks = {} def add_class(self, _class): self._classes[_class.uid()] = _class def class_by_uid(self, uid): return self._classes[uid] def...
''' 08 - Finding ambiguous datetimes At the end of lesson 2, we saw something anomalous in our bike trip duration data. Let's see if we can identify what the problem might be. The data is loaded as onebike_datetimes, and tz has already been imported from dateutil. Instructions - Loop over the trips in onebike_date...
""" 08 - Finding ambiguous datetimes At the end of lesson 2, we saw something anomalous in our bike trip duration data. Let's see if we can identify what the problem might be. The data is loaded as onebike_datetimes, and tz has already been imported from dateutil. Instructions - Loop over the trips in onebike_date...
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/openBrand_detection.py', '../_base_/default_runtime.py' ] data = dict( samples_per_gpu=4, workers_per_gpu=2, ) # model settings model = dict( neck=[ dict( type='FPN', in_channels=[256, 512...
_base_ = ['../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/openBrand_detection.py', '../_base_/default_runtime.py'] data = dict(samples_per_gpu=4, workers_per_gpu=2) model = dict(neck=[dict(type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), dict(type='BFP', in_channels=256, num...
''' Problem statement: Given a binary tree, find if it is height balanced or not. A tree is height balanced if difference between heights of left and right subtrees is not more than one for all nodes of tree. ''' class Node: # Constructor to create a new Node def __init__(self, data): self.data = data ...
""" Problem statement: Given a binary tree, find if it is height balanced or not. A tree is height balanced if difference between heights of left and right subtrees is not more than one for all nodes of tree. """ class Node: def __init__(self, data): self.data = data self.left = None self....
# Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. inas = [('ina219', '0x40', 'pp1050_s', 1.05, 0.010, 'rem', True), ('ina219', '0x41', 'pp1800_a', 1.80, 0.010, 'rem', True), ('ina219'...
inas = [('ina219', '0x40', 'pp1050_s', 1.05, 0.01, 'rem', True), ('ina219', '0x41', 'pp1800_a', 1.8, 0.01, 'rem', True), ('ina219', '0x42', 'pp1200_vddq', 1.2, 0.01, 'rem', True), ('ina219', '0x43', 'pp3300_a', 3.3, 0.01, 'rem', True), ('ina219', '0x44', 'ppvbat', 7.5, 0.01, 'rem', True), ('ina219', '0x47', 'ppvccgi', ...
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. load("//antlir/bzl:shape.bzl", "shape") conf_t = shape.shape( nameservers = shape.list(str), search_domains = shape.list(str), )
load('//antlir/bzl:shape.bzl', 'shape') conf_t = shape.shape(nameservers=shape.list(str), search_domains=shape.list(str))
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None def __repr__(self): if self: return "{} -> {}".format(self.val, self.next) class Solution: def deleteDuplicates(self, head): """ :type head: ListNod...
class Listnode: def __init__(self, x): self.val = x self.next = None def __repr__(self): if self: return '{} -> {}'.format(self.val, self.next) class Solution: def delete_duplicates(self, head): """ :type head: ListNode :rtype: ListNode ...
# Sudoku problem solved using backtracking def solve_sudoku(array): is_empty_cell_found = False; # Finding if there is any empty cell for i in range(0, 9): for j in range(0, 9): if array[i][j] == 0: row, col = i, j is_empty_cell_found = True ...
def solve_sudoku(array): is_empty_cell_found = False for i in range(0, 9): for j in range(0, 9): if array[i][j] == 0: (row, col) = (i, j) is_empty_cell_found = True break if is_empty_cell_found: break if not is_empty_cel...
# All rights reserved by forest fairy. # You cannot modify or share anything without sacrifice. # If you don't agree, keep calm and don't look at code bellow! __author__ = "VirtualV <https://github.com/virtualvfix>" __date__ = "03/22/18 15:40" class InstallError(Exception): """ Install exception base class. ...
__author__ = 'VirtualV <https://github.com/virtualvfix>' __date__ = '03/22/18 15:40' class Installerror(Exception): """ Install exception base class. """ def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class Apknotfounderror(InstallError):...
#SetExample4.py ------difference between discard() & remove() #from both remove() gives error if value not found nums = {1,2,3,4} #remove using discard() nums.discard(5) print("After discard(5) : ",nums) #reove using remove() try: nums.remove(5) print("After remove(5) : ",nums) except KeyErr...
nums = {1, 2, 3, 4} nums.discard(5) print('After discard(5) : ', nums) try: nums.remove(5) print('After remove(5) : ', nums) except KeyError: print('KeyError : Value not found')
class Item: def __init__(self, name, price, quantity): self._name = name self.set_price(price) self.set_quantity(quantity) def get_name(self): return self._name def get_price(self): return self._price def get_quantity(self): return self._quantity ...
class Item: def __init__(self, name, price, quantity): self._name = name self.set_price(price) self.set_quantity(quantity) def get_name(self): return self._name def get_price(self): return self._price def get_quantity(self): return self._quantity ...
""" Constants for django Organice. """ ORGANICE_DJANGO_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', ] ORGANICE_CMS_APPS = [ 'cms', 'm...
""" Constants for django Organice. """ organice_django_apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin'] organice_cms_apps = ['cms', 'mptt', 'menus', 'sekizai', 'treebeard', 'e...
""" dp """ class Solution: def uniquePaths(self, row: int, col: int) -> int: """ Since only 2 options are possible, either from the cell above or left, it is a dp problem. """ def is_valid(i, j): if i >= row or j >= col or i < 0 or j < 0: return False ...
""" dp """ class Solution: def unique_paths(self, row: int, col: int) -> int: """ Since only 2 options are possible, either from the cell above or left, it is a dp problem. """ def is_valid(i, j): if i >= row or j >= col or i < 0 or (j < 0): return Fals...
class Solution: def makeConnected(self, n: int, connections: List[List[int]]) -> int: if len(connections) < n-1: return -1 adjacency = [set() for _ in range(n)] for x,y in connections: adjacency[x].add(y) adjacency[y].add(x) components = 0...
class Solution: def make_connected(self, n: int, connections: List[List[int]]) -> int: if len(connections) < n - 1: return -1 adjacency = [set() for _ in range(n)] for (x, y) in connections: adjacency[x].add(y) adjacency[y].add(x) components = 0 ...
class Solution: def bitwiseComplement(self, N: int) -> int: if N == 0: return 1 ans = 0 i = 0 while N: r = N % 2 ans += 2 ** i * (1 - r) i += 1 N //= 2 return ans
class Solution: def bitwise_complement(self, N: int) -> int: if N == 0: return 1 ans = 0 i = 0 while N: r = N % 2 ans += 2 ** i * (1 - r) i += 1 n //= 2 return ans
"""Utils related to urls.""" def uri_scheme_behind_proxy(request, url): """ Fix uris with forwarded protocol. When behind a proxy, django is reached in http, so generated urls are using http too. """ if request.META.get("HTTP_X_FORWARDED_PROTO", "http") == "https": url = url.replace("...
"""Utils related to urls.""" def uri_scheme_behind_proxy(request, url): """ Fix uris with forwarded protocol. When behind a proxy, django is reached in http, so generated urls are using http too. """ if request.META.get('HTTP_X_FORWARDED_PROTO', 'http') == 'https': url = url.replace('h...
a, b, c = input().split(' ') d, e, f = input().split(' ') g, h, i = input().split(' ') a = int(a) b = int(b) c = int(c) d = int(d) e = int(e) f = int(f) g = int(g) h = int(h) i = int(i) def resto(a, b, c): return (a + b) % c resultado_1 = resto(a, b, c) resultado_2 = resto(d, e, f) resultado_3 = resto(g, h, ...
(a, b, c) = input().split(' ') (d, e, f) = input().split(' ') (g, h, i) = input().split(' ') a = int(a) b = int(b) c = int(c) d = int(d) e = int(e) f = int(f) g = int(g) h = int(h) i = int(i) def resto(a, b, c): return (a + b) % c resultado_1 = resto(a, b, c) resultado_2 = resto(d, e, f) resultado_3 = resto(g, h, ...
jogador = {} time = [] lista = [] total = 0 while True: jogador.clear() jogador['Nome'] = input('Nome do jogador: ') quantidade = int(input('Quantas partidas {} jogou ? '.format(jogador['Nome']))) lista.clear() for i in range(0, quantidade): gol_quantidade = int(input('Quantos gols na partid...
jogador = {} time = [] lista = [] total = 0 while True: jogador.clear() jogador['Nome'] = input('Nome do jogador: ') quantidade = int(input('Quantas partidas {} jogou ? '.format(jogador['Nome']))) lista.clear() for i in range(0, quantidade): gol_quantidade = int(input('Quantos gols na partid...
def df_restructure_values(data, structure='list', destructive=False): '''Takes in a dataframe, and restructures the values so that the output dataframe consist of columns where the value is coupled with the column header. data | DataFrame | a pandas dataframe structure | str | 'list', 'str', '...
def df_restructure_values(data, structure='list', destructive=False): """Takes in a dataframe, and restructures the values so that the output dataframe consist of columns where the value is coupled with the column header. data | DataFrame | a pandas dataframe structure | str | 'list', 'str', 't...
T,R=int(input('Enter no. Test Cases: ')),[] while(T>0): P=[int(x) for x in input('Enter No. Cases,Sum: ').split()] A=sorted([int(x) for x in input('Enter Numbers(A): ').split()][:P[0]]) B=sorted([int(x) for x in input('Enter Numbers(B): ').split()][:P[0]]) for i in range(P[0]): if A[i]+B[-(i+1)]...
(t, r) = (int(input('Enter no. Test Cases: ')), []) while T > 0: p = [int(x) for x in input('Enter No. Cases,Sum: ').split()] a = sorted([int(x) for x in input('Enter Numbers(A): ').split()][:P[0]]) b = sorted([int(x) for x in input('Enter Numbers(B): ').split()][:P[0]]) for i in range(P[0]): if...
# Copyright 2012 Justas Sadzevicius # Licensed under the MIT license: http://www.opensource.org/licenses/MIT # Notes library for Finch buzzer #("Middle C" is C4 ) frequencies = { 'C0': 16.35, 'C#0': 17.32, 'Db0': 17.32, 'D0': 18.35, 'D#0': 19.45, 'Eb0': 19.45, 'E0': 20.6, 'F0': 21.83, ...
frequencies = {'C0': 16.35, 'C#0': 17.32, 'Db0': 17.32, 'D0': 18.35, 'D#0': 19.45, 'Eb0': 19.45, 'E0': 20.6, 'F0': 21.83, 'F#0': 23.12, 'Gb0': 23.12, 'G0': 24.5, 'G#0': 25.96, 'Ab0': 25.96, 'A0': 27.5, 'A#0': 29.14, 'Bb0': 29.14, 'B0': 30.87, 'C1': 32.7, 'C#1': 34.65, 'Db1': 34.65, 'D1': 36.71, 'D#1': 38.89, 'Eb1': 38....
class Solution: def findMaximumXOR(self, nums: List[int]) -> int: L = len(bin(max(nums))) - 2 nums = [[(num >> i) & 1 for i in range(L)][::-1] for num in nums] maxXor, trie = 0, {} for num in nums: currentNode, xorNode, currentXor = trie, trie, 0 for bit in nu...
class Solution: def find_maximum_xor(self, nums: List[int]) -> int: l = len(bin(max(nums))) - 2 nums = [[num >> i & 1 for i in range(L)][::-1] for num in nums] (max_xor, trie) = (0, {}) for num in nums: (current_node, xor_node, current_xor) = (trie, trie, 0) ...
""" Implementing DefaultErrorHandler. Object default_error_handler is used as global object to register a callbacks for exceptions in asynchronous operators, """ def _default_error_callback(exc_type, exc_value, exc_traceback): """ Default error callback is printing traceback of the exception """ raise exc...
""" Implementing DefaultErrorHandler. Object default_error_handler is used as global object to register a callbacks for exceptions in asynchronous operators, """ def _default_error_callback(exc_type, exc_value, exc_traceback): """ Default error callback is printing traceback of the exception """ raise exc_...
''' 2969 6299 9629 ''' def prime(n): if n <= 2: return n == 2 elif n % 2 == 0: return False else: #vsa liha ostanejo d = 3 while d ** 2 <= n: if n % d == 0: return False d += 2 return True for x in range(100...
""" 2969 6299 9629 """ def prime(n): if n <= 2: return n == 2 elif n % 2 == 0: return False else: d = 3 while d ** 2 <= n: if n % d == 0: return False d += 2 return True for x in range(1000, 10000 - 2 * 3330): if sorted(lis...
class Rectangle: pass rect1 = Rectangle() rect2 = Rectangle() rect1.height = 30 rect1.width = 10 rect2.height = 5 rect2.width = 10 rect1.area = rect1.height * rect1.width rect2.area = rect2.height * rect2.width print(rect2.area)
class Rectangle: pass rect1 = rectangle() rect2 = rectangle() rect1.height = 30 rect1.width = 10 rect2.height = 5 rect2.width = 10 rect1.area = rect1.height * rect1.width rect2.area = rect2.height * rect2.width print(rect2.area)
"""Configuration information for an AgPipeline Transformer """ class Configuration: """Contains configuration information on Transformers """ # Silence this error until we have public methods # pylint: disable=too-few-public-methods # The version number of the transformer transformer_version =...
"""Configuration information for an AgPipeline Transformer """ class Configuration: """Contains configuration information on Transformers """ transformer_version = None transformer_description = None transformer_name = None transformer_sensor = None transformer_type = None author_name =...
# Copyright (c) 2017, Matt Layman class AbortError(Exception): """Any fatal errors that would prevent handroll from proceeding should signal with the ``AbortError`` exception."""
class Aborterror(Exception): """Any fatal errors that would prevent handroll from proceeding should signal with the ``AbortError`` exception."""
"""Strip .HTML extension from URIs.""" def process(app, stream): for item in stream: # Most modern HTTP servers implicitly serve one of these files when # requested URL is pointing to a directory on filesystem. Hence in # order to provide "pretty" URLs we need to transform destination ...
"""Strip .HTML extension from URIs.""" def process(app, stream): for item in stream: if item['destination'].name not in ('index.html', 'index.htm'): item['destination'] = item['destination'].parent.joinpath(item['destination'].stem, 'index.html') yield item
# # Font compiler # fonts = [ None ] * 64 current = -1 for l in open("font.txt").readlines(): print(l) if l.strip() != "": if l[0] == ':': current = ord(l[1]) & 0x3F fonts[current] = [] else: l = l.strip().replace(".","0").replace("X","1") assert len(l) == 3 fonts[current].append(int(l,2)) for i ...
fonts = [None] * 64 current = -1 for l in open('font.txt').readlines(): print(l) if l.strip() != '': if l[0] == ':': current = ord(l[1]) & 63 fonts[current] = [] else: l = l.strip().replace('.', '0').replace('X', '1') assert len(l) == 3 ...
"""Classes used in warehouse""" class ItemSet: """A set of identical items. The dimensions is a tuple (x, y, z) of the dimensions of a single item. The weight is a weight of a single member""" def __init__(self, dimensions, weight, ref_id, quantity, colour): self.dimensions = dimensions ...
"""Classes used in warehouse""" class Itemset: """A set of identical items. The dimensions is a tuple (x, y, z) of the dimensions of a single item. The weight is a weight of a single member""" def __init__(self, dimensions, weight, ref_id, quantity, colour): self.dimensions = dimensions ...
# Read a DNA Sequence def readSequence(): sequence = open(raw_input('Enter sequence filename: '),'r') sequence.readline() sequence = sequence.read().replace('\n', '') return sequence def match(a, b): if a == b: return 1 else: return -1 # Align two sequences using Smith-Waterman algorithm def alignSequences(...
def read_sequence(): sequence = open(raw_input('Enter sequence filename: '), 'r') sequence.readline() sequence = sequence.read().replace('\n', '') return sequence def match(a, b): if a == b: return 1 else: return -1 def align_sequences(s1, s2): gap = -2 s1 = '-' + s1 ...
def flip(arr, i): start = 0 while start < i: temp = arr[start] arr[start] = arr[i] arr[i] = temp start += 1 i -= 1 def findMax(arr, n): mi = 0 for i in range(0,n): if arr[i] > arr[mi]: mi = i return mi def pancakeSort(arr, n): curr_size = n while curr_size > 1: mi = findMax(arr, curr_size) i...
def flip(arr, i): start = 0 while start < i: temp = arr[start] arr[start] = arr[i] arr[i] = temp start += 1 i -= 1 def find_max(arr, n): mi = 0 for i in range(0, n): if arr[i] > arr[mi]: mi = i return mi def pancake_sort(arr, n): curr...
n = int(input()) s = [] while n != 0: n -= 1 name = input() s.append(name) r = input() for i in range(len(s)): if r in s[i]: while r in s[i]: s[i] = s[i].replace(r, "") max_seq = "" for i in range(len(s[0])): ans = "" for j in range(i, len(s[0])): ans...
n = int(input()) s = [] while n != 0: n -= 1 name = input() s.append(name) r = input() for i in range(len(s)): if r in s[i]: while r in s[i]: s[i] = s[i].replace(r, '') max_seq = '' for i in range(len(s[0])): ans = '' for j in range(i, len(s[0])): ans += s[0][j] ...
class EnvMap(object): """EnvMap object used to load and render map from file""" def __init__(self, map_path): super(EnvMap, self).__init__() self.map_path = map_path self.load_map() def get_all_treasure_locations(self): treasure_locations = [] for row in range(len...
class Envmap(object): """EnvMap object used to load and render map from file""" def __init__(self, map_path): super(EnvMap, self).__init__() self.map_path = map_path self.load_map() def get_all_treasure_locations(self): treasure_locations = [] for row in range(len(s...
testArray = [1, 2, 3, 4, 5] testString = 'this is the test string' newString = testString + str(testArray) print(newString)
test_array = [1, 2, 3, 4, 5] test_string = 'this is the test string' new_string = testString + str(testArray) print(newString)
class Solution: def alienOrder(self, words: List[str]) -> str: """ Approach: 1. Make a graph according to the letters order, comparing to adjacent words 2. Find Topological order based on the graph Examples: ["ba", "bc", "ac", "cab"] ...
class Solution: def alien_order(self, words: List[str]) -> str: """ Approach: 1. Make a graph according to the letters order, comparing to adjacent words 2. Find Topological order based on the graph Examples: ["ba", "bc", "ac", "cab"] ...
""" https://leetcode.com/problems/find-lucky-integer-in-an-array/ Given an array of integers arr, a lucky integer is an integer which has a frequency in the array equal to its value. Return a lucky integer in the array. If there are multiple lucky integers return the largest of them. If there is no lucky integer retur...
""" https://leetcode.com/problems/find-lucky-integer-in-an-array/ Given an array of integers arr, a lucky integer is an integer which has a frequency in the array equal to its value. Return a lucky integer in the array. If there are multiple lucky integers return the largest of them. If there is no lucky integer retur...
def load_sensitivity_study_file_names(design): """ Parameters ---------- design: Name of design Returns experiment files names of a design ------- """ file_names = {} if design == 'NAE-IAW': path = '../Files_Results/Sensitivity_Study/NAE-IAW/' file_names['FILE_Mea...
def load_sensitivity_study_file_names(design): """ Parameters ---------- design: Name of design Returns experiment files names of a design ------- """ file_names = {} if design == 'NAE-IAW': path = '../Files_Results/Sensitivity_Study/NAE-IAW/' file_names['FILE_Mean...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. class DepthInfo: # The default depth that we travel before forcing a foreign key attribute DEFAULT_MAX_DEPTH = 2 # The max depth set if the user specif...
class Depthinfo: default_max_depth = 2 max_depth_limit = 32 def __init__(self, current_depth, max_depth, max_depth_exceeded): self.current_depth = current_depth self.max_depth = max_depth self.max_depth_exceeded = max_depth_exceeded
class Solution: def isMatch(self, text, pattern): if not pattern: return not text first_match = bool(text) and pattern[0] in {text[0], '.'} if len(pattern) >= 2 and pattern[1] == '*': return (self.isMatch(text, pattern[2:]) or first_match and sel...
class Solution: def is_match(self, text, pattern): if not pattern: return not text first_match = bool(text) and pattern[0] in {text[0], '.'} if len(pattern) >= 2 and pattern[1] == '*': return self.isMatch(text, pattern[2:]) or (first_match and self.isMatch(text[1:], ...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Associations Management', 'version': '0.1', 'category': 'Marketing', 'description': """ This module is to configure modules related to an association. =========================================...
{'name': 'Associations Management', 'version': '0.1', 'category': 'Marketing', 'description': '\nThis module is to configure modules related to an association.\n==============================================================\n\nIt installs the profile for associations to manage events, registrations, memberships, \nmemb...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class SnapKorf(MakefilePackage): """SNAP is a general purpose gene finding program suitable for both eukaryoti...
class Snapkorf(MakefilePackage): """SNAP is a general purpose gene finding program suitable for both eukaryotic and prokaryotic genomes.""" homepage = 'http://korflab.ucdavis.edu/software.html' url = 'http://korflab.ucdavis.edu/Software/snap-2013-11-29.tar.gz' git = 'https://github.com/KorfLab/SN...
def format_sql(table, obj: dict) -> str: cols = ','.join(obj.keys()) values = ','.join(obj.values()) sql = "insert into {table} ({cols}) values ({values})".format(table=table, cols=cols, values=values) return def format_sqls(table, objs: list) -> str: obj = objs.__getitem__(0) cols = ','.join(...
def format_sql(table, obj: dict) -> str: cols = ','.join(obj.keys()) values = ','.join(obj.values()) sql = 'insert into {table} ({cols}) values ({values})'.format(table=table, cols=cols, values=values) return def format_sqls(table, objs: list) -> str: obj = objs.__getitem__(0) cols = ','.join(o...
# Head ends here def next_move(posr, posc, board): p = 0 q = 0 dmin = 0 dmax = 0 position = 0 for i in range(5) : count = 0 for j in range(5) : if board[i][j] == "d" : count += 1 if count == 1 : dmax ...
def next_move(posr, posc, board): p = 0 q = 0 dmin = 0 dmax = 0 position = 0 for i in range(5): count = 0 for j in range(5): if board[i][j] == 'd': count += 1 if count == 1: dmax = dmin = j elif count...
class Person: def __init__(self, name): self.name = name # create the method greet here def greet(self): print(f"Hello, I am {self.name}!") in_name = input() p = Person(in_name) p.greet()
class Person: def __init__(self, name): self.name = name def greet(self): print(f'Hello, I am {self.name}!') in_name = input() p = person(in_name) p.greet()
load("@wix_oss_infra//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external") def dependencies(): import_external( name = "org_xerial_snappy_snappy_java", artifact = "org.xerial.snappy:snappy-java:1.1.7.1", artifact_sha256 = "bb52854753feb1919f13099a53475a2a8eb65db...
load('@wix_oss_infra//:import_external.bzl', import_external='safe_wix_scala_maven_import_external') def dependencies(): import_external(name='org_xerial_snappy_snappy_java', artifact='org.xerial.snappy:snappy-java:1.1.7.1', artifact_sha256='bb52854753feb1919f13099a53475a2a8eb65dbccd22839a9b9b2e1a2190b951', srcjar...
'''from flask import render_template from flask import Response from flask import Flask app = Flask(__name__) @app.route('/') def index(): return render_template('streaming2.html') def generate(camera): while True: frame = camera.get_frame() yield (b'--frame\r\n' b'Content-Type: image/jpg\r\n\r\n' + frame ...
"""from flask import render_template from flask import Response from flask import Flask app = Flask(__name__) @app.route('/') def index(): return render_template('streaming2.html') def generate(camera): while True: frame = camera.get_frame() yield (b'--frame\r ' b'Content-Type: image/jpg\r \r ' + frame + b...
class AbBuildUnsuccesful(Exception): """ Build was not successful """ def __init__(self, msg, output): self.msg = msg self.output = output def __str__(self): return "%s" % self.msg
class Abbuildunsuccesful(Exception): """ Build was not successful """ def __init__(self, msg, output): self.msg = msg self.output = output def __str__(self): return '%s' % self.msg
class StreamQueue: repeat = False current = None streams = [] def next(self): if self.repeat and self.current is not None: return self.current self.current = None if len(self.streams) > 0: self.current = self.streams.pop(0) return self.curre...
class Streamqueue: repeat = False current = None streams = [] def next(self): if self.repeat and self.current is not None: return self.current self.current = None if len(self.streams) > 0: self.current = self.streams.pop(0) return self.current ...
# GCD, LCM """ T = int(input()) def lcm(x, y): if x > y: greater = x else: greater = y while True: if greater % x == 0 and greater % y == 0: lcm = greater break greater += 1 return lcm for _ in range(T): M, N, x, y = map(int(), input().split(...
""" T = int(input()) def lcm(x, y): if x > y: greater = x else: greater = y while True: if greater % x == 0 and greater % y == 0: lcm = greater break greater += 1 return lcm for _ in range(T): M, N, x, y = map(int(), input().split()) """ de...
def Move(): global ArchiveIndex, gameData playerShip.landedBefore = playerShip.landedOn playerShip.landedOn = None for Thing in PlanetContainer: XDiff = playerShip.X - Thing.X YDiff = playerShip.Y + Thing.Y Distance = (XDiff ** 2 + YDiff ** 2) ** 0.5 if Distance > 40000: ...
def move(): global ArchiveIndex, gameData playerShip.landedBefore = playerShip.landedOn playerShip.landedOn = None for thing in PlanetContainer: x_diff = playerShip.X - Thing.X y_diff = playerShip.Y + Thing.Y distance = (XDiff ** 2 + YDiff ** 2) ** 0.5 if Distance > 40000...
""" >= 0.9 A >= 0.8 B >= 0.7 C >= 0.6 D < 0.6 F """ score = input("Enter Score: ") try: s = float(score) except: print("please enter numeric numbers") quit() if s>1.0 or s< 0.0: print("value out of range! please enter number btw 1.0 and 0.0") elif s >= 0.9: print("A") elif s >=0.8: print("B")...
""" >= 0.9 A >= 0.8 B >= 0.7 C >= 0.6 D < 0.6 F """ score = input('Enter Score: ') try: s = float(score) except: print('please enter numeric numbers') quit() if s > 1.0 or s < 0.0: print('value out of range! please enter number btw 1.0 and 0.0') elif s >= 0.9: print('A') elif s >= 0.8: print('B'...
def names(l): # list way new = [] for i in l: if not i in new: new.append(i) # set way new = list(set(l)) print(new) names(["Michele", "Robin", "Sara", "Michele"])
def names(l): new = [] for i in l: if not i in new: new.append(i) new = list(set(l)) print(new) names(['Michele', 'Robin', 'Sara', 'Michele'])
mylist = [1, 2, 3] # Imprime 1,2,3 for x in mylist: print(x)
mylist = [1, 2, 3] for x in mylist: print(x)
""" 141. Linked List Cycle """ class Solution(object): def hasCycle(self, head): """ :type head: ListNode :rtype: bool """ slow = fast = head while fast and fast.next: fast = fast.next.next slow = slow.next if slow ...
""" 141. Linked List Cycle """ class Solution(object): def has_cycle(self, head): """ :type head: ListNode :rtype: bool """ slow = fast = head while fast and fast.next: fast = fast.next.next slow = slow.next if slow == fast: ...
#Print without newline or space print("\n") for j in range(10): print("") for i in range(10): print(' @ ', end="") print("\n")
print('\n') for j in range(10): print('') for i in range(10): print(' @ ', end='') print('\n')
class Entry: def __init__(self, obj, line_number = 1): self.obj = obj self.line_number = line_number def __repr__(self): return "In {}, line {}".format(self.obj.name, self.line_number) class CallStack: def __init__(self, initial = None): self.__stack = [] if not initial e...
class Entry: def __init__(self, obj, line_number=1): self.obj = obj self.line_number = line_number def __repr__(self): return 'In {}, line {}'.format(self.obj.name, self.line_number) class Callstack: def __init__(self, initial=None): self.__stack = [] if not initial else ...
class BaseConfig(): API_PREFIX = '/api' TESTING = False DEBUG = False SECRET_KEY = '@!s3cr3t' AGENT_SOCK = 'cmdsrv__0' class DevConfig(BaseConfig): FLASK_ENV = 'development' DEBUG = True CELERY_BROKER = 'redis://localhost:6379/0' CELERY_RESULT_BACKEND = 'redis://localhost:6379/0' REDIS_UR...
class Baseconfig: api_prefix = '/api' testing = False debug = False secret_key = '@!s3cr3t' agent_sock = 'cmdsrv__0' class Devconfig(BaseConfig): flask_env = 'development' debug = True celery_broker = 'redis://localhost:6379/0' celery_result_backend = 'redis://localhost:6379/0' ...
while True: x,y=map(int,input().split()) if x==0 and y==0: break print(x+y)
while True: (x, y) = map(int, input().split()) if x == 0 and y == 0: break print(x + y)
def encode(json, schema): payload = schema.Main() payload.github = json['github'] payload.patreon = json['patreon'] payload.open_collective = json['open_collective'] payload.ko_fi = json['ko_fi'] payload.tidelift = json['tidelift'] payload.community_bridge = json['community_bridge'] payl...
def encode(json, schema): payload = schema.Main() payload.github = json['github'] payload.patreon = json['patreon'] payload.open_collective = json['open_collective'] payload.ko_fi = json['ko_fi'] payload.tidelift = json['tidelift'] payload.community_bridge = json['community_bridge'] payl...
#!/usr/local/bin/python3 """ This is written by Zhiyang Ong to try out Solutions 1-4 from [Sceenivasan, 2017]. Reference for Solutions 1, 2, 3, and 4 [Sceenivasan, 2017]: Sreeram Sceenivasan, "How to implement a switch-case statement in Python: No in-built switch statement here," from JAXenter.com, Software ...
""" This is written by Zhiyang Ong to try out Solutions 1-4 from [Sceenivasan, 2017]. Reference for Solutions 1, 2, 3, and 4 [Sceenivasan, 2017]: Sreeram Sceenivasan, "How to implement a switch-case statement in Python: No in-built switch statement here," from JAXenter.com, Software {\rm \\&}\\ Support Media ...
# Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking. # # Your class will have the method, book(int start, int end). Formally, this represents a booking on the half open interval [start, end), the range of real numbers x such that start <= x <...
class Mycalendar(object): def __init__(self): pass def book(self, start, end): """ :type start: int :type end: int :rtype: bool """
#!/usr/bin/python3 OPENVSWITCH_SERVICES_EXPRS = [r"ovsdb-\S+", r"ovs-vswitch\S+", r"ovn\S+"] OVS_PKGS = [r"libc-bin", r"openvswitch-switch", r"ovn", ] OVS_DAEMONS = {"ovs-vswitchd": {"logs": "var/log/openvswit...
openvswitch_services_exprs = ['ovsdb-\\S+', 'ovs-vswitch\\S+', 'ovn\\S+'] ovs_pkgs = ['libc-bin', 'openvswitch-switch', 'ovn'] ovs_daemons = {'ovs-vswitchd': {'logs': 'var/log/openvswitch/ovs-vswitchd.log'}, 'ovsdb-server': {'logs': 'var/log/openvswitch/ovsdb-server.log'}}
#!/usr/bin/env python3 inputs = {} reduced = {} with open("input.txt") as f: for line in f: inp, to = map(lambda x: x.strip(), line.split("->")) inputs[to] = inp.split(" ") inputs["b"] = "956" def reduce(name): try: return int(name) except: pass try: return int(...
inputs = {} reduced = {} with open('input.txt') as f: for line in f: (inp, to) = map(lambda x: x.strip(), line.split('->')) inputs[to] = inp.split(' ') inputs['b'] = '956' def reduce(name): try: return int(name) except: pass try: return int(inputs[name]) exce...
LCGDIR = '../lib/sunos5' LIBDIR = '${LCGDIR}' BF_PYTHON = '/usr/local' BF_PYTHON_VERSION = '3.2' BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/c...
lcgdir = '../lib/sunos5' libdir = '${LCGDIR}' bf_python = '/usr/local' bf_python_version = '3.2' bf_python_inc = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' bf_python_binary = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' bf_python_lib = 'python${BF_PYTHON_VERSION}' bf_python_linkflags = ['-Xlinker', '-export-dyn...
""" Connected client statistics """ class Statistics(object): """ A connected client statistics """ def __init__(self, downspeed, online, upspeed): self._downspeed = downspeed self._online = online self._upspeed = upspeed def get_downspeed(self): return self._downspeed ...
""" Connected client statistics """ class Statistics(object): """ A connected client statistics """ def __init__(self, downspeed, online, upspeed): self._downspeed = downspeed self._online = online self._upspeed = upspeed def get_downspeed(self): return self._downspeed ...
t=input() while(t>0): s=raw_input() str=s.split(' ') b=int(str[0]) c=int(str[1]) d=int(str[2]) print (c-b)+(c-d) t=t-1
t = input() while t > 0: s = raw_input() str = s.split(' ') b = int(str[0]) c = int(str[1]) d = int(str[2]) print(c - b) + (c - d) t = t - 1
def generate_shared_public_key(my_private_key, their_public_pair, generator): """ Two parties each generate a private key and share their public key with the other party over an insecure channel. The shared public key can be generated by either side, but not by eavesdroppers. You can then use the entrop...
def generate_shared_public_key(my_private_key, their_public_pair, generator): """ Two parties each generate a private key and share their public key with the other party over an insecure channel. The shared public key can be generated by either side, but not by eavesdroppers. You can then use the entrop...
__version__ = "0.1" __requires__ = [ "apptools>=4.2.0", "numpy>=1.6", "traits>=4.4", "enable>4.2", "chaco>=4.4", "fiona>=1.0.2", "scimath>=4.1.2", "shapely>=1.2.17", "tables>=2.4.0", "sdi", ]
__version__ = '0.1' __requires__ = ['apptools>=4.2.0', 'numpy>=1.6', 'traits>=4.4', 'enable>4.2', 'chaco>=4.4', 'fiona>=1.0.2', 'scimath>=4.1.2', 'shapely>=1.2.17', 'tables>=2.4.0', 'sdi']
# A plugin is supposed to define a setup function # which returns the type that the plugin provides # # This plugin fails to do so def useless(): print("Hello World")
def useless(): print('Hello World')
""" This module is deprecated and has been moved to `//toolchains/built_tools/...` """ load("//foreign_cc/built_tools:ninja_build.bzl", _ninja_tool = "ninja_tool") load(":deprecation.bzl", "print_deprecation") print_deprecation() ninja_tool = _ninja_tool
""" This module is deprecated and has been moved to `//toolchains/built_tools/...` """ load('//foreign_cc/built_tools:ninja_build.bzl', _ninja_tool='ninja_tool') load(':deprecation.bzl', 'print_deprecation') print_deprecation() ninja_tool = _ninja_tool
class Number: def numSum(num): count = [] for x in range(1, (num+1)): count.append(x) print(sum(count)) if __name__ == "__main__": num = int(input("Enter A Number: ")) numSum(num)
class Number: def num_sum(num): count = [] for x in range(1, num + 1): count.append(x) print(sum(count)) if __name__ == '__main__': num = int(input('Enter A Number: ')) num_sum(num)
logging.info(" *** Step 3: Build features *** ".format()) # %% =========================================================================== # Feature - Pure Breed Boolean column # ============================================================================= def pure_breed(row): # print(row) mixed_breed_keywords...
logging.info(' *** Step 3: Build features *** '.format()) def pure_breed(row): mixed_breed_keywords = ['domestic', 'tabby', 'mixed'] if row['Breed1'] == 'Mixed Breed': return False elif row['Breed2'] == 'NA': if any([word in row['Breed1'].lower() for word in mixed_breed_keywords]): ...
aws_access_key_id=None aws_secret_access_key=None img_bucket_name=None
aws_access_key_id = None aws_secret_access_key = None img_bucket_name = None
# -*- coding: utf-8 -*- """Deep Go Patterns ====== Design Patterns """
"""Deep Go Patterns ====== Design Patterns """
def get_tickets(path): with open(path, 'r') as fh: yield fh.read().splitlines() def get_new_range(_min, _max, value): # print(_min, _max, value) if value == 'F' or value == 'L': mid = _min + (_max - _min) // 2 return (_min, mid) if value == 'B' or value == 'R': mid = _m...
def get_tickets(path): with open(path, 'r') as fh: yield fh.read().splitlines() def get_new_range(_min, _max, value): if value == 'F' or value == 'L': mid = _min + (_max - _min) // 2 return (_min, mid) if value == 'B' or value == 'R': mid = _min + (_max - _min) // 2 + 1 ...