content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
DATA_FOLDER = "./data" DATA_PATH = DATA_FOLDER + "/news_summary_cleaned.csv" EXPORT_DATA_PATH = DATA_FOLDER + "/new_summary_cleaned.csv" PREPROC_DATA_PATH = EXPORT_DATA_PATH
data_folder = './data' data_path = DATA_FOLDER + '/news_summary_cleaned.csv' export_data_path = DATA_FOLDER + '/new_summary_cleaned.csv' preproc_data_path = EXPORT_DATA_PATH
# coding: utf-8 class Solution: """ @param root: The root of binary tree. @return: True if this Binary tree is Balanced, or false. """ def isBalanced(self, root): # write your code here if not root: return True else: if abs(self._isBalanced(root.left)...
class Solution: """ @param root: The root of binary tree. @return: True if this Binary tree is Balanced, or false. """ def is_balanced(self, root): if not root: return True elif abs(self._isBalanced(root.left) - self._isBalanced(root.right)) <= 1: return self...
# This file is part of the pyMOR project (http://www.pymor.org). # Copyright 2013-2016 pyMOR developers and contributors. All rights reserved. # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) """This module contains pure python backports of library features from python >= 3 to 2.7 """ cl...
"""This module contains pure python backports of library features from python >= 3 to 2.7 """ class Abstractclassmethod(classmethod): """ A decorator indicating abstract classmethods. Similar to abstractmethod. Usage:: class C(metaclass=ABCMeta): @abstractclassmethod ...
# -*- coding: utf-8 -* class LearningRateScheduler(object): """ Provides inteface of learning rate scheduler. Note: Do not use this class directly, use one of the sub classes. """ def __init__(self, optimizer, init_lr): self.optimizer = optimizer self.init_lr = init_lr ...
class Learningratescheduler(object): """ Provides inteface of learning rate scheduler. Note: Do not use this class directly, use one of the sub classes. """ def __init__(self, optimizer, init_lr): self.optimizer = optimizer self.init_lr = init_lr def step(self, *args, *...
class BankAccount(): def __init__(self, name, balance): self._name = name self._balance = balance def get_name(self): return self._name def get_balance(self): return self._balance def deposit(self, amount): if amount < 0: print("Deposit amount must ...
class Bankaccount: def __init__(self, name, balance): self._name = name self._balance = balance def get_name(self): return self._name def get_balance(self): return self._balance def deposit(self, amount): if amount < 0: print('Deposit amount must b...
## Advent of Code 2019: Intcode Computer v3 ## https://adventofcode.com/2019 ## Jesse Williams | github.com/vblank182 # **Compatible with Day 5, Part 2** # Changelog: # - Added JIT, JIF, LT, and EQ instructions #~# Opcodes #~# ADD, MUL, IN, OUT, JIT, JIF, LT, EQ = 1, 2, 3, 4, 5, 6, 7, 8 END = 99 #~# Parameter Modes...
(add, mul, in, out, jit, jif, lt, eq) = (1, 2, 3, 4, 5, 6, 7, 8) end = 99 pos = 0 imm = 1 num_params = {1: 3, 2: 3, 3: 1, 4: 1, 5: 2, 6: 2, 7: 3, 8: 3, 99: 0} def load_program(inputFile): """ Loads a program file in "0,1,2,3,..." format and returns a list of integers. """ with open(inputFile) as f: ini...
def hand_string(hand): return " ".join(map(lambda x: str(x), hand)) def hand_sum(hand): hand_copy = list(hand) simple_sum = _simple_sum(hand_copy) if _contains_ace(hand_copy): new_sum = 11 + _simple_sum(hand_copy) if new_sum > 21: return simple_sum else: ...
def hand_string(hand): return ' '.join(map(lambda x: str(x), hand)) def hand_sum(hand): hand_copy = list(hand) simple_sum = _simple_sum(hand_copy) if _contains_ace(hand_copy): new_sum = 11 + _simple_sum(hand_copy) if new_sum > 21: return simple_sum else: ...
# -*- coding: utf-8 -*- """ Created on Thu Sep 13 2018 @author: Emily """ rootFolder='./' dataFolder=rootFolder+'data/'
""" Created on Thu Sep 13 2018 @author: Emily """ root_folder = './' data_folder = rootFolder + 'data/'
# # PySNMP MIB module SAVEPOWER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SAVEPOWER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:52:41 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, constraints_intersection, value_range_constraint, constraints_union) ...
x = 0 x = x + 10 x = x - 10 x = x * 10 x = x @ 10 x = x / 10 x = x // 10 x = x % 10 x = x ** 10 x = x >> 10 x = x << 10 x = x & 10 x = x ^ 10 x = x | 10 x = x + (10 + 20 * 3) x = x - (10 + 20 * 3) x = x * (10 + 20 * 3) x = x @ (10 + 20 * 3) x = x / (10 + 20 * 3) x = x // (10 + 20 * 3) x = x % (10 + 20 * 3) x = x ** (1...
x = 0 x = x + 10 x = x - 10 x = x * 10 x = x @ 10 x = x / 10 x = x // 10 x = x % 10 x = x ** 10 x = x >> 10 x = x << 10 x = x & 10 x = x ^ 10 x = x | 10 x = x + (10 + 20 * 3) x = x - (10 + 20 * 3) x = x * (10 + 20 * 3) x = x @ (10 + 20 * 3) x = x / (10 + 20 * 3) x = x // (10 + 20 * 3) x = x % (10 + 20 * 3) x = x ** (10...
class Reduction(): def __init__(self, m, b,c): self.m = m self.b = b self.c = c def reduction(self, d): T1 = [0]*(self.b-2) D_red = [0]*self.m for i in xrange(0,self.b-1): T1[i] = (d[i + 2*self.b + 1] + d[i + 3*self.b + (2*self.c)])%2; fo...
class Reduction: def __init__(self, m, b, c): self.m = m self.b = b self.c = c def reduction(self, d): t1 = [0] * (self.b - 2) d_red = [0] * self.m for i in xrange(0, self.b - 1): T1[i] = (d[i + 2 * self.b + 1] + d[i + 3 * self.b + 2 * self.c]) % 2 ...
""" Codemonk link: https://www.hackerearth.com/practice/data-structures/hash-tables/basics-of-hash-tables/practice-problems/algorithm/little-jhool-and-the-magical-jewels/ Little Jhool is still out of his mind - exploring all his happy childhood memories. And one of his favorite memory is when he found a magical ghost,...
""" Codemonk link: https://www.hackerearth.com/practice/data-structures/hash-tables/basics-of-hash-tables/practice-problems/algorithm/little-jhool-and-the-magical-jewels/ Little Jhool is still out of his mind - exploring all his happy childhood memories. And one of his favorite memory is when he found a magical ghost,...
# # PySNMP MIB module LJM9050mfp-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LJM9050mfp-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:57:38 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...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ...
arr = [] userinput = 10 # for c in range[0,5]: # arr.append(input("enter number ")+ str(c+1) +": ")) newarr = [] # Function to ask for users input def user_prompt(userinput): try: print("input here : ") userinput = int(input()) arr.append(userinput) except: # Catches for an error s...
arr = [] userinput = 10 newarr = [] def user_prompt(userinput): try: print('input here : ') userinput = int(input()) arr.append(userinput) except: print('Input is not correct') exit() for i in range(5): user_prompt(userinput) for x in range(0, len(arr)): if int(a...
class Solution: @staticmethod def naive(s): stack = [] d = {"(":")","{":"}","[":"]"} for tmps in s: if tmps in d: stack.append(d[tmps]) if tmps in d.values(): if len(stack)==0: return False tmp = stack.pop() ...
class Solution: @staticmethod def naive(s): stack = [] d = {'(': ')', '{': '}', '[': ']'} for tmps in s: if tmps in d: stack.append(d[tmps]) if tmps in d.values(): if len(stack) == 0: return False ...
__package__ = 'pywebio' __description__ = 'Write interactive web app in script way.' __url__ = 'https://pywebio.readthedocs.io' __version__ = "1.6.1" __version_info__ = (1, 6, 1, 0) __author__ = 'WangWeimin' __author_email__ = 'wang0.618@qq.com' __license__ = 'MIT'
__package__ = 'pywebio' __description__ = 'Write interactive web app in script way.' __url__ = 'https://pywebio.readthedocs.io' __version__ = '1.6.1' __version_info__ = (1, 6, 1, 0) __author__ = 'WangWeimin' __author_email__ = 'wang0.618@qq.com' __license__ = 'MIT'
""" Question: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no children. Example 1: Input: root = [3,9,20,null,null,15,7] Output: 2 """ # Definition for a binary tree nod...
""" Question: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no children. Example 1: Input: root = [3,9,20,null,null,15,7] Output: 2 """ class Treenode: def __init__(...
#!/usr/local/bin/python # Code Fights Pressure Gauges Problem def pressureGauges(morning, evening): return [list(map(min, zip(morning, evening))), list(map(max, zip(morning, evening)))] def main(): tests = [ [ [3, 5, 2, 6], [1, 6, 6, 6], [ ...
def pressure_gauges(morning, evening): return [list(map(min, zip(morning, evening))), list(map(max, zip(morning, evening)))] def main(): tests = [[[3, 5, 2, 6], [1, 6, 6, 6], [[1, 5, 2, 6], [3, 6, 6, 6]]], [[0, 12, 478, 23, 1000], [48, 23, 56, 23, 88], [[0, 12, 56, 23, 88], [48, 23, 478, 23, 1000]]], [[8], [1]...
class Event(object): def __init__(self): self._handlers = [] def __iadd__(self, handler): self._handlers.append(handler) return self def __isub__(self, handler): self._handlers.remove(handler) return self def fire(self, *args, **kwargs): # Make a copy ...
class Event(object): def __init__(self): self._handlers = [] def __iadd__(self, handler): self._handlers.append(handler) return self def __isub__(self, handler): self._handlers.remove(handler) return self def fire(self, *args, **kwargs): handlers = lis...
# Declare and initialise the variables that we will use later on in our program. # Remember that this is not necessary, since in Python variables can be created dynamically. # For example if you delete lines 4, 5, 6 the program will still work. number1 = 0 number2 = 0 mult = 0 # Ask the user for two numbers using the ...
number1 = 0 number2 = 0 mult = 0 number1 = int(input('Enter first number: ')) number2 = int(input('Enter second number: ')) mult = number1 * number2 print('The two number multiplied are: ' + str(mult)) number1 = float(input('Enter first number: ')) number2 = float(input('Enter second number: ')) print('The squares of t...
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param head: The first node of the linked list. @return: You should return the head of the sorted linked list, using constant ...
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param head: The first node of the linked list. @return: You should return the head of the sorted linked list, using constant...
class IncrementalAverage: """ This class enables us to store the running average of some datapoints on an incremental way, without the need of saving all the values. """ def __init__(self): self.counter = 1 self.sum = 0 def __str__(self): return str(self.sum) d...
class Incrementalaverage: """ This class enables us to store the running average of some datapoints on an incremental way, without the need of saving all the values. """ def __init__(self): self.counter = 1 self.sum = 0 def __str__(self): return str(self.sum) d...
#!/usr/bin/python3 # https://practice.geeksforgeeks.org/problems/element-that-appears-once-where-every-element-occurs-twice/0 # XOR of any number with 0 results in the same number # XOR of number with same number results in 'Zero' # So if we take the XOR of all elements the one doubles will zero out and # only the si...
def sol(arr, n): res = arr[0] for i in range(1, n): res = arr[i] ^ res res
class Solution: """ @param n: An integer as description @return: A list of strings. For example, if n = 7, your code should return ["1", "2", "fizz", "4", "buzz", "fizz", "7"] """ def fizzBuzz(self, n): results = [] for i in range(1, n + 1): if i % 15 == 0: ...
class Solution: """ @param n: An integer as description @return: A list of strings. For example, if n = 7, your code should return ["1", "2", "fizz", "4", "buzz", "fizz", "7"] """ def fizz_buzz(self, n): results = [] for i in range(1, n + 1): if i % 15 == 0: ...
class BankAccount: bank_name = 'My Bank' def print_bank_name(self): print('My name is', self.bank_name)
class Bankaccount: bank_name = 'My Bank' def print_bank_name(self): print('My name is', self.bank_name)
"""Set module version. <Major>.<Minor>.<maintenance>[alpha/beta/..] Alphas will be numbered like this -> 0.4.0a0 """ VERSION = '0.7.2'
"""Set module version. <Major>.<Minor>.<maintenance>[alpha/beta/..] Alphas will be numbered like this -> 0.4.0a0 """ version = '0.7.2'
""" A tic-tac-toe solver using minimax (without alpha-beta pruning). Example usage: >>> game = GameTree() >>> game.run_minimax_game() """ class GameTree: # A list to switch between players players = ["X", "O"] def __init__(self, value=" ", player_number=0): self.value = value sel...
""" A tic-tac-toe solver using minimax (without alpha-beta pruning). Example usage: >>> game = GameTree() >>> game.run_minimax_game() """ class Gametree: players = ['X', 'O'] def __init__(self, value=' ', player_number=0): self.value = value self.children = [] self.player_num...
a=10 b=5 print(a+b) print(success)
a = 10 b = 5 print(a + b) print(success)
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'werror': '', }, 'includes': [ '../../native_client/build/untrusted.gypi', ], 'targets': [ { 'target_name': 'opu...
{'variables': {'werror': ''}, 'includes': ['../../native_client/build/untrusted.gypi'], 'targets': [{'target_name': 'opus_nacl', 'type': 'none', 'variables': {'nlib_target': 'libopus_nacl.a', 'build_glibc': 0, 'build_newlib': 0, 'build_pnacl_newlib': 1}, 'dependencies': ['<(DEPTH)/native_client/tools.gyp:prep_toolchain...
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Who likes it? #Problem level: 6 kyu def likes(names): if not names: return "no one likes this" elif len(names)==1: return names[0] + " likes this" elif len(names)==2: return names[0] + " and " + names[1] + " like this" elif len(names...
def likes(names): if not names: return 'no one likes this' elif len(names) == 1: return names[0] + ' likes this' elif len(names) == 2: return names[0] + ' and ' + names[1] + ' like this' elif len(names) == 3: return names[0] + ', ' + names[1] + ' and ' + names[2] + ' like...
def configure(conf): conf.env.ARCHITECTURE = 'x86' conf.env.VALID_ARCHITECTURES = ['x86', 'i386'] conf.env.ARCH_FAMILY = 'x86' conf.env.ARCH_LP64 = False conf.env.append_unique('DEFINES', '_X86')
def configure(conf): conf.env.ARCHITECTURE = 'x86' conf.env.VALID_ARCHITECTURES = ['x86', 'i386'] conf.env.ARCH_FAMILY = 'x86' conf.env.ARCH_LP64 = False conf.env.append_unique('DEFINES', '_X86')
# Make a list of the multiples of 3 from 3 to 30. Use a for loop to print the numbers in your list. multiples_of_three = [3,6,9,12,15,18,21,24,27,30] for multiple in multiples_of_three: print (multiple * multiple * multiple) print (multiples_of_three)
multiples_of_three = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30] for multiple in multiples_of_three: print(multiple * multiple * multiple) print(multiples_of_three)
def foo(): x = 1 y = 1 res = x + y return res x = 2 y = 2 x1 = 1 y1 = 1 res = x1 + y1 def bar(arg=res): return arg
def foo(): x = 1 y = 1 res = x + y return res x = 2 y = 2 x1 = 1 y1 = 1 res = x1 + y1 def bar(arg=res): return arg
class Solution(object): def findContentChildren(self, g, s): """ :type g: List[int] :type s: List[int] :rtype: int """ res = 0 g = sorted(g) s = sorted(s) i = 0 j = 0 while i <= len(g)-1 and j <= len(s)-1: ...
class Solution(object): def find_content_children(self, g, s): """ :type g: List[int] :type s: List[int] :rtype: int """ res = 0 g = sorted(g) s = sorted(s) i = 0 j = 0 while i <= len(g) - 1 and j <= len(s) - 1: if ...
word = input("please type in any word of your choice: \n") while word != "Jesus": if word == "Jesus": break else: word = input("please type in any word of your choice: \n") else: print("The Name above all Name \n")
word = input('please type in any word of your choice: \n') while word != 'Jesus': if word == 'Jesus': break else: word = input('please type in any word of your choice: \n') else: print('The Name above all Name \n')
# # PySNMP MIB module TY3250I-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TY3250I-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:20:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) ...
# # PySNMP MIB module SCA-MPLINK2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SCA-MPLINK2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:52:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint, constraints_union) ...
""" This file auto-generated with generate-enums.js """ class EnumNamespace: """A collection of enum values. This collection can be used as specification to traitlets.Enum as it supports the `in` operator, and also supports tab completion as the values are attributes. """ def __init__(self, **...
""" This file auto-generated with generate-enums.js """ class Enumnamespace: """A collection of enum values. This collection can be used as specification to traitlets.Enum as it supports the `in` operator, and also supports tab completion as the values are attributes. """ def __init__(self, *...
""" Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up: Could you do it without any loop/recursion...
""" Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up: Could you do it without any loop/recursion...
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('Digite um valor para [{}, {}]: '.format(linha + 1, coluna + 1))) for l in range(0, 3): for c in range(0, 3): print('[{:^5}] '.format(matriz[l][...
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('Digite um valor para [{}, {}]: '.format(linha + 1, coluna + 1))) for l in range(0, 3): for c in range(0, 3): print('[{:^5}] '.format(matriz[l][c]), end='') print...
"""Constants for launch_library.""" DOMAIN = "launch_library" ATTR_LAUNCH_FACILITY = "facility" ATTR_LAUNCH_PAD = "pad" ATTR_LAUNCH_PAD_COUNTRY_CODE = "provider_country_code" ATTR_LAUNCH_PROVIDER = "provider" ATTR_REASON = "reason" ATTR_STREAM_LIVE = "stream_live" ATTR_WINDOW_END = "window_end" ATTR_WINDOW_START = "w...
"""Constants for launch_library.""" domain = 'launch_library' attr_launch_facility = 'facility' attr_launch_pad = 'pad' attr_launch_pad_country_code = 'provider_country_code' attr_launch_provider = 'provider' attr_reason = 'reason' attr_stream_live = 'stream_live' attr_window_end = 'window_end' attr_window_start = 'win...
MINIMAL_WEEDCOCO = { "images": [], "annotations": [], "categories": [], "agcontexts": [], "info": { "description": "Something", "metadata": { "name": "Something", "description": "Images of weeds", "creator": [{"@type": "Person", "name": "Someone"}]...
minimal_weedcoco = {'images': [], 'annotations': [], 'categories': [], 'agcontexts': [], 'info': {'description': 'Something', 'metadata': {'name': 'Something', 'description': 'Images of weeds', 'creator': [{'@type': 'Person', 'name': 'Someone'}], 'datePublished': 'XXXX-XX-XX', 'license': 'https://creativecommons.org/li...
def BMICalculator(param): def BMICategory(BMI): if BMI <= 18.4: return ("18.4 and below", "Malnutrition risk") elif BMI >= 18.5 and BMI <= 24.9: return("18.5 - 24.9", "Low risk") elif BMI >= 25.0 and BMI <= 29.9: return("25 - 29.9", "Enhanced risk") ...
def bmi_calculator(param): def bmi_category(BMI): if BMI <= 18.4: return ('18.4 and below', 'Malnutrition risk') elif BMI >= 18.5 and BMI <= 24.9: return ('18.5 - 24.9', 'Low risk') elif BMI >= 25.0 and BMI <= 29.9: return ('25 - 29.9', 'Enhanced risk') ...
class ComposableQuery: def __init__(self, path, executor=None): self.path = path if type(path) is list else [path] self.executor = executor @property def full_path(self): return '/'.join(self.path) async def get(self): async with self.executor.construct_session() as ses...
class Composablequery: def __init__(self, path, executor=None): self.path = path if type(path) is list else [path] self.executor = executor @property def full_path(self): return '/'.join(self.path) async def get(self): async with self.executor.construct_session() as se...
# This sample validates that an unbound variable error is reported # even if that variable has a type declaration. def fn1(): aaa: int # This should generate an error because aaa is unbound. return aaa fn1()
def fn1(): aaa: int return aaa fn1()
class FormTypes: Q = "10-Q" K = "10-K" def __init__(self): raise NotImplementedError
class Formtypes: q = '10-Q' k = '10-K' def __init__(self): raise NotImplementedError
""" Trolls are attacking your comment section! A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat. Your task is to write a function that takes a string and return a new string with all vowels removed. For example, the string "This website is for...
""" Trolls are attacking your comment section! A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat. Your task is to write a function that takes a string and return a new string with all vowels removed. For example, the string "This website is for...
#This program finds the favtorial of the specified numbers def factorial(number): '''This function finds the factorial of the number passed as argument''' if number < 0: print('Invalid entry! Cannot find factorial of a negative number') if number == 0 or number == 1: return 1 else: ...
def factorial(number): """This function finds the factorial of the number passed as argument""" if number < 0: print('Invalid entry! Cannot find factorial of a negative number') if number == 0 or number == 1: return 1 else: return number * factorial(number - 1) if __name__ == '__...
#encoding:utf-8 subreddit = 'cursedimages+cursedcomments+cursedmemes+cursed_images+cursedguns+hmmm+cursedamongus' t_channel = '@r_cursed' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'cursedimages+cursedcomments+cursedmemes+cursed_images+cursedguns+hmmm+cursedamongus' t_channel = '@r_cursed' def send_post(submission, r2t): return r2t.send_simple(submission)
#!/usr/bin/env python3 #-*- coding: utf8 -*- i = 0 while True: print("i = %d" % i) i += 1
i = 0 while True: print('i = %d' % i) i += 1
bit_pattern_31 = \ [ 8,-3, 9,5, #/*mean (0), correlation (0)*/, 4,2, 7,-12, #/*mean (1.12461e-05), correlation (0.0437584)*/, -11,9, -8,2, #/*mean (3.37382e-05), correlation (0.0617409)*/, 7,-12, 12,-13, #/*mean (5.62303e-05), correlation (0.0636977)*/, 2,-13, 2,12, #/*mean (0.000134953), correlat...
bit_pattern_31 = [8, -3, 9, 5, 4, 2, 7, -12, -11, 9, -8, 2, 7, -12, 12, -13, 2, -13, 2, 12, 1, -7, 1, 6, -2, -10, -2, -4, -13, -13, -11, -8, -13, -3, -12, -9, 10, 4, 11, 9, -13, -8, -8, -9, -11, 7, -9, 12, 7, 7, 12, 6, -4, -5, -3, 0, -13, 2, -12, -3, -9, 0, -7, 5, 12, -6, 12, -1, -3, 6, -2, 12, -6, -13, -4, -8, 11, -13...
LOGIN_URL = 'https://pocketapi.48.cn/user/api/v1/login/app/mobile' IM_ROOM_MESSAGE_URL = 'https://pocketapi.48.cn/im/api/v1/chatroom/msg/list/homeowner' IM_ROOM_MESSAGE_ALL_URL = 'https://pocketapi.48.cn/im/api/v1/chatroom/msg/list/all' IM_ROOM_INFO_URL = 'https://pocketapi.48.cn/im/api/v1/im/room/info/type/source' IM_...
login_url = 'https://pocketapi.48.cn/user/api/v1/login/app/mobile' im_room_message_url = 'https://pocketapi.48.cn/im/api/v1/chatroom/msg/list/homeowner' im_room_message_all_url = 'https://pocketapi.48.cn/im/api/v1/chatroom/msg/list/all' im_room_info_url = 'https://pocketapi.48.cn/im/api/v1/im/room/info/type/source' im_...
"""VHDL generation of the Binary Modulo operator""" __author__ = "Jon Dawson" __copyright__ = "Copyright 2010, Jonathan P Dawson" __license__ = "MIT:" __version__ = "0.1.3" __maintainer__ = "Jon Dawson" __email__ = "chips@jondawson.org.uk" __status__ = "Prototype" def write(stream): identifier = stream.get_identi...
"""VHDL generation of the Binary Modulo operator""" __author__ = 'Jon Dawson' __copyright__ = 'Copyright 2010, Jonathan P Dawson' __license__ = 'MIT:' __version__ = '0.1.3' __maintainer__ = 'Jon Dawson' __email__ = 'chips@jondawson.org.uk' __status__ = 'Prototype' def write(stream): identifier = stream.get_identif...
def sortedSquaredArray(array): return sorted(map(lambda x: x * x, array)) def test_sample(): assert sortedSquaredArray([1, 2, 3, 5, 6, 8, 9]) == [ 1, 4, 9, 25, 36, 64, 81]
def sorted_squared_array(array): return sorted(map(lambda x: x * x, array)) def test_sample(): assert sorted_squared_array([1, 2, 3, 5, 6, 8, 9]) == [1, 4, 9, 25, 36, 64, 81]
"""@package This package enables the project study field usage for the database. """ class StudyField: """ This class defines a Study Field. e.g.: Computer Science, Mathematics, ... """ def __init__(self, field_name, is_active): """ Study field initializer. :param field_na...
"""@package This package enables the project study field usage for the database. """ class Studyfield: """ This class defines a Study Field. e.g.: Computer Science, Mathematics, ... """ def __init__(self, field_name, is_active): """ Study field initializer. :param field_nam...
# target wechat user to response wechat_user = 'target user to respond' # chrome driver path driver_path = './chromedriver' # API Keys weather_api = "open weather api" lta_api = "lta datamall api" news_api = "news api" url_api = 'url shorten api' url_workspace = 'url shorten workspace id' # news news_latest = 7 news...
wechat_user = 'target user to respond' driver_path = './chromedriver' weather_api = 'open weather api' lta_api = 'lta datamall api' news_api = 'news api' url_api = 'url shorten api' url_workspace = 'url shorten workspace id' news_latest = 7 news_sources = ['bbc-news', 'cnn'] news_article_cnt = 10 js_username = 'jobstre...
def insertionSort(arr): for i in range(1, len(arr)): # iterate from 1..n element = arr[i] # current element j = i # current index while j > 0 and arr[j - 1] > element: ''' compare with the sorted list on the right and shift those elements one place right ...
def insertion_sort(arr): for i in range(1, len(arr)): element = arr[i] j = i while j > 0 and arr[j - 1] > element: "\n compare with the sorted list on the right and shift those elements\n one place right until the current element is smaller than it's\n ...
"""Normalizes paths to targets which may vary based on the workspace.""" labels = struct( package = Label("@pub__bazel_codegen//:_bazel_codegen"), template = Label("//dart/build_rules/codegen:codegen_template"), )
"""Normalizes paths to targets which may vary based on the workspace.""" labels = struct(package=label('@pub__bazel_codegen//:_bazel_codegen'), template=label('//dart/build_rules/codegen:codegen_template'))
# -*- coding: utf-8 -*- __all__ = ['test_order_book'] def test_order_book(exchange, orderbook, method, symbol): # todo add real order book tests here print( exchange.id, symbol, method, orderbook['nonce'] if orderbook['nonce'] else orderbook['datetime'], len(orderbook[...
__all__ = ['test_order_book'] def test_order_book(exchange, orderbook, method, symbol): print(exchange.id, symbol, method, orderbook['nonce'] if orderbook['nonce'] else orderbook['datetime'], len(orderbook['bids']), 'bids', str(orderbook['bids'][0] if len(orderbook['bids']) else 'N/A'), len(orderbook['asks']), 'as...
class Container(object): """ Holds hashable objects. Objects may occur 0 or more times """ def __init__(self): """ Creates a new container with no objects in it. I.e., any object occurs 0 times in self. """ self.vals = {} def insert(self, e): """ assumes e is hashable ...
class Container(object): """ Holds hashable objects. Objects may occur 0 or more times """ def __init__(self): """ Creates a new container with no objects in it. I.e., any object occurs 0 times in self. """ self.vals = {} def insert(self, e): """ assumes e is hashable ...
def getSeqTerm(n): if n % 3 == 0: return n // 3 * 2 elif n == 1: return 2 else: return 1 def sumDigits(n): sum = 0 while n > 0: sum += n % 10 n //= 10 return sum def euler65(lastN): num, den = getSeqTerm(lastN), 1 for x in range(lastN - 1, 0, -1): num, den = den + getSeqTerm(x) * num, num retur...
def get_seq_term(n): if n % 3 == 0: return n // 3 * 2 elif n == 1: return 2 else: return 1 def sum_digits(n): sum = 0 while n > 0: sum += n % 10 n //= 10 return sum def euler65(lastN): (num, den) = (get_seq_term(lastN), 1) for x in range(lastN - ...
class Note: def __init__(self, **kwargs): self.id = kwargs.get("id") self.title = kwargs.get("title") self.content = kwargs.get("content") def __str__(self): return self.title def __repr__(self): return f"<Note id={self.id} title={self.title}>"
class Note: def __init__(self, **kwargs): self.id = kwargs.get('id') self.title = kwargs.get('title') self.content = kwargs.get('content') def __str__(self): return self.title def __repr__(self): return f'<Note id={self.id} title={self.title}>'
def is_increasing_sequence(sequence): for i in range(len(sequence) - 1): if sequence[i] >= sequence[i + 1]: return i return -1 def almostIncreasingSequence(sequence): j = is_increasing_sequence(sequence) if j == -1: return True if is_increasing_sequence(sequence[j - 1 :...
def is_increasing_sequence(sequence): for i in range(len(sequence) - 1): if sequence[i] >= sequence[i + 1]: return i return -1 def almost_increasing_sequence(sequence): j = is_increasing_sequence(sequence) if j == -1: return True if is_increasing_sequence(sequence[j - 1:...
# For manual installation, fill in the fields below. If you are using # install.sh, the config.py should have been generated for you. APPLICATION_ROOT = None CSRF_ENABLED = True DATABASE_URI = 'mysql+pymysql://root:@localhost:3306/test?charset=utf8' GITHUB_BOT = '' GITHUB_TOKEN = '' GITHUB_OWNER = 'CCExtractor' GITHUB_...
application_root = None csrf_enabled = True database_uri = 'mysql+pymysql://root:@localhost:3306/test?charset=utf8' github_bot = '' github_token = '' github_owner = 'CCExtractor' github_repository = 'ccextractor' server_name = 'localhost' email_domain = '' email_api_key = '' hmac_key = '' github_deploy_key = '' github_...
def gcd(a, b): if b == 0: return a else: return gcd(b, a%b) def main(): n = int(input()) a = list(map(int,input().split())) L = [a[0] for _ in range(n)] R = [a[n-1] for _ in range(n)] for i in range(1,n): L[i] = gcd(L[i-1], a[i]) for i in range(1,n): R[i...
def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) def main(): n = int(input()) a = list(map(int, input().split())) l = [a[0] for _ in range(n)] r = [a[n - 1] for _ in range(n)] for i in range(1, n): L[i] = gcd(L[i - 1], a[i]) for i in range(1, n): ...
with open("dane.txt", "r") as f: liczby = [int(line) for line in f.readlines()] def remove(remove_every_num: int, nums_list: list[int]): i = remove_every_num - 1 # Indeksacja od 0. while i < len(nums_list): del nums_list[i] i = i + (remove_every_num - 1) def gen_lucky_numbers(high: int...
with open('dane.txt', 'r') as f: liczby = [int(line) for line in f.readlines()] def remove(remove_every_num: int, nums_list: list[int]): i = remove_every_num - 1 while i < len(nums_list): del nums_list[i] i = i + (remove_every_num - 1) def gen_lucky_numbers(high: int) -> list[int]: luc...
"""Input file for input template test""" def template_function(foo): """Runs some checks on the given function parameter. This rule runs checks on a given function parameter in chosen template. Use `bazel build` to run the check. Args: foo: A unique name for this function. """ pass e...
"""Input file for input template test""" def template_function(foo): """Runs some checks on the given function parameter. This rule runs checks on a given function parameter in chosen template. Use `bazel build` to run the check. Args: foo: A unique name for this function. """ pass ex...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2012-2019 Snowflake Computing Inc. All right reserved. # class FileCompressionType(): def __init__(self): pass Types = { 'GZIP': { 'name': 'GZIP', 'file_extension': '.gz', 'mime_type': 'applica...
class Filecompressiontype: def __init__(self): pass types = {'GZIP': {'name': 'GZIP', 'file_extension': '.gz', 'mime_type': 'application', 'mime_subtypes': ['gzip', 'x-gzip'], 'is_supported': True}, 'DEFLATE': {'name': 'DEFLATE', 'file_extention': '.deflate', 'mime_type': 'application', 'mime_subtypes'...
''' This is not meant to be edited by the user ''' rest_test_url = "https://tudata-test.ulb.tu-darmstadt.de/rest" rest_url = "https://tudatalib.ulb.tu-darmstadt.de/rest"
""" This is not meant to be edited by the user """ rest_test_url = 'https://tudata-test.ulb.tu-darmstadt.de/rest' rest_url = 'https://tudatalib.ulb.tu-darmstadt.de/rest'
# Python program to demonstrate # logical or operator a = 10 b = 10 c = -10 if any([a == b , 4 > 5]): # (a==b or 4 > 5) print("True") else: print("False")
a = 10 b = 10 c = -10 if any([a == b, 4 > 5]): print('True') else: print('False')
def f(x, y): '''Returns the first argument. :type x: (int, :py:class:`b.C`, b.C) :param b.C y: ignored :rtype: :class:`b.C` ''' _, c = x return c
def f(x, y): """Returns the first argument. :type x: (int, :py:class:`b.C`, b.C) :param b.C y: ignored :rtype: :class:`b.C` """ (_, c) = x return c
# # @lc app=leetcode id=58 lang=python3 # # [58] Length of Last Word # class Solution: def lengthOfLastWord(self, s: str) -> int: ls = len(s) # slow and fast pointers slow = -1 # iterate over trailing spaces while slow >= -ls and s[slow] == ' ': slow -= 1 ...
class Solution: def length_of_last_word(self, s: str) -> int: ls = len(s) slow = -1 while slow >= -ls and s[slow] == ' ': slow -= 1 fast = slow while fast >= -ls and s[fast] != ' ': fast -= 1 return slow - fast
""" This code has been commented away. It's a bit unclear to what extend we want to continue supporting this feature, hence it was ignored during the 2.x -> 3.x port. """ # import json # import re # from collections import defaultdict # from pathlib import Path # from typing import Any, Dict, List, Optional, Set, Text...
""" This code has been commented away. It's a bit unclear to what extend we want to continue supporting this feature, hence it was ignored during the 2.x -> 3.x port. """
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def reverseKGroup(self, head, k): """ :type head: ListNode :type k: int :rtype: ListNode """ hd = ListNode(0) hd.ne...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def reverse_k_group(self, head, k): """ :type head: ListNode :type k: int :rtype: ListNode """ hd = list_node(0) hd.next = head head = hd ...
''' 2. Write a program to search for the "saddle points" in a 5 by 5 array of integers. A saddle point is a cell whose value is greater than or equal to in its row, and less than or equal to any in its column. There may be more than one saddle point in the array. Print out the coordinates of any saddle points your ...
""" 2. Write a program to search for the "saddle points" in a 5 by 5 array of integers. A saddle point is a cell whose value is greater than or equal to in its row, and less than or equal to any in its column. There may be more than one saddle point in the array. Print out the coordinates of any saddle points your ...
load( "@bazel_tools//tools/build_defs/repo:utils.bzl", "patch", "read_netrc", "update_attrs", "use_netrc", "workspace_and_buildfile", ) load("@bazel_skylib//lib:versions.bzl", "versions") NETRC_FORMAT = """ machine {hostname} password {token} """ NETRC_ERROR = """ {path} file not found, pl...
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'patch', 'read_netrc', 'update_attrs', 'use_netrc', 'workspace_and_buildfile') load('@bazel_skylib//lib:versions.bzl', 'versions') netrc_format = '\nmachine {hostname}\n password {token}\n' netrc_error = "\n{path} file not found, please open https://{hostname}/-/...
""" Recipes available to data with tags ['GHOST', 'CAL', 'ARC']. Default is "makeProcessedArc". """ recipe_tags = set(['GHOST', 'CAL', 'ARC']) def makeProcessedArc(p): """ This recipe performs the standardization and corrections needed to convert the raw input arc images into a single stacked arc image. Th...
""" Recipes available to data with tags ['GHOST', 'CAL', 'ARC']. Default is "makeProcessedArc". """ recipe_tags = set(['GHOST', 'CAL', 'ARC']) def make_processed_arc(p): """ This recipe performs the standardization and corrections needed to convert the raw input arc images into a single stacked arc image. ...
# begin the table print("<table>") infile = open("test 3 column.csv","r") for line in infile: row = line.split(",") print("<tr>") for i in row.count: print("<td>%s</td>" % row[i]) print("</tr>") # end the table print("</table>")
print('<table>') infile = open('test 3 column.csv', 'r') for line in infile: row = line.split(',') print('<tr>') for i in row.count: print('<td>%s</td>' % row[i]) print('</tr>') print('</table>')
SCREEN_WIDTH = 650 SCREEN_HEIGHT = 650 SCALE = 20 CURR_DIRECTION = "right" HIGHSCORE_FILE_PATH = "highscore.txt" DIRECTIONS = { "up": (0, -SCALE), "down": (0, SCALE), "right": (SCALE, 0), "left": (-SCALE, 0), }
screen_width = 650 screen_height = 650 scale = 20 curr_direction = 'right' highscore_file_path = 'highscore.txt' directions = {'up': (0, -SCALE), 'down': (0, SCALE), 'right': (SCALE, 0), 'left': (-SCALE, 0)}
mobile = "https://mobile.twitter.com" base = "https://twitter.com/i" async def Favorites(username, init): url = "{}/{}/favorites?lang=en".format(mobile, username) if init != -1: url += "&max_id={}".format(init) return url async def Followers(username, init): url = "{}/{}/followers?lang=en".f...
mobile = 'https://mobile.twitter.com' base = 'https://twitter.com/i' async def Favorites(username, init): url = '{}/{}/favorites?lang=en'.format(mobile, username) if init != -1: url += '&max_id={}'.format(init) return url async def Followers(username, init): url = '{}/{}/followers?lang=en'.for...
# coding: utf-8 classificacao = raw_input() tipo = raw_input() especie = raw_input() if (classificacao == "vertebrado"): if(tipo == "ave"): if (especie == "carnivoro"): print("aguia") elif(especie == "onivoro"): print("pomba") elif (tipo == "mamifero"): if (especie == "onivoro"): print("homem") el...
classificacao = raw_input() tipo = raw_input() especie = raw_input() if classificacao == 'vertebrado': if tipo == 'ave': if especie == 'carnivoro': print('aguia') elif especie == 'onivoro': print('pomba') elif tipo == 'mamifero': if especie == 'onivoro': ...
# -*-coding: utf-8 -*- """ @Project: utils @File : __init__.py.py @Author : panjq @E-mail : pan_jinquan@163.com @Date : 2019-05-10 17:08:02 """
""" @Project: utils @File : __init__.py.py @Author : panjq @E-mail : pan_jinquan@163.com @Date : 2019-05-10 17:08:02 """
class Matrix: def __init__(self, matrix_string: str): # another solution (functional) # [list(map(int, elements.split())) for elements in matrix_string.splitlines()] self.matrix = [ [int(element) for element in elements.split()] for elements in matrix_string.splitline...
class Matrix: def __init__(self, matrix_string: str): self.matrix = [[int(element) for element in elements.split()] for elements in matrix_string.splitlines()] def row(self, index): return self.matrix[index - 1].copy() def column(self, index): return [row[index - 1] for row in sel...
_base_ = "./wheat_detection_mstrain.py" data_root = "/data/" data = dict( samples_per_gpu=1, train=dict( ann_file=[ data_root + "coco_train.json", data_root + "coco_pseudo_test.json", data_root + "coco_pseudo_test.json", data_root + "coco_pseudo_test.json...
_base_ = './wheat_detection_mstrain.py' data_root = '/data/' data = dict(samples_per_gpu=1, train=dict(ann_file=[data_root + 'coco_train.json', data_root + 'coco_pseudo_test.json', data_root + 'coco_pseudo_test.json', data_root + 'coco_pseudo_test.json'], img_prefix=[data_root + 'train/', data_root + 'test/', data_root...
# string = [char for char in input() if char not in ['a', 'o', 'u', 'e', 'i', 'A', 'O', 'U', 'E', 'I']] # print(''.join(string)) print(''.join([char for char in input() if char not in ['a', 'o', 'u', 'e', 'i', 'A', 'O', 'U', 'E', 'I']]))
print(''.join([char for char in input() if char not in ['a', 'o', 'u', 'e', 'i', 'A', 'O', 'U', 'E', 'I']]))
_NOVAL = object() class Peekable(object): def __init__(self, iterator): self.iterator = iter(iterator) self._cached = None def has_next(self): try: self.peek() return True except StopIteration: return False def peek(self, default=_NOVAL)...
_noval = object() class Peekable(object): def __init__(self, iterator): self.iterator = iter(iterator) self._cached = None def has_next(self): try: self.peek() return True except StopIteration: return False def peek(self, default=_NOVAL...
# coding=utf-8 class Grant: """ A grant is described by : - The database on which it exists - The privilege granted - The table on which the grant applies - The owner of the table on which the grant applies (OPTIONNAL) - The user on wich the grant applies - The ...
class Grant: """ A grant is described by : - The database on which it exists - The privilege granted - The table on which the grant applies - The owner of the table on which the grant applies (OPTIONNAL) - The user on wich the grant applies - The user's alias ...
"""Exceptions for BaseCollection.""" class CollectionIsEmptyExeption(Exception): """Exception class if the collection is empty.""" pass # noqa: WPS420, WPS604
"""Exceptions for BaseCollection.""" class Collectionisemptyexeption(Exception): """Exception class if the collection is empty.""" pass
# var inteiro a = 2 # var real b = 1.2 # var logico c = True # var caractere d = 'caractere' print('var a =>', type(a)) print('var b =>', type(b)) print('var c =>', type(c)) print('var d =>', type(d))
a = 2 b = 1.2 c = True d = 'caractere' print('var a =>', type(a)) print('var b =>', type(b)) print('var c =>', type(c)) print('var d =>', type(d))
programmer_num = int(input("Enter a number for the user to guess: ")) num = int(input("Enter a number: ")) while num != programmer_num: if num > programmer_num: num = int(input("Incorrect please try again (hint: your number was too high): ")) elif num < programmer_num: num = int(input(...
programmer_num = int(input('Enter a number for the user to guess: ')) num = int(input('Enter a number: ')) while num != programmer_num: if num > programmer_num: num = int(input('Incorrect please try again (hint: your number was too high): ')) elif num < programmer_num: num = int(input('Incorrect...
load("@bazel_bootlin//toolchains:toolchain_info.bzl", "AVAILABLE_TOOLCHAINS") def all_platforms(): for architecture in AVAILABLE_TOOLCHAINS: for buildroot_version in AVAILABLE_TOOLCHAINS[architecture]: if buildroot_version not in native.existing_rules(): native.constraint_value(...
load('@bazel_bootlin//toolchains:toolchain_info.bzl', 'AVAILABLE_TOOLCHAINS') def all_platforms(): for architecture in AVAILABLE_TOOLCHAINS: for buildroot_version in AVAILABLE_TOOLCHAINS[architecture]: if buildroot_version not in native.existing_rules(): native.constraint_value(...
# # @lc app=leetcode.cn id=1627 lang=python3 # # [1627] last-moment-before-all-ants-fall-out-of-a-plank # None # @lc code=end
None
class SimpleIntegral: """ Get the first 5 integrals of the simple function: f(x) = x """ def __init__(self, x): self.x = x def get_first_integral(self): return (1 / 2) * self.x ** 2 def get_second_integral(self): return (1 / 6) * self.x ** 3 def get_third_...
class Simpleintegral: """ Get the first 5 integrals of the simple function: f(x) = x """ def __init__(self, x): self.x = x def get_first_integral(self): return 1 / 2 * self.x ** 2 def get_second_integral(self): return 1 / 6 * self.x ** 3 def get_third_inte...
while True: try: n = int(input()) if((n >= 1) and (n <= 1000)): for item in range(n): num = int(input ()) if((num >= 1) and (num <= 10**100)): led = 0 num = str(num) for y in num: ...
while True: try: n = int(input()) if n >= 1 and n <= 1000: for item in range(n): num = int(input()) if num >= 1 and num <= 10 ** 100: led = 0 num = str(num) for y in num: i...
with open('./21/input_a.txt') as f: p1 = int(f.readline().strip()[-1:]) p2 = int(f.readline().strip()[-1:]) ddice = 1 def rollddice(num): global ddice ddice += num return (ddice-1) * num - num p1score, p1loc, p2score, p2loc = 0, p1, 0, p2 while max(p1score, p2score) < 1000: p1loc = (((p1loc ...
with open('./21/input_a.txt') as f: p1 = int(f.readline().strip()[-1:]) p2 = int(f.readline().strip()[-1:]) ddice = 1 def rollddice(num): global ddice ddice += num return (ddice - 1) * num - num (p1score, p1loc, p2score, p2loc) = (0, p1, 0, p2) while max(p1score, p2score) < 1000: p1loc = (p1loc...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. INCLUDES = """ #include <openssl/asn1.h> #include <openssl/stack.h> """ TYPES = """ typedef int... time_t; typedef ... ASN1_INTEGER; st...
includes = '\n#include <openssl/asn1.h>\n#include <openssl/stack.h>\n' types = '\ntypedef int... time_t;\n\ntypedef ... ASN1_INTEGER;\n\nstruct asn1_string_st {\n int length;\n int type;\n unsigned char *data;\n long flags;\n};\n\ntypedef struct asn1_string_st ASN1_OCTET_STRING;\ntypedef struct asn1_string_...
''' The web is built with HTML strings like "<i>Yay</i>" which draws Yay as italic text. In this example, the "i" tag makes <i> and </i> which surround the word "Yay". Given tag and word strings, create the HTML string with tags around the word, e.g. "<i>Yay</i>". ''' def make_tags(tag, word): return "<%s>%s</%s>"...
""" The web is built with HTML strings like "<i>Yay</i>" which draws Yay as italic text. In this example, the "i" tag makes <i> and </i> which surround the word "Yay". Given tag and word strings, create the HTML string with tags around the word, e.g. "<i>Yay</i>". """ def make_tags(tag, word): return '<%s>%s</%s>'...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. py:currentmodule:: leepstools.file.input .. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca> Read and write LEEPS input file .in """ ############################################################################### # Copyright 2017 Hendrix Demers # # L...
""" .. py:currentmodule:: leepstools.file.input .. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca> Read and write LEEPS input file .in """ class Parameter: keyword_length = 6 separator = ' ' value_length = 120 def __init__(self, keyword, default_value, comment, conversion): sel...
set_name(0x8014B0D8, "EA_cd_seek", SN_NOWARN) set_name(0x8014B0E0, "MY_CdGetSector", SN_NOWARN) set_name(0x8014B114, "init_cdstream", SN_NOWARN) set_name(0x8014B124, "flush_cdstream", SN_NOWARN) set_name(0x8014B148, "check_complete_frame", SN_NOWARN) set_name(0x8014B1C8, "reset_cdstream", SN_NOWARN) set_name(0x8014B1F0...
set_name(2148839640, 'EA_cd_seek', SN_NOWARN) set_name(2148839648, 'MY_CdGetSector', SN_NOWARN) set_name(2148839700, 'init_cdstream', SN_NOWARN) set_name(2148839716, 'flush_cdstream', SN_NOWARN) set_name(2148839752, 'check_complete_frame', SN_NOWARN) set_name(2148839880, 'reset_cdstream', SN_NOWARN) set_name(2148839920...
class Solution(object): def removeInterval(self, intervals, toBeRemoved): """ :type intervals: List[List[int]] :type toBeRemoved: List[int] :rtype: List[List[int]] """ removeStart, removeEnd = toBeRemoved output = [] for start, end in intervals: ...
class Solution(object): def remove_interval(self, intervals, toBeRemoved): """ :type intervals: List[List[int]] :type toBeRemoved: List[int] :rtype: List[List[int]] """ (remove_start, remove_end) = toBeRemoved output = [] for (start, end) in intervals...