content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
n = int(input()) lst = [list(map(int, input().split())) for _ in range(n)] dp = [[0]*3 for _ in range(n)] for i in range(3): dp[0][i] = lst[0][i] for i in range(1, n): dp[i][0] = max(dp[i-1][1], dp[i-1][2])+lst[i][0] dp[i][1] = max(dp[i-1][0], dp[i-1][2])+lst[i][1] dp[i][2] = max(dp[i-1][0], dp[i-1][...
n = int(input()) lst = [list(map(int, input().split())) for _ in range(n)] dp = [[0] * 3 for _ in range(n)] for i in range(3): dp[0][i] = lst[0][i] for i in range(1, n): dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + lst[i][0] dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + lst[i][1] dp[i][2] = max(dp[i - 1]...
# cases where FunctionAchievement should not unlock # >> CASE def test(): pass # >> CASE def func(): pass func # >> CASE def func(): pass f = func f() # >> CASE func() # >> CASE func
def test(): pass def func(): pass func def func(): pass f = func f() func() func
class Solution: def removeDuplicates(self, nums: List[int]) -> int: return len(nums) if len(nums) < 2 else self.calculate(nums) @staticmethod def calculate(nums): result = 0 for i in range(1, len(nums)): if nums[i] != nums[result]: result += 1 ...
class Solution: def remove_duplicates(self, nums: List[int]) -> int: return len(nums) if len(nums) < 2 else self.calculate(nums) @staticmethod def calculate(nums): result = 0 for i in range(1, len(nums)): if nums[i] != nums[result]: result += 1 ...
# function with large number of arguments def fun(a, b, c, d, e, f, g): return a + b + c * d + e * f * g print(fun(1, 2, 3, 4, 5, 6, 7))
def fun(a, b, c, d, e, f, g): return a + b + c * d + e * f * g print(fun(1, 2, 3, 4, 5, 6, 7))
# Input: nums = [0,1,2,2,3,0,4,2], val = 2 # Output: 5, nums = [0,1,4,0,3] # Explanation: Your function should return length = 5, # with the first five elements of nums containing 0, 1, 3, 0, and 4. # Note that the order of those five elements can be arbitrary. # It doesn't matter what values are set beyond the returne...
class Solution: def remove_element(self, nums: List[int], val: int) -> int: try: while True: nums.remove(val) finally: return len(nums)
class Solution: def firstMissingPositive(self, nums: List[int], res: int = 1) -> int: for num in sorted(nums): res += num == res return res
class Solution: def first_missing_positive(self, nums: List[int], res: int=1) -> int: for num in sorted(nums): res += num == res return res
# # PySNMP MIB module Wellfleet-AOT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-AOT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:32:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ...
# absoluteimports/__init__.py print("inside absoluteimports/__init__.py")
print('inside absoluteimports/__init__.py')
''' 5 - Remapping categories To better understand survey respondents from airlines, you want to find out if there is a relationship between certain responses and the day of the week and wait time at the gate. The airlines DataFrame contains the day and wait_min columns, which are categorical and numerical respectiv...
""" 5 - Remapping categories To better understand survey respondents from airlines, you want to find out if there is a relationship between certain responses and the day of the week and wait time at the gate. The airlines DataFrame contains the day and wait_min columns, which are categorical and numerical respectiv...
def read_file(): file_input = open("data/file_input_data.txt", 'r') file_data = file_input.readlines() file_input.close() return file_data if __name__ == "__main__": data = read_file() print(type(data)) print(data) for line in data: print(line)
def read_file(): file_input = open('data/file_input_data.txt', 'r') file_data = file_input.readlines() file_input.close() return file_data if __name__ == '__main__': data = read_file() print(type(data)) print(data) for line in data: print(line)
def is_armstrong_number(number): digits = [int(i) for i in str(number)] d_len = len(digits) d_sum = 0 for digit in digits: d_sum += digit ** d_len return d_sum == number
def is_armstrong_number(number): digits = [int(i) for i in str(number)] d_len = len(digits) d_sum = 0 for digit in digits: d_sum += digit ** d_len return d_sum == number
# Preprocessing config SAMPLING_RATE = 22050 FFT_WINDOW_SIZE = 1024 HOP_LENGTH = 512 N_MELS = 80 F_MIN = 27.5 F_MAX = 8000 AUDIO_MAX_LENGTH = 90 # in seconds # Data augmentation config MAX_SHIFTING_PITCH = 0.3 MAX_STRETCHING = 0.3 MAX_LOUDNESS_DB = 10 BLOCK_MIXING_MIN = 0.2 BLOCK_MIXING_MAX = 0.5 # Model config ...
sampling_rate = 22050 fft_window_size = 1024 hop_length = 512 n_mels = 80 f_min = 27.5 f_max = 8000 audio_max_length = 90 max_shifting_pitch = 0.3 max_stretching = 0.3 max_loudness_db = 10 block_mixing_min = 0.2 block_mixing_max = 0.5 loss = 'binary_crossentropy' metrics = ['binary_accuracy', 'categorical_accuracy'] cl...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def repo(): http_archive( name = "fmt", strip_prefix = "fmt-7.1.3", urls = ["https://github.com/fmtlib/fmt/releases/download/7.1.3/fmt-7.1.3.zip"], sha256 = "5d98c504d0205f912e22449ecdea776b78ce0bb096927334f80781e7...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def repo(): http_archive(name='fmt', strip_prefix='fmt-7.1.3', urls=['https://github.com/fmtlib/fmt/releases/download/7.1.3/fmt-7.1.3.zip'], sha256='5d98c504d0205f912e22449ecdea776b78ce0bb096927334f80781e720084c9f', build_file='@//third_party/fmt...
# 1 - push # 2 - pop # 3 - print max element # 4 - print max element # last - print all elements n = int(input()) query = [] for _ in range(n): num = input().split() if num[0] == "1": query.append(int(num[1])) elif num[0] == "2": if query: query.pop() continue el...
n = int(input()) query = [] for _ in range(n): num = input().split() if num[0] == '1': query.append(int(num[1])) elif num[0] == '2': if query: query.pop() continue elif num[0] == '3': if query: print(max(query)) elif num[0] == '4': if q...
# Constants for the image IMAGE_URL = str(input("Enter a valid image URL: ")) IMAGE_WIDTH = 280 IMAGE_HEIGHT = 200 blueUpFactor = int(input("How much more blue do you want this image | Enter a value between 1 and 255")) maxPixelValue = 255 image = Image(IMAGE_URL) image.set_position(70, 70) image.set_size(IMAGE_WIDTH,...
image_url = str(input('Enter a valid image URL: ')) image_width = 280 image_height = 200 blue_up_factor = int(input('How much more blue do you want this image | Enter a value between 1 and 255')) max_pixel_value = 255 image = image(IMAGE_URL) image.set_position(70, 70) image.set_size(IMAGE_WIDTH, IMAGE_HEIGHT) add(imag...
class Solution: def reverseOnlyLetters(self, S: str) -> str: alpha = set([chr(i) for i in list(range(ord('a'), ord('z')+1)) + list(range(ord('A'), ord('Z')+1))]) words, res = [], list(S) for char in res: if char in alpha: words.append(char) ...
class Solution: def reverse_only_letters(self, S: str) -> str: alpha = set([chr(i) for i in list(range(ord('a'), ord('z') + 1)) + list(range(ord('A'), ord('Z') + 1))]) (words, res) = ([], list(S)) for char in res: if char in alpha: words.append(char) for ...
number = int(input()) while number < 1 or number > 100: print('Invalid number') number = int(input()) print(f'The number is: {number}')
number = int(input()) while number < 1 or number > 100: print('Invalid number') number = int(input()) print(f'The number is: {number}')
class Configuration(object): config={} def __str__(self): return str(Configuration.config) @staticmethod def defaults(): Configuration.config['api_base_link'] = 'https://api.twitch.tv/kraken/' @staticmethod def load(file=None): if file: with open (file, ...
class Configuration(object): config = {} def __str__(self): return str(Configuration.config) @staticmethod def defaults(): Configuration.config['api_base_link'] = 'https://api.twitch.tv/kraken/' @staticmethod def load(file=None): if file: with open(file, 'r...
# By Taiwo Kareem <taiwo.kareem36@gmail.com> # Github <https://github.com/tushortz> # Last updated (08-February-2016) # Card class class Card: # Initialize necessary field variables def __init__(self, *code): # Accept two character arguments if len(code) == 2: rank = code[0] suit = code[1] # Can also ac...
class Card: def __init__(self, *code): if len(code) == 2: rank = code[0] suit = code[1] elif len(code) == 1: if len(code[0]) == 2: rank = code[0][0] suit = code[0][1] else: raise value_error('card codes ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def getMinimumDifference(self, root: TreeNode) -> int: def dfs(root): if not root: return ...
class Solution: def get_minimum_difference(self, root: TreeNode) -> int: def dfs(root): if not root: return dfs(root.left) nums.append(root.val) dfs(root.right) nums = [] dfs(root) res = float('inf') for i in r...
# -*- coding: utf-8 -*- __author__ = 'Andile Jaden Mbele' __email__ = 'andilembele020@gmail.com' __github__ = 'https://github.com/xeroxzen/genuine-fake' __package__ = 'genuine-fake' __version__ = '1.2.20'
__author__ = 'Andile Jaden Mbele' __email__ = 'andilembele020@gmail.com' __github__ = 'https://github.com/xeroxzen/genuine-fake' __package__ = 'genuine-fake' __version__ = '1.2.20'
def b2d(number): decimal_number = 0 i = 0 while number > 0: decimal_number += number % 10*(2**i) number = int(number / 10) i += 1 return decimal_number def d2b(number): binary_number = 0 i = 0 while number > 0: binary_number += number % 2*(10**i) nu...
def b2d(number): decimal_number = 0 i = 0 while number > 0: decimal_number += number % 10 * 2 ** i number = int(number / 10) i += 1 return decimal_number def d2b(number): binary_number = 0 i = 0 while number > 0: binary_number += number % 2 * 10 ** i ...
''' 06 - Treating duplicates In the last exercise, you were able to verify that the new update feeding into ride_sharing contains a bug generating both complete and incomplete duplicated rows for some values of the ride_id column, with occasional discrepant values for the user_birth_year and duration colu...
""" 06 - Treating duplicates In the last exercise, you were able to verify that the new update feeding into ride_sharing contains a bug generating both complete and incomplete duplicated rows for some values of the ride_id column, with occasional discrepant values for the user_birth_year and duration colu...
print("Welcome to RollerCoaster") height = int(input("Enter your height in cm : ")) bill = 0 # Comparison operators are used more > , <= , == , > , >= , != if height >= 120 : print("You can ride the RollerCoaster") age = int(input("Enter your age : ")) if age < 12 : bill = 5 print("Childe...
print('Welcome to RollerCoaster') height = int(input('Enter your height in cm : ')) bill = 0 if height >= 120: print('You can ride the RollerCoaster') age = int(input('Enter your age : ')) if age < 12: bill = 5 print('Childeren tickets are $5') elif age <= 18: bill = 7 p...
class Revoked(Exception): pass class MintingNotAllowed(Exception): pass
class Revoked(Exception): pass class Mintingnotallowed(Exception): pass
class Time: def __init__(self): self.hours=0 self.minutes=0 self.seconds=0 def input_values(self): self.hours=int(input('Enter the hours: ')) self.minutes=int(input('Enter the minutes: ')) self.seconds=int(input('Enter the seconds: ')) def print_details(self): print(self.hours,':',self.minutes,':',self...
class Time: def __init__(self): self.hours = 0 self.minutes = 0 self.seconds = 0 def input_values(self): self.hours = int(input('Enter the hours: ')) self.minutes = int(input('Enter the minutes: ')) self.seconds = int(input('Enter the seconds: ')) def print...
PANEL_GROUP = 'default' PANEL_DASHBOARD = 'billing' PANEL = 'billing_invoices' # Python panel class of the PANEL to be added. ADD_PANEL = 'astutedashboard.dashboards.billing.invoices.panel.BillingInvoices'
panel_group = 'default' panel_dashboard = 'billing' panel = 'billing_invoices' add_panel = 'astutedashboard.dashboards.billing.invoices.panel.BillingInvoices'
def isPrime(n): if n <= 1: return False for i in range(2,int(n**.5)+1): if n % i == 0: return False return True def findPrime(n): k=1 for i in range(n): if isPrime(i): if(k>=10001):return i k+=1 print(findPrime(300000))
def is_prime(n): if n <= 1: return False for i in range(2, int(n ** 0.5) + 1): if n % i == 0: return False return True def find_prime(n): k = 1 for i in range(n): if is_prime(i): if k >= 10001: return i k += 1 print(find_pr...
dict={'A': ['B', 'CB', 'D', 'E', 'F', 'GD', 'H', 'IE'], 'B': ['A', 'C', 'D', 'E', 'F', 'G', 'HE', 'I'], 'C': ['AB', 'GE', 'D', 'E', 'F', 'B', 'H', 'IF'], 'D': ['A', 'B', 'C', 'E', 'FE', 'G', 'H', 'I'], 'E': ['A', 'B', 'C', 'D', 'F', 'G', 'H', 'I'], 'F': ['A', 'B', 'C', 'DE', 'E', 'G',...
dict = {'A': ['B', 'CB', 'D', 'E', 'F', 'GD', 'H', 'IE'], 'B': ['A', 'C', 'D', 'E', 'F', 'G', 'HE', 'I'], 'C': ['AB', 'GE', 'D', 'E', 'F', 'B', 'H', 'IF'], 'D': ['A', 'B', 'C', 'E', 'FE', 'G', 'H', 'I'], 'E': ['A', 'B', 'C', 'D', 'F', 'G', 'H', 'I'], 'F': ['A', 'B', 'C', 'DE', 'E', 'G', 'H', 'I'], 'G': ['AD', 'B', 'CE'...
test = { 'name': 'q4c', 'points': 10, 'suites': [ { 'cases': [ { 'code': '>>> len(prophet_forecast) == ' '5863\n' 'True', 'hidden': False, ...
test = {'name': 'q4c', 'points': 10, 'suites': [{'cases': [{'code': '>>> len(prophet_forecast) == 5863\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> len(prophet_forecast_holidays) == 5863\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
def read_blob(blob, bucket): return bucket.blob(blob).download_as_string().decode("utf-8", errors="ignore") def download_blob(blob, file_obj, bucket): return bucket.blob(blob).download_to_file(file_obj) def write_blob(key, file_obj, bucket): return bucket.blob(key).upload_from_file(file_obj)
def read_blob(blob, bucket): return bucket.blob(blob).download_as_string().decode('utf-8', errors='ignore') def download_blob(blob, file_obj, bucket): return bucket.blob(blob).download_to_file(file_obj) def write_blob(key, file_obj, bucket): return bucket.blob(key).upload_from_file(file_obj)
class Attachment: def __init__( self, fallback: str, color: str = None, pretext: str = None, text: str = None, author_name: str = None, author_link: str = None, author_icon: str = None, title: str = None, title_link: str = None, ...
class Attachment: def __init__(self, fallback: str, color: str=None, pretext: str=None, text: str=None, author_name: str=None, author_link: str=None, author_icon: str=None, title: str=None, title_link: str=None, fields: list=None, image_url: str=None, thumb_url: str=None): self.fallback = fallback ...
infile = open("sud3_results.csv","r") outfile = open("sud4_results.csv","w") keywords = infile.readline().strip().split(",")[1:] outfile.write("%s, %s" % ("filename", ",".join("Environment+Social+Economic", "Environment+Social+Economic+Cultural", "Environment+Social+Economic+Cultural+Institutional"))) three_pillars_k...
infile = open('sud3_results.csv', 'r') outfile = open('sud4_results.csv', 'w') keywords = infile.readline().strip().split(',')[1:] outfile.write('%s, %s' % ('filename', ','.join('Environment+Social+Economic', 'Environment+Social+Economic+Cultural', 'Environment+Social+Economic+Cultural+Institutional'))) three_pillars_k...
class EnvInfo(object): def __init__(self, frame_id, time_stamp, road_path, obstacle_array): # default params self.frame_id = frame_id self.time_stamp = time_stamp self.road_path = road_path self.obstacle_array = obstacle_array
class Envinfo(object): def __init__(self, frame_id, time_stamp, road_path, obstacle_array): self.frame_id = frame_id self.time_stamp = time_stamp self.road_path = road_path self.obstacle_array = obstacle_array
# Module for implementing gradients used in the autograd system __all__ = ["GradFunc"] def forward_grad(tensor): ## tensor here should be an AutogradTensor or a Tensor where we can set .grad try: grad_fn = tensor.grad_fn except AttributeError: return None # If a tensor doesn't have ...
__all__ = ['GradFunc'] def forward_grad(tensor): try: grad_fn = tensor.grad_fn except AttributeError: return None if grad_fn is None and tensor.requires_grad: return accumulate(tensor) else: return grad_fn class Gradfunc: def __init__(self, *args): self.nex...
class KeywordsOnlyMeta(type): def __call__(cls, *args, **kwargs): if args: raise TypeError("Constructor for class {!r} does not accept positional arguments.".format(cls)) return super().__call__(cls, **kwargs) class ConstrainedToKeywords(metaclass=KeywordsOnlyMeta): def __init__...
class Keywordsonlymeta(type): def __call__(cls, *args, **kwargs): if args: raise type_error('Constructor for class {!r} does not accept positional arguments.'.format(cls)) return super().__call__(cls, **kwargs) class Constrainedtokeywords(metaclass=KeywordsOnlyMeta): def __init__(...
if __name__ == "__main__": ans = "" for n in range(2, 10): for i in range(1, 10**(9 // n)): s = "".join(str(i * j) for j in range(1, n + 1)) if "".join(sorted(s)) == "123456789": ans = max(s, ans) print(ans)
if __name__ == '__main__': ans = '' for n in range(2, 10): for i in range(1, 10 ** (9 // n)): s = ''.join((str(i * j) for j in range(1, n + 1))) if ''.join(sorted(s)) == '123456789': ans = max(s, ans) print(ans)
COLORS = { 'Black': u'\u001b[30m', 'Red': u'\u001b[31m', 'Green': u'\u001b[32m', 'Yellow': u'\u001b[33m', 'Blue': u'\u001b[34m', 'Magenta': u'\u001b[35m', 'Cyan': u'\u001b[36m', 'White': u'\u001b[37m', 'Reset': u'\u001b[0m', }
colors = {'Black': u'\x1b[30m', 'Red': u'\x1b[31m', 'Green': u'\x1b[32m', 'Yellow': u'\x1b[33m', 'Blue': u'\x1b[34m', 'Magenta': u'\x1b[35m', 'Cyan': u'\x1b[36m', 'White': u'\x1b[37m', 'Reset': u'\x1b[0m'}
def mmc(x, y): if a == 0 or b == 0: return 0 return a * b // mdc(a, b) def mdc(a, b): if b == 0: return a return mdc(b, a % b) a, b = input().split() a, b = int(a), int(b) while a >= 0 and b >= 0: print(mmc(a, b)) a, b = input().split() a, b = int(a), int(b)
def mmc(x, y): if a == 0 or b == 0: return 0 return a * b // mdc(a, b) def mdc(a, b): if b == 0: return a return mdc(b, a % b) (a, b) = input().split() (a, b) = (int(a), int(b)) while a >= 0 and b >= 0: print(mmc(a, b)) (a, b) = input().split() (a, b) = (int(a), int(b))
# Puzzle Input with open('Day20_Input.txt') as puzzle_input: tiles = puzzle_input.read().split('\n\n') # Parse the tiles: Separate the ID and get the 4 sides: parsed_tiles = [] tiles_IDs = [] for original_tile in tiles: # For every tile: original_tile = original_tile.split('\n') # Spl...
with open('Day20_Input.txt') as puzzle_input: tiles = puzzle_input.read().split('\n\n') parsed_tiles = [] tiles_i_ds = [] for original_tile in tiles: original_tile = original_tile.split('\n') tiles_i_ds += [int(original_tile[0][5:-1])] parsed_tiles += [[]] left_side = '' right_side = '' for ...
# FLOYD TRIANGLE limit = int(input("Enter the limit: ")) n = 1 for i in range(1, limit+1): for j in range(1, i+1): print(n, ' ', end='') # print on same line n += 1 print('')
limit = int(input('Enter the limit: ')) n = 1 for i in range(1, limit + 1): for j in range(1, i + 1): print(n, ' ', end='') n += 1 print('')
# 008: Make a program that reads a value in meter and convert to centimeter and millimeter n = float(input('Write a number in meter: ')) print(f'{n} is: {n*100:.1f}cm and {n*1000:.1f}mm')
n = float(input('Write a number in meter: ')) print(f'{n} is: {n * 100:.1f}cm and {n * 1000:.1f}mm')
def restar(x,y): resta = x-y return resta def multiplicar(x,y): mult = x*y return mult def dividir(x,y): div = x/y return div
def restar(x, y): resta = x - y return resta def multiplicar(x, y): mult = x * y return mult def dividir(x, y): div = x / y return div
if 1: print("1 is ") else: print("???")
if 1: print('1 is ') else: print('???')
print(''' _ _ _ _ _ | || | __ _ _ _ ___ | |_ (_) | |_ | __ | / _` | | '_| (_-< | ' \ | | | _| |_||_| \__,_| |_| /__/ |_||_| |_| \__| ''') print("IP \t Date time \t Request \t") with open("website.log...
print("\n _ _ _ _ _ \n | || | __ _ _ _ ___ | |_ (_) | |_ \n | __ | / _` | | '_| (_-< | ' \\ | | | _|\n |_||_| \\__,_| |_| /__/ |_||_| |_| \\__|\n ") print('IP \t Date time \t Request \t') with open('website.log', 'r...
sumTotal = 0 nameNum = '' a = 1 b = 2 c = 3 d = 4 e = 5 f = 6 g = 7 h = 8 i = 9 j = 10 k = 11 l = 12 m = 13 n = 14 o = 15 p = 16 q = 17 r = 18 s = 19 t = 20 u = 21 v = 22 w = 23 x = 24 y = 25 z = 26 A = '1' B = '2' C = '3' D = '4' E = '5' F = '6' G = '7' H = '8' I = '9' J = '10' K = '11' L = '12' M = '13' N ...
sum_total = 0 name_num = '' a = 1 b = 2 c = 3 d = 4 e = 5 f = 6 g = 7 h = 8 i = 9 j = 10 k = 11 l = 12 m = 13 n = 14 o = 15 p = 16 q = 17 r = 18 s = 19 t = 20 u = 21 v = 22 w = 23 x = 24 y = 25 z = 26 a = '1' b = '2' c = '3' d = '4' e = '5' f = '6' g = '7' h = '8' i = '9' j = '10' k = '11' l = '12' m = '13' n = '14' o ...
############################################################################ # # 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') def main(): start_application('qtcreator' + SettingsPath) if not started_without_plugin_error(): return available = ['5.6'] for qt_version in available: working_dir = temp_dir() project_name = create_new_qt_quick_ui(workingDir, qtVersion) ...
#State Codes area_codes = [("Alabama",[205, 251, 256, 334, 659, 938]), ("Alaska",[907]), ("Arizona",[480, 520, 602, 623, 928]), ("Arkansas",[327, 479, 501, 870]), ("California",[209, 213, 310, 323, 341, 369, 408, 415, 424, 442, 510, 530, 559, 562, 619, 626, 627, 628, 650, 657, 661, 669, 707, 714, 747, 760, 764, 805, 81...
area_codes = [('Alabama', [205, 251, 256, 334, 659, 938]), ('Alaska', [907]), ('Arizona', [480, 520, 602, 623, 928]), ('Arkansas', [327, 479, 501, 870]), ('California', [209, 213, 310, 323, 341, 369, 408, 415, 424, 442, 510, 530, 559, 562, 619, 626, 627, 628, 650, 657, 661, 669, 707, 714, 747, 760, 764, 805, 818, 831, ...
#!/usr/bin/python '''the -O turns off the assertions''' def myFunc(a,b,c,d): ''' this is my function with the formula (2*a+b)/(c-d) ''' assert c!=d, "c should not equal d" return (2*a+b)/(c-d) myFunc(1,2,3,3)
"""the -O turns off the assertions""" def my_func(a, b, c, d): """ this is my function with the formula (2*a+b)/(c-d) """ assert c != d, 'c should not equal d' return (2 * a + b) / (c - d) my_func(1, 2, 3, 3)
# # PySNMP MIB module H3C-IKE-MONITOR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-IKE-MONITOR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:09:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
print("Hello World") print("Hello again.\n") print("Hello BCC!") print("My name is Andy.\n") print("single 'quotes' <-- in double quotes") print('double "quotes" <-- in single quotes\n') print("Python docs @ --> https://docs/python.org/3") print("Type --> python3 ex1.py <-- in terminal to run this program.\n") # print(...
print('Hello World') print('Hello again.\n') print('Hello BCC!') print('My name is Andy.\n') print("single 'quotes' <-- in double quotes") print('double "quotes" <-- in single quotes\n') print('Python docs @ --> https://docs/python.org/3') print('Type --> python3 ex1.py <-- in terminal to run this program.\n')
# # PySNMP MIB module Wellfleet-QOS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-QOS-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:41:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) ...
def main(): n = int(input('Number to count to: ')) fizzbuzz(n) def fizzbuzz(n): for number in range(1, n + 1): if number % 5 == 0: if number % 3 == 0: print('FizzBuzz') if number % 3 == 0: print('Fizz') elif number % 5 == 0: p...
def main(): n = int(input('Number to count to: ')) fizzbuzz(n) def fizzbuzz(n): for number in range(1, n + 1): if number % 5 == 0: if number % 3 == 0: print('FizzBuzz') if number % 3 == 0: print('Fizz') elif number % 5 == 0: print(...
## setup MQTT MQTT_BROKER = "" # Ip adress of the MQTT Broker MQTT_USERNAME = "" # Username MQTT_PASSWD = "" # Password MQTT_TOPIC = "" # MQTT Topic ## setup RGB NUMBER_OF_LEDS= 100 #int
mqtt_broker = '' mqtt_username = '' mqtt_passwd = '' mqtt_topic = '' number_of_leds = 100
# Copyright 2021 Nate Gay # # 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 writing, so...
"""rules_kustomize""" load('@bazel_skylib//lib:dicts.bzl', 'dicts') load('@io_bazel_rules_docker//container:providers.bzl', 'PushInfo') image_info = provider(doc='Image modification information', fields={'partial': 'A yaml file containing kustomize image replacement info'}) def _impl(ctx): image_name = '{}/{}'.for...
def parseFileTypes(rawTypes): out = [] for rtype in rawTypes: if isinstance(rtype, str): out.append({'name': rtype, 'ext': rtype}) else: assert 'name' in rtype assert 'ext' in rtype out.append({'name': rtype['name'], 'ext': rtype['ext']}) ret...
def parse_file_types(rawTypes): out = [] for rtype in rawTypes: if isinstance(rtype, str): out.append({'name': rtype, 'ext': rtype}) else: assert 'name' in rtype assert 'ext' in rtype out.append({'name': rtype['name'], 'ext': rtype['ext']}) ret...
keycode = { 'up': 72, 'down': 80, 'left': 75, 'right': 77, 'P': 25 }
keycode = {'up': 72, 'down': 80, 'left': 75, 'right': 77, 'P': 25}
''' Given two strings, determine if they share a common substring. A substring may be as small as one character. For example, the words "a", "and", "art" share the common substring . The words "be" and "cat" do not share a substring. ''' #this has the best runtime out of initial coding varieties def twoStrings(s1,...
""" Given two strings, determine if they share a common substring. A substring may be as small as one character. For example, the words "a", "and", "art" share the common substring . The words "be" and "cat" do not share a substring. """ def two_strings(s1, s2): s1 = list(set(s1)) cache = {} for i in s1...
class Solution: def numJewelsInStones(self, J: str, S: str) -> int: ans = 0 for i in range(0, len(S)): if(J.find(S[i])!=-1): ans += 1 return ans
class Solution: def num_jewels_in_stones(self, J: str, S: str) -> int: ans = 0 for i in range(0, len(S)): if J.find(S[i]) != -1: ans += 1 return ans
# This is an Adventure Game about The Digital Sweet Shop # The program was written by Dr. Aung Win Htut # Date: 04-03-2022 # Green Hackers Online Traing Courses # 0-robot.py, 1-adgame3.py, 2-entershop.py, 3-ifelse2.py, 4-input.py, 5-ad62.py, 6-ad63.py # The next few lines give the introduction # Greetings m...
playerlives = 3 chocolate = 2 bonus = 0 numbercorrect = 0 print() print() print() print(' Game Intro') print(' ===========') print('Greetings my friend. if you want to go to the Digital Sweet Shop you must walk across') print('the long street and turn left a...
class Solution: def longestPalindrome(self, s: 'str') -> 'str': if len(s) <= 1: return s start = end = 0 length = len(s) for i in range(length): max_len_1 = self.get_max_len(s, i, i + 1) max_len_2 = self.get_max_len(s, i, i) max_len = m...
class Solution: def longest_palindrome(self, s: 'str') -> 'str': if len(s) <= 1: return s start = end = 0 length = len(s) for i in range(length): max_len_1 = self.get_max_len(s, i, i + 1) max_len_2 = self.get_max_len(s, i, i) max_len =...
class Patient: def __init__(self, pathology, gender, weight, height, images): self.pathology = pathology self.gender = gender self.weight = weight self.height = height self.images = images
class Patient: def __init__(self, pathology, gender, weight, height, images): self.pathology = pathology self.gender = gender self.weight = weight self.height = height self.images = images
def determinant_recursive(A, total=0): # Store indices in list for row referencing indices = list(range(len(A))) # When at 2x2, submatrices recursive calls end if len(A) == 2 and len(A[0]) == 2: val = A[0][0] * A[1][1] - A[1][0] * A[0][1] return val # Define submatrix for ...
def determinant_recursive(A, total=0): indices = list(range(len(A))) if len(A) == 2 and len(A[0]) == 2: val = A[0][0] * A[1][1] - A[1][0] * A[0][1] return val for fc in indices: as = A as = As[1:] height = len(As) for i in range(height): As[i] = As...
__all__ = [ "_is_ltag", "_is_not_ltag", "_is_rtag", "_is_not_rtag", "_is_tag", "_is_not_tag", "_is_ltag_of", "_is_not_ltag_of", "_is_rtag_of", "_is_not_rtag_of", "_is_pair_of", "_is_not_pair_of", "_is_not_ltag_and_not_rtag_of" ] #### def _is_ltag(tag,tag_pairs): ...
__all__ = ['_is_ltag', '_is_not_ltag', '_is_rtag', '_is_not_rtag', '_is_tag', '_is_not_tag', '_is_ltag_of', '_is_not_ltag_of', '_is_rtag_of', '_is_not_rtag_of', '_is_pair_of', '_is_not_pair_of', '_is_not_ltag_and_not_rtag_of'] def _is_ltag(tag, tag_pairs): cond = tag in tag_pairs return cond def _is_not_ltag(...
int_const = 5 bool_const = True string_const = 'abc' unicode_const = u'abc' float_const = 1.23
int_const = 5 bool_const = True string_const = 'abc' unicode_const = u'abc' float_const = 1.23
''' https://practice.geeksforgeeks.org/problems/subarray-with-given-sum/0/?ref=self Given an unsorted array of non-negative integers, find a continuous sub-array which adds to a given number. Input: The first line of input contains an integer T denoting the number of test cases. Then T test ...
""" https://practice.geeksforgeeks.org/problems/subarray-with-given-sum/0/?ref=self Given an unsorted array of non-negative integers, find a continuous sub-array which adds to a given number. Input: The first line of input contains an integer T denoting the number of test cases. Then T test ...
messageResources = {} messageResources['it'] = { 'browse':'Sfoglia', 'play':'Play', 'open.file':'Apri file', 'file':'File', 'edit':'Modifica', 'audio':'Audio', 'video':'Video', 'open':'Apri...', 'quit':'Esci', 'clear.file.list':'Cancella la lista dei file', 'output.audio':'Uscita audio...
message_resources = {} messageResources['it'] = {'browse': 'Sfoglia', 'play': 'Play', 'open.file': 'Apri file', 'file': 'File', 'edit': 'Modifica', 'audio': 'Audio', 'video': 'Video', 'open': 'Apri...', 'quit': 'Esci', 'clear.file.list': 'Cancella la lista dei file', 'output.audio': 'Uscita audio', 'hdmi': 'HDMI', 'loc...
def simple(request): return { 'simple': { 'boolean': True, 'list': [1, 2, 3], } } def is_authenticated(request): is_authenticated = request.user and request.user.is_authenticated if callable(is_authenticated): is_authenticated = is_authenticated() r...
def simple(request): return {'simple': {'boolean': True, 'list': [1, 2, 3]}} def is_authenticated(request): is_authenticated = request.user and request.user.is_authenticated if callable(is_authenticated): is_authenticated = is_authenticated() return {'is_authenticated': is_authenticated}
class Generating: def __init__(self, node): self._node = node def generatetoaddress(self, nblocks, address, maxtries=1): # 01 return self._node._rpc.call("generatetoaddress", nblocks, address, maxtries)
class Generating: def __init__(self, node): self._node = node def generatetoaddress(self, nblocks, address, maxtries=1): return self._node._rpc.call('generatetoaddress', nblocks, address, maxtries)
n_h1=100 n_h2=100 n_h3=100 batch_size=20
n_h1 = 100 n_h2 = 100 n_h3 = 100 batch_size = 20
class URI: prefix = { 'dbpedia': 'http://dbpedia.org/page/', 'dbr': 'http://dbpedia.org/resource/', 'dbo': 'http://dbpedia.org/ontology/', 'rdfs': 'http://www.w3.org/2000/01/rdf-schema#', 'xsd': 'http://www.w3.org/2001/XMLSchema#', 'dt': 'http://dbpedia.org/datatype/'...
class Uri: prefix = {'dbpedia': 'http://dbpedia.org/page/', 'dbr': 'http://dbpedia.org/resource/', 'dbo': 'http://dbpedia.org/ontology/', 'rdfs': 'http://www.w3.org/2000/01/rdf-schema#', 'xsd': 'http://www.w3.org/2001/XMLSchema#', 'dt': 'http://dbpedia.org/datatype/'} def __init__(self, prefix, suffix): ...
class Solution: def myPow(self, x: float, n: int) -> float: if n < 0: val = 1 / self._myPow(x, -n) else: val = self._myPow(x, n) return val def _myPow(self, x: float, n: int) -> float: if n == 1: return x if n == 0: return ...
class Solution: def my_pow(self, x: float, n: int) -> float: if n < 0: val = 1 / self._myPow(x, -n) else: val = self._myPow(x, n) return val def _my_pow(self, x: float, n: int) -> float: if n == 1: return x if n == 0: retu...
#1. Idea is we use a stack, where each element in the stack is a list, the list contains the current string and current repeat value, we know it is the current string because we have not yet hit a closed bracket because once we hit the closed bracket we pop off. #2. Initialize a stack which contains an empty string an...
def decode_string(self, s): stack = [['', 1]] k = 0 for i in s: if i.isdigit(): k = k * 10 + int(i) elif i == '[': stack.append(['', k]) k = 0 elif i == ']': (char_string, repeat_val) = stack.pop() stack[-1][0] += char_strin...
T = int(input()) for _ in range(T): h = 1 for i in range(int(input())): if i % 2 == 0: h *= 2 else: h += 1 print(h)
t = int(input()) for _ in range(T): h = 1 for i in range(int(input())): if i % 2 == 0: h *= 2 else: h += 1 print(h)
class Queue(object): def __init__(self): self.queue = [] self.size = 0 def isEmpty(self): return self.queue == [] def enqueue(self, item): self.queue.insert(0, item) self.size += 1 def dequeu(self): if not self.isEmpty(): self.size -= 1 ...
class Queue(object): def __init__(self): self.queue = [] self.size = 0 def is_empty(self): return self.queue == [] def enqueue(self, item): self.queue.insert(0, item) self.size += 1 def dequeu(self): if not self.isEmpty(): self.size -= 1 ...
#!/usr/bin/env python ord_numbers = [] for i in range(1,50): ord_numbers.append(i) print(ord_numbers) for j in ord_numbers: if j == 13: continue elif j > 39: break else: print(j)
ord_numbers = [] for i in range(1, 50): ord_numbers.append(i) print(ord_numbers) for j in ord_numbers: if j == 13: continue elif j > 39: break else: print(j)
doc(title="PaddlePaddle Use-Cases", underline_char="=", entries=[ "resnet50/paddle-resnet50.rst", "ssd/paddle-ssd.rst", "tsm/paddle-tsm.rst", ])
doc(title='PaddlePaddle Use-Cases', underline_char='=', entries=['resnet50/paddle-resnet50.rst', 'ssd/paddle-ssd.rst', 'tsm/paddle-tsm.rst'])
def generate_worklist(n, n_process, generate_mode="random", time_weights=None): works_type = {} works = [] if generate_mode == "random": minimum_time = 10 maximum_time = 300 reset_time_weights_prob = 0.05 time_weights = [random.randint(minimum_time, maximum_time) for i in range(n_process)] type_name = ti...
def generate_worklist(n, n_process, generate_mode='random', time_weights=None): works_type = {} works = [] if generate_mode == 'random': minimum_time = 10 maximum_time = 300 reset_time_weights_prob = 0.05 time_weights = [random.randint(minimum_time, maximum_time) for i in ran...
class Node: def __init__(self, item): self.item = item self.left = None self.right = None class BinaryTree: def __init__(self, root): self.root = root def insert(self, root, node): if node.item < root.item: i...
class Node: def __init__(self, item): self.item = item self.left = None self.right = None class Binarytree: def __init__(self, root): self.root = root def insert(self, root, node): if node.item < root.item: if not root.left: root.left =...
API_STAGE = 'dev' APP_FUNCTION = 'handler_for_events' APP_MODULE = 'tests.test_event_script_app' DEBUG = 'True' DJANGO_SETTINGS = None DOMAIN = 'api.example.com' ENVIRONMENT_VARIABLES = {} LOG_LEVEL = 'DEBUG' PROJECT_NAME = 'test_event_script_app' COGNITO_TRIGGER_MAPPING = {}
api_stage = 'dev' app_function = 'handler_for_events' app_module = 'tests.test_event_script_app' debug = 'True' django_settings = None domain = 'api.example.com' environment_variables = {} log_level = 'DEBUG' project_name = 'test_event_script_app' cognito_trigger_mapping = {}
AVAILABLE_OUTPUTS = [ (20, 'out 1'), (21, 'out 2') ]
available_outputs = [(20, 'out 1'), (21, 'out 2')]
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def isValidBST(self, root): def util(root, low, high): if not root: return True return low < root...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def is_valid_bst(self, root): def util(root, low, high): if not root: return True return low < root.val and root.val < high and util(...
#input # 28 # RP PP RR PS RP # PR PP SR PS SS RR RS RP # PR SP PR RS RP PP RS # RP PS PS PR SS RR PP PR SP SP RR PR PS PS SP # RS PS RR PR RP PR RS SR SR RR PP PP SR RS RP # RR RR RR SP PR RP RR PP SP PS RR RS SP # SS RP RP PP SS RR RP PS SP RR RS SR RS RS SS PS # SR SP SR RP RP SS SP PP SS SS SS SS RP # SR PP RP PP RP...
def convert_sign(s): if s == 'R': return 0 elif s == 'P': return 1 else: return 2 def winner(seq): a = convert_sign(seq[0]) b = convert_sign(seq[1]) res = (a - b + 3) % 3 if res == 0: return -1 elif res == 1: return 0 else: return 1 d...
sum =0 n = 99 while n>0: sum = sum+n n=n-2 if n<10: break print(sum) #---------- for x in range(101): if x%2==0: continue else: print(x) #---------- y = 0 while True: print(y) y=y+1
sum = 0 n = 99 while n > 0: sum = sum + n n = n - 2 if n < 10: break print(sum) for x in range(101): if x % 2 == 0: continue else: print(x) y = 0 while True: print(y) y = y + 1
def imprimePorIdade(pDIct = dict()): sortedDict = sorted(pDIct.items(), key = lambda x: x[1], reverse=False) for i in sortedDict: print(i[0], i[1]) pass pass testDict = { "narto": 29, "leo": 13, "antonia": 45, "mimosa": 27, } imprimePorIdade(testDict)
def imprime_por_idade(pDIct=dict()): sorted_dict = sorted(pDIct.items(), key=lambda x: x[1], reverse=False) for i in sortedDict: print(i[0], i[1]) pass pass test_dict = {'narto': 29, 'leo': 13, 'antonia': 45, 'mimosa': 27} imprime_por_idade(testDict)
#sublist def sub_list(list): return list[1:3] result = sub_list([1,2,3,4,5]) print(result) #concatenation list1 = [1,2,4,5,6] list2 = [5,6,7,8,9] list3 = list1 + list2 print(list3) #traverse for element in list3: print(element) #list slicing def get_sublist(list): return [list[0:3], list[3:]] print...
def sub_list(list): return list[1:3] result = sub_list([1, 2, 3, 4, 5]) print(result) list1 = [1, 2, 4, 5, 6] list2 = [5, 6, 7, 8, 9] list3 = list1 + list2 print(list3) for element in list3: print(element) def get_sublist(list): return [list[0:3], list[3:]] print(get_sublist([1, 4, 9, 10, 23])) print() de...
# _*_ coding:utf-8 _*_ #!/usr/local/bin/python encrypted = [6,3,1,7,5,8,9,2,4] def decrypt(encryptedTxt): head = 0 tail = len(encryptedTxt)-1 decrypted = [] while len(encryptedTxt)>0: decrypted.append(encryptedTxt[0]) del encryptedTxt[0] print(encryptedTxt) if(len(encr...
encrypted = [6, 3, 1, 7, 5, 8, 9, 2, 4] def decrypt(encryptedTxt): head = 0 tail = len(encryptedTxt) - 1 decrypted = [] while len(encryptedTxt) > 0: decrypted.append(encryptedTxt[0]) del encryptedTxt[0] print(encryptedTxt) if len(encryptedTxt) <= 0: break ...
# https://www.codewars.com/kata/550554fd08b86f84fe000a58/train/python def in_array(array1, array2): result = [] array1 = list(set(array1)) for arr1_element in array1: for arr2_element in array2: if arr2_element.count(arr1_element) != 0: result.append(arr1_element) ...
def in_array(array1, array2): result = [] array1 = list(set(array1)) for arr1_element in array1: for arr2_element in array2: if arr2_element.count(arr1_element) != 0: result.append(arr1_element) break return sorted(result)
class MyCircularQueue: def __init__(self, k: int): self.q = [None] * k self.front_idx = -1 self.back_idx = -1 self.capacity = k def display_elements(self): print("The elements in the Queue are ") print_str = "" # add the elements to the print string ...
class Mycircularqueue: def __init__(self, k: int): self.q = [None] * k self.front_idx = -1 self.back_idx = -1 self.capacity = k def display_elements(self): print('The elements in the Queue are ') print_str = '' for i in range(self.capacity): ...
def binary_search(search_val, search_list): midpoint = (len(search_list)-1) // 2 if search_val == search_list[midpoint]: return True elif len(search_list) == 1 and search_val != search_list[0]: return False elif search_val > search_list[midpoint]: return binary_search(search_val...
def binary_search(search_val, search_list): midpoint = (len(search_list) - 1) // 2 if search_val == search_list[midpoint]: return True elif len(search_list) == 1 and search_val != search_list[0]: return False elif search_val > search_list[midpoint]: return binary_search(search_va...
matrix = [[0,0,0], [0,0,0], [0,0,0]] for l in range(0,3): for c in range(0,3): matrix[l][c] = int(input(f'digite um numero [{l}][{c}]: ')) print('-='*30) for l in range(0,3): for c in range(0,3): print(f'[{matrix[l][c]:^5}]', end='') print()
matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] for l in range(0, 3): for c in range(0, 3): matrix[l][c] = int(input(f'digite um numero [{l}][{c}]: ')) print('-=' * 30) for l in range(0, 3): for c in range(0, 3): print(f'[{matrix[l][c]:^5}]', end='') print()
# -*- coding: utf-8 -*- # Scrapy settings for FinalProject project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # http://doc.scrapy.org/en/latest/topics/settings.html # http://scrapy.readthedocs.org/en/l...
bot_name = 'FinalProject' spider_modules = ['FinalProject.spiders'] newspider_module = 'FinalProject.spiders' dbkwargs = {'db': 'final_project', 'user': 'root', 'passwd': '', 'host': 'localhost', 'use_unicode': False, 'charset': 'utf8'} db_table = 'HouseRent_58' crawlera_enabled = True crawlera_apikey = '0ccaed0e666542...
class Solution: def stringMatching(self, words: List[str]) -> List[str]: words.sort(key=len) res = [] lps = [self._compute_lps(w) for w in words[:-1]] for i in range(len(words)): for j in range(i + 1, len(words)): if self._kmp(words[i], words[j], lps[i]): ...
class Solution: def string_matching(self, words: List[str]) -> List[str]: words.sort(key=len) res = [] lps = [self._compute_lps(w) for w in words[:-1]] for i in range(len(words)): for j in range(i + 1, len(words)): if self._kmp(words[i], words[j], lps[i])...
def char_concat(word): string = '' for i in range(int(len(word)/2)): string += word[i] + word[-i-1] + str(i+1) return string
def char_concat(word): string = '' for i in range(int(len(word) / 2)): string += word[i] + word[-i - 1] + str(i + 1) return string
def test_chain_web3_is_preconfigured_with_default_from(project): default_account = '0x0000000000000000000000000000000000001234' project.config['web3.Tester.eth.default_account'] = default_account with project.get_chain('tester') as chain: web3 = chain.web3 assert web3.eth.defaultAccount ==...
def test_chain_web3_is_preconfigured_with_default_from(project): default_account = '0x0000000000000000000000000000000000001234' project.config['web3.Tester.eth.default_account'] = default_account with project.get_chain('tester') as chain: web3 = chain.web3 assert web3.eth.defaultAccount == d...
#Ascending order n = int(input().strip()) a = list(map(int, input().strip().split(' '))) for i in range(n): for j in range(n-1): if(a[j]>a[j+1]): a[j],a[j+1]=a[j+1],a[j] print(a) #Descending order Data = [75,3,73,7,6,23,89,8] for i in range(len(Data)): for j in range(len(Data)-1): ...
n = int(input().strip()) a = list(map(int, input().strip().split(' '))) for i in range(n): for j in range(n - 1): if a[j] > a[j + 1]: (a[j], a[j + 1]) = (a[j + 1], a[j]) print(a) data = [75, 3, 73, 7, 6, 23, 89, 8] for i in range(len(Data)): for j in range(len(Data) - 1): if Data[j] ...
class Solution: def letterCasePermutation(self, S: str) -> List[str]: ans = [] self.dfs(S, 0, ans, []) return ans def dfs(self, S, i, ans, path): if i == len(S): ans.append(''.join(path)) return self.dfs(S, i+1, ans, path + [S[i]]...
class Solution: def letter_case_permutation(self, S: str) -> List[str]: ans = [] self.dfs(S, 0, ans, []) return ans def dfs(self, S, i, ans, path): if i == len(S): ans.append(''.join(path)) return self.dfs(S, i + 1, ans, path + [S[i]]) if...
#!/usr/bin/env python3 def validate_user(username, minlen): if type(username) != str: raise TypeError("username must be a string") if len(username) < minlen: return False if not username.isalnum(): return False # Username can't begin with a number if username[0].isnumeric():...
def validate_user(username, minlen): if type(username) != str: raise type_error('username must be a string') if len(username) < minlen: return False if not username.isalnum(): return False if username[0].isnumeric(): return False return True
# # PySNMP MIB module HPN-ICF-DHCPRELAY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-DHCPRELAY-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:37:51 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, single_value_constraint, value_range_constraint) ...
# ============================================================================= # Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/ # FileName: 10921.py # Description: UVa Online Judge - 10921 # ============================================================================= source = li...
source = list('-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ') target = list('-123456789022233344455566677778889999') mapping = dict(zip(source, target)) while True: try: line = input() except EOFError: break print(''.join(list(map(lambda x: mapping[x], line))))