content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def mult (y) : return lambda x : x * y x = mult(7) print(x(12))
def mult(y): return lambda x: x * y x = mult(7) print(x(12))
# Concatinate 2 dictionary def Dic_input(): my_dict = dict() n = int(input("Enter the number of items in the dictionary: ")) while n != 0: key = input("Enter Key: ") value = input("Enter value: ") my_dict[key] = value n = n-1 return (my_dict) print ("Enter Dictionary 1:...
def dic_input(): my_dict = dict() n = int(input('Enter the number of items in the dictionary: ')) while n != 0: key = input('Enter Key: ') value = input('Enter value: ') my_dict[key] = value n = n - 1 return my_dict print('Enter Dictionary 1:') d1 = dic_input() print('Ent...
MAG_ADDRESS = 0x1E ACC_ADDRESS = 0x1E GYR_ADDRESS = 0x6A #LSM9DS0 Gyro Registers WHO_AM_I_G = 0x0F CTRL_REG1_G = 0x20 CTRL_REG2_G = 0x21 CTRL_REG3_G = 0x22 CTRL_REG4_G = 0x23 CTRL_REG5_G = 0x24 REFERENCE_G = 0x25 STATUS_REG_G = 0x27 OUT_X_L_G = 0x28 OUT_X_H_G =...
mag_address = 30 acc_address = 30 gyr_address = 106 who_am_i_g = 15 ctrl_reg1_g = 32 ctrl_reg2_g = 33 ctrl_reg3_g = 34 ctrl_reg4_g = 35 ctrl_reg5_g = 36 reference_g = 37 status_reg_g = 39 out_x_l_g = 40 out_x_h_g = 41 out_y_l_g = 42 out_y_h_g = 43 out_z_l_g = 44 out_z_h_g = 45 fifo_ctrl_reg_g = 46 fifo_src_reg_g = 47 i...
############################################################################ # # Copyright (C) 2016 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. # # Commercial License Usage # Licensees holding valid commercial Qt licenses may use this file in # accordance with the co...
source('../../shared/qtcreator.py') project = 'untitled' def main(): output_q_debug = 'Output from qDebug().' output_std_out = 'Output from std::cout.' output_std_err = 'Output from std::cerr.' start_application('qtcreator' + SettingsPath) if not started_without_plugin_error(): return c...
def test_users_endpoint_with_unauthenticated_client(client): response = client.get('/api/v1/users/') assert response.status_code == 403 def test_users_detail_endpoint_with_unauthenticated_client(client): response = client.get('/api/v1/users/2/') assert response.status_code == 403 def test_users_en...
def test_users_endpoint_with_unauthenticated_client(client): response = client.get('/api/v1/users/') assert response.status_code == 403 def test_users_detail_endpoint_with_unauthenticated_client(client): response = client.get('/api/v1/users/2/') assert response.status_code == 403 def test_users_endpoi...
class Solution: def findAnagrams(self, s: str, p: str) -> List[int]: P = len(p) S = len(s) if P == 0 or S == 0 or S < P: return [] l_p = [0]*26 l_s = [0]*26 for i in range(P): l_p[ord(p[i])-97] += 1 l_s[ord(s[i])-97] += 1 an...
class Solution: def find_anagrams(self, s: str, p: str) -> List[int]: p = len(p) s = len(s) if P == 0 or S == 0 or S < P: return [] l_p = [0] * 26 l_s = [0] * 26 for i in range(P): l_p[ord(p[i]) - 97] += 1 l_s[ord(s[i]) - 97] += 1 ...
#!/usr/bin/env python #_*_coding:utf-8_*_ __all__ = [ 'saveFeature', 'CHI2', 'IG', 'MIC', 'pearsonr' ]
__all__ = ['saveFeature', 'CHI2', 'IG', 'MIC', 'pearsonr']
VOC_ROOT='VOC2012/VOCdevkit/VOC2012/' VOC_SAL_ROOT='VOC2012/VOCdevkit/VOC2012/saliency_map/' COCO_ROOT='COCO/' COCO_SAL_ROOT = 'COCO/saliency_maps_poolnet/'
voc_root = 'VOC2012/VOCdevkit/VOC2012/' voc_sal_root = 'VOC2012/VOCdevkit/VOC2012/saliency_map/' coco_root = 'COCO/' coco_sal_root = 'COCO/saliency_maps_poolnet/'
registers.xosct_trig_count.count.filename = '//mx340hs/data/anfinrud_1903/Archive/NIH.TIMING.registers.xosct_trig_count.count.txt' registers.xosct_acq_count.count.filename = '//mx340hs/data/anfinrud_1903/Archive/NIH.TIMING.registers.xosct_acq_count.count.txt' registers.xdet_acq_count.count.filename = '//mx340hs/data/an...
registers.xosct_trig_count.count.filename = '//mx340hs/data/anfinrud_1903/Archive/NIH.TIMING.registers.xosct_trig_count.count.txt' registers.xosct_acq_count.count.filename = '//mx340hs/data/anfinrud_1903/Archive/NIH.TIMING.registers.xosct_acq_count.count.txt' registers.xdet_acq_count.count.filename = '//mx340hs/data/an...
x = 3 * 0.1 print(x) a = 0o10 print(a) n = 8 m = 7 a = n > m print(a)
x = 3 * 0.1 print(x) a = 8 print(a) n = 8 m = 7 a = n > m print(a)
class SummaryVariables: def __init__(self): self.INTAG = None @classmethod def drop_point(cls): #appears to be present on points shared over gottena cls.INTAG = None return cls
class Summaryvariables: def __init__(self): self.INTAG = None @classmethod def drop_point(cls): cls.INTAG = None return cls
# Definition for binary tree with next pointer. # class TreeLinkNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # self.next = None class Solution: # @param root, a tree link node # @return nothing def iterator(self, root): ...
class Solution: def iterator(self, root): while root: if root.left: yield root.left if root.right: yield root.right root = root.next def connect(self, root): if not root: return cur = root while cur...
''' ''' all_acts = ['request', 'inform'] inform_slots = ['actor','critic_rating','genre','mpaa_rating','director','release_year'] sys_request_slots = ['actor', 'critic_rating', 'genre', 'mpaa_rating', 'director', 'release_year'] start_dia_acts = { #'greeting':[], 'request':['moviename', 'starttime', 'theater...
""" """ all_acts = ['request', 'inform'] inform_slots = ['actor', 'critic_rating', 'genre', 'mpaa_rating', 'director', 'release_year'] sys_request_slots = ['actor', 'critic_rating', 'genre', 'mpaa_rating', 'director', 'release_year'] start_dia_acts = {'request': ['moviename', 'starttime', 'theater', 'city', 'state', 'd...
#encoding:utf-8 subreddit = 'Orochisegundo+AgiotasClub' t_channel = '@CanalLixo' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'Orochisegundo+AgiotasClub' t_channel = '@CanalLixo' def send_post(submission, r2t): return r2t.send_simple(submission)
class Solution: def twoSumBSTs(self, root1: TreeNode, root2: TreeNode, target: int) -> bool: flag = 0 listTemp = [] def inOrderList(root) -> List[int]: if not root: return inOrderList(root.left) listTemp.append(root.val) inOrder...
class Solution: def two_sum_bs_ts(self, root1: TreeNode, root2: TreeNode, target: int) -> bool: flag = 0 list_temp = [] def in_order_list(root) -> List[int]: if not root: return in_order_list(root.left) listTemp.append(root.val) ...
''' 724. Find Pivot Index. Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the sum of all the numbers to the left of the index is equal to the sum of all the numbers to the right of the index. If no such index exists, we sho...
""" 724. Find Pivot Index. Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the sum of all the numbers to the left of the index is equal to the sum of all the numbers to the right of the index. If no such index exists, we shou...
Frutas_favoritas = ["Mangos", "Manzanas", "Bananas"] if("Mangos" in Frutas_favoritas): print("La neta si me gustan mucho los Manguitos") if("Cocos" in Frutas_favoritas): print("En verdad me agradan los cocos") if("Manzanas" in Frutas_favoritas): print("Me gustan mucho las manzanas") if("Kiwis" in Frutas...
frutas_favoritas = ['Mangos', 'Manzanas', 'Bananas'] if 'Mangos' in Frutas_favoritas: print('La neta si me gustan mucho los Manguitos') if 'Cocos' in Frutas_favoritas: print('En verdad me agradan los cocos') if 'Manzanas' in Frutas_favoritas: print('Me gustan mucho las manzanas') if 'Kiwis' in Frutas_favori...
def Merge(Array, LowerBound, midPoint, UpperBound): sizeLeft = midPoint + 1 - LowerBound sizeRight = UpperBound - midPoint leftArray = [0] * (sizeLeft) rightArray = [0] * (sizeRight) for i in range(sizeLeft): leftArray[i] = Array[LowerBound + i] for i in range(sizeRight)...
def merge(Array, LowerBound, midPoint, UpperBound): size_left = midPoint + 1 - LowerBound size_right = UpperBound - midPoint left_array = [0] * sizeLeft right_array = [0] * sizeRight for i in range(sizeLeft): leftArray[i] = Array[LowerBound + i] for i in range(sizeRight): rightAr...
class Array: def __init__(self, schema, oai3_schema_resolver): self.schema = schema self.oai3_schema_resolver = oai3_schema_resolver def convert(self): schema = { 'type': 'array', 'items': self.oai3_schema_resolver(self.schema.item_definition).convert() }...
class Array: def __init__(self, schema, oai3_schema_resolver): self.schema = schema self.oai3_schema_resolver = oai3_schema_resolver def convert(self): schema = {'type': 'array', 'items': self.oai3_schema_resolver(self.schema.item_definition).convert()} return schema
# Creates a list containing all possible sequences, as strings, # of length max_length given a list of possible character values # Parameters max_length = 13 possible_values = [".", "-"] def generate_sequences(length, values): current_sequences = values for dimension in range(1, length): cur...
max_length = 13 possible_values = ['.', '-'] def generate_sequences(length, values): current_sequences = values for dimension in range(1, length): current_sequences = add_dimension(current_sequences, values) return current_sequences def add_dimension(current_sequences, values_to_add): new_sequ...
#-- THIS LINE SHOULD BE THE FIRST LINE OF YOUR SUBMISSION! --# def are_anagrams(a, b): a = a.lower() b = b.lower() a1 = [] b1 = [] for char in a: if char.isalpha(): a1.append(char) for char in b: if char.isalpha(): b1.append(char) a1.sort() b1....
def are_anagrams(a, b): a = a.lower() b = b.lower() a1 = [] b1 = [] for char in a: if char.isalpha(): a1.append(char) for char in b: if char.isalpha(): b1.append(char) a1.sort() b1.sort() return a1 == b1 assert are_anagrams('Dog', 'God') assert...
class TestSuite(): sub_suites = None name = "" details = "" testcase_list = None def to_dict(self): me = {'name': self.name, 'details': self.details, 'testcase_list': [], 'sub_suites': []} if self.sub_suites: for s in self.sub_s...
class Testsuite: sub_suites = None name = '' details = '' testcase_list = None def to_dict(self): me = {'name': self.name, 'details': self.details, 'testcase_list': [], 'sub_suites': []} if self.sub_suites: for s in self.sub_suites: me['sub_suites'].appen...
counter=0 def binary_search(myitem,mylist): found=False global counter bottom=0 top=len(mylist)-1 while bottom<=top and not found: middle=(bottom+top)//2 counter=middle if mylist[middle]==myitem: found=True elif mylist[middle]<myitem: ...
counter = 0 def binary_search(myitem, mylist): found = False global counter bottom = 0 top = len(mylist) - 1 while bottom <= top and (not found): middle = (bottom + top) // 2 counter = middle if mylist[middle] == myitem: found = True elif mylist[middle] <...
CONFIG_FILE_NAME = 'django.json' HOME_BASE_PATH = '/srv' SHARED_GROUP = 'workload'
config_file_name = 'django.json' home_base_path = '/srv' shared_group = 'workload'
class Solution: def romanToInt(self, s: str) -> int: VALUE_MAP = { "I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000, } ans = 0 for i in range(0, len(s) - 1): cur = VALUE_MAP...
class Solution: def roman_to_int(self, s: str) -> int: value_map = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} ans = 0 for i in range(0, len(s) - 1): cur = VALUE_MAP[s[i]] if cur < VALUE_MAP[s[i + 1]]: ans -= cur else...
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @param sum, an integer # @return a boolean def hasPathSum(self, root, sum): ...
class Solution: def has_path_sum(self, root, sum): return self.dfs(root, sum, 0) def dfs(self, root, sum, cursum): if not root: return False if not root.left and (not root.right): return cursum + root.val == sum return self.dfs(root.left, sum, cursum + r...
colors = {'BOLD': '\033[1m','BLUE': '\033[34m' , 'GREEN': '\033[32m','YELLOW' :'\033[33m', 'RED': '\033[91m','ENDC' : '\033[0m','CIANO' :'\033[1m','ORAN' : '\033[91m', 'GREY': '\033[37m','DARKGREY' : '\033[1;30m','UNDERLINE' : '\033[4m'} def banner(): print (''' _ ...
colors = {'BOLD': '\x1b[1m', 'BLUE': '\x1b[34m', 'GREEN': '\x1b[32m', 'YELLOW': '\x1b[33m', 'RED': '\x1b[91m', 'ENDC': '\x1b[0m', 'CIANO': '\x1b[1m', 'ORAN': '\x1b[91m', 'GREY': '\x1b[37m', 'DARKGREY': '\x1b[1;30m', 'UNDERLINE': '\x1b[4m'} def banner(): print("\n\n _ _ _ _\n _ __ ___ (_)...
class TimingService: # Timing Service for scooters and bikes def __init__(self) -> None: self.scooting_cycling_speed = 20000/60 def get_travelling_time(self, distance: str) -> float: # distance is in km return distance / self.scooting_cycling_speed
class Timingservice: def __init__(self) -> None: self.scooting_cycling_speed = 20000 / 60 def get_travelling_time(self, distance: str) -> float: return distance / self.scooting_cycling_speed
MC2P_PAYMENT_DONE = 'D' MC2P_PAYMENT_CANCELLED = 'C' MC2P_PAYMENT_EXPIRED = 'E' MC2P_PAYMENT_PENDING = 'N' MC2P_SUBSCRIPTION_WAIT = 'W' MC2P_SUBSCRIPTION_ACTIVE = 'A' MC2P_SUBSCRIPTION_PAUSED = 'P' MC2P_SUBSCRIPTION_STOPPED = 'S' MC2P_AUTHORIZATION_ACTIVE = 'A' MC2P_AUTHORIZATION_REMOVED = 'R' MC2P_TYPE_TRANSACTION ...
mc2_p_payment_done = 'D' mc2_p_payment_cancelled = 'C' mc2_p_payment_expired = 'E' mc2_p_payment_pending = 'N' mc2_p_subscription_wait = 'W' mc2_p_subscription_active = 'A' mc2_p_subscription_paused = 'P' mc2_p_subscription_stopped = 'S' mc2_p_authorization_active = 'A' mc2_p_authorization_removed = 'R' mc2_p_type_tran...
__version__ = '0.1.5' VERSION = __version__ AUTHOR = 'jeffkit.info@gmail.com' RATE_LIMIT_IP_PER_SECOND = 500 RATE_LIMIT_ACCOUNT_PER_HOUR = 2000 ORDER_SIDE_BID = 'BID' ORDER_SIDE_ASK = 'ASK' ORDER_STATE_PENDING = 'PENDING' ORDER_STATE_FILLED = 'FILLED' ORDER_STATE_CANCELED = 'CANCELED' WITHDRAWALS_STATE_CONFIRMED = ...
__version__ = '0.1.5' version = __version__ author = 'jeffkit.info@gmail.com' rate_limit_ip_per_second = 500 rate_limit_account_per_hour = 2000 order_side_bid = 'BID' order_side_ask = 'ASK' order_state_pending = 'PENDING' order_state_filled = 'FILLED' order_state_canceled = 'CANCELED' withdrawals_state_confirmed = 'CON...
# Factorial of a number using recursion num = int(input("Enter the number:")) def recur_factorial(n): if n == 1: return n else: return n * recur_factorial(n - 1) # check if the number is negative if num < 0: print("Sorry, factorial does not exist for negative numbers") el...
num = int(input('Enter the number:')) def recur_factorial(n): if n == 1: return n else: return n * recur_factorial(n - 1) if num < 0: print('Sorry, factorial does not exist for negative numbers') elif num == 0: print('The factorial of 0 is 1') else: print('The factorial of', num, 'i...
l = [] l.append("Hello") l.append("World") print(str(l))
l = [] l.append('Hello') l.append('World') print(str(l))
with open("input.txt") as file: levels = [] for line in file.readlines(): line = line.strip("\n") levels.append(list(line)) totals = [] for xv,yv in [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]: count = 0 x = 0 y = 0 height = len(levels) width = len(levels[0]) while y < he...
with open('input.txt') as file: levels = [] for line in file.readlines(): line = line.strip('\n') levels.append(list(line)) totals = [] for (xv, yv) in [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]: count = 0 x = 0 y = 0 height = len(levels) width = len(levels[0]) while y < he...
a = 1 triples = [] END = 10500 def pairs(n): return [(i, n / i) for i in range(1, int(n**0.5) + 1) if n % i == 0] while a < END: fp = pairs(a*a) for p in fp: s = p[1]+p[0] d = p[1] - p[0] if s % 2 == 1 or d == 0: continue c = int(s/2) b = int(d/2) if a < b: triples.append((a...
a = 1 triples = [] end = 10500 def pairs(n): return [(i, n / i) for i in range(1, int(n ** 0.5) + 1) if n % i == 0] while a < END: fp = pairs(a * a) for p in fp: s = p[1] + p[0] d = p[1] - p[0] if s % 2 == 1 or d == 0: continue c = int(s / 2) b = int(d / ...
#!/usr/bin/env python 3 ############################################################################################ # # # Program purpose: Count number of non-empty substrings of a given string. # # Program...
def obtain_user_input(input_mess: str) -> str: (is_valid, user_data) = (False, '') while is_valid is False: try: user_data = input(input_mess) if len(user_data) == 0: raise value_error('Oops! Data is needed') is_valid = True except ValueError a...
# # @lc app=leetcode id=69 lang=python3 # # [69] Sqrt(x) # # @lc code=start class Solution: def mySqrt(self, x: int) -> int: i = 1 j = x r = 1 if x <= 1: return x while i < j: if j*j == x: return j elif i*i == x: ...
class Solution: def my_sqrt(self, x: int) -> int: i = 1 j = x r = 1 if x <= 1: return x while i < j: if j * j == x: return j elif i * i == x: return i if j - i == 1: break ...
def expect_cli_until_acknowledgment(child): #child.expect("Welcome to RIF Lumino Payments Protocol, Version 0.1") #child.expect("Have you read and understood and do you accept the RIF Lumino Disclosure Agreement and Privacy Warning?") child.sendline("y") def expect_cli_until_account_selection(child): ...
def expect_cli_until_acknowledgment(child): child.sendline('y') def expect_cli_until_account_selection(child): expect_cli_until_acknowledgment(child) child.expect('The following accounts were found in your machine:') child.expect('Select one of them by index to continue: ') child.sendline('0') def...
[[7, 4], [12, 1, 6], [9, 2], [5, 3, 3]] # Eingabeliste [[1, 1, 2], [1, 3], [5, 3, 2]] # Ausgabeliste [1, 1, 0]
[[7, 4], [12, 1, 6], [9, 2], [5, 3, 3]] [[1, 1, 2], [1, 3], [5, 3, 2]] [1, 1, 0]
def next_password(pwd): while True: new = pwd[::-1] for i,x in enumerate(pwd[::-1]): if x == 'z': new = new[:i] + 'a' + new[i+1:] else: new = new[:i] + chr(ord(x)+1) + new[i+1:] break pwd =...
def next_password(pwd): while True: new = pwd[::-1] for (i, x) in enumerate(pwd[::-1]): if x == 'z': new = new[:i] + 'a' + new[i + 1:] else: new = new[:i] + chr(ord(x) + 1) + new[i + 1:] break pwd = new[::-1] val...
expected_output = { 'name': { 'aci-catalog-dk10.121.8.2.bin': { 'version': { '70.8(2)': { 'type': 'catalog', 'size': 0.129 } } }, 'aci-apic-dk9.5.0.1k.bin':...
expected_output = {'name': {'aci-catalog-dk10.121.8.2.bin': {'version': {'70.8(2)': {'type': 'catalog', 'size': 0.129}}}, 'aci-apic-dk9.5.0.1k.bin': {'version': {'5.0(1k)': {'type': 'controller', 'size': 6266.102}}}, 'aci-catalog-dk10.121.7.4.bin': {'version': {'70.7(4)': {'type': 'catalog', 'size': 0.128}}}}}
#!/usr/bin/python36 s = str(input('Input a set of characters: ')) * 100 while True: # helps to avoid errors of input a width of an output try: w = int(input('Input a width of the output: ')) break except: pass t = 0 for i in s: # prints strin...
s = str(input('Input a set of characters: ')) * 100 while True: try: w = int(input('Input a width of the output: ')) break except: pass t = 0 for i in s: print(i, end='') t += 1 if t % w == 0: print('')
# Args def printPlayerDetails(name, age, team): print('Player Details: ') print('name: {}, Age: {}, Team: {}'.format(name, age, team)) printPlayerDetails('Virat', 33, "rcb") msd = ("ms dhoni", 37, 'csk') printPlayerDetails(msd[0], msd[1], msd[2]) printPlayerDetails(*msd) # packaging and unpa...
def print_player_details(name, age, team): print('Player Details: ') print('name: {}, Age: {}, Team: {}'.format(name, age, team)) print_player_details('Virat', 33, 'rcb') msd = ('ms dhoni', 37, 'csk') print_player_details(msd[0], msd[1], msd[2]) print_player_details(*msd)
#!/usr/bin/python code = input() if code.isdigit() and len(code) == 5: print("true") else: print("false")
code = input() if code.isdigit() and len(code) == 5: print('true') else: print('false')
# # PySNMP MIB module P8541-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/P8541-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:36:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, single_value_constraint, value_size_constraint) ...
#Dynamic Programming n, m = input().strip().split(' ') n, m = [int(n), int(m)] coins = [int(coins_temp) for coins_temp in input().strip().split(' ')] coins = [0] + coins T = [[-1 for _ in range(n + 1)] for _ in range(m + 1)] for p in range(1, m + 1): T[p][0] = 1 for i in range(1, n + 1): tot = 0 ...
(n, m) = input().strip().split(' ') (n, m) = [int(n), int(m)] coins = [int(coins_temp) for coins_temp in input().strip().split(' ')] coins = [0] + coins t = [[-1 for _ in range(n + 1)] for _ in range(m + 1)] for p in range(1, m + 1): T[p][0] = 1 for i in range(1, n + 1): tot = 0 for k in range(1...
# -*- coding: utf-8 -*- __version__ = '0.2.0' __author__ = 'matteo vezzola <matteo@studioripiu.it>' default_app_config = 'ripiu.cmsplugin_fup.apps.FUPConfig'
__version__ = '0.2.0' __author__ = 'matteo vezzola <matteo@studioripiu.it>' default_app_config = 'ripiu.cmsplugin_fup.apps.FUPConfig'
# [h] clear unicodes '''Clear unicode values from selected glyphs.''' f = CurrentFont() for gName in f.selection: f[gName].unicodes = []
"""Clear unicode values from selected glyphs.""" f = current_font() for g_name in f.selection: f[gName].unicodes = []
# Created by MechAviv # ID :: [865010200] # Commerci Republic : Berry sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.sendNext("Good! Now I leave. I just came to Berry to get fish from Berry. Haha! They have the same name! Berry, Berry, Berry, Berry.") sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.setPlaye...
sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.sendNext('Good! Now I leave. I just came to Berry to get fish from Berry. Haha! They have the same name! Berry, Berry, Berry, Berry.') sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.setPlayerAsSpeaker() sm.sendSay('Do you have to leave right this second? I wanted...
class Solution: def isAnagram(self, s: str, t: str) -> bool: ls, lt = list(s), list(t) ls.sort() lt.sort() return ls == lt
class Solution: def is_anagram(self, s: str, t: str) -> bool: (ls, lt) = (list(s), list(t)) ls.sort() lt.sort() return ls == lt
click("1471904203479.png") type("1471904321912.png", "chrome") click("1471904343756.png") type("1471614896832.png", "google") type(Key.ENTER) wait("1471904646171.png")
click('1471904203479.png') type('1471904321912.png', 'chrome') click('1471904343756.png') type('1471614896832.png', 'google') type(Key.ENTER) wait('1471904646171.png')
class Thing2(): # class attribute letters = 'abc' def test_bench(): ''' Demo class attribute ''' # expected output: ''' abc ''' print( Thing2.letters ) if __name__ == '__main__': help( test_bench ) test_bench()
class Thing2: letters = 'abc' def test_bench(): """ Demo class attribute """ '\n abc\n ' print(Thing2.letters) if __name__ == '__main__': help(test_bench) test_bench()
n = 100 while n > 0: print(n) n -= 1 def rec_while(n): # O(n) # base case if n == 0: return # logic that we want to do print(n) rec_while(n - 1)
n = 100 while n > 0: print(n) n -= 1 def rec_while(n): if n == 0: return print(n) rec_while(n - 1)
def A(): table = input() hand = input().split() numero , palo = table[0] , table[1] for h in hand: if (h[0]== numero): print("YES") return if(h[1]==palo): print("YES") return print("NO") A()
def a(): table = input() hand = input().split() (numero, palo) = (table[0], table[1]) for h in hand: if h[0] == numero: print('YES') return if h[1] == palo: print('YES') return print('NO') a()
class Solution: def compareVersion(self, version1: str, version2: str) -> int: v1 = [int(n) for n in version1.split('.')] v2 = [int(n) for n in version2.split('.')] l1 = len(v1) l2 = len(v2) if l1 < l2: v1 = self.addZero(v1, l2) elif l1 > l2: ...
class Solution: def compare_version(self, version1: str, version2: str) -> int: v1 = [int(n) for n in version1.split('.')] v2 = [int(n) for n in version2.split('.')] l1 = len(v1) l2 = len(v2) if l1 < l2: v1 = self.addZero(v1, l2) elif l1 > l2: ...
VERSION = 'v1' PROJECT = 'gcp-healthcare-oss-test' IMAGEPROJECT = 'cloud-healthcare-containers' LOCATION = 'us-central1' DATASET = "healthcare-dicom-dicomweb-adapter-test" STORE_NAME = 'integration-test-store' BUCKET = 'dicomweb-import-adapter-integration-test' ADAPTER_PORT = '2575' STORE_SCP_PORT = '2576' CLOSE_STORE_...
version = 'v1' project = 'gcp-healthcare-oss-test' imageproject = 'cloud-healthcare-containers' location = 'us-central1' dataset = 'healthcare-dicom-dicomweb-adapter-test' store_name = 'integration-test-store' bucket = 'dicomweb-import-adapter-integration-test' adapter_port = '2575' store_scp_port = '2576' close_store_...
class static_game(object): def __init__(self, S, U): self.S = S self.U = U def benefit(self, u): return reduce(lambda a, b: a[b], u, self.U) def playing(self, players, times = 200): point_p = [0] * len(players) rec = [] for iteration in xrange(tim...
class Static_Game(object): def __init__(self, S, U): self.S = S self.U = U def benefit(self, u): return reduce(lambda a, b: a[b], u, self.U) def playing(self, players, times=200): point_p = [0] * len(players) rec = [] for iteration in xrange(times): ...
ACIDS = { "Ala": ["gct", "gcc", "gca", "gcg"], "Arg": ["cgt", "cgc", "cga", "cgg"], "Asn": ["aat", "aac"], "Asp": ["gat", "gac"], "Cys": ["tgt", "tgc"], "Gln": ["caa", "cag"], "Glu": ["gaa", "gag"], "Gly": ["ggt", "ggc", "gga", "ggg"], "His": ["cat", "cac"], "Ile": ["att", "atc",...
acids = {'Ala': ['gct', 'gcc', 'gca', 'gcg'], 'Arg': ['cgt', 'cgc', 'cga', 'cgg'], 'Asn': ['aat', 'aac'], 'Asp': ['gat', 'gac'], 'Cys': ['tgt', 'tgc'], 'Gln': ['caa', 'cag'], 'Glu': ['gaa', 'gag'], 'Gly': ['ggt', 'ggc', 'gga', 'ggg'], 'His': ['cat', 'cac'], 'Ile': ['att', 'atc', 'ata'], 'Leu': ['ctt', 'ctc', 'cta', 'ct...
# Bubble Sort # Time Complexity: O(n^2) # Space Complexity: O(1) # Comparing adjacent elements by two for-loops continually # Then move the bigger one to its back def bubble_Sort(lst): for i in range(len(lst)): # first read print(lst) ...
def bubble__sort(lst): for i in range(len(lst)): print(lst) for j in range(1, len(lst) - i): if lst[j] < lst[j - 1]: (lst[j], lst[j - 1]) = (lst[j - 1], lst[j]) return lst
load("@io_bazel_rules_scala//scala:providers.bzl", _DepsInfo = "DepsInfo") load("//scala/private/toolchain_deps:toolchain_deps.bzl", "expose_toolchain_deps") def _tut_toolchain_impl(ctx): toolchain = platform_common.ToolchainInfo( dep_providers = ctx.attr.dep_providers, ) return [toolchain] tut_t...
load('@io_bazel_rules_scala//scala:providers.bzl', _DepsInfo='DepsInfo') load('//scala/private/toolchain_deps:toolchain_deps.bzl', 'expose_toolchain_deps') def _tut_toolchain_impl(ctx): toolchain = platform_common.ToolchainInfo(dep_providers=ctx.attr.dep_providers) return [toolchain] tut_toolchain = rule(_tut_...
numberTuple = (0, 1, 2) < (5, 1, 2) #goes from left to right so the order matters #run immediately without printing or providing a variable is to type directly on terminal (interactive shell) print(numberTuple) stringTuple = ('Jones', 'Sally') < ('Jones', 'Sam') #Jones = J, o, n, e, s [string and tupple are similar]] ...
number_tuple = (0, 1, 2) < (5, 1, 2) print(numberTuple) string_tuple = ('Jones', 'Sally') < ('Jones', 'Sam') print(stringTuple)
n, m = [int(x) for x in input().split()] img_a = [] img_b = [] for i in range(n): img_a.append(input()) for i in range(m): img_b.append(input()) ans = "No" for a in range(n - m + 1): border = 0 flag = True while flag: for b in range(m): if img_b[b] in img_a[b +...
(n, m) = [int(x) for x in input().split()] img_a = [] img_b = [] for i in range(n): img_a.append(input()) for i in range(m): img_b.append(input()) ans = 'No' for a in range(n - m + 1): border = 0 flag = True while flag: for b in range(m): if img_b[b] in img_a[b + a][border:]: ...
print("Most Rated Movies") display(rating_gb_movie.count()["userId"].sort_values()[::-1][:10]) nb_rate_min = 10 rating_gb_movie_filter = rating_gb_movie.mean()["rating"][rating_gb_movie.count()["userId"]>nb_rate_min] sorted_movies = rating_gb_movie_filter.sort_values() print("Top 10 worst movies (for movies with at lea...
print('Most Rated Movies') display(rating_gb_movie.count()['userId'].sort_values()[::-1][:10]) nb_rate_min = 10 rating_gb_movie_filter = rating_gb_movie.mean()['rating'][rating_gb_movie.count()['userId'] > nb_rate_min] sorted_movies = rating_gb_movie_filter.sort_values() print('Top 10 worst movies (for movies with at l...
#author Kollen Gruizenga #function to check if all numbers are odd in list L def allOdd(L): for x in L: if (x%2 == 0): return False return True
def all_odd(L): for x in L: if x % 2 == 0: return False return True
class BadDataError(Exception): def __init__(self, message): super(BadDataError, self).__init__(message) class InvalidFileError(Exception): def __init__(self,message): super(InvalidFileError, self).__init__(message)
class Baddataerror(Exception): def __init__(self, message): super(BadDataError, self).__init__(message) class Invalidfileerror(Exception): def __init__(self, message): super(InvalidFileError, self).__init__(message)
# This program reads in a students percentage mark # and prints out the corresponding grade x = float (input("Enter the percentage: ")) if x < 40: print("Fail") elif x in range(40, 49): print("Pass") elif x in range(50, 59): print("Merit 2") elif x in range(60, 69): print("Merit 1") else: print("D...
x = float(input('Enter the percentage: ')) if x < 40: print('Fail') elif x in range(40, 49): print('Pass') elif x in range(50, 59): print('Merit 2') elif x in range(60, 69): print('Merit 1') else: print('Distinction')
#!/usr/bin/python3 with open('./input.txt', 'r') as input: list_lines = input.read().split('\n') list_lines = [int(item) for item in list_lines] list_lines.sort() list_lines.append(list_lines[-1]+3) memo = {0: 1} for i in list_lines: memo[i] = memo.get(i-3,0) \ + memo.ge...
with open('./input.txt', 'r') as input: list_lines = input.read().split('\n') list_lines = [int(item) for item in list_lines] list_lines.sort() list_lines.append(list_lines[-1] + 3) memo = {0: 1} for i in list_lines: memo[i] = memo.get(i - 3, 0) + memo.get(i - 2, 0) + memo.get(i - 1, 0) ...
def is_triangle(a, b, c): return (a + b) > c and (a + c) > b and (b + c) > a # after conforming the input collector = [] with open('test_input.txt', 'r') as f: for line in f.readlines(): # explicit, because otherwise it's ugly a, b, c = map(lambda x: int(x), line.split()) collector.appe...
def is_triangle(a, b, c): return a + b > c and a + c > b and (b + c > a) collector = [] with open('test_input.txt', 'r') as f: for line in f.readlines(): (a, b, c) = map(lambda x: int(x), line.split()) collector.append((a, b, c)) i = 0 for line in collector: if is_triangle(*line): i ...
A = int(input()) B = int(input()) SOMA = A + B #operador de soma print('SOMA = {}'.format(SOMA))
a = int(input()) b = int(input()) soma = A + B print('SOMA = {}'.format(SOMA))
# coding: utf-8 ############################################################################## # Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. # # Subject to your compliance with these terms, you may use Microchip software # and any derivatives exclusively with Microchip products. It is your # resp...
i2sc_component_id_list = ['a_drv_i2s', 'drv_i2c', 'twihs0', 'a_i2sc1', 'sys_time', 'tc0'] i2sc_auto_connect_list = [['audio_codec_generic', 'DRV_I2S', 'a_drv_i2s_0', 'drv_i2s'], ['a_drv_i2s_0', 'drv_i2s_I2S_dependency', 'a_i2sc1', 'I2SC1_I2S'], ['audio_codec_generic', 'DRV_I2C', 'drv_i2c_0', 'drv_i2c'], ['drv_i2c_0', '...
expected_output = { 'peer_address': { '11.11.11.2': { 'peer_vni': { '20011': { 'local_vni': '20011', 'interface': 'nve1', 'up_time': '1w6d', 'number_of_routes': { 'ead_per_evi'...
expected_output = {'peer_address': {'11.11.11.2': {'peer_vni': {'20011': {'local_vni': '20011', 'interface': 'nve1', 'up_time': '1w6d', 'number_of_routes': {'ead_per_evi': 0, 'mac': 1, 'mac_ip': 1, 'imet': 1, 'total': 3}}, '20012': {'local_vni': '20012', 'interface': 'nve1', 'up_time': '1w6d', 'number_of_routes': {'ead...
class Stack(object): def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def isEmpty(self): return self.items == [] def size(self): return len(self.items) def peek(self): return self.items[len(self.items)-1] # This data structure is...
class Stack(object): def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def is_empty(self): return self.items == [] def size(self): return len(self.items) def peek(self): r...
f2= open("b.txt","w") dic ={} for line2 in open('TEMP_country_in_enesfr.txt'): country = line2.strip().lower() dic[country]=1 for line in open('words.filtered_SRC1000PlusCountry.txt'): entry = line.strip().lower() if entry in dic: continue; else: f2.write(entry+'\n') f2.close()
f2 = open('b.txt', 'w') dic = {} for line2 in open('TEMP_country_in_enesfr.txt'): country = line2.strip().lower() dic[country] = 1 for line in open('words.filtered_SRC1000PlusCountry.txt'): entry = line.strip().lower() if entry in dic: continue else: f2.write(entry + '\n') f2.close()
#encoding:utf-8 subreddit = 'thefalconandthews' t_channel = '@thefalconandthews_reddit' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'thefalconandthews' t_channel = '@thefalconandthews_reddit' def send_post(submission, r2t): return r2t.send_simple(submission)
# -*- coding: utf-8 -*- def invert_dictionary(dictionary): return {v:k for k, v in dictionary.items()} def capitalize_first(string): return string[:1].upper() + string[1:]
def invert_dictionary(dictionary): return {v: k for (k, v) in dictionary.items()} def capitalize_first(string): return string[:1].upper() + string[1:]
# # This file contains the Python code from Program 7.24 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm07_24.txt # class SortedListAs...
class Sortedlistasarray(OrderedListAsArray, SortedList): def __init__(self, size=0): super(SortedListAsArray, self).__init__(size)
def Calculator(a, b): print('----- Currently testing: ', a, b, '-----') print('----- Expect: ', a + b) neg_string = '' pos_string = '' Calculator(2, 1) # Calculator(-2, 1) # Calculator(-3, 1) # Calculator(0, 0) Calculator(2, 3)
def calculator(a, b): print('----- Currently testing: ', a, b, '-----') print('----- Expect: ', a + b) neg_string = '' pos_string = '' calculator(2, 1) calculator(2, 3)
class Solution: def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: ## dfs ## time complexity O(n^2) def dfs(nums, path=None, res=[]): if path: res += [path] if path is None: path = [] for idx, num in enumerate(num...
class Solution: def subsets_with_dup(self, nums: List[int]) -> List[List[int]]: def dfs(nums, path=None, res=[]): if path: res += [path] if path is None: path = [] for (idx, num) in enumerate(nums): if idx > 0 and num == n...
# Copyright 2016 Pinterest, Inc. # # 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...
class Agentstatus(object): succeeded = 0 unknown = 1 agent_failed = 2 retryable_agent_failed = 3 script_failed = 4 aborted_by_service = 5 script_timeout = 6 too_many_retry = 7 runtime_mismatch = 8 aborted_by_server = 9 _values_to_names = {0: 'SUCCEEDED', 1: 'UNKNOWN', 2: 'AGE...
class Solution: def isStrobogrammatic(self, num: str) -> bool: ''' T: O(n) and S: O(1) ''' maps = {'0':'0', '1':'1', '6':'9', '8':'8', '9':'6'} i, j = 0, len(num) - 1 while i <= j: if num[i] not in maps or num[j] not in maps: retur...
class Solution: def is_strobogrammatic(self, num: str) -> bool: """ T: O(n) and S: O(1) """ maps = {'0': '0', '1': '1', '6': '9', '8': '8', '9': '6'} (i, j) = (0, len(num) - 1) while i <= j: if num[i] not in maps or num[j] not in maps: ret...
CREATE_POST = "/post" STATS = "/me" TOP = "/top" REPLENISH = "/r" WITHDRAW = "/w" CHANGE_LANGUAGE = "/lang" HELP = "/help" START = "/start"
create_post = '/post' stats = '/me' top = '/top' replenish = '/r' withdraw = '/w' change_language = '/lang' help = '/help' start = '/start'
callers = ["delly", "gridss", "lumpy", "manta"] hp_consensus = ["0.2", "100", "4", "0.4", "0.1"] stacked = ["n", "y"] with open("Parameters_StackedWindows.txt", "w") as outfile: for caller in callers: for stack in stacked: outfile.write(caller + "\t" + "\t".join(hp_consensus) + "\t" + stack + "...
callers = ['delly', 'gridss', 'lumpy', 'manta'] hp_consensus = ['0.2', '100', '4', '0.4', '0.1'] stacked = ['n', 'y'] with open('Parameters_StackedWindows.txt', 'w') as outfile: for caller in callers: for stack in stacked: outfile.write(caller + '\t' + '\t'.join(hp_consensus) + '\t' + stack + '\...
n, m = map(int, input().split()) w = list(reversed(sorted([int(x) for x in input().split()]))) mongers = [] for i in range(m): x, j = map(int, input().split()) mongers.append((x, j)) mongers = sorted(mongers, key=lambda x: x[1], reverse=True) res = 0 p = 0 for monger in mongers: num_fish, price = monger ...
(n, m) = map(int, input().split()) w = list(reversed(sorted([int(x) for x in input().split()]))) mongers = [] for i in range(m): (x, j) = map(int, input().split()) mongers.append((x, j)) mongers = sorted(mongers, key=lambda x: x[1], reverse=True) res = 0 p = 0 for monger in mongers: (num_fish, price) = mong...
# This problem was recently asked by Amazon: # A number can be constructed by a path from the root to a leaf. Given a binary tree, sum all the numbers that can be constructed from the root to all leaves. class Node: def __init__(self, value, left=None, right=None): self.value = value self.left = ...
class Node: def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right def __repr__(self): return f'({self.value}, {self.left}, {self.right})' def tree_paths_sum_util(root, val): if root is None: return 0 val = val ...
class Logger: _instance = None def __new__(cls): if cls._instance is None: print('creating the object') cls._instance = super(Logger,cls).__new__(cls) return cls._instance log1 = Logger() log2 = Logger() print('Are they the same object?', log1 is log2)
class Logger: _instance = None def __new__(cls): if cls._instance is None: print('creating the object') cls._instance = super(Logger, cls).__new__(cls) return cls._instance log1 = logger() log2 = logger() print('Are they the same object?', log1 is log2)
class Calculator: def power(self,n,p): try: res = pow(n, p) if n<0: e=ValueError("n and p should be non-negative") raise e elif p<0: e = ValueError("n and p should be non-negative") raise e ...
class Calculator: def power(self, n, p): try: res = pow(n, p) if n < 0: e = value_error('n and p should be non-negative') raise e elif p < 0: e = value_error('n and p should be non-negative') raise e ...
firstLED = 512 strips = [ 32, 29, 24, 17, 10, 7, 8, 15, 11, 12, 14, 10, 9 ] highest = 0 for x in strips: if highest < x: highest = x base = ["SAFE_LED" for x in range(highest)] output = "#define...
first_led = 512 strips = [32, 29, 24, 17, 10, 7, 8, 15, 11, 12, 14, 10, 9] highest = 0 for x in strips: if highest < x: highest = x base = ['SAFE_LED' for x in range(highest)] output = '#define STRIP_MAX_SIZE {}\n'.format(highest) output += '#define STRIPS_NUM {}\n'.format(len(strips)) output += 'const uint...
def solution(l): # Take array l split into specific versions, change version to dictionary, sort using dictionary versions = [] # Array of dictionaries for version_number in l: numbers = version_number.split('.') parts = len(numbers) major = int(numbers[0]) minor = 0 ...
def solution(l): versions = [] for version_number in l: numbers = version_number.split('.') parts = len(numbers) major = int(numbers[0]) minor = 0 revision = 0 if parts > 1: minor = int(numbers[1]) if parts > 2: revision = int(numbe...
TEST_DATA_SET = { 'collector_and_host_tags_and_meta_tags': { "apiKey": "d9f7e9b4f8d4ebc2f5c4d7f0c3dffa96", "cpuSystem": 0.56, "memShared": 44, "ioStats": { "sr0": { "wrqm/s": "0.00", "r/s": "0.00", "rrqm/s": "0.00", ...
test_data_set = {'collector_and_host_tags_and_meta_tags': {'apiKey': 'd9f7e9b4f8d4ebc2f5c4d7f0c3dffa96', 'cpuSystem': 0.56, 'memShared': 44, 'ioStats': {'sr0': {'wrqm/s': '0.00', 'r/s': '0.00', 'rrqm/s': '0.00', 'rkB/s': '0.00', 'await': '0.00', 'w/s': '0.00', 'avgqu-sz': '0.00', 'svctm': '0.00', 'wkB/s': '0.00', 'r_aw...
# define GAN model model = dict( type='BasiccGAN', generator=dict(type='SNGANGenerator', output_scale=32, base_channels=256), discriminator=dict( type='ProjDiscriminator', input_scale=32, base_channels=128), gan_loss=dict(type='GANLoss', gan_type='hinge')) train_cfg = dict(disc_steps=5) test_cf...
model = dict(type='BasiccGAN', generator=dict(type='SNGANGenerator', output_scale=32, base_channels=256), discriminator=dict(type='ProjDiscriminator', input_scale=32, base_channels=128), gan_loss=dict(type='GANLoss', gan_type='hinge')) train_cfg = dict(disc_steps=5) test_cfg = None optimizer = dict(generator=dict(type=...
axis = [] dict = {} for p in ["L", "R"]: for q in ["DSP", "RME"]: for r in ["1","2","3","4","5"]: name = q + p + ' ' + r + ".txt" f = open(name, 'r') c = f.read() f.close() lines = [a for a in c.split('\n') if len(a) > 0 and a[0].isdigit()] data = [float(a.split(' ')[1]) for a...
axis = [] dict = {} for p in ['L', 'R']: for q in ['DSP', 'RME']: for r in ['1', '2', '3', '4', '5']: name = q + p + ' ' + r + '.txt' f = open(name, 'r') c = f.read() f.close() lines = [a for a in c.split('\n') if len(a) > 0 and a[0].isdigit()] ...
# Generator function allow us to write a function that can send back a value # and later resume to pick up where it left off. # It allows us to genrate a sequence of values over time,it uses yield statement # When it is compiled they became object which supports and iteration protocol # Create cubes def get_c...
def get_cubes(num): result = [] for i in range(num): result.append(i ** 3) return result print(get_cubes(10)) for x in get_cubes(10): print(x) def get_cubes2(num): for i in range(num): yield (i ** 3) print(get_cubes2(11)) for i in get_cubes2(11): print(i)
word_list=["ardvark", "baboon", "camel", "wolf", "dog", "cat", "elephant", "snake", "fish", "corocdail", "tiger", "loin"]
word_list = ['ardvark', 'baboon', 'camel', 'wolf', 'dog', 'cat', 'elephant', 'snake', 'fish', 'corocdail', 'tiger', 'loin']
f1 = lambda x: lambda y: x + y inc = f1(1) plus10 = f1(10) ___assertEqual(inc(1), 2) ___assertEqual(plus10(5), 15)
f1 = lambda x: lambda y: x + y inc = f1(1) plus10 = f1(10) ___assert_equal(inc(1), 2) ___assert_equal(plus10(5), 15)
a = int(input("introducir la raiz:")) b = 40 c = 60 d = 25 e = 45 f = 55 g = 65 if (a!= None ): print(a) if((b>d) and (e>b) and (b<a)): print(b) if ((d<b) and (d<e) and (d>a)): print (d) if((e>b) and (e<a) and (e>d)): print (e) ...
a = int(input('introducir la raiz:')) b = 40 c = 60 d = 25 e = 45 f = 55 g = 65 if a != None: print(a) if b > d and e > b and (b < a): print(b) if d < b and d < e and (d > a): print(d) if e > b and e < a and (e > d): print(e) if c > a and c...
students = sorted([input(), float(input())] for _ in range(int(input()))) low2nd = sorted(set(s[1] for s in students))[1] for s in students: if s[1] == low2nd: print(s[0]) # OR students = sorted([input(), float(input())] for _ in range(int(input()))) low2nd = sorted(set(s[1] for s in students))[1] print('\n'.join...
students = sorted(([input(), float(input())] for _ in range(int(input())))) low2nd = sorted(set((s[1] for s in students)))[1] for s in students: if s[1] == low2nd: print(s[0]) students = sorted(([input(), float(input())] for _ in range(int(input())))) low2nd = sorted(set((s[1] for s in students)))[1] print(...
class Solution: def minimumAbsDifference(self, arr: List[int]) -> List[List[int]]: arr.sort() minn = inf n = len(arr) for i in range(1, n): minn = min(arr[i]-arr[i-1], minn) ans = [] for i in range(1, n): if minn == arr[i] - arr[i-1]: ans.append([arr[i-1], arr[i]]) retu...
class Solution: def minimum_abs_difference(self, arr: List[int]) -> List[List[int]]: arr.sort() minn = inf n = len(arr) for i in range(1, n): minn = min(arr[i] - arr[i - 1], minn) ans = [] for i in range(1, n): if minn == arr[i] - arr[i - 1]: ...
class SuffixTrie: def _init__(self, string): self.root = {} self.endSymbol = "*" self.populateSuffixTrieFrom(string) # O(n^2) time / O(n^2) space def populateSuffixTrieFrom(self, string): for i in range(len(string)): self.insertSubstringStartingAt(i, string) ...
class Suffixtrie: def _init__(self, string): self.root = {} self.endSymbol = '*' self.populateSuffixTrieFrom(string) def populate_suffix_trie_from(self, string): for i in range(len(string)): self.insertSubstringStartingAt(i, string) def insert_substring_startin...
class Solution: def XXX(self, x: int) -> int: i=1 while 1: if i*i>x: return i-1 else: i+=1
class Solution: def xxx(self, x: int) -> int: i = 1 while 1: if i * i > x: return i - 1 else: i += 1
n, m = map(int, input().split()) comb_dict = dict([]) comb_dict[(0, 0)] = 1 comb_dict[(1, 0)] = 1 comb_dict[(1, 1)] = 1 def get_comb(inp): n, m = inp if m == 0: return 1 elif n == m: return 1 else: try: return comb_dict[inp] except: ret = get_com...
(n, m) = map(int, input().split()) comb_dict = dict([]) comb_dict[0, 0] = 1 comb_dict[1, 0] = 1 comb_dict[1, 1] = 1 def get_comb(inp): (n, m) = inp if m == 0: return 1 elif n == m: return 1 else: try: return comb_dict[inp] except: ret = get_comb((...
print("primes under 100") for num in range(100): if num > 1: # check for factors for i in range(2,num): if (num % i) == 0: break else: print(num,"is a prime number") # if input number is less than # or equal to 1, it is not prime ...
print('primes under 100') for num in range(100): if num > 1: for i in range(2, num): if num % i == 0: break else: print(num, 'is a prime number') else: print(num, 'is not a prime number')