content
stringlengths
7
1.05M
class Products: # Surface Reflectance 8-day 500m modisRefl = 'MODIS/006/MOD09A1' # => NDDI # Surface Temperature 8-day 1000m */ modisTemp = 'MODIS/006/MOD11A2' # => T/NDVI # fAPAR 8-day 500m modisFpar = 'MODIS/006/MOD15A2H' # => fAPAR #Evapotranspiration 8-day 500m modisEt = 'MODIS/006/MOD16A2' # =...
# 3. Longest Substring Without Repeating Characters # Runtime: 60 ms, faster than 74.37% of Python3 online submissions for Longest Substring Without Repeating Characters. # Memory Usage: 14.4 MB, less than 53.07% of Python3 online submissions for Longest Substring Without Repeating Characters. class Solution: #...
class MXWarmSpareSettings(object): def __init__(self, session): super(MXWarmSpareSettings, self).__init__() self._session = session def swapNetworkWarmSpare(self, networkId: str): """ **Swap MX primary and warm spare appliances** https://developer.cisco.com/meraki/ap...
# Party member and chosen four names CHOSEN_FOUR = ( 'NESS', 'PAULA', 'JEFF', 'POO', ) PARTY_MEMBERS = ( 'NESS', 'PAULA', 'JEFF', 'POO', 'POKEY', 'PICKY', 'KING', 'TONY', 'BUBBLE_MONKEY', 'DUNGEON_MAN', 'FLYING_MAN_1', 'FLYING_MAN_2', 'FLYING_MAN_3',...
### Variaveis compostas TUPLAS '''print(lanche[2])''' '''print(lanche[0:2])''' '''print(lanche[1:])''' '''print(lanche[-1])''' '''len(lanche)''' '''for c in lanche: print(c)''' ### ''''As tuplas são IMUTÁVEIS''' ### Brincando lanche = ('Hambúrger', 'Suco', 'Pizza', 'Pudím') a = (2, 5, 4) b = (5, 8, 1, 2) c = b +a...
# -*- coding: utf-8 -*- def test_receiving_events(vim): vim.command('call rpcnotify(%d, "test-event", 1, 2, 3)' % vim.channel_id) event = vim.next_message() assert event[1] == 'test-event' assert event[2] == [1, 2, 3] vim.command('au FileType python call rpcnotify(%d, "py!", bufnr("$"))' % ...
""" Constants for common property names =================================== In order for different parts of the code to have got a common convention for the names of properties of importance of data points, here in this module, constants are defined for these names to facilitate the interoperability of different parts...
#%% Imports and function declaration class Node: """LinkedListNode class to be used for this problem""" def __init__(self, data): self.data = data self.next = None # helper functions for testing purpose def create_linked_list(arr): if len(arr)==0: return None head = Node(arr[0]...
class PlotmanError(Exception): """An exception type for all plotman errors to inherit from. This is never to be raised. """ pass class UnableToIdentifyPlotterFromLogError(PlotmanError): def __init__(self) -> None: super().__init__("Failed to identify the plotter definition for parsing lo...
class TreeError: TYPE_ERROR = 'ERROR' TYPE_ANOMALY = 'ANOMALY' ON_INDI = 'INDIVIDUAL' ON_FAM = 'FAMILY' def __init__(self, err_type, err_on, err_us, err_on_id, err_msg): self.err_type = err_type self.err_on = err_on self.err_us = err_us self.err_on_id = err_on_id ...
budget_header = 'Budget' forecast_total_header = 'Forecast outturn' variance_header = 'Variance -overspend/underspend' variance_percentage_header = 'Variance %' year_to_date_header = 'Year to Date Actuals' budget_spent_percentage_header = '% of budget spent to date' variance_outturn_header = "Forecast movement"
''' Commands: Basic module to handle all commands. Commands for mops are driven by one-line exec statements; these exec statements are held in a dictionary. Model Operations Processing System. Copyright Brian Fairbairn 2009-2010. Licenced under the EUPL. You may not use this work except in compliance with the...
# Задача: Дан массив целых чисел. Вывести максимальную сумму элементов в массиве. # Суммировать элементы можно только последовательно. # Пример: [-1, 10, -9, 5, 6, -10] # Вывод: 11 def max_sum(a): if a == 1: return a[0] return max([a[i] + a[i+1] for i in range(len(a)-1)]) assert max_sum([-1, 10, -9, 5, 6, ...
""" base.py: Base class for differentiable neural network layers.""" class Layer(object): """ Abstract base class for differentiable layer.""" def forward_pass(self, input_): """ Forward pass returning and storing outputs.""" raise NotImplementedError() def backward_pass(self, err): ...
def get_distance_matrix(orig, edited): # initialize the matrix orig_len = len(orig) + 1 edit_len = len(edited) + 1 distance_matrix = [[0] * edit_len for _ in range(orig_len)] for i in range(orig_len): distance_matrix[i][0] = i for j in range(edit_len): distance_matrix[0][j] = j ...
plural_suffixes = { 'ches': 'ch', 'shes': 'sh', 'ies': 'y', 'ves': 'fe', 'oes': 'o', 'zes': 'z', 's': '' } plural_words = { 'pieces': 'piece', 'bunches': 'bunch', 'haunches': 'haunch', 'flasks': 'flask', 'veins': 'vein', 'bowls': 'bowl' }
__author__ = 'jwely' __all__ = ["fetch_AVHRR"] def fetch_AVHRR(): """ fetches AVHRR-pathfinder data via ftp server: ftp://ftp.nodc.noaa.gov/pub/data.nodc/pathfinder/ """ print("this function is an unfinished stub!") return
# change this file to add additional keywords def make_states(TodoState): # do not remove any of these # any of these mappings must be in NAME_TO_STATE as well STATE_TO_NAME = { TodoState.open: "offen", TodoState.waiting: "wartet auf Rückmeldung", TodoState.in_progress: "in Bearbeitu...
lista = list() dic = dict() while True: dic["nome"] = str(input('Nome: ')) dic["idade"] = int(input('Idade: ')) dic["sexo"] = str(input('Sexo [F/M]: ')).strip().upper()[0] lista.append(dic.copy()) dic.clear() resp = str(input('Quer continuar? S/N: ')).strip().upper()[0] if resp in 'N': ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ============================================================================ # Erfr - One-time pad encryption tool # Substitution-box core module # Copyright (C) 2018 by Ralf Kilian # Distributed under the MIT License (https://opensource.org/licenses/MIT) # # Website: h...
''' Задача «Четные элементы» Условие Выведите все четные элементы списка. При этом используйте цикл for, перебирающий элементы списка, а не их индексы! ''' l1 = input().split() # print(l1) for i in range(len(l1)): l1[i] = int(l1[i]) # список изменяемый, преобразуем! # print(l1) for i in l1: if i % 2 == 0: ...
def insert_space(msg, idx): msg = msg[:idx] + " " + msg[idx:] print(msg) return msg def reverse(msg, substring): if substring in msg: msg = msg.replace(substring, "", 1) msg += substring[::-1] print(msg) return msg else: print("error") return msg d...
class Evaluator(object): """ Evaluates a model on a Dataset, using metrics specific to the Dataset. """ def __init__(self, dataset_cls, model, embedding, data_loader, batch_size, device, keep_results=False): self.dataset_cls = dataset_cls self.model = model self.embedding = embe...
# Time: O(n) # Space: O(h) class Solution(object): def diameterOfBinaryTree(self, root): """ :type root: TreeNode :rtype: int """ return self.depth(root, 0)[1] def depth(self, root, diameter): if not root: return 0, diameter left, diame...
# # Copyright (c) Members of the EGEE Collaboration. 2006-2009. # See http://www.eu-egee.org/partners/ for details on the copyright holders. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
#!/usr/bin/env python # coding: utf-8 # # Calculating protein mass, from [Rosalind.info](https://www.rosalind.info) # # (Specific exercise can be found at: http://rosalind.info/problems/prtm/) # # ## My personal interpretation # # 1. The exercise is about calculating the molecular weight of a protein # # 2. The pr...
class PokepayResponse(object): def __init__(self, response, response_body): self.body = response_body self.elapsed = response.elapsed self.status_code = response.status_code self.ok = response.ok self.headers = response.headers self.url = response.url def body(se...
str1=input("enter first string:") str2=input("enter second string:") new_a = str2[:2] + str1[2:] new_b = str1[:2] + str2[2:] print("the new string after swapping first two charaters of both string:",(new_a+' ' +new_b))
class Solution(object): # 画图理解两个区间的关系 # A,B形如[[0,2],[5,10]...] def intervalIntersection(self, firstList, secondList): """ :type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] """ i,j = 0, 0 # 双指针 res = [] w...
a = int(input()) b = int(input()) if a > b: print(1) elif a == b: print(0) else: print(2)
keys = ['a', 'b', 'c'] values = [1, 2, 3] hash = dict(list(zip(keys, values))) # Lazily, Python 2.3+, not 3.x: hash = dict(zip(keys, values))
class Space(): """ Common definitions for observations and actions. """ def sample(self, size=None, null=False): """ Uniformly randomly sample a random element(s) of this space. """ raise NotImplementedError
#criando uma matriz matriz = [[0, 0, 0],[0, 0, 0],[0, 0, 0]] for linha in range(0,3): for coluna in range(0,3): matriz[linha][coluna] = int(input(f'Digite o valor para posição [{linha},{coluna}]: ')) print('-='*30) for linha in range(0, 3): for coluna in range(0,3): print(f'[{matriz[linha][colun...
def main(request, response): """Send a response with the Origin-Policy header given in the query string. """ header = request.GET.first(b"header") response.headers.set(b"Origin-Policy", header) response.headers.set(b"Content-Type", b"text/html") return u""" <!DOCTYPE html> <meta charse...
description = 'Refsans 4 analog 1 GPIO on Raspberry' group = 'optional' tango_base = 'tango://%s:10000/test/ads/' % setupname lowlevel = () devices = { '%s_ch1' % setupname : device('nicos.devices.entangle.Sensor', description = 'ADin0', tangodevice = tango_base + 'ch1', unit = 'V', ...
class Solution: """ @param s: a string @return: the number of segments in a string """ def countSegments(self, s): # write yout code here return len(s.split())
file = open('JacobiMatrix.java', 'w') for i in range(10): for j in range(10): file.write('jacobiMatrix.setEntry(' + str(i) + ', ' + str(j) + ', Allfunc.cg' + str(i) + str(j) + '(currentApprox));\n') file.close()
#!/usr/bin/python2 lst = [] with open('lst.txt', 'r') as f: lst = f.read().split('\n') i=1 for img in lst: if 'resized' in img: with open(img, 'r') as rd: with open("combined/%05d.%s.png" % (i, img.split('.')[1]), 'w') as wr: wr.write(rd.read()) i+=1
class Task: def __init__(self): self.name = ""; self.active = False; def activate(self): pass def update(self, dt): pass def is_complete(self): pass def close(self): pass
"""Generate AXT release artifacts.""" load("//build_extensions:remove_from_jar.bzl", "remove_from_jar") load("//build_extensions:add_or_update_file_in_zip.bzl", "add_or_update_file_in_zip") def axt_release_lib( name, deps, custom_package = None, proguard_specs = None, proguard_library = None, ...
''' define some function to use. ''' def bytes_to_int(bytes_string, order_type): ''' the bind of the int.from_bytes function. ''' return int.from_bytes(bytes_string, byteorder=order_type) def bits_to_int(bit_string): ''' the bind of int(string, 2) function. ''' return int...
"""dbcfg - Annon configuration This is mutable object. """ dbcfg = { "created_on": None ,"modified_on": None ,"timestamp": None ,"anndb_id": None ,"rel_id": None ,"dbname": None ,"dbid": None ,"allowed_file_type":['.txt','.csv','.yml','.json'] ,"allowed_image_type":['.pdf','.png','.jpg','.jpeg','.gif'...
def _calc_product(series, start_idx, end_idx): product = 1 for digit in series[start_idx:end_idx + 1]: product *= int(digit) return product def largest_product_in_series(num_digits, series): largest_product = 0 for i in range(num_digits, len(series) + 1): product = _calc_product(se...
class Solution: def countOfAtoms(self, formula: str) -> str: formula = "(" + formula + ")" l = len(formula) def mmerge(dst, src, xs): for k, v in src.items(): t = dst.get(k, 0) dst[k] = v * xs + t def aux(st): nonlocal formula...
""" N=300 %timeit one_out_product(xs) 201 µs ± 1.57 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each) %timeit one_out_product_fast(xs) 194 µs ± 1.36 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each) %timeit bluteforce(xs) 27.2 ms ± 610 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) N=1000 %t...
#Program to be tested def boarding(seat_number): if seat_number >= 1 and seat_number <= 25: batch_no = 1 elif seat_number >= 26 and seat_number <= 100: batch_no = 2 elif seat_number >= 101 and seat_number <= 200: batch_no = 3 else: batch_no = -1 return batch_no
# PRE PROCESSING def symmetric_NaN_replacement(dataset): np_dataset = dataset.to_numpy() for col in range(0,(np_dataset.shape[1])): ss_idx = 0 for row in range(1,(dataset.shape[0]-1)): if (np.isnan(np_dataset[row,col]) and (~np.isnan(np_dataset[row-1,col]))): # if a NaN is found, an...
name0_0_1_0_0_2_0 = None name0_0_1_0_0_2_1 = None name0_0_1_0_0_2_2 = None name0_0_1_0_0_2_3 = None name0_0_1_0_0_2_4 = None
# -*- coding: utf-8 -*- __title__ = 'pyginx' __version__ = '0.1.13.7.7' __description__ = '' __author__ = 'wrmsr' __author_email__ = 'timwilloney@gmail.com' __url__ = 'https://github.com/wrmsr/pyginx'
# There are N students in a class. Some of them are friends, while some are not. # Their friendship is transitive in nature. For example, if A is a direct friend of B, # and B is a direct friend of C, then A is an indirect friend of C. # And we defined a friend circle is a group of students who are direct or indirec...
""" Exceptions declaration. """ __all__ = [ "PyCozmoException", "PyCozmoConnectionError", "ConnectionTimeout", "Timeout", ] class PyCozmoException(Exception): """ Base class for all PyCozmo exceptions. """ class PyCozmoConnectionError(PyCozmoException): """ Base class for all PyCozmo conn...
# -*- coding: utf-8 -*- """ 模板方法: 定义一个操作中算法骨架,而将一些步骤延迟到子类中。模板方法使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤 模板方法特点: 1、模板方法是通过把不变行为搬到超类,去除子类中重复代码来体现它的优势 2、当不变的和可变的行为在方法的子类实现中混合在一起的时候,不变的行为就会在子类中重复出现,当使用模板方法模式把这些行为搬移到单一的地方,这样做帮助子类摆况脱重复的不变行为的纠缠。 Created by 相濡HH on 4/10/15. """ class TemplateInterface(object): "...
class InvalidMeasurement(Exception): """ Raised when a specified measurement is invalid. """
path = r'c:\users\raibows\desktop\emma.txt' file = open(path, 'r') s = file.readlines() file.close() r = [i.swapcase() for i in s] file = open(path, 'w') file.writelines(r) file.close()
class Config(object): def __init__(self): # directories self.save_dir = '' self.log_dir = '' self.train_data_file = '' self.val_data_file = '' # input self.patch_size = [42, 42, 1] self.N = self.patch_size[0]*self.patch_size[1] ...
CAS_HEADERS = ('Host', 'Port', 'ID', 'Operator', 'NMEA', 'Country', 'Latitude', 'Longitude', 'FallbackHost', 'FallbackPort', 'Site', 'Other Details', 'Distance') NET_HEADERS = ('ID', 'Operator', 'Authentication', 'Fee', 'Web-Net', 'Web-Str', 'Web-Reg', 'Other Details', 'Dis...
""" """ def _impl(repository_ctx): sdk_path = repository_ctx.os.environ.get("VULKAN_SDK", None) if sdk_path == None: print("VULKAN_SDK environment variable not found, using /usr") sdk_path = "/usr" repository_ctx.symlink(sdk_path, "vulkan_sdk_linux") glslc_path = repository_ctx.which...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jun 27 21:16:00 2020 @author: mints """ A_K = 0.306 BANDS = { 'AllWISE': ['W1mag', 'W2mag'], 'ATLAS': ['%sap3' % s for s in list('UGRIZ')], 'DES': ['mag_auto_%s' % s for s in list('grizy')], 'KIDS': ['%smag' % s for s in list('ugri')]...
# -*- coding: UTF-8 -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (t...
__version__ = '0.1' supported_aln_types = ('blast', 'sam', 'xml') supported_db_types = ('nt', 'nr','cds', 'genome', 'none') consensus_aln_types = ('xml',)
def ordinal(n): """Translate a 0-based index into a 1-based ordinal, e.g. 0 -> 1st, 1 -> 2nd, etc. :param int n: the index to be translated. :return: (*str*) -- Ordinal. """ ord_dict = {1: "st", 2: "nd", 3: "rd"} return str(n + 1) + ord_dict.get((n + 1) if (n + 1) < 20 else (n + 1) % 10, "th")
def for_G(): for row in range(7): for col in range(5): if (col==0 and (row!=0 and row!=6)) or ((row==0 or row==6) and (col>0)) or (row==3 and col>1) or (row>3 and col==4): print("*",end=" ") else: print(end=" ") print() def while_G(...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 26 00:07:09 2017 @author: Nadiar """ def iterPower(base, exp): ''' base: int or float. exp: int >= 0 returns: int or float, base^exp ''' # Your code here res = 1 for i in range(1,(exp + 1)): res *= base ...
TODO = """ TODO: /kick - Done /ban - Done /hi - Done /unban - Done /del - Incomplete /admin - Incomplete /pin -no - Incomplete /unpin - Done -unpin a mesage /whois - Done. Get the info abouth a member /members - Done. Tells how many members are in the group /rules - Done /py (code) -cancele...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by imoyao at 2020/1/15 23:06 NAME = 'yst' TINY_KEY = '' TINY_KEY_FILE = 'tiny.key' DEFUALT_TINY_SUFFIX = 'tiny' # 默认文件在当前目录时,保存的后缀名 DEFUALT_TINY_DIR = 'tiny' # 默认保存的目录名称 TINY_SAVE_IN_CURRENT_DIR_SUFFIX = '.' SUPPORT_IMG_TYPES = ['.jpg', '.png', '.jpeg'] VERSION ...
def solution(A, K): # if length is equal to K nothing changes if K == len(A): return A # if all elements are the same, nothing change if all([item == A[0] for item in A]): return A N = len(A) _A = [0] * N for ind in range(N): transf_ind = ind + K _A[...
#!/usr/bin/env python # # Azure Linux extension # # Copyright (c) Microsoft Corporation # All rights reserved. # MIT License # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated # documentation files (the ""Software""), to deal in the Software without restr...
# *################### # * SYMBOL TABLE # *################### class SymbolTable: def __init__(self, parent=None): self.symbols = {} self.parent = parent def get(self, name): value = self.symbols.get(name, None) if value is None and self.parent: return self.parent.g...
#!/usr/bin/env python3 try: print('If you provide a legal file name, this program will output the last two lines of the song to that file...') print('\nMary had a little lamb,') answersnow = input('With fleece as white as (enter your file name): ') answersnowobj = open(answersnow, 'w') except: print...
def solve_knapsack(profits, weights, capacity): # basic checks n = len(profits) if capacity <= 0 or n == 0 or len(weights) != n: return 0 dp = [0 for x in range(capacity + 1)] # <<<<<<<<<< # if we have only one weight, we will take it if it is not more than the capacity for c in range...
regions_data = { "us-east-2":"Leste dos EUA (Ohio)", "us-east-1":"Leste dos EUA (Norte da Virgínia)", "us-west-1":"Oeste dos EUA (Norte da Califórnia)", "us-west-2":"Oeste dos EUA (Oregon)", "ap-east-1": "Ásia-Pacífico (Hong Kong)", "ap-south-1":"Ásia Pacífico (Mumbai)", "ap-northeast-3":"Ás...
input1 = input("Insira a palavra #1") input2 = input("Insira a palavra #2") input3 = input("Insira a palavra #3") input3 = input3.upper().replace('A', '').replace('E', '').replace('I', '').replace('O', '').replace('U', '') print(input1.upper()) print(input2.lower()) print(input3)
# Define a simple function that prints x def f(x): x += 1 print(x) # Set y y = 10 # Call the function f(y) # Print y to see if it changed print(y)
# # @lc app=leetcode id=922 lang=python3 # # [922] Sort Array By Parity II # # @lc code=start class Solution: def sortArrayByParityII(self, a: List[int]) -> List[int]: i = 0 # pointer for even misplaced j = 1 # pointer for odd misplaced sz = len(a) # invariant: for every mi...
class StringUtil: @staticmethod def is_empty(string): if string is None or string.strip() == "": return True else: return False @staticmethod def is_not_empty(string): return not StringUtil.is_empty(string)
#!/usr/bin/env python # -*- coding: UTF-8 -*- # 地址:http://www.runoob.com/python/python-exercise-example15.html score = int(input("请输入学习成绩(分数): \n")) if score >= 90: grade = "A" elif score >= 60: grade = "B" else: grade = "C" print("%d 属于 %s" % (score, grade))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Subsetsum by splitting # c.durr et jill-jênn vie - 2014-2015 # snip{ def part_sum(x, i=0): """All subsetsums from x[i:] :param x: table of values :param int i: index defining suffix of x to be considered :iterates: over all values, in arbitrary order ...
#!python3 #encoding:utf-8 class Json2Sqlite(object): def __init__(self): pass def BoolToInt(self, bool_value): if True == bool_value: return 1 else: return 0 def IntToBool(self, int_value): if 0 == int_value: return False else: ...
""" @author: David E. Craciunescu @date: 2021/02/22 (yyyy/mm/dd) 3. Consider a function f(x) which: - Is known to have a unique local minimum called x0 - At a point in the interval [p1, p2] - That CAN be p1 or p2. - Is strictly decreasing between [p1, x0] - Is strictly increas...
INPUT = { "google": { "id_token": "" }, "github": { "code": "", "state": "" } }
"""Constants for the Kuna component.""" ATTR_NOTIFICATIONS_ENABLED = "notifications_enabled" ATTR_SERIAL_NUMBER = "serial_number" ATTR_VOLUME = "volume" CONF_RECORDING_INTERVAL = "recording_interval" CONF_STREAM_INTERVAL = "stream_interval" CONF_UPDATE_INTERVAL = "update_interval" DEFAULT_RECORDING_INTERVAL = 7200 D...
base=10 height=5 area=1/2*(base*height) print("Area of our triangle is : ", area) file = open("/Users/lipingzhang/Desktop/program/pycharm/seq2seq/MNIST_data/0622_train_features.csv","r") lines = [] with file as myFile: for line in file: feat = [] line = line.split(',') for i in range(0, len...
def main(): A=input("Enter the string") A1=A[0:2:1] A2=A[-2::1] print(A1) print(A2) A3=(A1+A2) print("The new string is " ,A3) if(__name__== '__main__'): main()
''' Kattis - memorymatch Consider the 2 different corner cases and the rest is not too hard. Time: O(num_opens), Space: O(n) ''' n = int(input()) num_opens = int(input()) cards = {} turned_off = set() for i in range(num_opens): x, y, cx, cy = input().split() x, y = int(x), int(y) if not cx in cards: ...
# Copyright 2020 Tensorforce Team. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
''' 11 1 4 3 5 0 6 5 7 3 8 5 9 6 10 8 11 8 12 2 13 12 14 ''' n = int(input()) data = [] for _ in range(n): line = list(map(int, input().split())) data.append(line) data.sort() # debug # print(n) # print(data) x = -1 y = -1 nx = -1 ny = -1 cnt = 0 for i in range(n): nx, ny = data[i] if nx >= y: #...
# Copyright 2020 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
# John McDonough # github - movinalot # Advent of Code 2015 testing = 0 debug = 0 day = "03" year = "2015" part = "1" answer = None with open("puzzle_data_" + day + "_" + year + ".txt") as f: puzzle_data = f.read() if testing: puzzle_data = ">" #puzzle_data = "^>v<" #puzzle_data ...
""" This module defines function that turns ANSI codes into an escaped string """ def encode_ansi(*codes: int) -> str: """ Encodes the ANSI code into an ANSI escape sequence. >>> encode_ansi(30) '\\x1b[30m' Support defining multiple codes: >>> encode_ansi(1, 33) '\\x1b[1;33m' All n...
# string methods course = 'Python for Beginners' print('Original = ' + course) print(course.upper()) print(course.lower()) print(course.find('P')) # finds the index of P which is 0 print(course.replace('Beginners', 'Absolute Beginners')) print('Python' in course) # Boolean value
"""Internet Relay Chat Protocol numerics""" RPL_WELCOME = 1 RPL_YOURHOST = 2 RPL_TRACELINK = 200 RPL_TRACECONNECTING = 201 RPL_TRACEHANDSHAKE = 202 RPL_TRACEUNKNOWN = 203 RPL_TRACEOPERATOR = 204 RPL_TRACEUSER = 205 RPL_TRACESERVER = 206 RPL_TRACENEWTYPE = 208 RPL_TRACELOG = 261 RPL_STATSLINKINFO = 211 RPL_STATSCOMMA...
''' TACO: Multi-sample transcriptome assembly from RNA-Seq ''' __author__ = "Matthew Iyer, Yashar Niknafs, and Balaji Pandian" __copyright__ = "Copyright 2012-2018" __credits__ = ["Matthew Iyer", "Yashar Niknafs", "Balaji Pandian"] __license__ = "MIT" __version__ = "0.7.3" __maintainer__ = "Yashar Niknafs" __email__ =...
class Event: def __init__(self): self.listeners = set() def __call__(self, *args, **kwargs): for listener in self.listeners: listener(*args, **kwargs) def subscribe(self, listener): self.listeners.add(listener)
# currently unused; to be tested and further refined prior to final csv handover byline_replacementlist = [ "Exclusive ", " And ", # jobs "National", "Correspondent", "Political", "Health " , "Political", "Education" , "Commentator", "Regional", "Agencies", "Defence", "Fashion", "Music", "Social Iss...
""" Model attributes, from https://github.com/kohpangwei/group_DRO/blob/master/models.py Used for: Waterbirds """ model_attributes = { 'bert': { 'feature_type': 'text' }, 'inception_v3': { 'feature_type': 'image', 'target_resolution': (299, 299), 'flatten': False }, ...
# read input file = open("day_two_input.txt", 'r') # compile to list raw_data = file.read().splitlines() valid_count = 0 # iterate over all lines for line in raw_data: line_data = line.split() # find min/max group from line required_value_list = line_data[0].split('-') # define min/max min = int(...
class DispatchActionConfiguration(object): """Slack Dispatch Action Configuration composition object builder. For more information, see the following URL: https://api.slack.com/reference/block-kit/composition-objects#dispatch_action_config""" ON_ENTER_PRESSED = 'on_enter_pressed' ON_CHARACTER_ENTE...
__title__ = 'SQL Python for Deep Learning' __version__ = '0.1' __author__ = 'Miguel Gonzalez-Fierro' __license__ = 'MIT license' # Synonym VERSION = __version__ LICENSE = __license__
# # Complete the 'flippingMatrix' function below. # # The function is expected to return an INTEGER. # The function accepts 2D_INTEGER_ARRAY matrix as parameter. # def flippingMatrix(matrix): n = len(matrix) - 1 max_sum = 0 for i in range(len(matrix) // 2): for j in range(len(matrix) // 2): ...
# # PySNMP MIB module SIAE-UNITYPE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file://./sm_unitype.mib # Produced by pysmi-0.3.2 at Fri Jul 19 08:22:05 2019 # On host 0e190c6811ee platform Linux version 4.9.125-linuxkit by user root # Using Python version 3.7.3 (default, Apr 3 2019, 05:39:12) # OctetString, Object...