content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
with open('pessoa.csv') as arquivo: with open('pessoas.txt', 'w') as saida: for registro in arquivo: registro = registro.strip().split(',') print(f'Nome:{registro[0]}, Idade: {registro[1]} anos', file=saida)
with open('pessoa.csv') as arquivo: with open('pessoas.txt', 'w') as saida: for registro in arquivo: registro = registro.strip().split(',') print(f'Nome:{registro[0]}, Idade: {registro[1]} anos', file=saida)
class PrettyException(Exception): "Semantic errors in prettyqr." pass class ImageNotSquareException(PrettyException): pass class BaseImageSmallerThanQRCodeException(PrettyException): pass
class Prettyexception(Exception): """Semantic errors in prettyqr.""" pass class Imagenotsquareexception(PrettyException): pass class Baseimagesmallerthanqrcodeexception(PrettyException): pass
# # Author: # Date: # Description: # # Constants used to refer to the parts of the quiz question CATEGORY = 0 VALUE = 1 QUESTION = 2 ANSWER = 3 # # Read lines of text from a specified file and create a list of those lines # with each line added as a separate String item in the list # # Parameter # inputFile -...
category = 0 value = 1 question = 2 answer = 3 def get_list_from_file(inputFile): output_list = [] try: source = open(inputFile, 'r') output_list = source.readlines() source.close() except FileNotFoundError: print('Unable to open input file: ' + inputFile) return outputL...
def C_to_F(temp): temp = temp*9/5+32 return temp def F_to_C(temp): temp = (temp-32)*5.0/9.0 return temp sel = input('\nCelsius and Fahrenheit Convert\n\n'+ '(A) Fatrenheit to Celsius\n'+ '(B) Celsius to Fatrenheit\n'+ '(C) Exit\n\n'+ 'Please input...> ') while sel != 'C': temp = int(input('Please input tempe...
def c_to_f(temp): temp = temp * 9 / 5 + 32 return temp def f_to_c(temp): temp = (temp - 32) * 5.0 / 9.0 return temp sel = input('\nCelsius and Fahrenheit Convert\n\n' + '(A) Fatrenheit to Celsius\n' + '(B) Celsius to Fatrenheit\n' + '(C) Exit\n\n' + 'Please input...> ') while sel != 'C': temp = int...
# first line: 1 @memory.cache def vsigmomEdw_NR(Erecoil_keV, aH): return [sigmomEdw(x,band='NR',label='GGA3',F=0.000001,V=4.0,aH=aH,alpha=(1/18.0)) for x in Erecoil_keV]
@memory.cache def vsigmom_edw_nr(Erecoil_keV, aH): return [sigmom_edw(x, band='NR', label='GGA3', F=1e-06, V=4.0, aH=aH, alpha=1 / 18.0) for x in Erecoil_keV]
# Copyright 2020 The XLS Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
"""Generates a fuzz issue regression suite.""" def _to_suffix(path): basename = path.split('/')[-1] if not basename.endswith('.x'): fail() basename = basename[:-len('.x')] if basename.startswith('crasher_'): basename = basename[len('crasher_'):] return basename def generate_crasher...
for i in range(101): if i % 15 == 0: print("Fizzbuzz") elif i % 3 == 0: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i)
for i in range(101): if i % 15 == 0: print('Fizzbuzz') elif i % 3 == 0: print('Fizz') elif i % 5 == 0: print('Buzz') else: print(i)
RESOURCE = "https://graph.microsoft.com" # Add the resource you want the access token for TENANT = "Your tenant" # Enter tenant name, e.g. contoso.onmicrosoft.com AUTHORITY_HOST_URL = "https://login.microsoftonline.com" CLIENT_ID = "Your client id " # copy the Application ID of your app from your Azure portal CLIENT...
resource = 'https://graph.microsoft.com' tenant = 'Your tenant' authority_host_url = 'https://login.microsoftonline.com' client_id = 'Your client id ' client_secret = 'Your client secret' api_version = 'v1.0'
# Hiztegi bat deklaratu ta aldagaiak jarri, erabiltzaileak sartu ditzan hizt = {} EI = input("Sartu zure erabiltzaile izena:\n") hizt['Erabiltzaile_izena'] = EI PH = input("Sartu zure pasahitza:\n") hizt['Pasahitza'] = PH # Aldagai hoiek gorde ta bukle batekin bere datuak sartzea, ondo sartu arte (input = hiztegian...
hizt = {} ei = input('Sartu zure erabiltzaile izena:\n') hizt['Erabiltzaile_izena'] = EI ph = input('Sartu zure pasahitza:\n') hizt['Pasahitza'] = PH print('\n\nERREGISTRO LEIHOA\n') input('Sartu zure erabiltzaile izena:\n') if input == EI: print('Ondo, orain sartu pasahitza.') else: print('Gaizki.')
#!/usr/bin/env python3 x, y = map(int, input().strip().split()) while x != 0 and y != 0: att = list(map(int, input().strip().split())) att.sort() dff = list(map(int, input().strip().split())) dff.sort() if(att[0] < dff[1]): print("Y") else: print("N") x, y = map(int, input...
(x, y) = map(int, input().strip().split()) while x != 0 and y != 0: att = list(map(int, input().strip().split())) att.sort() dff = list(map(int, input().strip().split())) dff.sort() if att[0] < dff[1]: print('Y') else: print('N') (x, y) = map(int, input().strip().split())
FreeSansBold9pt7bBitmaps = [ 0xFF, 0xFF, 0xFE, 0x48, 0x7E, 0xEF, 0xDF, 0xBF, 0x74, 0x40, 0x19, 0x86, 0x67, 0xFD, 0xFF, 0x33, 0x0C, 0xC3, 0x33, 0xFE, 0xFF, 0x99, 0x86, 0x61, 0x90, 0x10, 0x1F, 0x1F, 0xDE, 0xFF, 0x3F, 0x83, 0xC0, 0xFC, 0x1F, 0x09, 0xFC, 0xFE, 0xF7, 0xF1, 0xE0, 0x40, 0x38, 0x10, 0x7C, 0x30,...
free_sans_bold9pt7b_bitmaps = [255, 255, 254, 72, 126, 239, 223, 191, 116, 64, 25, 134, 103, 253, 255, 51, 12, 195, 51, 254, 255, 153, 134, 97, 144, 16, 31, 31, 222, 255, 63, 131, 192, 252, 31, 9, 252, 254, 247, 241, 224, 64, 56, 16, 124, 48, 198, 32, 198, 64, 198, 64, 124, 128, 57, 156, 1, 62, 3, 99, 2, 99, 4, 99, 12,...
s = ''' [setattr(f, 'func_code', type(f.func_code)(0, 0, 2, 67, 'd\\x06\\x00j\\x00\\x00j\\x01\\x00d\\x01\\x00\\x19j\\x02\\x00\\x83\\x00\\x00d\\x02\\x00\\x19j\\x03\\x00j\\x04\\x00d\\x03\\x00\\x19j\\x05\\x00d\\x04\\x00\\x19j\\x06\\x00j\\x07\\x00d\\x05\\x00\\x83\\x01\\x00\\x01d\\x00\\x00' + 's'.upper(), ([].append(1), 0,...
s = "\n[setattr(f, 'func_code', type(f.func_code)(0, 0, 2, 67,\n'd\\x06\\x00j\\x00\\x00j\\x01\\x00d\\x01\\x00\\x19j\\x02\\x00\\x83\\x00\\x00d\\x02\\x00\\x19j\\x03\\x00j\\x04\\x00d\\x03\\x00\\x19j\\x05\\x00d\\x04\\x00\\x19j\\x06\\x00j\\x07\\x00d\\x05\\x00\\x83\\x01\\x00\\x01d\\x00\\x00'\n+ 's'.upper(),\n([].append(1), ...
def split_labels( label_reader, training_label_writer, testing_label_writer, training_fraction, max_labels=0, ): """Splits a full label set into a training and testing set. Given a full set of labels and associated inputs, splits up the labels into training and testing sets in the propor...
def split_labels(label_reader, training_label_writer, testing_label_writer, training_fraction, max_labels=0): """Splits a full label set into a training and testing set. Given a full set of labels and associated inputs, splits up the labels into training and testing sets in the proportion defined by tra...
print("What is your first name?") firstName = input() print("What is your last name?") lastName = input() fullName = firstName + " " + lastName greeting = "Hello " + fullName print(greeting)
print('What is your first name?') first_name = input() print('What is your last name?') last_name = input() full_name = firstName + ' ' + lastName greeting = 'Hello ' + fullName print(greeting)
# Write your movie_review function here: def movie_review(rating): if rating <= 5: return "Avoid at all costs!" elif rating > 5 and rating < 9: return "This one was fun." else: return "Outstanding!" # Uncomment these function calls to test your movie_review function: print(movie_review(9)) # should ...
def movie_review(rating): if rating <= 5: return 'Avoid at all costs!' elif rating > 5 and rating < 9: return 'This one was fun.' else: return 'Outstanding!' print(movie_review(9)) print(movie_review(4)) print(movie_review(6))
''' Author: hdert Date: 25/5/2018 Desc: Input Validation Version: Dev Build V.0.1.6.9.1 ''' #--Librarys-- #--Definitions-- #--Variables-- choice = "" number = 0 #-Main-Code-- while(choice != "e"): ''' while(True): choice = input("Enter a, b, or c: ") if(ch...
""" Author: hdert Date: 25/5/2018 Desc: Input Validation Version: Dev Build V.0.1.6.9.1 """ choice = '' number = 0 while choice != 'e': '\n while(True):\n choice = input("Enter a, b, or c: ")\n if(choice.lower() == \'a\' or choice.lower() == \'b\' or choice.lower() == \'c\'):\n break\n...
""" Optional problems for Lab 3 """ def is_prime(n): """Returns True if n is a prime number and False otherwise. >>> is_prime(2) True >>> is_prime(16) False >>> is_prime(521) True """ "*** YOUR CODE HERE ***" def gcd(a, b): """Returns the greatest common divisor of a and b. ...
""" Optional problems for Lab 3 """ def is_prime(n): """Returns True if n is a prime number and False otherwise. >>> is_prime(2) True >>> is_prime(16) False >>> is_prime(521) True """ '*** YOUR CODE HERE ***' def gcd(a, b): """Returns the greatest common divisor of a and b. ...
""" 551. Student Attendance Record I """ class Solution: def checkRecord(self, s): """ :type s: str :rtype: bool """ A = i = 0 while i < len(s): if s[i] == 'A': A+=1 if A>=2: return False if s[i] == 'L': ...
""" 551. Student Attendance Record I """ class Solution: def check_record(self, s): """ :type s: str :rtype: bool """ a = i = 0 while i < len(s): if s[i] == 'A': a += 1 if A >= 2: return False if s[...
class dtype(object): def __init__(self): super().__init__() def is_floating_point(self) -> bool: raise NotImplementedError('is_floating_point NotImplementedError') def is_complex(self) -> bool: raise NotImplementedError('is_complex NotImplementedError') def is_signed(self) -...
class Dtype(object): def __init__(self): super().__init__() def is_floating_point(self) -> bool: raise not_implemented_error('is_floating_point NotImplementedError') def is_complex(self) -> bool: raise not_implemented_error('is_complex NotImplementedError') def is_signed(self...
def print_conversion(prev_char, cur_count, first_char): space = '' if first_char else ' ' if prev_char == '0': print('{}00 {}'.format(space, '0' * cur_count), end='') else: print('{}0 {}'.format(space, '0' * cur_count), end='') def solution(): binary = [] for char in input(): ...
def print_conversion(prev_char, cur_count, first_char): space = '' if first_char else ' ' if prev_char == '0': print('{}00 {}'.format(space, '0' * cur_count), end='') else: print('{}0 {}'.format(space, '0' * cur_count), end='') def solution(): binary = [] for char in input(): ...
class Exchange: def __init__(self, name): self.name = name self.market_bases = {'BTC', 'ETH', 'USDT'} self.coins = self.get_all_coin_balance() self.dontTouch = {'XRP', 'XEM', 'BTC', 'DOGE', 'SC', 'NEO', 'ZEC', 'BTG', 'MONA', 'WINGS', 'USDT', 'IOTA', 'EOS', 'QTUM', 'ADA', 'XLM', 'LSK'...
class Exchange: def __init__(self, name): self.name = name self.market_bases = {'BTC', 'ETH', 'USDT'} self.coins = self.get_all_coin_balance() self.dontTouch = {'XRP', 'XEM', 'BTC', 'DOGE', 'SC', 'NEO', 'ZEC', 'BTG', 'MONA', 'WINGS', 'USDT', 'IOTA', 'EOS', 'QTUM', 'ADA', 'XLM', 'LSK...
CELLMAP_WIDTH = 200 CELLMAP_HEIGHT = 200 SCREEN_WIDTH = 1200 SCREEN_HEIGHT = 1200 CELL_WIDTH = SCREEN_WIDTH / CELLMAP_WIDTH CELL_HEIGHT = SCREEN_HEIGHT / CELLMAP_HEIGHT FILL_CELL = 0 SHOW_QUADTREE = True BLACK = (0, 0, 0) WHITE = (255, 255, 255) BLUE = (0, 0, 255) RANDOM_CHANCE = 0.0625
cellmap_width = 200 cellmap_height = 200 screen_width = 1200 screen_height = 1200 cell_width = SCREEN_WIDTH / CELLMAP_WIDTH cell_height = SCREEN_HEIGHT / CELLMAP_HEIGHT fill_cell = 0 show_quadtree = True black = (0, 0, 0) white = (255, 255, 255) blue = (0, 0, 255) random_chance = 0.0625
# This is the output of analyzeImage.py (each value indicates a RGB color) myScreenshot = """ 0 4 264 267 527 530 789 66328 66588 66591 66849 132388 132647 132650 132908 198447 198706 198708 264503 264505 330299 330557 330560 396354 3966...
my_screenshot = '\n 0 4 264 267 527 530 789 66328\n 66588 66591 66849 132388 132647 132650 132908 198447\n 198706 198708 264503 264505 330299 330557 330560 396354\n 396612 462150 462408 527946 528204 593998 594000 659794\n 66...
#!/usr/bin/env python3 inversions = 0 def count_inversions(input): _ = merge_sort(input) return inversions def merge_sort(input): if len(input) <= 1: return input mid = len(input) // 2 left = input[:mid] right = input[mid:] left = merge_sort(left) right = merge_sort(right)...
inversions = 0 def count_inversions(input): _ = merge_sort(input) return inversions def merge_sort(input): if len(input) <= 1: return input mid = len(input) // 2 left = input[:mid] right = input[mid:] left = merge_sort(left) right = merge_sort(right) return merge(left, righ...
test = { 'name': 'q3a', 'points': 1, 'suites': [ { 'cases': [ { 'code': '>>> diabetes_2d.shape\n' '(442, 2)', 'hidden': False, 'locked': False}, ...
test = {'name': 'q3a', 'points': 1, 'suites': [{'cases': [{'code': '>>> diabetes_2d.shape\n(442, 2)', 'hidden': False, 'locked': False}, {'code': '>>> -0.10 < np.sum(diabetes_2d[0]) < 0\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> np.isclose(0, np.sum(diabetes_2d))\nTrue', 'hidden': False, 'locked': False}]...
def binary_diagnostic(input): numberLength = (len(input[0])) gammaRate = '' for col in range(numberLength): ones = 0 for line in input: if line[col] == '1': ones += 1 else: ones -= 1 gammaRate += '1' if ones >= 0 else '0' ...
def binary_diagnostic(input): number_length = len(input[0]) gamma_rate = '' for col in range(numberLength): ones = 0 for line in input: if line[col] == '1': ones += 1 else: ones -= 1 gamma_rate += '1' if ones >= 0 else '0' g...
def test(func, verbose=True): """ Tests a sort function by comparing it to Python's builtin 'Timsort.' """ tests = [ [5, 7, 1, 9, 89, 15, 14, 2], [False, True, False, True, False, True, True, True, False, False], ['z', 'x', 'u', 'i', 'o', 'z', 'r', 'a', 'b'], ['grape', '...
def test(func, verbose=True): """ Tests a sort function by comparing it to Python's builtin 'Timsort.' """ tests = [[5, 7, 1, 9, 89, 15, 14, 2], [False, True, False, True, False, True, True, True, False, False], ['z', 'x', 'u', 'i', 'o', 'z', 'r', 'a', 'b'], ['grape', 'orange', 'apple', 'zebra'], [1.0, 1.1,...
def maxmin(A): if len(A) == 1: return A[0], A[0] elif len(A) == 2: return max(A[0], A[1]), min(A[0], A[1]) maxl, minl = maxmin(A[:int(len(A) / 2)]) maxr, minr = maxmin(A[int(len(A) / 2):]) return max(maxl, maxr), min(minl, minr) class Solution: # @param A : list of integers ...
def maxmin(A): if len(A) == 1: return (A[0], A[0]) elif len(A) == 2: return (max(A[0], A[1]), min(A[0], A[1])) (maxl, minl) = maxmin(A[:int(len(A) / 2)]) (maxr, minr) = maxmin(A[int(len(A) / 2):]) return (max(maxl, maxr), min(minl, minr)) class Solution: def solve(self, A): ...
#!/usr/bin/env python class DocumentProperty(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.""" def __init__(self): """ Attributes: swaggerTypes (dict): The key is attribute name and the value is attribute typ...
class Documentproperty(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.""" def __init__(self): """ Attributes: swaggerTypes (dict): The key is attribute name and the value is attribute type. attributeMa...
class StartTimeVariables: @classmethod def Checklist(cls): cls.INTAG = None return cls
class Starttimevariables: @classmethod def checklist(cls): cls.INTAG = None return cls
class Encoder(): def encode_char(self, char, order): return char def _to_index(self, char): return ord(char) - ord('A') def _to_char(self, index): return chr(index + ord('A'))
class Encoder: def encode_char(self, char, order): return char def _to_index(self, char): return ord(char) - ord('A') def _to_char(self, index): return chr(index + ord('A'))
# ----------------------Cutter Model Error Messages--------------------------- NEG_OVERLAP_LAST_PROP_MESSAGE = \ "the overlap or last segment proportion should not be negative" LARGER_SEG_SIZE_MESSAGE = \ "the segment size should be larger than the overlap size" INVALID_CUTTING_TYPE_MESSAGE = "the cutting type ...
neg_overlap_last_prop_message = 'the overlap or last segment proportion should not be negative' larger_seg_size_message = 'the segment size should be larger than the overlap size' invalid_cutting_type_message = 'the cutting type should be letters, lines, number, words or milestone' empty_milestone_message = 'the milest...
base = 40 altura = 47 print('area del cuadrado =', base*altura)
base = 40 altura = 47 print('area del cuadrado =', base * altura)
def main(): K = input() D = int(input()) L = len(K) dp = [[[0, 0] for _ in range(D)] for _ in range(L+1)] mod = 10 ** 9 + 7 dp[0][0][1] = 1 for i in range(L): d = int(K[i]) for j in range(D): for k in range(10): dp[i+1][(j + k) % D][0] += dp[i][j][...
def main(): k = input() d = int(input()) l = len(K) dp = [[[0, 0] for _ in range(D)] for _ in range(L + 1)] mod = 10 ** 9 + 7 dp[0][0][1] = 1 for i in range(L): d = int(K[i]) for j in range(D): for k in range(10): dp[i + 1][(j + k) % D][0] += dp[i]...
# Twitter error codes TWITTER_PAGE_DOES_NOT_EXISTS_ERROR = 34 TWITTER_USER_NOT_FOUND_ERROR = 50 TWITTER_TWEET_NOT_FOUND_ERROR = 144 TWITTER_DELETE_OTHER_USER_TWEET = 183 TWITTER_ACCOUNT_SUSPENDED_ERROR = 64 TWITTER_USER_IS_NOT_LIST_MEMBER_SUBSCRIBER = 109 TWITTER_AUTOMATED_REQUEST_ERROR = 226 TWITTER_OVER_CAPACITY_ERRO...
twitter_page_does_not_exists_error = 34 twitter_user_not_found_error = 50 twitter_tweet_not_found_error = 144 twitter_delete_other_user_tweet = 183 twitter_account_suspended_error = 64 twitter_user_is_not_list_member_subscriber = 109 twitter_automated_request_error = 226 twitter_over_capacity_error = 130 twitter_daily_...
with open('./inputs/04.txt') as f: passphrases = f.readlines() first = 0 second = 0 are_only_distinct = lambda x: len(x) == len(set(x)) for line in passphrases: words = line.split() first += are_only_distinct(words) anagrams = [''.join(sorted(word)) for word in words] second += are_only_distinct(...
with open('./inputs/04.txt') as f: passphrases = f.readlines() first = 0 second = 0 are_only_distinct = lambda x: len(x) == len(set(x)) for line in passphrases: words = line.split() first += are_only_distinct(words) anagrams = [''.join(sorted(word)) for word in words] second += are_only_distinct(ana...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def sumNumbers(self, root: TreeNode) -> int: res = [] num = root.val val=0 s...
class Solution: def sum_numbers(self, root: TreeNode) -> int: res = [] num = root.val val = 0 self.helper(root, val, res) return sum(res) def helper(self, root, val, res): if not root: return if not root.left and (not root.right): ...
def cart_prod(*sets): result = [[]] set_list = list(sets) for s in set_list: result = [x+[y] for x in result for y in s] if (len(set_list) > 0): return {tuple(prod) for prod in result} else: return set(tuple()) A = {1} B = {1, 2} C = {1, 2, 3} X = ...
def cart_prod(*sets): result = [[]] set_list = list(sets) for s in set_list: result = [x + [y] for x in result for y in s] if len(set_list) > 0: return {tuple(prod) for prod in result} else: return set(tuple()) a = {1} b = {1, 2} c = {1, 2, 3} x = {'a'} y = {'a', 'b'} z = {'a...
class Solution: def getRow(self, rowIndex): def n_c_r(n, r): numerator = 1 for i in xrange(1, r + 1): numerator *= n - (i - 1) numerator /= i return numerator return [n_c_r(rowIndex, i) for i in xrange(rowIndex + 1)]
class Solution: def get_row(self, rowIndex): def n_c_r(n, r): numerator = 1 for i in xrange(1, r + 1): numerator *= n - (i - 1) numerator /= i return numerator return [n_c_r(rowIndex, i) for i in xrange(rowIndex + 1)]
class Solution: def removeOuterParentheses(self, S: str) -> str: stack = [] is_assemble = False assembler = "" result = "" for p in S: if p == "(": if is_assemble: assembler += p if not stack: ...
class Solution: def remove_outer_parentheses(self, S: str) -> str: stack = [] is_assemble = False assembler = '' result = '' for p in S: if p == '(': if is_assemble: assembler += p if not stack: ...
message = "Hello python world" print(message) message = "Hello python crash course world" print(message)
message = 'Hello python world' print(message) message = 'Hello python crash course world' print(message)
class Solution: def singleNumber(self, nums: List[int]) -> int: d = {} for n in nums: if n in d: d[n] += 1 else: d[n] = 1 for k in d: if d[k] == 1: return k
class Solution: def single_number(self, nums: List[int]) -> int: d = {} for n in nums: if n in d: d[n] += 1 else: d[n] = 1 for k in d: if d[k] == 1: return k
def postorder(tree): if tree != None: postorder(tree.getLeftChild()) postorder(tree.getRightChild()) print(tree.getRootVal())
def postorder(tree): if tree != None: postorder(tree.getLeftChild()) postorder(tree.getRightChild()) print(tree.getRootVal())
# Set random seed np.random.seed(0) # Generate data true_mean = 5 true_standard_dev = 1 n_samples = 1000 x = np.random.normal(true_mean, true_standard_dev, size = (n_samples,)) # We define the function to optimise, the negative log likelihood def negLogLike(theta): """ Function for computing the negative log-likel...
np.random.seed(0) true_mean = 5 true_standard_dev = 1 n_samples = 1000 x = np.random.normal(true_mean, true_standard_dev, size=(n_samples,)) def neg_log_like(theta): """ Function for computing the negative log-likelihood given the observed data and given parameter values stored in theta. Args: theta (...
__version__ = "0.8.10" __format_version__ = 3 __format_version_mcool__ = 2 __format_version_scool__ = 1
__version__ = '0.8.10' __format_version__ = 3 __format_version_mcool__ = 2 __format_version_scool__ = 1
class Solution: def maxIncreaseKeepingSkyline(self, grid: List[List[int]]) -> int: row_max = list(map(max, grid)) col_max = list(map(max, zip(*grid))) return sum( min(row_max[i], col_max[j]) - val for i, row in enumerate(grid) for j, val in enumerate(row)...
class Solution: def max_increase_keeping_skyline(self, grid: List[List[int]]) -> int: row_max = list(map(max, grid)) col_max = list(map(max, zip(*grid))) return sum((min(row_max[i], col_max[j]) - val for (i, row) in enumerate(grid) for (j, val) in enumerate(row)))
# hw08_02 for i in range(1, 9+1, 2): print("{:^9}".format("^"*i)) ''' ^ ^^^ ^^^^^ ^^^^^^^ ^^^^^^^^^ '''
for i in range(1, 9 + 1, 2): print('{:^9}'.format('^' * i)) '\n\n ^\n ^^^\n ^^^^^\n ^^^^^^^\n^^^^^^^^^\n\n'
# # @lc app=leetcode id=430 lang=python3 # # [430] Flatten a Multilevel Doubly Linked List # """ # Definition for a Node. class Node: def __init__(self, val, prev, next, child): self.val = val self.prev = prev self.next = next self.child = child """ class Node: def __init__(sel...
""" # Definition for a Node. class Node: def __init__(self, val, prev, next, child): self.val = val self.prev = prev self.next = next self.child = child """ class Node: def __init__(self, val, prev, next, child): self.val = val self.prev = prev self.next...
# http://www.codewars.com/kata/55c933c115a8c426ac000082/ def eval_object(v): return {"+": v['a'] + v['b'], "-": v['a'] - v['b'], "/": v['a'] / v['b'], "*": v['a'] * v['b'], "%": v['a'] % v['b'], "**": v['a'] ** v['b']}.get(v.get('operation', 1))
def eval_object(v): return {'+': v['a'] + v['b'], '-': v['a'] - v['b'], '/': v['a'] / v['b'], '*': v['a'] * v['b'], '%': v['a'] % v['b'], '**': v['a'] ** v['b']}.get(v.get('operation', 1))
def oddNumbers(l, r): result = [] for i in range(l, r + 1): if i % 2 == 1: result.append(i) return result
def odd_numbers(l, r): result = [] for i in range(l, r + 1): if i % 2 == 1: result.append(i) return result
description = 'Lambda power supplies' group = 'optional' tango_base = 'tango://172.28.77.81:10000/antares/' devices = dict( I_lambda1 = device('nicos.devices.entangle.PowerSupply', description = 'Current 1', tangodevice = tango_base + 'lambda1/current', precision = 0.04, timeout = ...
description = 'Lambda power supplies' group = 'optional' tango_base = 'tango://172.28.77.81:10000/antares/' devices = dict(I_lambda1=device('nicos.devices.entangle.PowerSupply', description='Current 1', tangodevice=tango_base + 'lambda1/current', precision=0.04, timeout=10))
def solution(): def integers(): num = 1 while True: yield num num += 1 def halves(): for i in integers(): yield i / 2 def take(n, seq): take_list = [] for num in seq: if len(take_list) == n: return take...
def solution(): def integers(): num = 1 while True: yield num num += 1 def halves(): for i in integers(): yield (i / 2) def take(n, seq): take_list = [] for num in seq: if len(take_list) == n: return t...
def longest_consecutive_subsequence(input_list): # TODO: Write longest consecutive subsequence solution input_list.sort() # iterate over the list and store element in a suitable data structure subseq_indexes = {} index = 0 for el in input_list: if index not in subseq_indexes: ...
def longest_consecutive_subsequence(input_list): input_list.sort() subseq_indexes = {} index = 0 for el in input_list: if index not in subseq_indexes: subseq_indexes[index] = [el] elif subseq_indexes[index][-1] + 1 == el: subseq_indexes[index].append(el) e...
"""DNA na RNA""" DNA_RNA = { 'G':'C', 'C':'G', 'T':'A', 'A':'U', } def transcribe_rna(dna): rna = '' for i in dna: rna += DNA_RNA[i] return rna def validate_dna(dna): return set(dna).issubset(set('GCTA')) def main(): while True: my_dna = input('Type DNA sequence:...
"""DNA na RNA""" dna_rna = {'G': 'C', 'C': 'G', 'T': 'A', 'A': 'U'} def transcribe_rna(dna): rna = '' for i in dna: rna += DNA_RNA[i] return rna def validate_dna(dna): return set(dna).issubset(set('GCTA')) def main(): while True: my_dna = input('Type DNA sequence: ') if no...
def value_2_class(value): if value < 0.33: return [1, 0, 0] elif 0.33 <= value < 0.66: return [0, 1, 0] else: # I know that he is not necessary the else but I like it return [0, 0, 1]
def value_2_class(value): if value < 0.33: return [1, 0, 0] elif 0.33 <= value < 0.66: return [0, 1, 0] else: return [0, 0, 1]
lista = [] maior = 0 menor = 9 ** 9 maiorn = list() menorn = list() while True: pessoa = [str(input('Nome: ')), float(input('Peso: '))] lista.append(pessoa[:]) co = str(input('Continuar?[S/N]: ')) if co in 'Nn': break for l in lista: if l[1] >= maior: if l[1] > maior and l != lista[...
lista = [] maior = 0 menor = 9 ** 9 maiorn = list() menorn = list() while True: pessoa = [str(input('Nome: ')), float(input('Peso: '))] lista.append(pessoa[:]) co = str(input('Continuar?[S/N]: ')) if co in 'Nn': break for l in lista: if l[1] >= maior: if l[1] > maior and l != lista[0...
# all jobs for letters created via the api must have this filename LETTER_API_FILENAME = 'letter submitted via api' LETTER_TEST_API_FILENAME = 'test letter submitted via api' # S3 tags class Retention: KEY = 'retention' ONE_WEEK = 'ONE_WEEK'
letter_api_filename = 'letter submitted via api' letter_test_api_filename = 'test letter submitted via api' class Retention: key = 'retention' one_week = 'ONE_WEEK'
class Queue: def __init__(self, number_of_queues, array_lenght): self.number_of_queues = number_of_queues self.array_length = array_lenght self.array = [-1] * array_lenght self.front = [-1] * number_of_queues self.back = [-1] * number_of_queues self.next_array = list(...
class Queue: def __init__(self, number_of_queues, array_lenght): self.number_of_queues = number_of_queues self.array_length = array_lenght self.array = [-1] * array_lenght self.front = [-1] * number_of_queues self.back = [-1] * number_of_queues self.next_array = list...
hora = float(input('INFORME AS HORAS POR FAVOR: ')) if hora <=11: print ('BOM DIA!!!') if hora >= 12 and hora <= 17: print ('BOA TARDE!!!') if hora >= 18 and hora <= 23: print ('BOA NOITE!!!') print ('OBRIGADO, VOLTE SEMPRE!!!')
hora = float(input('INFORME AS HORAS POR FAVOR: ')) if hora <= 11: print('BOM DIA!!!') if hora >= 12 and hora <= 17: print('BOA TARDE!!!') if hora >= 18 and hora <= 23: print('BOA NOITE!!!') print('OBRIGADO, VOLTE SEMPRE!!!')
# Your Fitbit access credentials, which must be requested from Fitbit. # You must provide these in your project's settings. FITAPP_CONSUMER_KEY = None FITAPP_CONSUMER_SECRET = None # The verification code for verifying subscriber endpoints FITAPP_VERIFICATION_CODE = None # Where to redirect to after Fitbit authentica...
fitapp_consumer_key = None fitapp_consumer_secret = None fitapp_verification_code = None fitapp_login_redirect = '/' fitapp_logout_redirect = '/' fitapp_subscribe = False fitapp_subscriptions = None fitapp_historical_init_delay = 10 fitapp_between_delay = 5 fitapp_get_intraday = False fitapp_verification_code = None fi...
# -*- coding: utf-8 -*- def main(): s = input()[::-1] w_count = 0 ans = 0 for si in s: if si == 'W': w_count += 1 else: ans += w_count print(ans) if __name__ == '__main__': main()
def main(): s = input()[::-1] w_count = 0 ans = 0 for si in s: if si == 'W': w_count += 1 else: ans += w_count print(ans) if __name__ == '__main__': main()
src = ['board.c'] component = aos_board_component('board_mk3060', 'moc108', src) aos_global_config.add_ld_files('memory.ld.S') build_types="" linux_only_targets="athostapp blink coapapp helloworld http2app id2_app itls_app linkkit_gateway linkkitapp meshapp modbus_demo mqttapp otaapp prov_app tls udataapp udevap...
src = ['board.c'] component = aos_board_component('board_mk3060', 'moc108', src) aos_global_config.add_ld_files('memory.ld.S') build_types = '' linux_only_targets = 'athostapp blink coapapp helloworld http2app id2_app itls_app linkkit_gateway linkkitapp meshapp modbus_demo mqttapp otaapp prov_app tls udataapp udevapp u...
class Config(object): pass class Production(Config): ELASTICSEARCH_HOST = 'elasticsearch' JANUS_HOST = 'janus' class Development(Config): ELASTICSEARCH_HOST = '127.0.0.1' JANUS_HOST = '127.0.0.1'
class Config(object): pass class Production(Config): elasticsearch_host = 'elasticsearch' janus_host = 'janus' class Development(Config): elasticsearch_host = '127.0.0.1' janus_host = '127.0.0.1'
string = input() vowels = {'a', 'e', 'i', 'o', 'u'} v = sum(1 for char in string if char.lower() in vowels) print(v, len(string)-v)
string = input() vowels = {'a', 'e', 'i', 'o', 'u'} v = sum((1 for char in string if char.lower() in vowels)) print(v, len(string) - v)
#Copyright ReportLab Europe Ltd. 2000-2016 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/enums.py __version__='3.3.0' __doc__=""" Container for constants. Hardly used! """ TA_LEFT = 0 TA_CENTER = 1 TA_RIGHT = 2 TA_JUSTIFY = 4
__version__ = '3.3.0' __doc__ = '\nContainer for constants. Hardly used!\n' ta_left = 0 ta_center = 1 ta_right = 2 ta_justify = 4
_base_ = [ '../../_base_/models/convnext/convnext-tiny.py', './dataset.py', './schedule.py', './default_runtime.py', ] custom_hooks = [dict(type='EMAHook', momentum=4e-5, priority='ABOVE_NORMAL')] model = dict( type='TextureMixClassifier', style_weight=1.5, content_weight=0.5, mix_lr=0...
_base_ = ['../../_base_/models/convnext/convnext-tiny.py', './dataset.py', './schedule.py', './default_runtime.py'] custom_hooks = [dict(type='EMAHook', momentum=4e-05, priority='ABOVE_NORMAL')] model = dict(type='TextureMixClassifier', style_weight=1.5, content_weight=0.5, mix_lr=0.03, mix_iter=15, backbone=dict(type=...
N = int(input()) X = input().split() for i in range(N): X[i] = int(X[i]) minimum = min(X) result = X.index(minimum) + 1 print(result)
n = int(input()) x = input().split() for i in range(N): X[i] = int(X[i]) minimum = min(X) result = X.index(minimum) + 1 print(result)
def generate(event, context): print(event) response = { "statusCode": 200, "body": "this worked" } return response
def generate(event, context): print(event) response = {'statusCode': 200, 'body': 'this worked'} return response
__title__ = 'Voice Collab' __description__ = "Let's harness the power of voice to collaborate and interact with your code and the people you work with" __email__ = "santhoshkdhana@gmail.com" __author__ = 'Santhosh Kumar' __github__ = 'https://github.com/Santhoshkumard11/Voice-Collab' __license__ = 'MIT' __copyright__ =...
__title__ = 'Voice Collab' __description__ = "Let's harness the power of voice to collaborate and interact with your code and the people you work with" __email__ = 'santhoshkdhana@gmail.com' __author__ = 'Santhosh Kumar' __github__ = 'https://github.com/Santhoshkumard11/Voice-Collab' __license__ = 'MIT' __copyright__ =...
# IBM Preliminary Test direction,floor,floor_requests,z = input(),int(input()),sorted(list(map(int,input().split())),reverse=True),0 if(floor_requests[-1]>=0 and floor_requests[0]<=15 and (direction=="UP" or direction=="DN")): while(floor_requests[z]>floor): z+=1 print(*(floor_requests[:z][::-1]+floor_request...
(direction, floor, floor_requests, z) = (input(), int(input()), sorted(list(map(int, input().split())), reverse=True), 0) if floor_requests[-1] >= 0 and floor_requests[0] <= 15 and (direction == 'UP' or direction == 'DN'): while floor_requests[z] > floor: z += 1 print(*floor_requests[:z][::-1] + floor_r...
""" Bar configuration constants """ # # Colours # BG_COL = "#1b1b1b" BG_SEC_COL = "#262626" FG_COL = "#9e9e9e" FG_SEC_COL = "#616161" HL_COL = "#7cafc2" # # Placeholder space # BATTERY_PLACEHOLDER = " " WORKSPACE_PLACEHOLDER = " " CLOCK_PLACEHOLDER = " " VOLUME_PLACEHOLDER = " " GENERAL_PLACEHOLDER = " ...
""" Bar configuration constants """ bg_col = '#1b1b1b' bg_sec_col = '#262626' fg_col = '#9e9e9e' fg_sec_col = '#616161' hl_col = '#7cafc2' battery_placeholder = ' ' workspace_placeholder = ' ' clock_placeholder = ' ' volume_placeholder = ' ' general_placeholder = ' ' text_font = 'DroidSansMono-8' icon_font...
""" This file will generate output that will be in error because the name of this module (tests) clashes with the @tests annotation. """ def this_wont_work(): pass
""" This file will generate output that will be in error because the name of this module (tests) clashes with the @tests annotation. """ def this_wont_work(): pass
""" A python file must contain a prefix to be detected by pytest as a test file. You can run the test using: pytest tests/must_have_a_prefx.py To allow pytest to find this file add the test_ prefix, e.g.: test_basics.py once done you can run it using: pytest test.py """ def test_assertions(): """ Most ...
""" A python file must contain a prefix to be detected by pytest as a test file. You can run the test using: pytest tests/must_have_a_prefx.py To allow pytest to find this file add the test_ prefix, e.g.: test_basics.py once done you can run it using: pytest test.py """ def test_assertions(): """ Most o...
def compute_single_neuron_isis(spike_times, neuron_idx): """Compute a vector of ISIs for a single neuron given spike times. Args: spike_times (list of 1D arrays): Spike time dataset, with the first dimension corresponding to different neurons. neuron_idx (int): Index of the unit to compute ISIs for. ...
def compute_single_neuron_isis(spike_times, neuron_idx): """Compute a vector of ISIs for a single neuron given spike times. Args: spike_times (list of 1D arrays): Spike time dataset, with the first dimension corresponding to different neurons. neuron_idx (int): Index of the unit to compute ISIs for...
sequence = input("Enter your sequence: ") sequence_list = sequence[1:len(sequence)-1].split(", ") subset_sum = False for element in sequence_list: for other in sequence_list: if int(element) + int(other) == 0: subset_sum = True print(str(subset_sum))
sequence = input('Enter your sequence: ') sequence_list = sequence[1:len(sequence) - 1].split(', ') subset_sum = False for element in sequence_list: for other in sequence_list: if int(element) + int(other) == 0: subset_sum = True print(str(subset_sum))
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"get_py_files": "01_nbutils.ipynb", "get_cells_one_nb": "01_nbutils.ipynb", "write_code_cell": "01_nbutils.ipynb", "py_to_nb": "01_nbutils.ipynb", "get_module_text": "01_nb...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'get_py_files': '01_nbutils.ipynb', 'get_cells_one_nb': '01_nbutils.ipynb', 'write_code_cell': '01_nbutils.ipynb', 'py_to_nb': '01_nbutils.ipynb', 'get_module_text': '01_nbutils.ipynb', 'write_module_text': '01_nbutils.ipynb', 'clear_all_modules': '...
# # PySNMP MIB module MITEL-DHCP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MITEL-DHCP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:02:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ...
def setup(): print(10*'=' + ' Notas SIGAA setup ' + 10*'=') username = str(input('SIGAA username: ')) password = str(input('SIGAA password: ')) webdriver_path = str(input('Webdriver path (always use / and, if in the same dir, use ./): ')) csv_output = str(input('CSV output path (always use / and, i...
def setup(): print(10 * '=' + ' Notas SIGAA setup ' + 10 * '=') username = str(input('SIGAA username: ')) password = str(input('SIGAA password: ')) webdriver_path = str(input('Webdriver path (always use / and, if in the same dir, use ./): ')) csv_output = str(input('CSV output path (always use / and...
ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" print("*** Caesar Cipher ***") shift = int(input("Please enter a number from -26 to 26: ")) if input("Press 'd' to decipher, anything else to encipher: ").lower() == "d": msg = input("Please enter your message: ") decrypted = [] for char in msg: index = ALP...
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' print('*** Caesar Cipher ***') shift = int(input('Please enter a number from -26 to 26: ')) if input("Press 'd' to decipher, anything else to encipher: ").lower() == 'd': msg = input('Please enter your message: ') decrypted = [] for char in msg: index = ALPHAB...
"""This is where we store the created dicts of callbacks for global and template execution""" REGISTERED_GLOBAL_BEFORE_CALLBACKS = {} REGISTERED_GLOBAL_AFTER_CALLBACKS = {} REGISTERED_TEMPLATE_AFTER_CALLBACKS = {} REGISTERED_TEMPLATE_BEFORE_CALLBACKS = {} callback_kinds = { "GLOBAL_BEFORE": REGISTERED_GLOBAL_BEF...
"""This is where we store the created dicts of callbacks for global and template execution""" registered_global_before_callbacks = {} registered_global_after_callbacks = {} registered_template_after_callbacks = {} registered_template_before_callbacks = {} callback_kinds = {'GLOBAL_BEFORE': REGISTERED_GLOBAL_BEFORE_CALL...
_CALCULATIONS_GRAPHVIZSHAPE = "ellipse" def _raise(e): raise e
_calculations_graphvizshape = 'ellipse' def _raise(e): raise e
def preprocess_data(_data): nul, shape = _data.shape[0], _data.shape[1:] print(nul) print(shape) _data = _data.reshape(nul, shape[0], shape[1], 1) _data = _data.astype('float32') _data /= 255 return _data
def preprocess_data(_data): (nul, shape) = (_data.shape[0], _data.shape[1:]) print(nul) print(shape) _data = _data.reshape(nul, shape[0], shape[1], 1) _data = _data.astype('float32') _data /= 255 return _data
class NotFound(Exception): """The requested data was not found during a call to .get().""" pass
class Notfound(Exception): """The requested data was not found during a call to .get().""" pass
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def bstFromPreorder(self, preorder: List[int]) -> TreeNode: def rectree(orderlist): if len(orderlist) == 0: ...
class Solution: def bst_from_preorder(self, preorder: List[int]) -> TreeNode: def rectree(orderlist): if len(orderlist) == 0: return None if len(orderlist) == 1: return tree_node(orderlist[0]) left = list() right = list() ...
class TypeLibFuncAttribute(Attribute,_Attribute): """ Contains the System.Runtime.InteropServices.FUNCFLAGS that were originally imported for this method from the COM type library. TypeLibFuncAttribute(flags: TypeLibFuncFlags) TypeLibFuncAttribute(flags: Int16) """ def __init__(self,*args): """ ...
class Typelibfuncattribute(Attribute, _Attribute): """ Contains the System.Runtime.InteropServices.FUNCFLAGS that were originally imported for this method from the COM type library. TypeLibFuncAttribute(flags: TypeLibFuncFlags) TypeLibFuncAttribute(flags: Int16) """ def __init__(self, *args): ...
class IcmpException(OSError): pass class BufferTooSmall(IcmpException): pass class DestinationNetUnreachable(IcmpException): pass class DestinationHostUnreachable(IcmpException): pass class DestinationProtocolUnreachable(IcmpException): pass class DestinationPortUnreachable(IcmpException): ...
class Icmpexception(OSError): pass class Buffertoosmall(IcmpException): pass class Destinationnetunreachable(IcmpException): pass class Destinationhostunreachable(IcmpException): pass class Destinationprotocolunreachable(IcmpException): pass class Destinationportunreachable(IcmpException): ...
test = { 'name': 'has-cycle', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (has-cycle s) #f scm> (has-cycle cycle) #t scm> (has-cycle cycle-within) #t """, 'hidden': False, 'locked': ...
test = {'name': 'has-cycle', 'points': 1, 'suites': [{'cases': [{'code': '\n scm> (has-cycle s)\n #f\n scm> (has-cycle cycle)\n #t\n scm> (has-cycle cycle-within)\n #t\n ', 'hidden': False, 'locked': False}], 'scored': True, 'setup': "\n scm> (load 'hw...
for x in range(6, 0, -1): if (x % 2 != 0): ctrl = x + 1 else: ctrl = x for y in range(0, ctrl): print("*", end="") print()
for x in range(6, 0, -1): if x % 2 != 0: ctrl = x + 1 else: ctrl = x for y in range(0, ctrl): print('*', end='') print()
day_of_week = input() work_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'] vacation_days = ['Saturday', 'Sunday'] if day_of_week in (work_days): print('Working day') elif day_of_week in (vacation_days): print('Weekend') else: print('Error')
day_of_week = input() work_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'] vacation_days = ['Saturday', 'Sunday'] if day_of_week in work_days: print('Working day') elif day_of_week in vacation_days: print('Weekend') else: print('Error')
x = 10 y = 2 a = x*y print(a) b = 12
x = 10 y = 2 a = x * y print(a) b = 12
# pma.py --maxTransitions 100 --output synchronous_graph synchronous # 4 states, 4 transitions, 1 accepting states, 0 unsafe states, 0 finished and 0 deadend states # actions here are just labels, but must be symbols with __name__ attribute def send_return(): pass def send_call(): pass def recv_call(): pass def recv...
def send_return(): pass def send_call(): pass def recv_call(): pass def recv_return(): pass states = {0: {'synchronous': 0}, 1: {'synchronous': 1}, 2: {'synchronous': 2}, 3: {'synchronous': 3}} initial = 0 accepting = [0] unsafe = [] frontier = [] finished = [] deadend = [] runstarts = [0] graph = ((...
# -*- coding: utf-8 -*- """ Created on Thu Jul 15 11:46:46 2021 @author: Easin """ in1 = input() #flag = True for elem in range(len(in1)): if in1[elem] == "H" or in1[elem] == "Q" or in1[elem] == "9": flag = False break else: flag = True if flag == False: print("YES"...
""" Created on Thu Jul 15 11:46:46 2021 @author: Easin """ in1 = input() for elem in range(len(in1)): if in1[elem] == 'H' or in1[elem] == 'Q' or in1[elem] == '9': flag = False break else: flag = True if flag == False: print('YES') else: print('NO')
fr = open('cora/features.features') a = fr.readlines() fr.close() fw = open('cora/features.txt','w') for i in range(len(a)): s = a[i].strip().split(' ') fw.write(s[0]+'\t') for j in range(1,len(s)): if (s[j]=='0.0'): fw.write('0\t') else: fw.write('1\t') fw.write('\n') fw.close()
fr = open('cora/features.features') a = fr.readlines() fr.close() fw = open('cora/features.txt', 'w') for i in range(len(a)): s = a[i].strip().split(' ') fw.write(s[0] + '\t') for j in range(1, len(s)): if s[j] == '0.0': fw.write('0\t') else: fw.write('1\t') fw.wr...
""" [2017-03-17] Challenge #306 [Hard] Generate Strings to Match a Regular Expression https://www.reddit.com/r/dailyprogrammer/comments/5zxebw/20170317_challenge_306_hard_generate_strings_to/ # Description Most everyone who programs using general purpose languages is familiar with regular expressions, which enable yo...
""" [2017-03-17] Challenge #306 [Hard] Generate Strings to Match a Regular Expression https://www.reddit.com/r/dailyprogrammer/comments/5zxebw/20170317_challenge_306_hard_generate_strings_to/ # Description Most everyone who programs using general purpose languages is familiar with regular expressions, which enable yo...
''' While the very latest in 1518 alchemical technology might have solved their problem eventually, you can do better. You scan the chemical composition of the suit's material and discover that it is formed by extremely long polymers. The polymer is formed by smaller units which, when triggered, react with each other ...
""" While the very latest in 1518 alchemical technology might have solved their problem eventually, you can do better. You scan the chemical composition of the suit's material and discover that it is formed by extremely long polymers. The polymer is formed by smaller units which, when triggered, react with each other ...
""" A collection of command-line tools for building encoded update.xml files. """ class InfoFile: update_file = "" version = None checksum = None # A multi-line HTML document describing the changes between # this version and the previous version description = "" @classmethod def from...
""" A collection of command-line tools for building encoded update.xml files. """ class Infofile: update_file = '' version = None checksum = None description = '' @classmethod def from_info_file(filename): return def files2xml(filenames): """ Given a list of filenames, extracts th...
''' # 977. [Squares of a Sorted Array](https://leetcode.com/problems/squares-of-a-sorted-array/) Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order. Example 1: Input: [-4,-1,0,3,10] Output: [0,1,9,16,100] Example 2: Input: ...
""" # 977. [Squares of a Sorted Array](https://leetcode.com/problems/squares-of-a-sorted-array/) Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order. Example 1: Input: [-4,-1,0,3,10] Output: [0,1,9,16,100] Example 2: Input: ...
""" The permissions of a file in a Linux system are split into three sets of three permissions: read, write, and execute for the owner, group, and others. Each of the three values can be expressed as an octal number summing each permission, with 4 corresponding to read, 2 to write, and 1 to execute. Or it can be writt...
""" The permissions of a file in a Linux system are split into three sets of three permissions: read, write, and execute for the owner, group, and others. Each of the three values can be expressed as an octal number summing each permission, with 4 corresponding to read, 2 to write, and 1 to execute. Or it can be writte...
__all__ = ["decoder"] def decoder(x: list) -> int: x = int(str("0b" + "".join(reversed(list(map(str, x))))), 2) return x
__all__ = ['decoder'] def decoder(x: list) -> int: x = int(str('0b' + ''.join(reversed(list(map(str, x))))), 2) return x
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def repos(): http_archive( name = "vim", urls = [ "https://github.com/vim/vim/archive/v8.1.1846.tar.gz", ], sha256 = "68de2854199a396aee19fe34c32c02db5784c76c0334d58b510266436c7529bb", ...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def repos(): http_archive(name='vim', urls=['https://github.com/vim/vim/archive/v8.1.1846.tar.gz'], sha256='68de2854199a396aee19fe34c32c02db5784c76c0334d58b510266436c7529bb', strip_prefix='vim-8.1.1846', build_file=str(label('//app-editor:vim.BUI...