content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: # @param {integer[]} nums # @return {string} def largestNumber(self, nums): nums = sorted(nums, cmp=self.compare) res, j = '', 0 for i in range(len(nums) - 1): if nums[i] != 0: break else: j += 1 for k in...
class Solution: def largest_number(self, nums): nums = sorted(nums, cmp=self.compare) (res, j) = ('', 0) for i in range(len(nums) - 1): if nums[i] != 0: break else: j += 1 for k in range(j, len(nums)): res += str(nu...
n = int(input()) sequence = [] for i in range(n): sequence.append(int(input())) print(f"Max number: {max(sequence)}\nMin number: {min(sequence)}")
n = int(input()) sequence = [] for i in range(n): sequence.append(int(input())) print(f'Max number: {max(sequence)}\nMin number: {min(sequence)}')
#python evt = lx.args()[0] if evt == 'onDo': lx.eval("?kelvin.quickScale") elif evt == 'onDrop': pass
evt = lx.args()[0] if evt == 'onDo': lx.eval('?kelvin.quickScale') elif evt == 'onDrop': pass
class Solution: def lexicalOrder(self, n: int) -> List[int]: ans = [1] while len(ans) < n: nxt = ans[-1] * 10 while nxt > n: nxt //= 10 nxt += 1 while nxt % 10 == 0: nxt //= 10 ans.append(nxt) ...
class Solution: def lexical_order(self, n: int) -> List[int]: ans = [1] while len(ans) < n: nxt = ans[-1] * 10 while nxt > n: nxt //= 10 nxt += 1 while nxt % 10 == 0: nxt //= 10 ans.append(nxt) ...
# Advent of Code - Day 2 # day_2_advent_2020.py # 2020.12.02 # Jimmy Taylor # Reading data from text file, spliting each value as separate lines without line break input_data = open('inputs/day2.txt').read().splitlines() # Cleaning up the data in each row to make it easier to parse later as individual rows modified_da...
input_data = open('inputs/day2.txt').read().splitlines() modified_data = [line.replace('-', ' ').replace(':', '').replace(' ', ',') for line in input_data] valid_passwords_part_1 = 0 bad_passwords_part_1 = 0 valid_passwords_part_2 = 0 bad_passwords_part_2 = 0 for row in modified_data: row = list(row.split(',')) ...
for t in range(int(input())): G = int(input()) for g in range(G): I,N,Q = map(int,input().split()) if I == 1 : if N%2: heads = N//2 tails = N - N//2 if Q == 1: print(heads) else: ...
for t in range(int(input())): g = int(input()) for g in range(G): (i, n, q) = map(int, input().split()) if I == 1: if N % 2: heads = N // 2 tails = N - N // 2 if Q == 1: print(heads) else: ...
class Tile(): def __init__(self, pos): self.white = True self.pos = pos def flip(self): self.white = not self.white def get_new_coord(from_tile, instructions): curr = [from_tile.pos[0], from_tile.pos[1]] for instruction in instructions: if instruction == "ne": ...
class Tile: def __init__(self, pos): self.white = True self.pos = pos def flip(self): self.white = not self.white def get_new_coord(from_tile, instructions): curr = [from_tile.pos[0], from_tile.pos[1]] for instruction in instructions: if instruction == 'ne': ...
# Example 1: # Input: digits = "23" # Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"] # Example 2: # Input: digits = "" # Output: [] # Example 3: # Input: digits = "2" # Output: ["a","b","c"] class Solution: def letterCombinations(self, digits: str) -> List[str]: phone_keyboard = {2: 'abc', 3: 'de...
class Solution: def letter_combinations(self, digits: str) -> List[str]: phone_keyboard = {2: 'abc', 3: 'def', 4: 'ghi', 5: 'jkl', 6: 'mno', 7: 'pqrs', 8: 'tuv', 9: 'wxyz'} answer = [''] if digits else [] for x in digits: answer = [i + j for i in answer for j in phone_keyboard[i...
# Write a program to read through the mbox-short.txt and figure out who has sent # the greatest number of mail messages. The program looks for 'From ' lines and # takes the second word of those lines as the person who sent the mail # The program creates a Python dictionary that maps the sender's mail address to a ' \ #...
md = dict() name = input('Enter file:') if len(name) < 1: name = 'mbox-short.txt' handle = open(name) for linem in handle: if linem.startswith('From '): key = linem.split()[1] md[key] = md.get(key, 0) + 1 bigcnt = None bigwd = None for (wd, cnt) in md.items(): if bigcnt is None or cnt > bigc...
#List of Numbers list1 = [12, -7, 5, 64, -14] #Iterating each number in the lsit for i in list1: #checking the condition if i >= 0: print(i, end = " ")
list1 = [12, -7, 5, 64, -14] for i in list1: if i >= 0: print(i, end=' ')
def Rotate2DArray(arr): n = len(arr[0]) for i in range(0, n//2): for j in range(i, n-i-1): temp = arr[i][j] arr[i][j] = arr[n-1-j][i] arr[n-j-1][i] = arr[n-1-i][n-j-1] arr[n-i-1][n-j-1] = arr[j][n-i-1] arr[j][n-i-1] = temp return ar...
def rotate2_d_array(arr): n = len(arr[0]) for i in range(0, n // 2): for j in range(i, n - i - 1): temp = arr[i][j] arr[i][j] = arr[n - 1 - j][i] arr[n - j - 1][i] = arr[n - 1 - i][n - j - 1] arr[n - i - 1][n - j - 1] = arr[j][n - i - 1] arr[j]...
class Scene: def __init__(self, name="svg", height=400, width=400): self.name = name self.items = [] self.height = height self.width = width return def add(self, item): self.items.append(item) def strarray(self): var = ["<?xml version=\"1.0\"?>\n", ...
class Scene: def __init__(self, name='svg', height=400, width=400): self.name = name self.items = [] self.height = height self.width = width return def add(self, item): self.items.append(item) def strarray(self): var = ['<?xml version="1.0"?>\n', '<...
#Leia uma temperatura em graus celsius e apresente-a convertida em fahrenheit. # A formula da conversao eh: F=C*(9/5)+32, # sendo F a temperatura em fahrenheit e c a temperatura em celsius. C=float(input("Informe a temperatura em Celsius: ")) F=C*(9/5)+32 print(f"A temperatura em Fahrenheit eh {round(F,1)}")
c = float(input('Informe a temperatura em Celsius: ')) f = C * (9 / 5) + 32 print(f'A temperatura em Fahrenheit eh {round(F, 1)}')
def main(j, args, params, tags, tasklet): page = args.page action = args.requestContext.params.get('action') domain = args.requestContext.params.get('domain') name = args.requestContext.params.get('name') version = args.requestContext.params.get('version') nid = args.requestContext.params.get('n...
def main(j, args, params, tags, tasklet): page = args.page action = args.requestContext.params.get('action') domain = args.requestContext.params.get('domain') name = args.requestContext.params.get('name') version = args.requestContext.params.get('version') nid = args.requestContext.params.get('n...
STATS = [ { "num_node_expansions": 25, "plan_length": 20, "search_time": 0.04, "total_time": 0.04 }, { "num_node_expansions": 22, "plan_length": 18, "search_time": 0.04, "total_time": 0.04 }, { "num_node_expansions": 24, ...
stats = [{'num_node_expansions': 25, 'plan_length': 20, 'search_time': 0.04, 'total_time': 0.04}, {'num_node_expansions': 22, 'plan_length': 18, 'search_time': 0.04, 'total_time': 0.04}, {'num_node_expansions': 24, 'plan_length': 21, 'search_time': 0.33, 'total_time': 0.33}, {'num_node_expansions': 26, 'plan_length': 2...
print(14514) for i in range(3, 121): for j in range(1, i + 1): print(i, j, -1) print(i, j, 1)
print(14514) for i in range(3, 121): for j in range(1, i + 1): print(i, j, -1) print(i, j, 1)
obj_row, obj_col = 2978, 3083 first_code = 20151125 def generate(obj_row, obj_col): x_row= obj_row + obj_col - 1 x_n = sum(range(1, x_row + 1)) - (x_row - obj_col) print(x_n) previous = first_code aux = first_code for i in range(1, x_n) : aux = (previous * 252533) % 33554393 ...
(obj_row, obj_col) = (2978, 3083) first_code = 20151125 def generate(obj_row, obj_col): x_row = obj_row + obj_col - 1 x_n = sum(range(1, x_row + 1)) - (x_row - obj_col) print(x_n) previous = first_code aux = first_code for i in range(1, x_n): aux = previous * 252533 % 33554393 p...
def wait(t, c): while c < t: c += c return c s, t, n = [int(i) for i in raw_input().split()] d = map(int, raw_input().split()) b = map(int, raw_input().split()) c = map(int, raw_input().split()) time = s time += d[0] for i in range(n): time = wait(time, c[i]) time += b[i] time += d[i+1] pri...
def wait(t, c): while c < t: c += c return c (s, t, n) = [int(i) for i in raw_input().split()] d = map(int, raw_input().split()) b = map(int, raw_input().split()) c = map(int, raw_input().split()) time = s time += d[0] for i in range(n): time = wait(time, c[i]) time += b[i] time += d[i + 1] ...
class Config: SECRET_KEY = 'a22912297e93845c6cf4776991df63ec' SQLALCHEMY_DATABASE_URI = 'sqlite:///site.db' MAIL_SERVER = 'smtp.gmail.com' MAIL_PORT = 587 MAIL_USE_TLS = True MAIL_USERNAME = "noreplya006@gmail.com" MAIL_PASSWORD = "#@1234abcd"
class Config: secret_key = 'a22912297e93845c6cf4776991df63ec' sqlalchemy_database_uri = 'sqlite:///site.db' mail_server = 'smtp.gmail.com' mail_port = 587 mail_use_tls = True mail_username = 'noreplya006@gmail.com' mail_password = '#@1234abcd'
# https://practice.geeksforgeeks.org/problems/circular-tour-1587115620/1 # 4 6 7 4 # 6 5 3 5 # -2 1 4 -1 class Solution: def tour(self, lis, n): sum = 0 j = 0 for i in range(len(lis)): pair = lis[i] sum += pair[0]-pair[1] if sum < 0: sum =...
class Solution: def tour(self, lis, n): sum = 0 j = 0 for i in range(len(lis)): pair = lis[i] sum += pair[0] - pair[1] if sum < 0: sum = 0 j = i + 1 if j >= n: return -1 else: return ...
MESSAGES = { # name -> (message send, expected response) "ping request": (b'd1:ad2:id20:\x16\x01\xfb\xa7\xca\x18P\x9e\xe5\x1d\xcc\x0e\xf8\xc6Z\x1a\xfe<s\x81e1:q4:ping1:t2:aa1:y1:qe', b'^d1:t2:aa1:y1:r1:rd2:id20:.{20}ee$'), "ping request missing id": (b'd1:ade1:q4:ping1:t2:XX1:y1:qe', b'^d1:t2:X...
messages = {'ping request': (b'd1:ad2:id20:\x16\x01\xfb\xa7\xca\x18P\x9e\xe5\x1d\xcc\x0e\xf8\xc6Z\x1a\xfe<s\x81e1:q4:ping1:t2:aa1:y1:qe', b'^d1:t2:aa1:y1:r1:rd2:id20:.{20}ee$'), 'ping request missing id': (b'd1:ade1:q4:ping1:t2:XX1:y1:qe', b'^d1:t2:XX1:y1:e1:eli203e14:Protocol Erroree$'), 'find_node request': (b'd1:ad2...
#!/usr/bin/env python # PoC1.py junk = "A"*1000 payload = junk f = open('exploit.plf','w') f.write(payload) f.close()
junk = 'A' * 1000 payload = junk f = open('exploit.plf', 'w') f.write(payload) f.close()
''' Created on 22 Oct 2019 @author: Yvo ''' name = "Rom Filter";
""" Created on 22 Oct 2019 @author: Yvo """ name = 'Rom Filter'
class State: MOTION_STATIONARY = 0 MOTION_WALKING = 1 MOTION_RUNNING = 2 MOTION_DRIVING = 3 MOTION_BIKING = 4 LOCATION_HOME = 0 LOCATION_WORK = 1 LOCATION_OTHER = 2 RINGER_MODE_SILENT = 0 RINGER_MODE_VIBRATE = 1 RINGER_MODE_NORMAL = 2 SCREEN_STATUS_ON = 0 SCREEN_S...
class State: motion_stationary = 0 motion_walking = 1 motion_running = 2 motion_driving = 3 motion_biking = 4 location_home = 0 location_work = 1 location_other = 2 ringer_mode_silent = 0 ringer_mode_vibrate = 1 ringer_mode_normal = 2 screen_status_on = 0 screen_statu...
class Solution: def confusingNumberII(self, N: int) -> int: table = {0:0, 1:1, 6:9, 8:8, 9:6} keys = [0, 1, 6, 8, 9] def dfs(num, rotation, base): count = 0 if num != rotation: count += 1 for d in keys: if num == 0 and d == ...
class Solution: def confusing_number_ii(self, N: int) -> int: table = {0: 0, 1: 1, 6: 9, 8: 8, 9: 6} keys = [0, 1, 6, 8, 9] def dfs(num, rotation, base): count = 0 if num != rotation: count += 1 for d in keys: if num == 0 ...
def or_else(lhs, rhs): if lhs != None: return lhs else: return rhs def fold(function, arguments, initializer, accumulator = None): if len(arguments) == 0: return accumulator else: return fold( function, arguments[1:], initializer, function( or_else(accumulator, initializer), arg...
def or_else(lhs, rhs): if lhs != None: return lhs else: return rhs def fold(function, arguments, initializer, accumulator=None): if len(arguments) == 0: return accumulator else: return fold(function, arguments[1:], initializer, function(or_else(accumulator, initializer),...
## https://leetcode.com/problems/path-sum # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def hasPathSum(self, root: Optional[TreeNode], targetSum: int) ->...
class Solution: def has_path_sum(self, root: Optional[TreeNode], targetSum: int) -> bool: if root is None: return False if root.left is None and root.right is None: return root.val == targetSum left = self.hasPathSum(root.left, targetSum - root.val) right = s...
class Solution: def groupAnagrams(self, strs: 'List[str]') -> 'List[List[str]]': dic = {} for anagram in strs: key = ''.join(sorted(anagram)) if key in dic.keys(): dic[key].append(anagram) else: dic[key] = [anagram] result =...
class Solution: def group_anagrams(self, strs: 'List[str]') -> 'List[List[str]]': dic = {} for anagram in strs: key = ''.join(sorted(anagram)) if key in dic.keys(): dic[key].append(anagram) else: dic[key] = [anagram] result...
#!/usr/bin/env python3 def format_log_level(level): return [ 'DEBUG', 'INFO ', 'WARN ', 'ERROR', 'FATAL', ][level] def format_log_type(log_type): return log_type.lstrip('TI') def format_log_entry(log_entry): return '{} {} {}:{} {}'.format( log_entry['lo...
def format_log_level(level): return ['DEBUG', 'INFO ', 'WARN ', 'ERROR', 'FATAL'][level] def format_log_type(log_type): return log_type.lstrip('TI') def format_log_entry(log_entry): return '{} {} {}:{} {}'.format(log_entry['log_time'], format_log_level(log_entry['log_level']), log_entry['file_name'], log_...
# app/utils.py def make_step_iter(step, max_): num = 0 while True: yield num num = (num + step) % max_
def make_step_iter(step, max_): num = 0 while True: yield num num = (num + step) % max_
PASILLO_DID = "A1" CUARTO_ESTE_DID = "A2" CUARTO_OESTE_DID = "A4" SALON_DID = "A5" HEATER_DID = "C1" HEATER_PROTOCOL = "X10" HEATER_API = "http://localhost" HEATER_USERNAME = "raton" HEATER_PASSWORD = "xxxx" HEATER_MARGIN = 0.0 HEATER_INCREMENT = 0.5 AWS_CREDS_PATH = "/etc/aws.keys" AWS_ZONE = "us-east-1" MINUTES...
pasillo_did = 'A1' cuarto_este_did = 'A2' cuarto_oeste_did = 'A4' salon_did = 'A5' heater_did = 'C1' heater_protocol = 'X10' heater_api = 'http://localhost' heater_username = 'raton' heater_password = 'xxxx' heater_margin = 0.0 heater_increment = 0.5 aws_creds_path = '/etc/aws.keys' aws_zone = 'us-east-1' minutes_after...
# best solution: # https://leetcode.com/problems/merge-two-sorted-lists/discuss/9735/Python-solutions-(iteratively-recursively-iteratively-in-place). # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def mergeTwoL...
class Solution: def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode: dummy = list_node(0) tmp = dummy while l1 and l2: dummy.next = list_node(min(l1.val, l2.val)) dummy = dummy.next if l1.val < l2.val: l1 = l1.next ...
# Doris Zdravkovic, March, 2019 # Solution to problem 5. # python primes.py # Input of a positive integer n = int(input("Please enter a positive integer: ")) # Prime number is always greater than 1 # Reference: https://docs.python.org/3/tutorial/controlflow.html # If entered number is greater than 1, for every numbe...
n = int(input('Please enter a positive integer: ')) if n > 1: for x in range(2, n): if n % x == 0: print('This is not a prime number.') break else: print(n, 'is a prime number.') else: print(n, 'is a prime number')
#!/usr/bin/python ''' This file is part of SNC Copyright (c) 2014-2021, Richard Barnett Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitati...
""" This file is part of SNC Copyright (c) 2014-2021, Richard Barnett Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to us...
def get_menu_choice(): def print_menu(): # Your menu design here print(" _ _ _____ _____ _ _ ") print("| \ | | ___|_ _| / \ _ __| |_ ") print("| \| | |_ | | / _ \ | '__| __|") print("| |\ | _| | | / ___ \| | | |_ ") print("|_| \_...
def get_menu_choice(): def print_menu(): print(' _ _ _____ _____ _ _ ') print('| \\ | | ___|_ _| / \\ _ __| |_ ') print("| \\| | |_ | | / _ \\ | '__| __|") print('| |\\ | _| | | / ___ \\| | | |_ ') print('|_| \\_|_| |_| /_/ \\...
conversion = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} roman_letter_order = dict((letter, ind) for ind, letter in enumerate('IVXLCDM')) minimal_num_of_letter_needed_for_each_digit = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 2, '5': 1, '6': 2, '7': 3, '8...
conversion = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} roman_letter_order = dict(((letter, ind) for (ind, letter) in enumerate('IVXLCDM'))) minimal_num_of_letter_needed_for_each_digit = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 2, '5': 1, '6': 2, '7': 3, '8': 4, '9': 2} def check_order(long_form): ...
# Write a for loop using range() to print out multiples of 5 up to 30 inclusive for mult in range(5, 31, 5): # prints out multiples of 5 up to 30 inclusive print(mult)
for mult in range(5, 31, 5): print(mult)
# # PySNMP MIB module CISCO-SWITCH-HARDWARE-CAPACITY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SWITCH-HARDWARE-CAPACITY-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:13:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ...
#/usr/bin/env python3 GET_PHOTOS_PATTERN = "https://www.flickr.com/services/rest?method=flickr.people.getPhotos&api_key={}&user_id={}&format=json&page={}&per_page={}" FIND_USER_BY_NAME_METHOD = "https://www.flickr.com/services/rest?method=flickr.people.findbyusername&api_key={}&username={}&format={}" GET_PHOTO_COMMENT...
get_photos_pattern = 'https://www.flickr.com/services/rest?method=flickr.people.getPhotos&api_key={}&user_id={}&format=json&page={}&per_page={}' find_user_by_name_method = 'https://www.flickr.com/services/rest?method=flickr.people.findbyusername&api_key={}&username={}&format={}' get_photo_comments = 'https://www.flickr...
def sayhi(): print("hello") def chat(): print("This is a calculator") def exit(): print("Thank you") def mul(n1,n2): return n1*n2 def add(n1,n2): return n1+n2 def sub(n1,n2): return n1-n2 def div(n1,n2): return n1/n2 sayhi() chat() i = int(input("Enter a number:- ")) j = int(input(...
def sayhi(): print('hello') def chat(): print('This is a calculator') def exit(): print('Thank you') def mul(n1, n2): return n1 * n2 def add(n1, n2): return n1 + n2 def sub(n1, n2): return n1 - n2 def div(n1, n2): return n1 / n2 sayhi() chat() i = int(input('Enter a number:- ')) j = in...
''' m18 - maiores de 18 h - homens m20 - mulheres menos de 20 ''' m18 = h = m20 = 0 while True: print('-'*25) print('CADSTRE UMA PESSOA') print('-'*25) idade = int(input('Idade: ')) if idade > 18: m18 += 1 while True: sexo = str(input('Sexo: [M/F] ')).upper() i...
""" m18 - maiores de 18 h - homens m20 - mulheres menos de 20 """ m18 = h = m20 = 0 while True: print('-' * 25) print('CADSTRE UMA PESSOA') print('-' * 25) idade = int(input('Idade: ')) if idade > 18: m18 += 1 while True: sexo = str(input('Sexo: [M/F] ')).upper() if sexo...
bootstrap_url="http://agent-resources.cloudkick.com/" s3_bucket="s3://agent-resources.cloudkick.com" pubkey="etc/agent-linux.public.key" branding_name="cloudkick-agent"
bootstrap_url = 'http://agent-resources.cloudkick.com/' s3_bucket = 's3://agent-resources.cloudkick.com' pubkey = 'etc/agent-linux.public.key' branding_name = 'cloudkick-agent'
def binary_search(arr, num): lo, hi = 0, len(arr)-1 while lo <= hi: mid = (lo+hi)//2 if num < arr[mid]: hi = mid-1 elif num > arr[mid]: lo = mid+1 elif num == arr[mid]: print(num, 'found in array.') break if lo > hi: pri...
def binary_search(arr, num): (lo, hi) = (0, len(arr) - 1) while lo <= hi: mid = (lo + hi) // 2 if num < arr[mid]: hi = mid - 1 elif num > arr[mid]: lo = mid + 1 elif num == arr[mid]: print(num, 'found in array.') break if lo > h...
# 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. # TODO(borenet): This module belongs in the recipe engine. Remove it from this # repo once it has been moved. DEPS = [ 'recipe_engine/json', 'recipe_e...
deps = ['recipe_engine/json', 'recipe_engine/path', 'recipe_engine/python', 'recipe_engine/raw_io', 'recipe_engine/step']
command = '/home/billerot/Git/alexa-flask/venv/bin/gunicorn' pythonpath = '/home/billerot/Git/alexa-flask' workers = 3 user = 'billerot' bind = '0.0.0.0:8088' logconfig = "/home/billerot/Git/alexa-flask/conf/logging.conf" capture_output = True timeout = 90
command = '/home/billerot/Git/alexa-flask/venv/bin/gunicorn' pythonpath = '/home/billerot/Git/alexa-flask' workers = 3 user = 'billerot' bind = '0.0.0.0:8088' logconfig = '/home/billerot/Git/alexa-flask/conf/logging.conf' capture_output = True timeout = 90
# def minsteps1(n): # memo = [0] * (n + 1) # def loop(n): # if n > 1: # if memo[n] != 0: # return memo[n] # else: # memo[n] = 1 + loop(n - 1) # if n % 2 == 0: # memo[n] = min(memo[n], 1 + loop(n // 2)) # ...
def minsteps(n): memo = [0] * (n + 1) for i in range(1, n + 1): memo[i] = 1 + memo[i - 1] if i % 2 == 0: memo[i] = min(memo[i], memo[i // 2] + 1) if i % 3 == 0: memo[i] = min(memo[i], memo[i // 3] + 1) return memo[n] - 1 print(minsteps(10)) print(minsteps(317)...
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Codec: def serialize(self, root): ans = "" queue = [root] while queue: node = queue.pop(0) if node: ans += str(node.val) ...
class Treenode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Codec: def serialize(self, root): ans = '' queue = [root] while queue: node = queue.pop(0) if node: ans += str(node.val)...
def f(x): return x, x + 1 for a in b, c: f(a)
def f(x): return (x, x + 1) for a in (b, c): f(a)
class Proxy: def __init__(self, obj): self._obj = obj # Delegate attribute lookup to internal obj def __getattr__(self, name): return getattr(self._obj, name) # Delegate attribute assignment def __setattr__(self, name, value): if name.startswith('_'): super().__...
class Proxy: def __init__(self, obj): self._obj = obj def __getattr__(self, name): return getattr(self._obj, name) def __setattr__(self, name, value): if name.startswith('_'): super().__setattr__(name, value) else: setattr(self._obj, name, value) if...
rolls = [6, 5, 3, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] soma = 0 # for r in rolls: # soma += r # for twice in range(0, 3): # soma +=rolls[twice] # if soma == 10: # rolls[2] *= 2 # print(rolls) # # print(twice) # print(rolls) # print(rolls[0]) # row = [i for i in rolls] # print(rolls) for i...
rolls = [6, 5, 3, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] soma = 0 for iterator in range(0, len(rolls)): soma += rolls[iterator] if soma == 10: change = rolls[iterator + 1] * 2 rolls[iterator + 1] = change print(rolls)
def dfs(node,parent): currsize=1 for child in tree[node]: if child!=parent: currsize+=dfs(child,node) subsize[node]=currsize return currsize n=int(input()) tree=[[]for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) a,b=a-1,b-1 tree[a].append(b) tre...
def dfs(node, parent): currsize = 1 for child in tree[node]: if child != parent: currsize += dfs(child, node) subsize[node] = currsize return currsize n = int(input()) tree = [[] for i in range(n)] for i in range(n - 1): (a, b) = map(int, input().split()) (a, b) = (a - 1, b -...
''' Contains Hades gamedata ''' # Based on data in Weaponsets.lua HeroMeleeWeapons = { "SwordWeapon": "Stygian Blade", "SpearWeapon": "Eternal Spear", "ShieldWeapon": "Shield of Chaos", "BowWeapon": "Heart-Seeking Bow", "FistWeapon": "Twin Fists of Malphon", "GunWeapon": "Adamant Rail", } # B...
""" Contains Hades gamedata """ hero_melee_weapons = {'SwordWeapon': 'Stygian Blade', 'SpearWeapon': 'Eternal Spear', 'ShieldWeapon': 'Shield of Chaos', 'BowWeapon': 'Heart-Seeking Bow', 'FistWeapon': 'Twin Fists of Malphon', 'GunWeapon': 'Adamant Rail'} aspect_traits = {'SwordCriticalParryTrait': 'Nemesis', 'SwordCons...
class Property(object): def __init__(self, **kwargs): self.background = "#FFFFFF" self.candle_hl = dict() self.up_candle = dict() self.down_candle = dict() self.long_trade_line = dict() self.short_trade_line = dict() self.long_trade_tri = dict() sel...
class Property(object): def __init__(self, **kwargs): self.background = '#FFFFFF' self.candle_hl = dict() self.up_candle = dict() self.down_candle = dict() self.long_trade_line = dict() self.short_trade_line = dict() self.long_trade_tri = dict() self....
# Copyright 2017 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. DEPS = [ 'chromium', 'isolate', 'recipe_engine/properties', ] def RunSteps(api): api.chromium.set_config('chromium') api.isolate.compare_build_a...
deps = ['chromium', 'isolate', 'recipe_engine/properties'] def run_steps(api): api.chromium.set_config('chromium') api.isolate.compare_build_artifacts('first_dir', 'second_dir') def gen_tests(api): yield (api.test('basic') + api.properties(buildername='test_buildername', buildnumber=123)) yield (api.t...
''' # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail ''' # Write your code here def arr(): return [] def bfs(g,a,b,n): ...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ def arr(): return [] def bfs(g, a, b, n): vis = [] q ...
class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: return s rows = [''] * min(numRows, len(s)) cur_row = 0 goind_down = False for c in s: rows[cur_row] += c if cur_row == 0 or cur_row == numRows - 1: goi...
class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: return s rows = [''] * min(numRows, len(s)) cur_row = 0 goind_down = False for c in s: rows[cur_row] += c if cur_row == 0 or cur_row == numRows - 1: ...
class LowPassFilter(object): def __init__(self, lpf_constants): self.tau = lpf_constants[0] self.ts = lpf_constants[1] self.a = 1. / (self.tau / self.ts + 1.) self.b = self.tau / self.ts / (self.tau / self.ts + 1.); self.last_val = 0. self.ready = False def get...
class Lowpassfilter(object): def __init__(self, lpf_constants): self.tau = lpf_constants[0] self.ts = lpf_constants[1] self.a = 1.0 / (self.tau / self.ts + 1.0) self.b = self.tau / self.ts / (self.tau / self.ts + 1.0) self.last_val = 0.0 self.ready = False def g...
''' Problem Statement : Write a function that returns the boolean True if the given number is zero, the string "positive" if the number is greater than zero or the string "negative" if it's smaller than zero. Problem Link : https://edabit.com/challenge/2TdPmSpLpa8NWh6m9 ''' def equilibrium(x): return not x or ('negati...
""" Problem Statement : Write a function that returns the boolean True if the given number is zero, the string "positive" if the number is greater than zero or the string "negative" if it's smaller than zero. Problem Link : https://edabit.com/challenge/2TdPmSpLpa8NWh6m9 """ def equilibrium(x): return not x or ('ne...
class Solution: def findShortestSubArray(self, nums): first, count, res, degree = {}, {}, 0, 0 for i, num in enumerate(nums): first.setdefault(num, i) count[num] = count.get(num, 0) + 1 if count[num] > degree: degree = count[num] re...
class Solution: def find_shortest_sub_array(self, nums): (first, count, res, degree) = ({}, {}, 0, 0) for (i, num) in enumerate(nums): first.setdefault(num, i) count[num] = count.get(num, 0) + 1 if count[num] > degree: degree = count[num] ...
DISCORD_API_BASE_URL = "https://discord.com/api" DISCORD_AUTHORIZATION_BASE_URL = DISCORD_API_BASE_URL + "/oauth2/authorize" DISCORD_TOKEN_URL = DISCORD_API_BASE_URL + "/oauth2/token" DISCORD_OAUTH_ALL_SCOPES = [ "bot", "connections", "email", "identify", "guilds", "guilds.join", "gdm.join", "messages.read",...
discord_api_base_url = 'https://discord.com/api' discord_authorization_base_url = DISCORD_API_BASE_URL + '/oauth2/authorize' discord_token_url = DISCORD_API_BASE_URL + '/oauth2/token' discord_oauth_all_scopes = ['bot', 'connections', 'email', 'identify', 'guilds', 'guilds.join', 'gdm.join', 'messages.read', 'rpc', 'rpc...
CSRF_ENABLED = True SECRET_KEY = 'blabla' DOCUMENTDB_HOST = 'https://mongo-olx.documents.azure.com:443/' DOCUMENTDB_KEY = 'hJJaII1eaMs2wUHNqvjDkzRF3wOz24x8x/J7+Zfw2D91KM/LTjNXcVg8WgMV2JiaNGuTnsnInSmO8jrqDRGw/g==' DOCUMENTDB_DATABASE = 'olxDB' DOCUMENTDB_COLLECTION = 'rentals' DOCUMENTDB_DOCUMENT = 'rent-doc'
csrf_enabled = True secret_key = 'blabla' documentdb_host = 'https://mongo-olx.documents.azure.com:443/' documentdb_key = 'hJJaII1eaMs2wUHNqvjDkzRF3wOz24x8x/J7+Zfw2D91KM/LTjNXcVg8WgMV2JiaNGuTnsnInSmO8jrqDRGw/g==' documentdb_database = 'olxDB' documentdb_collection = 'rentals' documentdb_document = 'rent-doc'
class Solution: def numMovesStones(self, a: int, b: int, c: int) -> List[int]: temp = [a,b,c] temp.sort() d1, d2 = temp[1] - temp[0], temp[2] - temp[1] if d1 == 1 and d2 == 1: return [0, 0] elif d1 == 1 or d2 == 1: return [1, max(d1, ...
class Solution: def num_moves_stones(self, a: int, b: int, c: int) -> List[int]: temp = [a, b, c] temp.sort() (d1, d2) = (temp[1] - temp[0], temp[2] - temp[1]) if d1 == 1 and d2 == 1: return [0, 0] elif d1 == 1 or d2 == 1: return [1, max(d1, d2) - 1] ...
class GST_Company(): def __init__(self, gstno, rate,pos,st): self.GSTNO = gstno self.RATE = rate self.POS=pos self.ST=st self.__taxable = 0.00 self.__cgst = 0.00 self.__sgst = 0.00 self.__igst = 0.00 self.__cess = 0 self.__total = 0.00 ...
class Gst_Company: def __init__(self, gstno, rate, pos, st): self.GSTNO = gstno self.RATE = rate self.POS = pos self.ST = st self.__taxable = 0.0 self.__cgst = 0.0 self.__sgst = 0.0 self.__igst = 0.0 self.__cess = 0 self.__total = 0.0 ...
parameters = { # Add entry for each state variable to check; number is tolerance "alpha": 0.0, "b": 0.0, "d1c": 0.0, "d1t": 0.0, "d2": 0.0, "fb1": 0.0, "fb2": 0.0, "fb3": 0.0, "nstatev": 0, "phi0_12": 0.0, }
parameters = {'alpha': 0.0, 'b': 0.0, 'd1c': 0.0, 'd1t': 0.0, 'd2': 0.0, 'fb1': 0.0, 'fb2': 0.0, 'fb3': 0.0, 'nstatev': 0, 'phi0_12': 0.0}
class Stack: def __init__(self): self.queue = [] def enqueue(self, element): self.queue # [3,2,1] def dequeue(self): queue_helper = [] while len(self.queue) != 1: x = self.queue.pop() queue_helper.append(x) temp = self.queue.pop() ...
class Stack: def __init__(self): self.queue = [] def enqueue(self, element): self.queue def dequeue(self): queue_helper = [] while len(self.queue) != 1: x = self.queue.pop() queue_helper.append(x) temp = self.queue.pop() while queue_...
class SRTError(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg class SRTLoginError(SRTError): def __init__(self, msg="Login failed, please check ID/PW"): super().__init__(msg) class SRTResponseError(SRTError): def __init__(self, msg): ...
class Srterror(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg class Srtloginerror(SRTError): def __init__(self, msg='Login failed, please check ID/PW'): super().__init__(msg) class Srtresponseerror(SRTError): def __init__(self, msg): ...
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. # version_info = (0, 15, 0) __version__ = '%s.%s.%s' % (version_info[0], version_info[1], version_info[2]) EXTENSION_VERSION = '^0.15.0'
version_info = (0, 15, 0) __version__ = '%s.%s.%s' % (version_info[0], version_info[1], version_info[2]) extension_version = '^0.15.0'
#!/usr/bin/env python log_dir = os.environ['LOG_DIR'] admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] managed_server_name = os.environ[...
log_dir = os.environ['LOG_DIR'] admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] managed_server_name = os.environ['MANAGED_SERVER_NAME'] d...
# -*- coding: utf-8 -*- def env_comment(env,comment=''): if env.get('fwuser_info') and not env['fwuser_info'].get('lock'): env['fwuser_info']['comment'] = comment env['fwuser_info']['lock'] = True
def env_comment(env, comment=''): if env.get('fwuser_info') and (not env['fwuser_info'].get('lock')): env['fwuser_info']['comment'] = comment env['fwuser_info']['lock'] = True
balance = 320000 annualInterestRate = 0.2 monthlyInterestRate = (annualInterestRate) / 12 epsilon = 0.01 lowerBound = balance / 12 upperBound = (balance * (1 + monthlyInterestRate)**12) / 12 ans = (upperBound + lowerBound)/2.0 newBalance = balance while abs(0 - newBalance) >= epsilon: newBalance = balance for i...
balance = 320000 annual_interest_rate = 0.2 monthly_interest_rate = annualInterestRate / 12 epsilon = 0.01 lower_bound = balance / 12 upper_bound = balance * (1 + monthlyInterestRate) ** 12 / 12 ans = (upperBound + lowerBound) / 2.0 new_balance = balance while abs(0 - newBalance) >= epsilon: new_balance = balance ...
# DO NOT LOAD THIS FILE. Targets from this file should be considered private # and not used outside of the @envoy//bazel package. load(":envoy_select.bzl", "envoy_select_google_grpc", "envoy_select_hot_restart") # Compute the final copts based on various options. def envoy_copts(repository, test = False): posix_op...
load(':envoy_select.bzl', 'envoy_select_google_grpc', 'envoy_select_hot_restart') def envoy_copts(repository, test=False): posix_options = ['-Wall', '-Wextra', '-Werror', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-Wold-style-cast', '-Wvla', '-std=c++14'] msvc_options = ['-WX', '-Zc:__cplusplus', '-std:c++...
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_header(pluginname, "django")
def run(whatweb, pluginname): whatweb.recog_from_header(pluginname, 'django')
class Solution: def checkString(self, s: str) -> bool: a_indices = [i for i, x in enumerate(s) if x=='a'] try: if a_indices[-1] > s.index('b'): return False except: pass return True
class Solution: def check_string(self, s: str) -> bool: a_indices = [i for (i, x) in enumerate(s) if x == 'a'] try: if a_indices[-1] > s.index('b'): return False except: pass return True
# [Job Adv] (Lv.30) Way of the Bandit darkMarble = 4031013 job = "Night Lord" sm.setSpeakerID(1052001) if sm.hasItem(darkMarble, 30): sm.sendNext("I am impressed, you surpassed the test. Only few are talented enough.\r\n" "You have proven yourself to be worthy, I shall mold your body into a #b...
dark_marble = 4031013 job = 'Night Lord' sm.setSpeakerID(1052001) if sm.hasItem(darkMarble, 30): sm.sendNext('I am impressed, you surpassed the test. Only few are talented enough.\r\nYou have proven yourself to be worthy, I shall mold your body into a #b' + job + '#k.') else: sm.sendSayOkay('You have not retrie...
INDEX_HEADER_SIZE = 16 INDEX_RECORD_SIZE = 41 META_HEADER_SIZE = 32 kMinMetadataRead = 1024 kChunkSize = 256 * 1024 kMaxElementsSize = 64 * 1024 kAlignSize = 4096
index_header_size = 16 index_record_size = 41 meta_header_size = 32 k_min_metadata_read = 1024 k_chunk_size = 256 * 1024 k_max_elements_size = 64 * 1024 k_align_size = 4096
#!/usr/bin python dec1 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" enc1 = "EICTDGYIYZKTHNSIRFXYCPFUEOCKRNEICTDGYIYZKTHNSIRFXYCPFUEOCKRNEI" dec2 = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" enc2 = "FJDUEHZJZALUIOTJSGYZDQGVFPDLSOFJDUEHZJZALUIOTJSG" with open("krypton7", 'r') as handle: ...
dec1 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' enc1 = 'EICTDGYIYZKTHNSIRFXYCPFUEOCKRNEICTDGYIYZKTHNSIRFXYCPFUEOCKRNEI' dec2 = 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB' enc2 = 'FJDUEHZJZALUIOTJSGYZDQGVFPDLSOFJDUEHZJZALUIOTJSG' with open('krypton7', 'r') as handle: flag = handle.read...
# -*- coding: utf-8 -*- class IRI: MAINNET_COORDINATOR = ''
class Iri: mainnet_coordinator = ''
MAX_FACTOR = 20 # avoid weirdness with python's arbitary integer precision MAX_WAIT = 60 * 60 # 1 hour class Backoff(): def __init__(self, initial=None, base=2, exp=2, max=MAX_WAIT, attempts=None): self._attempts = attempts self._initial = initial self._start = base self._max = m...
max_factor = 20 max_wait = 60 * 60 class Backoff: def __init__(self, initial=None, base=2, exp=2, max=MAX_WAIT, attempts=None): self._attempts = attempts self._initial = initial self._start = base self._max = max self._exp = exp self._counter = 0 def reset(self...
def main(): decimal = str(input()) number = float(decimal) last = int(decimal[-1]) if last == 7: number += 0.02 elif last % 2 == 1: number -= 0.09 elif last > 7: number -= 4 elif last < 4: number += 6.78 print(f"{number:.2f}") if __name__ == "__main__...
def main(): decimal = str(input()) number = float(decimal) last = int(decimal[-1]) if last == 7: number += 0.02 elif last % 2 == 1: number -= 0.09 elif last > 7: number -= 4 elif last < 4: number += 6.78 print(f'{number:.2f}') if __name__ == '__main__': ...
print("Hi, I'm a module!") raise Exception( "This module-level exception should also not occur during freeze" )
print("Hi, I'm a module!") raise exception('This module-level exception should also not occur during freeze')
GENCONF_DIR = 'genconf' CONFIG_PATH = GENCONF_DIR + '/config.yaml' SSH_KEY_PATH = GENCONF_DIR + '/ssh_key' IP_DETECT_PATH = GENCONF_DIR + '/ip-detect' CLUSTER_PACKAGES_PATH = GENCONF_DIR + '/cluster_packages.json' SERVE_DIR = GENCONF_DIR + '/serve' STATE_DIR = GENCONF_DIR + '/state' BOOTSTRAP_DIR = SERVE_DIR + '/bootst...
genconf_dir = 'genconf' config_path = GENCONF_DIR + '/config.yaml' ssh_key_path = GENCONF_DIR + '/ssh_key' ip_detect_path = GENCONF_DIR + '/ip-detect' cluster_packages_path = GENCONF_DIR + '/cluster_packages.json' serve_dir = GENCONF_DIR + '/serve' state_dir = GENCONF_DIR + '/state' bootstrap_dir = SERVE_DIR + '/bootst...
class Solution: def isStrobogrammatic(self, num: str) -> bool: rotated = ['0', '1', 'x', 'x', 'x', 'x', '9', 'x', '8', '6'] l = 0 r = len(num) - 1 while l <= r: if num[l] != rotated[ord(num[r]) - ord('0')]: return False l += 1 r -= 1 return True
class Solution: def is_strobogrammatic(self, num: str) -> bool: rotated = ['0', '1', 'x', 'x', 'x', 'x', '9', 'x', '8', '6'] l = 0 r = len(num) - 1 while l <= r: if num[l] != rotated[ord(num[r]) - ord('0')]: return False l += 1 r -...
# coding: utf-8 COLORS = { 'green': '\033[22;32m', 'boldblue': '\033[01;34m', 'purple': '\033[22;35m', 'red': '\033[22;31m', 'boldred': '\033[01;31m', 'normal': '\033[0;0m' } class Logger: def __init__(self): self.verbose = False @staticmethod def _print_msg(msg: str, col...
colors = {'green': '\x1b[22;32m', 'boldblue': '\x1b[01;34m', 'purple': '\x1b[22;35m', 'red': '\x1b[22;31m', 'boldred': '\x1b[01;31m', 'normal': '\x1b[0;0m'} class Logger: def __init__(self): self.verbose = False @staticmethod def _print_msg(msg: str, color: str=None): if color is None or ...
# # PySNMP MIB module INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:44:05 2019 # On host DAVWANG4-M-1475 platform Darwin version...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_size_constraint, value_range_constraint, constraints_intersection) ...
class Solution: def repeatedNTimes(self, A: List[int]) -> int: counter = 0 N = len(A) / 2 for a in A: a_count = A.count(a) if a_count == N: return a counter += a_count if counter == N: return A[0] ...
class Solution: def repeated_n_times(self, A: List[int]) -> int: counter = 0 n = len(A) / 2 for a in A: a_count = A.count(a) if a_count == N: return a counter += a_count if counter == N: return A[0] ...
def extraerVector(matrizPesos, i, dimVect): vectTemp = [] for j in range(dimVect - 1): vectTemp.append(matrizPesos[i][j]) return vectTemp
def extraer_vector(matrizPesos, i, dimVect): vect_temp = [] for j in range(dimVect - 1): vectTemp.append(matrizPesos[i][j]) return vectTemp
async def handler(event): # flush history data await event.kv.flush() # string: bit 0 v = await event.kv.setbit('string', 0, 1) if v != 0: return {'status': 503, 'body': 'test1 fail!'} # string: bit 1 v = await event.kv.setbit('string', 0, 1) if v != 1: return {'status'...
async def handler(event): await event.kv.flush() v = await event.kv.setbit('string', 0, 1) if v != 0: return {'status': 503, 'body': 'test1 fail!'} v = await event.kv.setbit('string', 0, 1) if v != 1: return {'status': 503, 'body': 'test2 fail!'} await event.kv.setbit('string', 7...
''' Copyright 2013 CyberPoint International, LLC. All rights reserved. Use and disclosure prohibited except as permitted in writing by CyberPoint. libpgm exception handler Charlie Cabot Sept 27 2013 ''' class libpgmError(Exception): pass class bntextError(libpgmError): pass
""" Copyright 2013 CyberPoint International, LLC. All rights reserved. Use and disclosure prohibited except as permitted in writing by CyberPoint. libpgm exception handler Charlie Cabot Sept 27 2013 """ class Libpgmerror(Exception): pass class Bntexterror(libpgmError): pass
class CachedLoader(object): items = {} @classmethod def load_compose_definition(cls, loader: callable): return cls.cached('compose', loader) @classmethod def cached(cls, name: str, loader: callable): if name not in cls.items: cls.items[name] = loader() return...
class Cachedloader(object): items = {} @classmethod def load_compose_definition(cls, loader: callable): return cls.cached('compose', loader) @classmethod def cached(cls, name: str, loader: callable): if name not in cls.items: cls.items[name] = loader() return cl...
print("Welcome to Byeonghoon's Age Calculator. This program provide your or someone's age at the specific date you are enquiring.") current_day = int(input("Please input the DAY you want to enquire (DD):\n")) while current_day < 1 or current_day > 31: print("!", current_day, "is not existing date. Please check your...
print("Welcome to Byeonghoon's Age Calculator. This program provide your or someone's age at the specific date you are enquiring.") current_day = int(input('Please input the DAY you want to enquire (DD):\n')) while current_day < 1 or current_day > 31: print('!', current_day, 'is not existing date. Please check your...
class AuthSession(object): def __init__(self, session): self._session = session def __enter__(self): return self._session def __exit__(self, *args): self._session.close()
class Authsession(object): def __init__(self, session): self._session = session def __enter__(self): return self._session def __exit__(self, *args): self._session.close()
# Given the array candies and the integer extraCandies, where candies[i] represents the number of candies that the # ith kid has. # # For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the # greatest number of candies among them. Notice that multiple kids can hav...
class Solution: def kids_with_candies(self, candies, extraCandies): highest = max(candies) output_list = [] for i in candies: total = i + extraCandies if total >= highest: output_list.append(True) else: output_list.append(F...
_base_ = './cascade_rcnn_s50_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py' model = dict( backbone=dict( stem_channels=128, depth=101, init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://resnest101')))
_base_ = './cascade_rcnn_s50_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py' model = dict(backbone=dict(stem_channels=128, depth=101, init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://resnest101')))
description = 'setup for the poller' group = 'special' sysconfig = dict(cache = 'mephisto17.office.frm2') devices = dict( Poller = device('nicos.services.poller.Poller', alwayspoll = ['tube_environ', 'pressure'], blacklist = ['tas'] ), )
description = 'setup for the poller' group = 'special' sysconfig = dict(cache='mephisto17.office.frm2') devices = dict(Poller=device('nicos.services.poller.Poller', alwayspoll=['tube_environ', 'pressure'], blacklist=['tas']))
# Asking Question print ("How old are you?"), age = input() print ("How tall are you?") height = input() print ("How much do you weigh?") weight = input() print ("So You are %r years old, %r tall and %r heavy."%(age, height , weight) )
(print('How old are you?'),) age = input() print('How tall are you?') height = input() print('How much do you weigh?') weight = input() print('So You are %r years old, %r tall and %r heavy.' % (age, height, weight))
__copyright__ = 'Copyright (C) 2019, Nokia' class TestPythonpath2(object): ROBOT_LIBRARY_SCOPE = "GLOBAL" def __init__(self): self.name = 'iina' self.age = 10 def get_name2(self): return self.name
__copyright__ = 'Copyright (C) 2019, Nokia' class Testpythonpath2(object): robot_library_scope = 'GLOBAL' def __init__(self): self.name = 'iina' self.age = 10 def get_name2(self): return self.name
# 1. Escreva uma funcao que recebe como entrada as dimensoes M e N e o elemento E de preenchimento # e retorna uma lista de listas que corresponde a uma matriz MxN contendo o elemento e em todas # as posicoes. Exemplo: # >>> cria_matriz(2, 3, 0) # [[0, 0, 0], [0, 0, 0]] def f_preencheMatriz(m, n, el): matrizPreen...
def f_preenche_matriz(m, n, el): matriz_preenchida = [] for lin in range(m): matrizPreenchida.append([]) for col in range(n): matrizPreenchida[lin].append(el) return matrizPreenchida def main(): (m, n, el, matriz) = (0, 0, 0, []) m = int(input('Informe a qtd de linhas da...
''' Python program to compute and print sum of two given integers (more than or equal to zero). If given integers or the sum have more than 80 digits, print "overflow". ''' print ("Input first integer:") x = int (input()) print ("Input second integer:") y = int (input()) if x >= 10 ** 80 or y >= 10 ** 80 or x + y >= ...
""" Python program to compute and print sum of two given integers (more than or equal to zero). If given integers or the sum have more than 80 digits, print "overflow". """ print('Input first integer:') x = int(input()) print('Input second integer:') y = int(input()) if x >= 10 ** 80 or y >= 10 ** 80 or x + y >= 10 **...
### Caesar Cipher - Solution def caesarCipher(s, rot_count): for ch in range(len(s)): if s[ch].isalpha(): first_letter = 'A' if s[ch].isupper() else 'a' s[ch] = chr(ord(first_letter) + ((ord(s[ch]) - ord(first_letter) + rot_count) % 26)) print(*s, sep='') n = int(input()) s = l...
def caesar_cipher(s, rot_count): for ch in range(len(s)): if s[ch].isalpha(): first_letter = 'A' if s[ch].isupper() else 'a' s[ch] = chr(ord(first_letter) + (ord(s[ch]) - ord(first_letter) + rot_count) % 26) print(*s, sep='') n = int(input()) s = list(input()[:n]) rot_count = int...
# atributos publicos, privados y protegidos class MiClase: def __init__(self): self.atributo_publico = "valor publico" self._atributo_protegido = "valor protegido" self.__atributo_privado = "valor privado" objeto1 = MiClase() # acceso a los atributos publicos print(objeto1.atribut...
class Miclase: def __init__(self): self.atributo_publico = 'valor publico' self._atributo_protegido = 'valor protegido' self.__atributo_privado = 'valor privado' objeto1 = mi_clase() print(objeto1.atributo_publico) objeto1.atributo_publico = 'otro valor' print(objeto1.atributo_publico) prin...