content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
_base_ = './faster_rcnn_r50_fpn.py' model = dict( type='QDTrack', rpn_head=dict( loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), roi_head=dict( type='QuasiDenseRoIHead', track_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict...
_base_ = './faster_rcnn_r50_fpn.py' model = dict(type='QDTrack', rpn_head=dict(loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), roi_head=dict(type='QuasiDenseRoIHead', track_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0), out_channels...
carWidth = 160 carHeight = 240 chessboardSize = 80 shiftWidth = 120 shiftHeight = 120 innerShiftWidth = 0 innerShiftHeight = 0 totalWidth = carWidth + 2 * chessboardSize + 2 * shiftWidth totalHeight = carHeight + 2 * chessboardSize + 2 * shiftHeight x1 = shiftWidth + chessboardSize + innerShiftWidth x2 = totalWidth - ...
car_width = 160 car_height = 240 chessboard_size = 80 shift_width = 120 shift_height = 120 inner_shift_width = 0 inner_shift_height = 0 total_width = carWidth + 2 * chessboardSize + 2 * shiftWidth total_height = carHeight + 2 * chessboardSize + 2 * shiftHeight x1 = shiftWidth + chessboardSize + innerShiftWidth x2 = tot...
#https://www.hackerrank.com/challenges/list-comprehensions #!/us/bin/env python # x_coordinates = 1 # y_coordinates = 1 # z_coordinates = 1 # n = 2 x_coordinates = int(raw_input()) y_coordinates = int(raw_input()) z_coordinates = int(raw_input()) n = int(raw_input()) result = [[x, y, z] for x in xrange(x_c...
x_coordinates = int(raw_input()) y_coordinates = int(raw_input()) z_coordinates = int(raw_input()) n = int(raw_input()) result = [[x, y, z] for x in xrange(x_coordinates + 1) for y in xrange(y_coordinates + 1) for z in xrange(z_coordinates + 1) if x + y + z != n] print(result)
#!/usr/bin/env python def pV2Str(pv): if pv < 0.0001: return "%.0e" % (pv) elif pv < 0.001: return "%.5f" % (pv) elif pv < 0.01: return "%.4f" % (pv) elif pv < 0.1: return "%.3f" % (pv) else: return "%.2f" % (pv)
def p_v2_str(pv): if pv < 0.0001: return '%.0e' % pv elif pv < 0.001: return '%.5f' % pv elif pv < 0.01: return '%.4f' % pv elif pv < 0.1: return '%.3f' % pv else: return '%.2f' % pv
a = int(input()) b = int(input()) c = int(input()) if a == b == c == 0: print("MANY SOLUTIONS") elif c < 0: print("NO SOLUTION") else: if a != 0: ans = int((c ** 2 - b) / a) if a * ans + b == c ** 2: print(ans) else: print("NO SOLUTION") elif a == 0 and ...
a = int(input()) b = int(input()) c = int(input()) if a == b == c == 0: print('MANY SOLUTIONS') elif c < 0: print('NO SOLUTION') elif a != 0: ans = int((c ** 2 - b) / a) if a * ans + b == c ** 2: print(ans) else: print('NO SOLUTION') elif a == 0 and b == c ** 2: print('MANY SOLUT...
# An OO lightswitch. It can be turned on or off and have it's status checked class LightSwitch(): def __init__(self): self.isSwitchOn = False def turnOn(self): self.isSwitchOn = True def turnOff(self): self.isSwitchOn = False def status(self): print(f"Is the lightswit...
class Lightswitch: def __init__(self): self.isSwitchOn = False def turn_on(self): self.isSwitchOn = True def turn_off(self): self.isSwitchOn = False def status(self): print(f'Is the lightswitch on? {self.isSwitchOn}') o_light_switch = light_switch() oLightSwitch.turnO...
dict = {} dict['one'] = "This is one" dict[2] = "This is two" tinydict = {'name': 'john','code':6734, 'dept': 'sales'} print(dict['one']) # Prints value for 'one' key print(dict[2]) # Prints value for 2 key print(tinydict) # Prints complete dictionary print(tinydict.keys()) # Prints all t...
dict = {} dict['one'] = 'This is one' dict[2] = 'This is two' tinydict = {'name': 'john', 'code': 6734, 'dept': 'sales'} print(dict['one']) print(dict[2]) print(tinydict) print(tinydict.keys()) print(tinydict.values())
# MIT License # (C) Copyright 2021 Hewlett Packard Enterprise Development LP. # # login : Login/Logout def login( self, user: str, password: str, ) -> bool: """Login to Edge Connect appliance .. list-table:: :header-rows: 1 * - Swagger Section - Method - Endpo...
def login(self, user: str, password: str) -> bool: """Login to Edge Connect appliance .. list-table:: :header-rows: 1 * - Swagger Section - Method - Endpoint * - login - POST - /login :param user: Username to login to appliance :type use...
game_rounds_number = int(input()) mishka_total_wins = 0 chris_total_wins = 0 for i in range(game_rounds_number): mishka_dice_value, chris_dice_value = map(int, input().split()) if mishka_dice_value > chris_dice_value: mishka_total_wins += 1 elif mishka_dice_value < chris_dice_value: chris_...
game_rounds_number = int(input()) mishka_total_wins = 0 chris_total_wins = 0 for i in range(game_rounds_number): (mishka_dice_value, chris_dice_value) = map(int, input().split()) if mishka_dice_value > chris_dice_value: mishka_total_wins += 1 elif mishka_dice_value < chris_dice_value: chris_...
# Given a string with repeated characters, rearrange the string so that no two # adjacent characters are the same. If this is not possible, return None. # For example, given "aaabbc", you could return "ababac". Given "aaab", # return None. def rearrange(text): text = list(text) n = len(text) ...
def rearrange(text): text = list(text) n = len(text) for i in range(n - 1): if text[i] == text[i + 1]: found = False for j in range(i + 1, n): if text[j] != text[i]: (text[i + 1], text[j]) = (text[j], text[i + 1]) found ...
def load(): with open("input") as f: data = {} for y, row in enumerate(f): data.update({(x, y): int(z) for x, z in enumerate(list(row.strip()))}) return data def get_adjacent_height(pos, heightmap): x, y = pos for p in [(x-1, y), (x+1, y), (x, y-1), (x, y+1)]: ...
def load(): with open('input') as f: data = {} for (y, row) in enumerate(f): data.update({(x, y): int(z) for (x, z) in enumerate(list(row.strip()))}) return data def get_adjacent_height(pos, heightmap): (x, y) = pos for p in [(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1...
""" Codemonk link: https://www.hackerearth.com/practice/basic-programming/recursion/recursion-and-backtracking/practice-problems/algorithm/a-tryst-with-chess/ You are a bank account hacker. Initially you have 1 rupee in your account, and you want exactly N rupees in it. You wrote two hacks, First hack can multiply...
""" Codemonk link: https://www.hackerearth.com/practice/basic-programming/recursion/recursion-and-backtracking/practice-problems/algorithm/a-tryst-with-chess/ You are a bank account hacker. Initially you have 1 rupee in your account, and you want exactly N rupees in it. You wrote two hacks, First hack can multiply the...
def round_sum(a, b, c): return round10(a) + round10(b) + round10(c) def round10(num): if num % 10 < 5: return num - (num % 10) return num + (10 - num % 10)
def round_sum(a, b, c): return round10(a) + round10(b) + round10(c) def round10(num): if num % 10 < 5: return num - num % 10 return num + (10 - num % 10)
# # PySNMP MIB module MPLS-TC-STD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MPLS-TC-STD-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:31:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) ...
# Space: O(1) # Time: O(n) class Solution: def rotate(self, matrix): """ Do not return anything, modify matrix in-place instead. """ m = len(matrix) n = len(matrix[0]) if m == 1 and n == 1: return index = 0 first, last = 0, n - 1 while first...
class Solution: def rotate(self, matrix): """ Do not return anything, modify matrix in-place instead. """ m = len(matrix) n = len(matrix[0]) if m == 1 and n == 1: return index = 0 (first, last) = (0, n - 1) while first < last: ...
# -*- coding: utf-8 -*- """ Created on Thu Aug 9 07:51:30 2018 @author: lenovo """ #have something wrong def dfs(A, start, path, res, k): if k == 0: return res.append(path + []) for i in range(start, len(A)): path.append(A[i]) dfs(A, i + 1, path, res, k -1) path.pop() test = [1...
""" Created on Thu Aug 9 07:51:30 2018 @author: lenovo """ def dfs(A, start, path, res, k): if k == 0: return res.append(path + []) for i in range(start, len(A)): path.append(A[i]) dfs(A, i + 1, path, res, k - 1) path.pop() test = [1, 2, 3, 4] res1 = [] res = dfs(test, 0, [], ...
class Solution: def maxPerformance(self, n: int, speed: List[int], efficiency: List[int], k: int) -> int: mod = 10 ** 9 + 7 best = 0 total = 0 h = [] for eff, sp in sorted(zip(efficiency, speed), reverse=True): total += sp heapq.heappush(h, sp) ...
class Solution: def max_performance(self, n: int, speed: List[int], efficiency: List[int], k: int) -> int: mod = 10 ** 9 + 7 best = 0 total = 0 h = [] for (eff, sp) in sorted(zip(efficiency, speed), reverse=True): total += sp heapq.heappush(h, sp) ...
try: EMAIL = str((open('login.txt')).read()) PASSWORD = str((open('password.txt')).read()) except: EMAIL = None PASSWORD = None
try: email = str(open('login.txt').read()) password = str(open('password.txt').read()) except: email = None password = None
#program to print pattern(day5) def isPrime(n): if n==1: return False flag = True if(n > 1): for i in range(2, n): if(n % i == 0): flag = False break return flag x= 1 for i in range(1,n+1): for j in range(1,i+1): if(isPrime(x)):...
def is_prime(n): if n == 1: return False flag = True if n > 1: for i in range(2, n): if n % i == 0: flag = False break return flag x = 1 for i in range(1, n + 1): for j in range(1, i + 1): if is_prime(x): print('#', end=...
# <auto-generated> # This code was generated by the UnitCodeGenerator tool # # Changes to this file will be lost if the code is regenerated # </auto-generated> def to_square_kilometres(value): return value * 2.58999 def to_square_metres(value): return value * 2589988.10 def to_square_yards(value): return value *...
def to_square_kilometres(value): return value * 2.58999 def to_square_metres(value): return value * 2589988.1 def to_square_yards(value): return value * 3097600.0 def to_square_feet(value): return value * 27878400.0 def to_square_inches(value): return value * 4014489600.0 def to_hectares(value)...
names = [] in_guest = False for row in open("participants.dat"): srow = row.strip() if srow == "" or "*******" in srow: continue srow = srow.replace("\t", " ") if "------" in srow: in_guest = True continue if "@" not in srow: name = srow names.append(nam...
names = [] in_guest = False for row in open('participants.dat'): srow = row.strip() if srow == '' or '*******' in srow: continue srow = srow.replace('\t', ' ') if '------' in srow: in_guest = True continue if '@' not in srow: name = srow names.append(name) ...
dict = open("english2.txt","r") validWords = [] for word in dict: count = 0 for letter in word: if letter in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ': count += 1 if 3 <= count <= 16: validWords.append(word) dict.close() outputfile = open("z.txt","w") for ...
dict = open('english2.txt', 'r') valid_words = [] for word in dict: count = 0 for letter in word: if letter in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ': count += 1 if 3 <= count <= 16: validWords.append(word) dict.close() outputfile = open('z.txt', 'w') for outword ...
corona_people = 'Maharashtra 1100 Delhi 3300 Gujarat 4500 TamilNadu 7500' c=list(corona_people.split(" ")) corona_db={} for i in range(0,len(c),2): corona_db[c[i]]=c[i+1] print("Corona Database:",corona_db) x=input("Enter a State name :") if corona_db.get(x): print("The {} state has {} infected people".format(...
corona_people = 'Maharashtra 1100 Delhi 3300 Gujarat 4500 TamilNadu 7500' c = list(corona_people.split(' ')) corona_db = {} for i in range(0, len(c), 2): corona_db[c[i]] = c[i + 1] print('Corona Database:', corona_db) x = input('Enter a State name :') if corona_db.get(x): print('The {} state has {} infected peo...
m = sum([float(x) for x in input().split()]) / 2 if 7 <= m: print('Aprovado') elif 4 <= m: print('Recuperacao') else: print('Reprovado')
m = sum([float(x) for x in input().split()]) / 2 if 7 <= m: print('Aprovado') elif 4 <= m: print('Recuperacao') else: print('Reprovado')
class TNode: def __init__(self, value): self.value = value self.left = None self.right = None class BinaryTree: def __init__(self): self.root = None def tree_intersection(tree_a, tree_b): """ Find the intersection of values in two trees. """ union = set({}) ...
class Tnode: def __init__(self, value): self.value = value self.left = None self.right = None class Binarytree: def __init__(self): self.root = None def tree_intersection(tree_a, tree_b): """ Find the intersection of values in two trees. """ union = set({}) ...
"""Functions for Tic Tac Toe game.""" def is_all_equal(value_list: list[str]) -> bool: """Check if all values in a list are equal.""" start: str = value_list[0] return True if value_list.count(start) == len(value_list) and start != ' ' else False def row_win(grid: list[list[str]]) -> bool: """...
"""Functions for Tic Tac Toe game.""" def is_all_equal(value_list: list[str]) -> bool: """Check if all values in a list are equal.""" start: str = value_list[0] return True if value_list.count(start) == len(value_list) and start != ' ' else False def row_win(grid: list[list[str]]) -> bool: """Check if...
#!/usr/bin/env python # coding: utf-8 # # 10: Solutions # # 1. Create a class named `Vehicle`. # * Give the class attributes `max_speed` and `mileage`. # * Instantiate an object `car` with: # * `max_speed` of 120, # * `mileage` of 10,000 # * Print these attributes _via an object reference...
class Vehicle: def __init__(self, max_speed, mileage): self.max_speed = max_speed self.mileage = mileage car = vehicle(120, 10000) print(f'The car has max speed {car.max_speed} and mileage {car.mileage}') class Bus(Vehicle): def __init__(self, max_speed, mileage, capacity=60): super()...
# Copyright 2018- The Pixie Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
load('@bazel_gazelle//:deps.bzl', 'gazelle_dependencies') load('@com_github_bazelbuild_buildtools//buildifier:deps.bzl', 'buildifier_dependencies') load('@distroless//package_manager:dpkg.bzl', 'dpkg_list', 'dpkg_src') load('@distroless//package_manager:package_manager.bzl', 'package_manager_repositories') load('@io_ba...
personal_info = { 'name': 'sean venard', 'age': 26, 'gender': 'male', 'location': 'California' } print(personal_info['name']) print(personal_info['age']) print(personal_info['gender'])
personal_info = {'name': 'sean venard', 'age': 26, 'gender': 'male', 'location': 'California'} print(personal_info['name']) print(personal_info['age']) print(personal_info['gender'])
# Adapted from a Java code in the "Refactoring" book by Martin Fowler. # Replace nested conditional with guard clauses. ADJ_FACTOR = 0.7 def elegible_adjusted_capital(capital, rate, duration): return capital > 0 and rate > 0 and duration > 0 def calculate_adjusted_capital(duration, income): return (income / ...
adj_factor = 0.7 def elegible_adjusted_capital(capital, rate, duration): return capital > 0 and rate > 0 and (duration > 0) def calculate_adjusted_capital(duration, income): return income / duration * ADJ_FACTOR def get_adjusted_capital(capital, rate, duration, income): if elegible_adjusted_capital(capit...
def cmdissue(toissue, activesession): ssh_stdin, ssh_stdout, ssh_stderr = activesession.exec_command(toissue) return ssh_stdout.read().decode('UTF-8')
def cmdissue(toissue, activesession): (ssh_stdin, ssh_stdout, ssh_stderr) = activesession.exec_command(toissue) return ssh_stdout.read().decode('UTF-8')
# -*- coding: utf-8 -*- def main(): n = int(input()) s = [input() for _ in range(n)] ans = 0 back_a_count = 0 front_b_count = 0 front_b_back_a_count = 0 for si in s: if si[0] == 'B': front_b_count += 1 if si[-1] == 'A': back_a_count +...
def main(): n = int(input()) s = [input() for _ in range(n)] ans = 0 back_a_count = 0 front_b_count = 0 front_b_back_a_count = 0 for si in s: if si[0] == 'B': front_b_count += 1 if si[-1] == 'A': back_a_count += 1 if si[0] == 'B' and si[-1] == ...
class Solution: def maxValueAfterReverse(self, nums: List[int]) -> int: mini = math.inf maxi = -math.inf for a, b in zip(nums, nums[1:]): mini = min(mini, max(a, b)) maxi = max(maxi, min(a, b)) diff = max(0, (maxi - mini) * 2) for a, b in zip(nums, nums[1:]): headDiff = -abs(a ...
class Solution: def max_value_after_reverse(self, nums: List[int]) -> int: mini = math.inf maxi = -math.inf for (a, b) in zip(nums, nums[1:]): mini = min(mini, max(a, b)) maxi = max(maxi, min(a, b)) diff = max(0, (maxi - mini) * 2) for (a, b) in zip(n...
file = open('./input_01_01.txt', 'r') string = file.read() lines = string.split() int_lines = list(map(lambda x: int(x), lines)) def checkNumber(): r = 0 first = int_lines.pop(0) for n in int_lines: if first + n == 2020: r = first * n break if r == 0: return checkNumber() else: ret...
file = open('./input_01_01.txt', 'r') string = file.read() lines = string.split() int_lines = list(map(lambda x: int(x), lines)) def check_number(): r = 0 first = int_lines.pop(0) for n in int_lines: if first + n == 2020: r = first * n break if r == 0: return che...
# Ask a user to enter a number # Ask a user to enter a second number # Calculate the total of the two numbers added together # Print 'first number + second number = answer' # For example if someone enters 4 and 6 the output should read # 4 + 6 = 10 First_num = input("Give me a number: ") Second_num = input("Give me a ...
first_num = input('Give me a number: ') second_num = input('Give me a second number: ') answer = float(First_num) + float(Second_num) print(First_num + '+' + Second_num + '=' + str(round(answer)))
USTP_FTDC_VC_AV = '1' USTP_FTDC_VC_MV = '2' USTP_FTDC_VC_CV = '3' USTP_FTDC_FCR_NotForceClose = '0' USTP_FTDC_FCR_LackDeposit = '1' USTP_FTDC_FCR_ClientOverPositionLimit = '2' USTP_FTDC_FCR_MemberOverPositionLimit = '3' USTP_FTDC_FCR_NotMultiple = '4' USTP_FTDC_FCR_Violation = '5' USTP_FTDC_FCR_Other = '6' USTP_FTDC_FC...
ustp_ftdc_vc_av = '1' ustp_ftdc_vc_mv = '2' ustp_ftdc_vc_cv = '3' ustp_ftdc_fcr__not_force_close = '0' ustp_ftdc_fcr__lack_deposit = '1' ustp_ftdc_fcr__client_over_position_limit = '2' ustp_ftdc_fcr__member_over_position_limit = '3' ustp_ftdc_fcr__not_multiple = '4' ustp_ftdc_fcr__violation = '5' ustp_ftdc_fcr__other =...
#! /usr/bin/env python # -*- coding: utf-8 -*- def after(caller_name, *caller_args, **caller_kwargs): ''' Connect two functions of the same class to execute in order as the function name means :param caller_name: Given the name of the function which should be called afterwards :param caller_args: :...
def after(caller_name, *caller_args, **caller_kwargs): """ Connect two functions of the same class to execute in order as the function name means :param caller_name: Given the name of the function which should be called afterwards :param caller_args: :param caller_kwargs: :return: """ d...
def average(x): return sum(x)/float(len(x)) if x else 0 print (average([0,0,3,1,4,1,5,9,0,0])) print (average([1e20,-1e-20,3,1,4,1,5,9,-1e20,1e-20]))
def average(x): return sum(x) / float(len(x)) if x else 0 print(average([0, 0, 3, 1, 4, 1, 5, 9, 0, 0])) print(average([1e+20, -1e-20, 3, 1, 4, 1, 5, 9, -1e+20, 1e-20]))
#!/usr/bin/env python3 """Python sketch of the sort of thing forward.cr should do.""" def collect_to_list(supplier): results = [] supplier(results.append) return results def each_day(action): action('Sunday') action('Monday') action('Tuesday') action('Wednesday') action('Thursday') ...
"""Python sketch of the sort of thing forward.cr should do.""" def collect_to_list(supplier): results = [] supplier(results.append) return results def each_day(action): action('Sunday') action('Monday') action('Tuesday') action('Wednesday') action('Thursday') action('Friday') a...
# coding: utf-8 """ Template constants for future expansions """ # fields names BITMAP = 'bitmap' COLS = 'cols' DATA = 'data' EXTERIOR = 'exterior' FACES = 'faces' INTERIOR = 'interior' MULTICHANNEL_BITMAP = 'multichannelBitmap' ORIGIN = 'origin' POINTS = 'points' ROWS = 'rows' TYPE = 'type' GEOMETRY_SHAPE = 'shape' ...
""" Template constants for future expansions """ bitmap = 'bitmap' cols = 'cols' data = 'data' exterior = 'exterior' faces = 'faces' interior = 'interior' multichannel_bitmap = 'multichannelBitmap' origin = 'origin' points = 'points' rows = 'rows' type = 'type' geometry_shape = 'shape' geometry_type = 'geometryType' an...
expected_output = { 'peer_session': {'PEER-SESSION': {'bfd': True, 'description': 'PEER-SESSION', 'disable_connectivity_check': True, 'ebgp_multihop_enable': True, 'ebgp_multihop_limit': 255, 'holdtime': 111, 'inheri...
expected_output = {'peer_session': {'PEER-SESSION': {'bfd': True, 'description': 'PEER-SESSION', 'disable_connectivity_check': True, 'ebgp_multihop_enable': True, 'ebgp_multihop_limit': 255, 'holdtime': 111, 'inherited_vrf_default': '10.16.2.5', 'keepalive': 222, 'local_as': True, 'transport_connection_mode': 'Passive'...
"""Your task is to create a function - basic_op(). The function should take three arguments - operation(string/char), value1(number), value2(number). The function should return result of numbers after applying the chosen operation.""" def basic_op(operator, value1, value2): if operator == '+': return va...
"""Your task is to create a function - basic_op(). The function should take three arguments - operation(string/char), value1(number), value2(number). The function should return result of numbers after applying the chosen operation.""" def basic_op(operator, value1, value2): if operator == '+': return val...
class Solution: """ @param: dictionary: an array of strings @return: an arraylist of strings """ def longestWords(self, dictionary): maxLength = 0 result = [] for word in dictionary : L = len(word) if L>maxLength : maxLength = L ...
class Solution: """ @param: dictionary: an array of strings @return: an arraylist of strings """ def longest_words(self, dictionary): max_length = 0 result = [] for word in dictionary: l = len(word) if L > maxLength: max_length = L ...
input = """ne,nw,se,nw,ne,s,s,s,sw,ne,sw,sw,sw,sw,sw,nw,nw,sw,se,ne,nw,nw,nw,nw,nw,nw,n,n,s,nw,n,n,nw,n,n,n,n,ne,n,n,ne,n,n,s,n,se,ne,ne,ne,n,se,ne,ne,ne,ne,se,ne,ne,ne,ne,ne,ne,ne,sw,ne,ne,s,se,se,se,s,ne,ne,se,ne,ne,sw,ne,se,se,se,se,se,se,s,s,se,se,ne,se,se,se,se,ne,se,se,s,se,se,s,n,s,se,s,ne,se,se,nw,ne,s,n,s,se,s...
input = 'ne,nw,se,nw,ne,s,s,s,sw,ne,sw,sw,sw,sw,sw,nw,nw,sw,se,ne,nw,nw,nw,nw,nw,nw,n,n,s,nw,n,n,nw,n,n,n,n,ne,n,n,ne,n,n,s,n,se,ne,ne,ne,n,se,ne,ne,ne,ne,se,ne,ne,ne,ne,ne,ne,ne,sw,ne,ne,s,se,se,se,s,ne,ne,se,ne,ne,sw,ne,se,se,se,se,se,se,s,s,se,se,ne,se,se,se,se,ne,se,se,s,se,se,s,n,s,se,s,ne,se,se,nw,ne,s,n,s,se,se,...
# loop condition list for i in [2, 4, 6, 8, 10]: print("i = ", i) # loop condition: range() print('My name is ') for i in range(5): print('Susanna Five Times ' + str(i)) for i in range(12, 16): print('Susanna Five Times ' + str(i)) for i in range(0, 10, 2): print('Susanna Five Times ' + str(i)) for ...
for i in [2, 4, 6, 8, 10]: print('i = ', i) print('My name is ') for i in range(5): print('Susanna Five Times ' + str(i)) for i in range(12, 16): print('Susanna Five Times ' + str(i)) for i in range(0, 10, 2): print('Susanna Five Times ' + str(i)) for i in range(5, -1, -1): print('Susanna Five Times...
def waveread(): return "This function name is waveread"
def waveread(): return 'This function name is waveread'
"""Provides the repository macro to import absl.""" load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls") def repo(): """Imports absl.""" # Attention: tools parse and update these lines. # LINT.IfChange ABSL_COMMIT = "215105818dfde3174fe799600bb0f3cae233d0bf" ABSL_SHA256 = "237e2e6a...
"""Provides the repository macro to import absl.""" load('//third_party:repo.bzl', 'tf_http_archive', 'tf_mirror_urls') def repo(): """Imports absl.""" absl_commit = '215105818dfde3174fe799600bb0f3cae233d0bf' absl_sha256 = '237e2e6aec7571ae90d961d02de19f56861a7417acbbc15713b8926e39d461ed' sys_dirs = ['...
class RequestHeader: """ A single request header. Immutable. """ def __init__(self, name, value): if name is None or not name.strip(): raise ValueError("name is required") self.__name = name self.__value = value @property def name(self): """ ...
class Requestheader: """ A single request header. Immutable. """ def __init__(self, name, value): if name is None or not name.strip(): raise value_error('name is required') self.__name = name self.__value = value @property def name(self): """ ...
while True: N = int(input('')) if N == 0: break else: V = list(map(int, input().split())) X = sorted(V) for i in V: if i == X[-2]: Y = V.index(i) + 1 print(Y)
while True: n = int(input('')) if N == 0: break else: v = list(map(int, input().split())) x = sorted(V) for i in V: if i == X[-2]: y = V.index(i) + 1 print(Y)
number_list=[] def max_min(number_list,n): min_position=number_list.index(min(number_list)) max_position=number_list.index(max(number_list)) print("Minimum element in array at index:", number_list[min_position],min_position ) print("Maximum element in array at index:", number_list[max_position],max...
number_list = [] def max_min(number_list, n): min_position = number_list.index(min(number_list)) max_position = number_list.index(max(number_list)) print('Minimum element in array at index:', number_list[min_position], min_position) print('Maximum element in array at index:', number_list[max_position],...
DEBUG = True # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE' : 'django.db.backends.postgresql', 'NAME' : 'allgoods', 'USER' : 'allgoods', 'PASSWORD' : '123456', 'HOST' : '127.0.0.1', 'P...
debug = True databases = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME': 'allgoods', 'USER': 'allgoods', 'PASSWORD': '123456', 'HOST': '127.0.0.1', 'PORT': '5432'}}
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def xaw(): http_archive( name="Xaw" , build_file="//bazel/deps/Xaw:build.BUILD" , sha256="c30f3e7bbe6bf949bca40e2c...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def xaw(): http_archive(name='Xaw', build_file='//bazel/deps/Xaw:build.BUILD', sha256='c30f3e7bbe6bf949bca40e2c0421f3bdae7d43753ae9f92d303ac44cf5de5e5a', strip_prefix='xorg-libXaw-197e9d055f3cd351ae73551955ff463294b965bf', urls=['https://github.c...
class Solution: def minCost(self, costs: List[List[int]]) -> int: costsLength = len(costs) if costsLength == 0: return 0 prevRow = costs[-1] for i in range(costsLength - 2, -1, -1): currRow = list(costs[i]) currRowLength = len(currRow) ...
class Solution: def min_cost(self, costs: List[List[int]]) -> int: costs_length = len(costs) if costsLength == 0: return 0 prev_row = costs[-1] for i in range(costsLength - 2, -1, -1): curr_row = list(costs[i]) curr_row_length = len(currRow) ...
""" 1. Clarification 2. Possible solutions - bfs - Use those next pointers already established 3. Coding 4. Tests """ """ # Definition for a Node. class Node: def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None): self.val = val self.left = left ...
""" 1. Clarification 2. Possible solutions - bfs - Use those next pointers already established 3. Coding 4. Tests """ "\n# Definition for a Node.\nclass Node:\n def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):\n self.val = val\n self.left = left\...
words = list() with open("resources/google-10000-english-usa-no-swears.txt", 'r') as file: for line in file.readlines(): words.append(line.strip()) by_length = dict() for word in words: length = len(word) if length not in by_length: by_length[length] = list() by_length[length].append(wo...
words = list() with open('resources/google-10000-english-usa-no-swears.txt', 'r') as file: for line in file.readlines(): words.append(line.strip()) by_length = dict() for word in words: length = len(word) if length not in by_length: by_length[length] = list() by_length[length].append(wor...
def save_board(board_list, game_key): """ Saves the board state to db """ game = game_key.get() board = list_to_string(board_list) game.board = board game.put() def string_to_list(string_in): """ Converts a string to a list """ list_out = [] for ch in string_in: list_out.appe...
def save_board(board_list, game_key): """ Saves the board state to db """ game = game_key.get() board = list_to_string(board_list) game.board = board game.put() def string_to_list(string_in): """ Converts a string to a list """ list_out = [] for ch in string_in: list_out.append(...
def mkerr(): raise ValueError("Error!") def request(flow): mkerr()
def mkerr(): raise value_error('Error!') def request(flow): mkerr()
print("Welcome to Band Name Generator") city_name = input("What's the name of the city you grew up in?\n") pet_name = input("What's your pet's name?\n") print("Your band name could be " + city_name + " " + pet_name)
print('Welcome to Band Name Generator') city_name = input("What's the name of the city you grew up in?\n") pet_name = input("What's your pet's name?\n") print('Your band name could be ' + city_name + ' ' + pet_name)
# Interaction of .pend_throw() with .throw() and .close() def gen(): i = 0 while 1: yield i i += 1 g = gen() try: g.pend_throw except AttributeError: print("SKIP") raise SystemExit g.pend_throw(1) try: g.throw(ValueError()) except ValueError: print("expected ValueError #1...
def gen(): i = 0 while 1: yield i i += 1 g = gen() try: g.pend_throw except AttributeError: print('SKIP') raise SystemExit g.pend_throw(1) try: g.throw(value_error()) except ValueError: print('expected ValueError #1') g = gen() print(next(g)) g.pend_throw(2) try: g.throw(...
#Skill: Breath first search #You are given the root of a binary tree. Return the deepest node (the furthest node from the root). #Example: # a # / \ # b c # / #d #The deepest node in this tree is d at depth 3. #Here's a starting point: class Node(object): def __init__(self, val): self.val = val...
class Node(object): def __init__(self, val): self.val = val self.left = None self.right = None def __repr__(self): return self.val class Solution: def find_deepest(self, node): return self.__iterativeDeepest(node) def __recusive_deepest(self, node, level): ...
f = Function(void, 'OpenDeskAcc', (Str255, 'name', InMode), condition='#if !TARGET_API_MAC_CARBON' ) functions.append(f) f = Function(MenuHandle, 'as_Menu', (Handle, 'h', InMode)) functions.append(f) f = Method(Handle, 'as_Resource', (MenuHandle, 'h', InMode)) methods.append(f) # The following have "Mac" prepended...
f = function(void, 'OpenDeskAcc', (Str255, 'name', InMode), condition='#if !TARGET_API_MAC_CARBON') functions.append(f) f = function(MenuHandle, 'as_Menu', (Handle, 'h', InMode)) functions.append(f) f = method(Handle, 'as_Resource', (MenuHandle, 'h', InMode)) methods.append(f) f = function(MenuHandle, 'GetMenu', (short...
def main() -> None: N = int(input()) assert 1 <= N <= 300 for _ in range(N): X_i, A_i = map(int, input().split()) assert -10**9 <= X_i <= 10**9 assert 1 <= A_i <= 10**9 if __name__ == '__main__': main()
def main() -> None: n = int(input()) assert 1 <= N <= 300 for _ in range(N): (x_i, a_i) = map(int, input().split()) assert -10 ** 9 <= X_i <= 10 ** 9 assert 1 <= A_i <= 10 ** 9 if __name__ == '__main__': main()
class BinaryTree: def __init__(self,root): self.key=root self.leftChild=None self.rightChild=None def insertLeft(self,root): if self.leftChild==None: self.leftChild=BinaryTree(root) else: tempNode=BinaryTree(root) tempNode.leftChild=self.leftChild self.leftChild=tempNode def insertRight(self,ro...
class Binarytree: def __init__(self, root): self.key = root self.leftChild = None self.rightChild = None def insert_left(self, root): if self.leftChild == None: self.leftChild = binary_tree(root) else: temp_node = binary_tree(root) te...
def generate_get_uri(endpoint: str, **params): unpacked_params = [f"{p}={params[p]}" for p in params] return endpoint + '?' + '&'.join(unpacked_params)
def generate_get_uri(endpoint: str, **params): unpacked_params = [f'{p}={params[p]}' for p in params] return endpoint + '?' + '&'.join(unpacked_params)
def geometric_progression(a, q): k = 0 while True: result = a * q**k if result <= 100000: yield result else: return k += 1 for n in geometric_progression(2, 5): print(n)
def geometric_progression(a, q): k = 0 while True: result = a * q ** k if result <= 100000: yield result else: return k += 1 for n in geometric_progression(2, 5): print(n)
# -*- coding: utf-8 -*- """ mundiapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class CreateAddressRequest(object): """Implementation of the 'CreateAddressRequest' model. Request for creating a new Address Attributes: street (st...
""" mundiapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class Createaddressrequest(object): """Implementation of the 'CreateAddressRequest' model. Request for creating a new Address Attributes: street (string): Street number (string): Numb...
''' Print out each element of the following array on a separate line: ["Joe", "2", "Ted", "4.98", "14", "Sam", "void *", "42", "float", "pointers", "5006"] You may use whatever programming language you'd like. Verbalize your thought process as much as possible before writing any code. Run through the UPER problem sol...
""" Print out each element of the following array on a separate line: ["Joe", "2", "Ted", "4.98", "14", "Sam", "void *", "42", "float", "pointers", "5006"] You may use whatever programming language you'd like. Verbalize your thought process as much as possible before writing any code. Run through the UPER problem sol...
# Define states and events, including symbolic (numeric) constants and their friendly names. STATE_NAMES = ['open', 'closed', 'opening', 'closing'] for i in range(len(STATE_NAMES)): globals()[STATE_NAMES[i].upper() + '_STATE'] = i EVENT_NAMES = ['open requested', 'close requested', 'finished opening', 'finished clo...
state_names = ['open', 'closed', 'opening', 'closing'] for i in range(len(STATE_NAMES)): globals()[STATE_NAMES[i].upper() + '_STATE'] = i event_names = ['open requested', 'close requested', 'finished opening', 'finished closing'] for i in range(len(EVENT_NAMES)): globals()[EVENT_NAMES[i].upper().replace(' ', '_...
def multi(x): total = 1 for num in x: total = total * num return total user_list = [1,2,3,-4] print(multi(user_list))
def multi(x): total = 1 for num in x: total = total * num return total user_list = [1, 2, 3, -4] print(multi(user_list))
# -*- coding: utf-8 -*- """ Created on Wed Apr 3 10:43:26 2019 @author: Matt Macarty """ # Setting up the application # create a menu of options for email system mail_options = {1:"Send Message", 2 :"Add Contact", 3:"Delete Contact", 4: "Quit"} # primary application functions # this...
""" Created on Wed Apr 3 10:43:26 2019 @author: Matt Macarty """ mail_options = {1: 'Send Message', 2: 'Add Contact', 3: 'Delete Contact', 4: 'Quit'} def read_contacts(file_name): f = open(file_name, 'r') data = f.read().split('\n') contacts = [] for contact in data: if len(contact) > 0: ...
"""Constants for PlayStation 4.""" ATTR_MEDIA_IMAGE_URL = 'media_image_url' CONFIG_ENTRY_VERSION = 3 DEFAULT_NAME = "PlayStation 4" DEFAULT_REGION = "United States" DEFAULT_ALIAS = 'Home-Assistant' DOMAIN = 'ps4' GAMES_FILE = '.ps4-games.json' PS4_DATA = 'ps4_data' COMMANDS = ( 'up', 'down', 'right', 'left', 'ente...
"""Constants for PlayStation 4.""" attr_media_image_url = 'media_image_url' config_entry_version = 3 default_name = 'PlayStation 4' default_region = 'United States' default_alias = 'Home-Assistant' domain = 'ps4' games_file = '.ps4-games.json' ps4_data = 'ps4_data' commands = ('up', 'down', 'right', 'left', 'enter', 'b...
# Copyright (c) 2020 fortiss GmbH # # This software is released under the MIT License. # https://opensource.org/licenses/MIT class AgentTrackInfo: def __init__(self, filename, track_id, start_offset, end_offset, first_ts_on_map=None, precision=-2): self._filename = filename self._track_id = track_...
class Agenttrackinfo: def __init__(self, filename, track_id, start_offset, end_offset, first_ts_on_map=None, precision=-2): self._filename = filename self._track_id = track_id self._start_offset = int(round(start_offset, precision)) self._end_offset = int(round(end_offset, precision...
''' Created on Dec 22, 2019 @author: ballance ''' class DB(): def __init__(self): pass def createCrossByName(self): pass
""" Created on Dec 22, 2019 @author: ballance """ class Db: def __init__(self): pass def create_cross_by_name(self): pass
h,w=map(int,input().split()) a=[] for i in range(h): x = input() if "#" in x: a.append(x) a=list(zip(*a)) b=[] for y in a: if "#" in y: b.append(y) b=list(zip(*b)) for c in b: print("".join(c))
(h, w) = map(int, input().split()) a = [] for i in range(h): x = input() if '#' in x: a.append(x) a = list(zip(*a)) b = [] for y in a: if '#' in y: b.append(y) b = list(zip(*b)) for c in b: print(''.join(c))
emtiaz=0 majmoEmtiaz=0 bord=0 for i in range(1,31): emtiaz = int(input()) majmoEmtiaz += emtiaz if emtiaz ==3: bord +=1 print(majmoEmtiaz,bord)
emtiaz = 0 majmo_emtiaz = 0 bord = 0 for i in range(1, 31): emtiaz = int(input()) majmo_emtiaz += emtiaz if emtiaz == 3: bord += 1 print(majmoEmtiaz, bord)
#!/usr/bin/python3 """Create and define the class "Square". This module creates an class called "Square" that defines a square. Typical usage example: var = Square() """ class Square: """Define a square. Define a square by size. Attributes: __size: size of the square. """ def __...
"""Create and define the class "Square". This module creates an class called "Square" that defines a square. Typical usage example: var = Square() """ class Square: """Define a square. Define a square by size. Attributes: __size: size of the square. """ def __init__(self, size): ...
''' This file is a place to store flags that affect the operation of mwahpy ''' verbose=1 #If on, functions are a lot noisier #will slow things down slightly, but it may be helpful for debugging progress_bars=1 #Display progress bars #slows down a program somewhat, but is useful for making sure that #a long program i...
""" This file is a place to store flags that affect the operation of mwahpy """ verbose = 1 progress_bars = 1 auto_update = 1
# The class and its functions are designed to write into an empty .html file # Each object takes three parameters - center latitude and -longitude and the zoom # for the height of the map class GoogleMaps_HeatMap(object): def __init__(self, center_lat, center_lng, zoom, apikey=''): self.center = ...
class Googlemaps_Heatmap(object): def __init__(self, center_lat, center_lng, zoom, apikey=''): self.center = (float(center_lat), float(center_lng)) self.zoom = int(zoom) self.apikey = str(apikey) self.circles = [] self.heatmap_points = [] def circle(self, lat, lng, radi...
""" Author: CaptCorpMURICA Project: 100DaysPython File: module1_day05_strFormat.py Creation Date: 6/2/2019, 8:55 AM Description: Learn the basics of formatting strings in python. """ cheers = "where everybody knows YOUR name." print("norm".upper()) spinoff = "Frasier" ...
""" Author: CaptCorpMURICA Project: 100DaysPython File: module1_day05_strFormat.py Creation Date: 6/2/2019, 8:55 AM Description: Learn the basics of formatting strings in python. """ cheers = 'where everybody knows YOUR name.' print('norm'.upper()) spinoff = 'Frasier' yr...
# Code generation format strings for UFC (Unified Form-assembly Code) v. 2.0.5. # This code is released into the public domain. # # The FEniCS Project (http://www.fenicsproject.org/) 2006-2011. function_combined = """\ /// This class defines the interface for a general tensor-valued function. class %(classname)s: pub...
function_combined = '/// This class defines the interface for a general tensor-valued function.\n\nclass %(classname)s: public ufc::function\n{%(members)s\npublic:\n\n /// Constructor\n %(classname)s::%(classname)s(%(constructor_arguments)s) : ufc::function()%(initializer_list)s\n {\n%(constructor)s\n }\n\n /// De...
description = 'HM configuration for the FOCUS lower detector bank' includes = [ 'lowerbank_config', ] group = 'lowlevel' devices = dict( lower_histogrammer = device('nicos_sinq.devices.sinqhm.channel.HistogramMemoryChannel', description = "Lower bank HM Channel", connector = 'lower_connector'...
description = 'HM configuration for the FOCUS lower detector bank' includes = ['lowerbank_config'] group = 'lowlevel' devices = dict(lower_histogrammer=device('nicos_sinq.devices.sinqhm.channel.HistogramMemoryChannel', description='Lower bank HM Channel', connector='lower_connector'), lower_image=device('nicos_sinq.dev...
#stats.py class stats(): def __init__(self): print("You created an instance of stats()") def total(self, list_obj): total = 0 n = len(list_obj) for i in range(n): total += list_obj[i] return total def mean(self, list_obj): n = len(lis...
class Stats: def __init__(self): print('You created an instance of stats()') def total(self, list_obj): total = 0 n = len(list_obj) for i in range(n): total += list_obj[i] return total def mean(self, list_obj): n = len(list_obj) mean_ = ...
# # WAP to find no of occurance of each letter in a String using dictionary. String = input("Enter String: ") d = {} s = "" for i in range(0, len(String)): if(String[i] not in s): c = String.count(String[i]) d[String[i]] = c s += String[i] print(d) # # WAP convert the following String into...
string = input('Enter String: ') d = {} s = '' for i in range(0, len(String)): if String[i] not in s: c = String.count(String[i]) d[String[i]] = c s += String[i] print(d) string = 'Vijay=23,Ganesh=20,Lakshmi=19,Nikhil=22' string += ',' d = {} (p, st, st1) = (0, '', 0) for i in range(0, len(S...
{ 'variables': { 'bin': '<!(node -p "require(\'addon-tools-raub\').bin")', }, 'targets': [ { 'target_name': 'segfault', 'sources': [ 'cpp/bindings.cpp', 'cpp/segfault-handler.cpp', ], 'include_dirs': [ '<!@(node -p "require(\'addon-tools-raub\').include")', ], 'cflags!': ['-fno-exce...
{'variables': {'bin': '<!(node -p "require(\'addon-tools-raub\').bin")'}, 'targets': [{'target_name': 'segfault', 'sources': ['cpp/bindings.cpp', 'cpp/segfault-handler.cpp'], 'include_dirs': ['<!@(node -p "require(\'addon-tools-raub\').include")'], 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'cfl...
# # PySNMP MIB module MRV-IN-REACH-CHASSIS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MRV-IN-REACH-CHASSIS-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:15:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, constraints_union, value_range_constraint) ...
# Exercise for Classes: Homework Solution class Car(): # we initialize a class called "Car" def __init__(self, topSpeed, acc): # __init__ method, called when an object of this class is created ...
class Car: def __init__(self, topSpeed, acc): self.topSpeed = topSpeed self.acceleration = acc def calc_time(self, currentSpeed): t = (self.topSpeed - currentSpeed) / self.acceleration return t car = car(75, 3.5) time = car.calcTime(30) print(time)
''' Desription: Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a val (int) and a list (List[Node]) of its neighbors. class Node { public int val; public List<Node> neighbors; } Test case format: For simplicity sake, ...
""" Desription: Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a val (int) and a list (List[Node]) of its neighbors. class Node { public int val; public List<Node> neighbors; } Test case format: For simplicity sake, ...
""" Exceptions are when things go wrong. We can catch exceptions with try/except. By catching the exceptions we can then handle it anyway we want. """ # # Dividing by zero causes an exception. # try: val = 345 / 0 except: print("Opps there was an error.") # # Trying to open a file that doesn't exist cause...
""" Exceptions are when things go wrong. We can catch exceptions with try/except. By catching the exceptions we can then handle it anyway we want. """ try: val = 345 / 0 except: print('Opps there was an error.') try: data = open('wrongname.txt').read() except: print('Sorry the file does not exist.') tr...
EVALANGUAGEDEFINITION = """ start: evaluate+ evaluate: "evaluate" selectexpression "using" templatename [("," strictness )] -> evaluatething selectexpression : "name" "=" ELEMENTNAME -> selectexpressionname | "type" ":" typelist -> selectexpressiontype | "eid" "=" UUID...
evalanguagedefinition = '\nstart: evaluate+\n\nevaluate: "evaluate" selectexpression "using" templatename [("," strictness )]\t\t-> evaluatething\n\n\nselectexpression : "name" "=" ELEMENTNAME \t\t\t\t\t\t\t\t-> selectexpressionname\n \t | "type" ":" typelist\t\t\t\t\t\t\t-> selectexpressiontype\n ...
CITIES_SIGSPATIAL = [ 'Zagrzeb', 'Helsinki', 'Espoo', 'Tampere', 'Oulu', 'Lille', 'Nice', 'Toulouse', 'Nantes', 'Cologne', 'Aachen', 'Hamburg', 'Erfurt', 'Mannheim', 'Antwerp', 'Gent', 'Wieden', 'Karlsruhe', 'Ateny', 'Budapest', 'Wenecja', 'Florencja', 'Genoa', 'Turin', 'Palermo', 'Milan', 'O...
cities_sigspatial = ['Zagrzeb', 'Helsinki', 'Espoo', 'Tampere', 'Oulu', 'Lille', 'Nice', 'Toulouse', 'Nantes', 'Cologne', 'Aachen', 'Hamburg', 'Erfurt', 'Mannheim', 'Antwerp', 'Gent', 'Wieden', 'Karlsruhe', 'Ateny', 'Budapest', 'Wenecja', 'Florencja', 'Genoa', 'Turin', 'Palermo', 'Milan', 'Oslo', 'Szczecin', 'Lublin', ...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'targets': [ { # GN version: //cc/ipc 'target_name': 'cc_ipc', 'type': '<(component)...
{'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'cc_ipc', 'type': '<(component)', 'dependencies': ['../../base/base.gyp:base', '../../cc/cc.gyp:cc', '../../gpu/gpu.gyp:gpu_ipc_common', '../../ipc/ipc.gyp:ipc', '../../skia/skia.gyp:skia', '../../ui/events/events.gyp:events_base', '../../ui/events/events....
"""author : @akashsaini """ for _ in range(int(input())): n=int(input()) nn=2**n-1 print(nn//2+1)
"""author : @akashsaini """ for _ in range(int(input())): n = int(input()) nn = 2 ** n - 1 print(nn // 2 + 1)
APPEAL_LEVEL = ( ('level 1', 'Level 1'), ('level 2', 'Level 2'), ('level 3', 'Level 3'), ('level 4', 'Level 4'), ) APPEAL_SERVICE_CATEGORY = ( ('practitioner services', 'Practitioner Services'), ('emergency room', 'Emergency Room'), ('acute inpatient hospital', 'Acute Inpatient Hospital'), ...
appeal_level = (('level 1', 'Level 1'), ('level 2', 'Level 2'), ('level 3', 'Level 3'), ('level 4', 'Level 4')) appeal_service_category = (('practitioner services', 'Practitioner Services'), ('emergency room', 'Emergency Room'), ('acute inpatient hospital', 'Acute Inpatient Hospital'), ('office-based lab/x-ray', 'Offic...
class CustomException(Exception): def __init__(self, message="", data=None): super(CustomException, self).__init__(self, message) self.message = message self.data = data
class Customexception(Exception): def __init__(self, message='', data=None): super(CustomException, self).__init__(self, message) self.message = message self.data = data
""" Constants for ocw-studio """ ISO_8601_FORMAT = "%Y-%m-%dT%H:%M:%SZ" STATUS_CREATED = "Created" STATUS_COMPLETE = "Complete" STATUS_FAILED = "Failed"
""" Constants for ocw-studio """ iso_8601_format = '%Y-%m-%dT%H:%M:%SZ' status_created = 'Created' status_complete = 'Complete' status_failed = 'Failed'
#encoding:utf-8 subreddit = 'terriblefacebookmemes' t_channel = '@TerribleFacebookMemes' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'terriblefacebookmemes' t_channel = '@TerribleFacebookMemes' def send_post(submission, r2t): return r2t.send_simple(submission)
# Given a string, find the length of the longest substring without repeating characters. # Example 1: # Input: "abcabcbbdd" # Output: 3 # Explanation: The answer is "abc", with the length of 3. def subString(str): n = len(str) # Start pos of final string , length of final string start = 0 max_length...
def sub_string(str): n = len(str) start = 0 max_length = 0 visited_pos = {} current_start = 0 current_length = 0 for i in range(0, n): if str[i] not in visited_pos: visited_pos[str[i]] = i else: if visited_pos[str[i]] >= current_start: ...
"""mixin to add filters to config attributes""" class AddFiltersMixin(object): """stuff""" def add_filters(self, filter_mappings): """adds filter functions to config""" pass def add_filters_from_module(self, filter_module): """adds filter functions to config""" pass
"""mixin to add filters to config attributes""" class Addfiltersmixin(object): """stuff""" def add_filters(self, filter_mappings): """adds filter functions to config""" pass def add_filters_from_module(self, filter_module): """adds filter functions to config""" pass
""" Module to interpret Roman Numeral strings and convert them to integers >>> integer_to_numeral(22) 'XXII' >>> numeral_to_integer('XXII') 22 """ NUMERAL_MAPPING = { 1: 'I', 5: 'V', 10: 'X', 50: 'L', 100: 'C', 500: 'D', 1000: 'M', } INTEGER_MAPPING = {val: key for key, val in NUMERAL_MAP...
""" Module to interpret Roman Numeral strings and convert them to integers >>> integer_to_numeral(22) 'XXII' >>> numeral_to_integer('XXII') 22 """ numeral_mapping = {1: 'I', 5: 'V', 10: 'X', 50: 'L', 100: 'C', 500: 'D', 1000: 'M'} integer_mapping = {val: key for (key, val) in NUMERAL_MAPPING.items()} clean_mapping = {...
#!/usr/bin/env python3 # encoding: utf-8 def error(): yield 1 raise Exception def thing(): return error() def main(): for x in thing(): # thing won't be in the traceback pass if __name__ == '__main__': main()
def error(): yield 1 raise Exception def thing(): return error() def main(): for x in thing(): pass if __name__ == '__main__': main()