content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#weight = 50 State.PS_veliki=_State(False,name='PS_veliki',shared=True) State.PS_mali=_State(False,name='PS_mali',shared=True) def run(): r.setpos(-1500+155+125+10,-1000+600+220,90) #bocno absrot90 r.conf_set('send_status_interval', 10) State.color = 'ljubicasta' # init servos llift(0) rlift(0) rfliper(0) lflip...
State.PS_veliki = __state(False, name='PS_veliki', shared=True) State.PS_mali = __state(False, name='PS_mali', shared=True) def run(): r.setpos(-1500 + 155 + 125 + 10, -1000 + 600 + 220, 90) r.conf_set('send_status_interval', 10) State.color = 'ljubicasta' llift(0) rlift(0) rfliper(0) lflip...
def join_dictionaries( dictionaries: list) -> dict: joined_dictionary = \ dict() for dictionary in dictionaries: joined_dictionary.update( dictionary) return \ joined_dictionary
def join_dictionaries(dictionaries: list) -> dict: joined_dictionary = dict() for dictionary in dictionaries: joined_dictionary.update(dictionary) return joined_dictionary
APIAE_PARAMS = dict( n_x=90, # dimension of x; observation n_z=3, # dimension of z; latent space n_u=1, # dimension of u; control K=10, # the number of time steps R=1, # the number of adaptations L=32, # the number of trajectory sampled dt=.1, # time interval ur=.1, # update r...
apiae_params = dict(n_x=90, n_z=3, n_u=1, K=10, R=1, L=32, dt=0.1, ur=0.1, lr=0.001) training_epochs = 3000 offset_std = 1e-05
class Computer: def __init__(self): self.__maxprice = 900 def sell(self): print("Selling Price: {}".format(self.__maxprice)) def setMaxPrice(self, price): self.__maxprice = price c = Computer() c.sell() # change the price c.__maxprice = 1000 c.sell() # using setter function c.se...
class Computer: def __init__(self): self.__maxprice = 900 def sell(self): print('Selling Price: {}'.format(self.__maxprice)) def set_max_price(self, price): self.__maxprice = price c = computer() c.sell() c.__maxprice = 1000 c.sell() c.setMaxPrice(1000) c.sell()
n,m = input().split(' ') my_array = list(input().split(' ')) A = set(input().split(' ')) B = set(input().split(' ')) happiness = 0 for i in my_array: happiness += (i in A) - (i in B) print(happiness)
(n, m) = input().split(' ') my_array = list(input().split(' ')) a = set(input().split(' ')) b = set(input().split(' ')) happiness = 0 for i in my_array: happiness += (i in A) - (i in B) print(happiness)
buf = "" buf += "\xdb\xdd\xd9\x74\x24\xf4\x58\xbf\x63\x6e\x69\x90\x33" buf += "\xc9\xb1\x52\x83\xe8\xfc\x31\x78\x13\x03\x1b\x7d\x8b" buf += "\x65\x27\x69\xc9\x86\xd7\x6a\xae\x0f\x32\x5b\xee\x74" buf += "\x37\xcc\xde\xff\x15\xe1\x95\x52\x8d\x72\xdb\x7a\xa2" buf += "\x33\x56\x5d\x8d\xc4\xcb\x9d\x8c\x46\x16\xf2\x6e\x76" ...
buf = '' buf += 'ÛÝÙt$ôX¿cni\x903' buf += 'ɱR\x83èü1x\x13\x03\x1b}\x8b' buf += "e'iÉ\x86×j®\x0f2[ît" buf += '7ÌÞÿ\x15á\x95R\x8drÛz¢' buf += '3V]\x8dÄË\x9d\x8cF\x16ònv' buf += 'Ù\x07o¿\x04å=hBXÑ\x1d\x1e' buf += 'aZm\x8eá¿&±Àn<èÂ' buf += '\x91\x91\x80J\x89ö\xad\x05"ÌZ\x94â' buf += '\x1c¢;Ë\x90QE\x0c\x16\x8a0dd' buf += "...
print(" "*7 + "A") print(" "*6 + "B B") print(" "*5 + "C C") print(" "*4 + "D" + " "*5 + "D") print(" "*3 + "E" + " "*7 + "E") print(" "*4 + "D" + " "*5 + "D") print(" "*5 + "C C") print(" "*6 + "B B") print(" "*7 + "A")
print(' ' * 7 + 'A') print(' ' * 6 + 'B B') print(' ' * 5 + 'C C') print(' ' * 4 + 'D' + ' ' * 5 + 'D') print(' ' * 3 + 'E' + ' ' * 7 + 'E') print(' ' * 4 + 'D' + ' ' * 5 + 'D') print(' ' * 5 + 'C C') print(' ' * 6 + 'B B') print(' ' * 7 + 'A')
subscription_service = paymill_context.get_subscription_service() subscription_with_offer_and_different_values = subscription_service.create_with_offer_id( payment_id='pay_5e078197cde8a39e4908f8aa', offer_id='offer_b33253c73ae0dae84ff4', name='Example Subscription', period_of_validity='2 YEAR', star...
subscription_service = paymill_context.get_subscription_service() subscription_with_offer_and_different_values = subscription_service.create_with_offer_id(payment_id='pay_5e078197cde8a39e4908f8aa', offer_id='offer_b33253c73ae0dae84ff4', name='Example Subscription', period_of_validity='2 YEAR', start_at=1400575533)
class Monkey(object): '''Store data of placed monkey''' def __init__(self, position=None, name=None, mtype=None) -> None: ''' :arg position: position, list :arg name: name :arg mtype: type of monkey (get from action.action) ''' self.position = position se...
class Monkey(object): """Store data of placed monkey""" def __init__(self, position=None, name=None, mtype=None) -> None: """ :arg position: position, list :arg name: name :arg mtype: type of monkey (get from action.action) """ self.position = position se...
matched = [[0, 450], [1, 466], [2, 566], [3, 974], [4, 1000], [5, 1222], [6, 1298], [7, 1322], [8, 1340], [9, 1704], [10, 1752], [11, 2022], [12, 2114], [13, 2332], [14, 2360], [15, 2380], [16, 2388], [17, 2596], [18, 2662], [19, 2706], [20, 2842], [21, 2914], [22, 3132], [23, 3148], [24, 3158], [...
matched = [[0, 450], [1, 466], [2, 566], [3, 974], [4, 1000], [5, 1222], [6, 1298], [7, 1322], [8, 1340], [9, 1704], [10, 1752], [11, 2022], [12, 2114], [13, 2332], [14, 2360], [15, 2380], [16, 2388], [17, 2596], [18, 2662], [19, 2706], [20, 2842], [21, 2914], [22, 3132], [23, 3148], [24, 3158], [25, 3164], [26, 3244],...
#!/usr/bin/env python # Mainly for use in stubconnections/kubectl.yml print('PID: 1')
print('PID: 1')
# START LAB EXERCISE 03 print('Lab Exercise 03 \n') # PROBLEM 1 (5 Points) inventors = None # PROBLEM 2 (4 Points) #SETUP invention = 'Heating, ventilation, and air conditioning' #END SETUP # PROBLEM 3 (4 Points) # SETUP new_inventor = {'Alexander Miles': 'Automatic electric elevator doors'} # END SETUP # PRO...
print('Lab Exercise 03 \n') inventors = None invention = 'Heating, ventilation, and air conditioning' new_inventor = {'Alexander Miles': 'Automatic electric elevator doors'} gastroscope_inventor = 'Leonidas Berry' tuple_gastroscope_inventor = None medical_inventors = None
#!/usr/bin/python3 # Can user retrieve reward after a time cycle? def test_get_reward(multi, base_token, reward_token, alice, issue, chain): amount = 10 ** 10 init_reward_balance = reward_token.balanceOf(alice) base_token.approve(multi, amount, {"from": alice}) multi.stake(amount, {"from": alice}) ...
def test_get_reward(multi, base_token, reward_token, alice, issue, chain): amount = 10 ** 10 init_reward_balance = reward_token.balanceOf(alice) base_token.approve(multi, amount, {'from': alice}) multi.stake(amount, {'from': alice}) chain.mine(timedelta=60) earnings = multi.earned(alice, reward_...
data = ( 'ddwim', # 0x00 'ddwib', # 0x01 'ddwibs', # 0x02 'ddwis', # 0x03 'ddwiss', # 0x04 'ddwing', # 0x05 'ddwij', # 0x06 'ddwic', # 0x07 'ddwik', # 0x08 'ddwit', # 0x09 'ddwip', # 0x0a 'ddwih', # 0x0b 'ddyu', # 0x0c 'ddyug', # 0x0d 'ddyugg', # 0x0e 'ddyugs', # 0x0f 'dd...
data = ('ddwim', 'ddwib', 'ddwibs', 'ddwis', 'ddwiss', 'ddwing', 'ddwij', 'ddwic', 'ddwik', 'ddwit', 'ddwip', 'ddwih', 'ddyu', 'ddyug', 'ddyugg', 'ddyugs', 'ddyun', 'ddyunj', 'ddyunh', 'ddyud', 'ddyul', 'ddyulg', 'ddyulm', 'ddyulb', 'ddyuls', 'ddyult', 'ddyulp', 'ddyulh', 'ddyum', 'ddyub', 'ddyubs', 'ddyus', 'ddyuss', ...
def build_mx(n, m): grid = [] for i in range(n): grid.append([' '] * m) return grid def EMPTY_SHAPE(): return [[]] class Shape(object): _name = None grid = EMPTY_SHAPE() rotate_grid = [] def __init__(self, grid): # align each row and column is same n = len(gri...
def build_mx(n, m): grid = [] for i in range(n): grid.append([' '] * m) return grid def empty_shape(): return [[]] class Shape(object): _name = None grid = empty_shape() rotate_grid = [] def __init__(self, grid): n = len(grid) m = max([len(row) for row in grid]...
def cal_average(num): i = 0 for x in num: i += x avg = i / len(num) return avg cal_average([1,2,3,4])
def cal_average(num): i = 0 for x in num: i += x avg = i / len(num) return avg cal_average([1, 2, 3, 4])
#!/use/bin/python3 __author__ = 'yangdd' ''' example 024 ''' a = 2 b =1 total = 0.0 for i in range(1,21): total += a/b a,b=a+b,a print(total)
__author__ = 'yangdd' '\n\texample 024\n' a = 2 b = 1 total = 0.0 for i in range(1, 21): total += a / b (a, b) = (a + b, a) print(total)
# # PySNMP MIB module RFC1285-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1285-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:48:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ...
grey_image = np.mean(image, axis=-1) print("Shape: {}".format(grey_image.shape)) print("Type: {}".format(grey_image.dtype)) print("image size: {:0.3} MB".format(grey_image.nbytes / 1e6)) print("Min: {}; Max: {}".format(grey_image.min(), grey_image.max())) plt.imshow(grey_image, cmap=plt.cm.Greys_r)
grey_image = np.mean(image, axis=-1) print('Shape: {}'.format(grey_image.shape)) print('Type: {}'.format(grey_image.dtype)) print('image size: {:0.3} MB'.format(grey_image.nbytes / 1000000.0)) print('Min: {}; Max: {}'.format(grey_image.min(), grey_image.max())) plt.imshow(grey_image, cmap=plt.cm.Greys_r)
def start_HotSpot(ssid="Hovercraft",encrypted=False,passd="1234",iface="wlan0"): print("HotSpot %s encrypt %s with Pass %s on Interface %s",ssid,encrypted,passd,iface) def stop_HotSpot(): print("HotSpot stopped")
def start__hot_spot(ssid='Hovercraft', encrypted=False, passd='1234', iface='wlan0'): print('HotSpot %s encrypt %s with Pass %s on Interface %s', ssid, encrypted, passd, iface) def stop__hot_spot(): print('HotSpot stopped')
n = int(input()) left_side = 0 right_side = 0 for i in range(n): num = int(input()) left_side += num for i in range(n): num = int(input()) right_side += num if left_side == right_side: print(f"Yes, sum = {left_side}") else: print(f"No, diff = {abs(left_side - right_side)}")
n = int(input()) left_side = 0 right_side = 0 for i in range(n): num = int(input()) left_side += num for i in range(n): num = int(input()) right_side += num if left_side == right_side: print(f'Yes, sum = {left_side}') else: print(f'No, diff = {abs(left_side - right_side)}')
# # PySNMP MIB module CTRON-PRIORITY-CLASSIFY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-PRIORITY-CLASSIFY-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:30:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
DESCRIPTION = "switch to a different module" def autocomplete(shell, line, text, state): # todo: make this show shorter paths at a time # should never go this big... if len(line.split()) > 2 and line.split()[0] != "set": return None options = [x + " " for x in shell.plugins if x.startswith(tex...
description = 'switch to a different module' def autocomplete(shell, line, text, state): if len(line.split()) > 2 and line.split()[0] != 'set': return None options = [x + ' ' for x in shell.plugins if x.startswith(text)] try: return options[state] except: return None def help(s...
# test builtin issubclass class A: pass print(issubclass(A, A)) print(issubclass(A, (A,))) try: issubclass(A, 1) except TypeError: print('TypeError') try: issubclass('a', 1) except TypeError: print('TypeError')
class A: pass print(issubclass(A, A)) print(issubclass(A, (A,))) try: issubclass(A, 1) except TypeError: print('TypeError') try: issubclass('a', 1) except TypeError: print('TypeError')
# Gianna-Carina Gruen # 05/23/2016 # Homework 1 # 1. Prompt the user for their year of birth, and tell them (approximately): year_of_birth = input ("Hello! I'm not interested in your name, but I would like to know your age. In what year were you born?") # Additionally, if someone gives you a year in the futu...
year_of_birth = input("Hello! I'm not interested in your name, but I would like to know your age. In what year were you born?") if int(year_of_birth) >= 2016: year_of_birth = input('I seriously doubt that - you get another chance. Tell me the truth this time. In what year where you born?') age = 2016 - int(year_of_...
class Solution: def removePalindromeSub(self, s: str) -> int: # exception if s == '': return 0 elif s == s[::-1]: return 1 else: return 2
class Solution: def remove_palindrome_sub(self, s: str) -> int: if s == '': return 0 elif s == s[::-1]: return 1 else: return 2
#!/usr/bin/env python # coding=utf-8 class startURL: xinfangURL = [ 'http://cs.ganji.com/fang12/o1/', 'http://cs.ganji.com/fang12/o2/', 'http://cs.ganji.com/fang12/o3/', 'http://cs.ganji.com/fang12/o4/', 'http://cs.ganji.com/fang12/o5/', 'http://cs.ganji.com/fang12/o...
class Starturl: xinfang_url = ['http://cs.ganji.com/fang12/o1/', 'http://cs.ganji.com/fang12/o2/', 'http://cs.ganji.com/fang12/o3/', 'http://cs.ganji.com/fang12/o4/', 'http://cs.ganji.com/fang12/o5/', 'http://cs.ganji.com/fang12/o6/', 'http://cs.ganji.com/fang12/o7/', 'http://cs.ganji.com/fang12/o8/', 'http://cs.ga...
# File: hackerone_consts.py # Copyright (c) 2020-2021 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # # Constants for actions ACTION_ID_GET_ALL = 'get_reports' ACTION_ID_GET_UPDATED = 'get_updated_reports' ACTION_ID_GET_ONE = 'get_report' ACTION_ID_UPDATE = 'update_id' ACTI...
action_id_get_all = 'get_reports' action_id_get_updated = 'get_updated_reports' action_id_get_one = 'get_report' action_id_update = 'update_id' action_id_unassign = 'unassign' action_id_on_poll = 'on_poll' action_id_test = 'test_asset_connectivity' action_id_get_bounty_balance = 'get_bounty_balance' action_id_get_billi...
# -*- coding: utf-8 -*- # Author: Daniel Yang <daniel.yj.yang@gmail.com> # # License: BSD-3-Clause __version__ = "0.0.6" __license__ = "BSD-3-Clause License"
__version__ = '0.0.6' __license__ = 'BSD-3-Clause License'
##n=int(input("enter a number:")) ##i=1 ## ##count=0 ##while(i<n): ## if(n%i==0): ## count=count+1 ## ## i=i+1 ##if(count<=2): ## print("prime") ##else: ## print("not") i=2 j=2 while(i<=10): while(j<i): if(i%j==0): break; else: print(i) ...
i = 2 j = 2 while i <= 10: while j < i: if i % j == 0: break else: print(i) j += 1 i += 1
for m in range(1,1000): for n in range(m+1,1000): c=1000-m-n if c**2==(m**2+n**2): print('The individual numbers a,b,c respectively are',m,n,c,'the product of abc is',m*n*c)
for m in range(1, 1000): for n in range(m + 1, 1000): c = 1000 - m - n if c ** 2 == m ** 2 + n ** 2: print('The individual numbers a,b,c respectively are', m, n, c, 'the product of abc is', m * n * c)
{ 'target_defaults': { 'includes': ['../common-mk/common.gypi'], 'variables': { 'deps': [ 'protobuf', ], }, }, 'targets': [ { 'target_name': 'media_perception_protos', 'type': 'static_library', 'variables': { 'proto_in_dir': 'proto/', 'proto_ou...
{'target_defaults': {'includes': ['../common-mk/common.gypi'], 'variables': {'deps': ['protobuf']}}, 'targets': [{'target_name': 'media_perception_protos', 'type': 'static_library', 'variables': {'proto_in_dir': 'proto/', 'proto_out_dir': 'include/media_perception'}, 'sources': ['<(proto_in_dir)/device_management.proto...
class Solution: def canReach(self, arr: List[int], start: int) -> bool: # bastardized version of DFS # if we are out of bounds return false # else check to left and right # same idea as sinking islands where we remove visited for current recurse left, right ...
class Solution: def can_reach(self, arr: List[int], start: int) -> bool: (left, right) = (0, len(arr)) def dfs(i): if i < left or i >= right or arr[i] < 0: return False if arr[i] == 0: return True arr[i] = -arr[i] poss...
class Queue: def __init__(self, maxsize): self.__max_size = maxsize self.__elements = [None] * self.__max_size self.__rear = -1 self.__front = 0 def getMaxSize(self): return self.__max_size def isFull(self): return self.__rear == self.__max_size def isE...
class Queue: def __init__(self, maxsize): self.__max_size = maxsize self.__elements = [None] * self.__max_size self.__rear = -1 self.__front = 0 def get_max_size(self): return self.__max_size def is_full(self): return self.__rear == self.__max_size def...
def HammingDistance(p, q): mm = [p[i] != q[i] for i in range(len(p))] return sum(mm) # def ImmediateNeighbors(Pattern): # Neighborhood = [Pattern] # for i in range(len(Pattern)): # nuc = Pattern[i] # for nuc2 in ['A', 'C', 'G', 'T']: # if nuc != nuc2: # pat =...
def hamming_distance(p, q): mm = [p[i] != q[i] for i in range(len(p))] return sum(mm) def neighbors(Pattern, d): if d == 0: return Pattern if len(Pattern) == 1: return ['A', 'C', 'G', 'T'] neighborhood = set() suffix_neighbors = neighbors(Pattern[1:], d) for text in SuffixNe...
''' Description: Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is guaranteed to have unique values. Example 1: Input: root = [10,5,15,3,7,null,18], L = 7, R = 15 Output: 32 Example 2: Input: root = [10,5,15,3,7,...
""" Description: Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is guaranteed to have unique values. Example 1: Input: root = [10,5,15,3,7,null,18], L = 7, R = 15 Output: 32 Example 2: Input: root = [10,5,15,3,7,...
# model settings model = dict( type='Classification', pretrained=None, backbone=dict( type='MobileNetV3', arch='large', out_indices=(16,), # x-1: stage-x norm_cfg=dict(type='BN', eps=0.001, momentum=0.01), ), head=dict( type='ClsHead', loss=dict(type=...
model = dict(type='Classification', pretrained=None, backbone=dict(type='MobileNetV3', arch='large', out_indices=(16,), norm_cfg=dict(type='BN', eps=0.001, momentum=0.01)), head=dict(type='ClsHead', loss=dict(type='CrossEntropyLoss', loss_weight=1.0), with_avg_pool=True, in_channels=960, num_classes=1000))
# Generate permutations with a space def permutation_with_space_helper(input_val, output_val): if len(input_val) == 0: # Base condition to get a final output once the input string is empty final.append(output_val) return # Store the first element of the string and make decisions on it ...
def permutation_with_space_helper(input_val, output_val): if len(input_val) == 0: final.append(output_val) return temp = input_val[0] permutation_with_space_helper(input_val[1:], output_val + temp) permutation_with_space_helper(input_val[1:], output_val + '_' + temp) def permutation_wit...
EXAMPLE_DOCS = [ # Collection stored as "docs" { '_data': 'one two', '_type': 'http://sharejs.org/types/textv1', '_v': 8, '_m': { 'mtime': 1415654366808, 'ctime': 1415654358668 }, '_id': '26aabd89-541b-5c02-9e6a-ad332ba43118' }, { ...
example_docs = [{'_data': 'one two', '_type': 'http://sharejs.org/types/textv1', '_v': 8, '_m': {'mtime': 1415654366808, 'ctime': 1415654358668}, '_id': '26aabd89-541b-5c02-9e6a-ad332ba43118'}, {'_data': 'XXX', '_type': 'http://sharejs.org/types/textv1', '_v': 4, '_m': {'mtime': 1415654385628, 'ctime': 1415654381131}, ...
def insert_line(file, text, after=None, before=None, past=None, once=True): with open(file) as f: lines = iter(f.readlines()) with open(file, 'w') as f: if past: for line in lines: f.write(line) if re.match(past, line): break ...
def insert_line(file, text, after=None, before=None, past=None, once=True): with open(file) as f: lines = iter(f.readlines()) with open(file, 'w') as f: if past: for line in lines: f.write(line) if re.match(past, line): break ...
count = int(input()) tux = [" _~_ ", " (o o) ", " / V \ ", "/( _ )\\ ", " ^^ ^^ "] for i in tux: print(i * count)
count = int(input()) tux = [' _~_ ', ' (o o) ', ' / V \\ ', '/( _ )\\ ', ' ^^ ^^ '] for i in tux: print(i * count)
class Node(): ''' The DiNode class is specifically designed for altering path search. - Active and passive out nodes, for easily iteratively find new nodes in path. - Marks for easy look up edges already visited (earlier Schlaufen) / nodes in path-creation already visited - The edge-marks have t...
class Node: """ The DiNode class is specifically designed for altering path search. - Active and passive out nodes, for easily iteratively find new nodes in path. - Marks for easy look up edges already visited (earlier Schlaufen) / nodes in path-creation already visited - The edge-marks have the...
class Point2D: def __init__(self,x,y): self.x = x self.y = y def __eq__(self, value): return self.x == value.x and self.y == value.y def __hash__(self): return hash((self.x,self.y))
class Point2D: def __init__(self, x, y): self.x = x self.y = y def __eq__(self, value): return self.x == value.x and self.y == value.y def __hash__(self): return hash((self.x, self.y))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, a, b): if a is None: return b if b is None: return a if a.val > b.va...
class Solution: def merge_two_lists(self, a, b): if a is None: return b if b is None: return a if a.val > b.val: (a, b) = (b, a) result = a result_head = result a = a.next while a is not None or b is not None: a...
# DEFAULT_ASSET_URL="https://totogoto.com/assets/python_project/images/" DEFAULT_ASSET_URL="https://cdn.jsdelivr.net/gh/totogoto/assets/" DEFAULT_OBJECTS = [ "1", "2", "3", "4", "5", "apple_goal", "apple", "around3_sol", "banana_goal", "banana", "beeper_goal", "box_goal",...
default_asset_url = 'https://cdn.jsdelivr.net/gh/totogoto/assets/' default_objects = ['1', '2', '3', '4', '5', 'apple_goal', 'apple', 'around3_sol', 'banana_goal', 'banana', 'beeper_goal', 'box_goal', 'box', 'bricks', 'bridge', 'carrot_goal', 'carrot', 'daisy_goal', 'daisy', 'dandelion_goal', 'dandelion', 'desert', 'ea...
def main(): with open('test.txt','rt') as infile: test2 = infile.read() test1 ='This is a test of the emergency text system' print(test1 == test2) if __name__ == '__main__': main()
def main(): with open('test.txt', 'rt') as infile: test2 = infile.read() test1 = 'This is a test of the emergency text system' print(test1 == test2) if __name__ == '__main__': main()
# Enter your code here. Read input from STDIN. Print output to STDOUT testCases = int(input()) for i in range(testCases): word = input() for j in range(len(word)): if j%2 == 0: print(word[j], end='') print(" ", end="") for j in range(len(word)): if j%2 !=...
test_cases = int(input()) for i in range(testCases): word = input() for j in range(len(word)): if j % 2 == 0: print(word[j], end='') print(' ', end='') for j in range(len(word)): if j % 2 != 0: print(word[j], end='') print('')
# # gambit # # This file contains the information to make the mesh for a subset of the original point data set. # # # The original data sets are in csv format and are for 6519 observation points. # 1. `Grav_MeasEs.csv` contains the cartesian coordinates of the observation points (m). # 2. `Grav_gz.csv` contains the Bou...
big_gravity_data_file = 'Grav_gz.csv' big_acc_data_file = 'Grav_acc.csv' big_obs_pts_file = 'Grav_MeasEs.csv' pick = 4 gravity_data_file = 'Grav_small_gz.csv' accuracy_data_file = 'Grav_small_acc.csv' obs_pts_file = 'Grav_small_MeasEs.csv' min_dist_file = 'Grav_small_minDist.csv' max_dist = 5000 mindist1 = 500 mindist2...
i = 1 while i < 6: print(i) if i == 3: break i += 1 i = 1 while i < 6: print(i) if i == 3: continue i += 1 fruits = ["apple", "banana", "cherry"] for x in fruits: print(x) if x == "banana": break fruits = ["apple", "banana", "cherry"] for x in fruits: if x == "ba...
i = 1 while i < 6: print(i) if i == 3: break i += 1 i = 1 while i < 6: print(i) if i == 3: continue i += 1 fruits = ['apple', 'banana', 'cherry'] for x in fruits: print(x) if x == 'banana': break fruits = ['apple', 'banana', 'cherry'] for x...
def config(): return None def watch(): return None
def config(): return None def watch(): return None
def transposition(key, order, order_name): new_key = "" for pos in order: new_key += key[pos-1] print("Permuted "+ order_name +" = "+ new_key) return new_key def P10(key): P10_order = [3, 5, 2, 7, 4, 10, 1, 9, 8, 6] P10_key = transposition(key, P10_order, "P10") return P10_key ...
def transposition(key, order, order_name): new_key = '' for pos in order: new_key += key[pos - 1] print('Permuted ' + order_name + ' = ' + new_key) return new_key def p10(key): p10_order = [3, 5, 2, 7, 4, 10, 1, 9, 8, 6] p10_key = transposition(key, P10_order, 'P10') return P10_key ...
class laptop: brand=[] year=[] ram=[] def __init__(self,brand,year,ram,cost): self.brand.append(brand) self.year.append(year) self.ram.append(ram) self.cost.append(cost)
class Laptop: brand = [] year = [] ram = [] def __init__(self, brand, year, ram, cost): self.brand.append(brand) self.year.append(year) self.ram.append(ram) self.cost.append(cost)
dataset_type = 'TextDetDataset' data_root = 'data/synthtext' train = dict( type=dataset_type, ann_file=f'{data_root}/instances_training.lmdb', loader=dict( type='AnnFileLoader', repeat=1, file_format='lmdb', parser=dict( type='LineJsonParser', keys=['...
dataset_type = 'TextDetDataset' data_root = 'data/synthtext' train = dict(type=dataset_type, ann_file=f'{data_root}/instances_training.lmdb', loader=dict(type='AnnFileLoader', repeat=1, file_format='lmdb', parser=dict(type='LineJsonParser', keys=['file_name', 'height', 'width', 'annotations'])), img_prefix=f'{data_root...
class Solution: def judgeSquareSum(self, c: int) -> bool: left = 0 right = int(c ** 0.5) while left <= right: cur = left ** 2 + right ** 2 if cur < c: left += 1 elif cur > c: right -= 1 else: retu...
class Solution: def judge_square_sum(self, c: int) -> bool: left = 0 right = int(c ** 0.5) while left <= right: cur = left ** 2 + right ** 2 if cur < c: left += 1 elif cur > c: right -= 1 else: r...
#!/usr/bin/env python3 def score_word(word): score = 0 for letter in word: # add code here pass return score
def score_word(word): score = 0 for letter in word: pass return score
#!/bin/python3 # https://www.hackerrank.com/challenges/alphabet-rangoli/problem #ll=limitting letter #sl=starting letter #df=deduction factor #cd=character difference #rl=resulting letter while True: ll=ord(input("Enter the limitting letter in the pattern:> ")) sl=65 if ll in range(65,91) else (97 if ll in ran...
while True: ll = ord(input('Enter the limitting letter in the pattern:> ')) sl = 65 if ll in range(65, 91) else 97 if ll in range(97, 123) else None if sl: break print('Enter a valid input.') print('See the alphabet pattern:>\n') for df in range(sl - ll, ll - sl + 1): for cd in range(sl - ll...
# initialize step_end step_end = 25 with plt.xkcd(): # initialize the figure plt.figure() # loop for step_end steps for step in range(step_end): t = step * dt i = i_mean * (1 + np.sin((t * 2 * np.pi) / 0.01)) plt.plot(t, i, 'ko') plt.title('Synaptic Input $I(t)$') plt.xlabel('time (s)') pl...
step_end = 25 with plt.xkcd(): plt.figure() for step in range(step_end): t = step * dt i = i_mean * (1 + np.sin(t * 2 * np.pi / 0.01)) plt.plot(t, i, 'ko') plt.title('Synaptic Input $I(t)$') plt.xlabel('time (s)') plt.ylabel('$I$ (A)') plt.show()
S = list(map(str, input())) for i in range(len(S)): if S[i] == '6': S[i] = '9' elif S[i] == '9': S[i] = '6' S = reversed(S) print("".join(S))
s = list(map(str, input())) for i in range(len(S)): if S[i] == '6': S[i] = '9' elif S[i] == '9': S[i] = '6' s = reversed(S) print(''.join(S))
global_variable = "global_variable" print(global_variable + " printed at the module level.") class GeoPoint(): class_attribute = "class_attribute" print(class_attribute + " printed at the class level.") def __init__(self): global global_variable print(global_variable + " printed at th...
global_variable = 'global_variable' print(global_variable + ' printed at the module level.') class Geopoint: class_attribute = 'class_attribute' print(class_attribute + ' printed at the class level.') def __init__(self): global global_variable print(global_variable + ' printed at the metho...
#!/usr/bin/env python3 #!/usr/bin/python str1 = 'test1' if str1 == 'test1' or str1 == 'test2': print('1 or 2') elif str1 == 'test3' or str1 == 'test4': print("3 or 4") else: print("else") str1 = '' if str1: print(("'%s' is True" % str1)) else: print(("'%s' is False" % str1)) str1 = ' ' if str1: ...
str1 = 'test1' if str1 == 'test1' or str1 == 'test2': print('1 or 2') elif str1 == 'test3' or str1 == 'test4': print('3 or 4') else: print('else') str1 = '' if str1: print("'%s' is True" % str1) else: print("'%s' is False" % str1) str1 = ' ' if str1: print("'%s' is True" % str1) else: print(...
# Python Class 1 # variable <-- Left # = <-- Assign # data = int, String, char, boolean, float name = "McGill University" age = 10 is_good = False height = 5.6 print("Name is :" + name) print("Age is :" + str(age)) print("He is good :" +str(is_good))
name = 'McGill University' age = 10 is_good = False height = 5.6 print('Name is :' + name) print('Age is :' + str(age)) print('He is good :' + str(is_good))
e,f,c = map(int,input().split()) bottle = (e+f)//c get = (e+f)%c + bottle while 1: if get < c: break bottle += get//c get = get//c + get%c print(bottle)
(e, f, c) = map(int, input().split()) bottle = (e + f) // c get = (e + f) % c + bottle while 1: if get < c: break bottle += get // c get = get // c + get % c print(bottle)
TESTING = True HOST = "127.0.0.1" PORT = 8000
testing = True host = '127.0.0.1' port = 8000
def to_star(word): vowels = ['a', 'e' ,'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] for char in vowels: word = word.replace(char,"*") return word word = input("Enter a word: ") print(to_star(word))
def to_star(word): vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] for char in vowels: word = word.replace(char, '*') return word word = input('Enter a word: ') print(to_star(word))
print ("Welcome to the mad lib generator. Please follow along and type your input to each statement or question.") print ("Name an object") obj1 = input() print ("Name the plural of your previous object") obj3 = input() print ("Name a different plural object") obj2 = input() print ("Name a color") color1 = i...
print('Welcome to the mad lib generator. Please follow along and type your input to each statement or question.') print('Name an object') obj1 = input() print('Name the plural of your previous object') obj3 = input() print('Name a different plural object') obj2 = input() print('Name a color') color1 = input() print('W...
students = { "ivan": 5.50, "alex": 3.50, "maria": 5.50, "georgy": 5.50, } for k,v in students.items(): if v > 4.50: print( "{} - {}".format(k, v) )
students = {'ivan': 5.5, 'alex': 3.5, 'maria': 5.5, 'georgy': 5.5} for (k, v) in students.items(): if v > 4.5: print('{} - {}'.format(k, v))
# This script will track two lists through a 3-D printing process # Source code/inspiration/software # Python Crash Course by Eric Matthews, Chapter 8, example 8+ # Made with Mu 1.0.3 in October 2021 # Start with a list of unprinted_designs to be 3-D printed unprinted_designs = ['iphone case', 'robot pend...
unprinted_designs = ['iphone case', 'robot pendant', 'dodecahedron'] for unprinted_design in unprinted_designs: print('The following model will be printed: ' + unprinted_design) completed_models = [] print('\n ') while unprinted_designs: current_design = unprinted_designs.pop() print('Printing model: ' + cu...
# from typing import Counter # counter={} words=input().split(" ") counter ={ x:words.count(x) for x in set(words)} print('max: ', max(counter)) print('min: ', min(counter)) # a = input().split() # d = {} # for x in a: # try: # d[x] += 1 # except: # d[x] = 1 # print('max: ', max(d)) # prin...
words = input().split(' ') counter = {x: words.count(x) for x in set(words)} print('max: ', max(counter)) print('min: ', min(counter))
# This file is part of the Extra-P software (http://www.scalasca.org/software/extra-p) # # Copyright (c) 2020, Technical University of Darmstadt, Germany # # This software may be modified and distributed under the terms of a BSD-style license. # See the LICENSE file in the base directory for details. class Recoverable...
class Recoverableerror(RuntimeError): def __init__(self, *args: object) -> None: super().__init__(*args) class Fileformaterror(RecoverableError): name = 'File Format Error' def __init__(self, *args: object) -> None: super().__init__(*args) class Invalidexperimenterror(RecoverableError): ...
def greet(first_name, last_name): print(f"Hi {first_name} {last_name}") greet("Tom", "Hill")
def greet(first_name, last_name): print(f'Hi {first_name} {last_name}') greet('Tom', 'Hill')
print() print("--- Math ---") print(1+1) print(1*3) print(1/2) print(3**2) print(4%2) print(4%2 == 0) print(type(1)) print(type(1.0))
print() print('--- Math ---') print(1 + 1) print(1 * 3) print(1 / 2) print(3 ** 2) print(4 % 2) print(4 % 2 == 0) print(type(1)) print(type(1.0))
directions = [(-1,0), (0,1), (1,0), (0,-1), (0,0)] dirs = ["North", "East", "South", "West", "Stay"] def add(a, b): return tuple(map(lambda a, b: a + b, a, b)) def sub(a,b): return tuple(map(lambda a, b: a - b, a, b)) def manhattan_dist(a, b): return abs(a[0]-b[0]) + abs(a[1]-b[1]) def direction_t...
directions = [(-1, 0), (0, 1), (1, 0), (0, -1), (0, 0)] dirs = ['North', 'East', 'South', 'West', 'Stay'] def add(a, b): return tuple(map(lambda a, b: a + b, a, b)) def sub(a, b): return tuple(map(lambda a, b: a - b, a, b)) def manhattan_dist(a, b): return abs(a[0] - b[0]) + abs(a[1] - b[1]) def directi...
def even_fibo(): a =1 b = 1 even_sum = 0 c =0 while(c<= 4000000): c = a + b a = b b = c if(c %2 == 0): even_sum = c + even_sum print(even_sum) if __name__ == "__main__": print("Project Euler Problem 1") even_fibo()
def even_fibo(): a = 1 b = 1 even_sum = 0 c = 0 while c <= 4000000: c = a + b a = b b = c if c % 2 == 0: even_sum = c + even_sum print(even_sum) if __name__ == '__main__': print('Project Euler Problem 1') even_fibo()
MULTI_ERRORS_HTTP_RESPONSE = { "errors": [ { "code": 403, "message": "access denied, authorization failed" }, { "code": 401, "message": "test error #1" }, { "code": 402, "message": "test error #2" ...
multi_errors_http_response = {'errors': [{'code': 403, 'message': 'access denied, authorization failed'}, {'code': 401, 'message': 'test error #1'}, {'code': 402, 'message': 'test error #2'}], 'meta': {'powered_by': 'crowdstrike-api-gateway', 'query_time': 0.000654734, 'trace_id': '39f1573c-7a51-4b1a-abaa-92d29f704afd'...
name = 'shell_proc' version = '1.1.1' description = 'Continuous shell process' url = 'https://github.com/justengel/shell_proc' author = 'Justin Engel' author_email = 'jtengel08@gmail.com'
name = 'shell_proc' version = '1.1.1' description = 'Continuous shell process' url = 'https://github.com/justengel/shell_proc' author = 'Justin Engel' author_email = 'jtengel08@gmail.com'
def open_input(): with open("input.txt") as fd: array = fd.read().splitlines() array = list(map(int, array)) return array def part_one(array): lenght = len(array) increased = 0 for i in range(0, lenght - 1): if array[i] < array[i + 1]: increased += 1 print("part...
def open_input(): with open('input.txt') as fd: array = fd.read().splitlines() array = list(map(int, array)) return array def part_one(array): lenght = len(array) increased = 0 for i in range(0, lenght - 1): if array[i] < array[i + 1]: increased += 1 print('part ...
# =========================================================================== # dictionary.py ----------------------------------------------------------- # =========================================================================== # function ---------------------------------------------------------------- # -----...
def update_dict(a, b): if a and b and isinstance(a, dict): a.update(b) return a def get_dict_element(dict_list, field, query): for item in dict_list: if item[field] == query: return item return dict() def get_dict_elements(dict_list, field, query, update=False): if not ...
# selectionsort() method def selectionSort(arr): arraySize = len(arr) for i in range(arraySize): min = i for j in range(i+1, arraySize): if arr[j] < arr[min]: min = j #swap values arr[i], arr[min] = arr[min], arr[i] # method to print an array def printList(arr): for i in rang...
def selection_sort(arr): array_size = len(arr) for i in range(arraySize): min = i for j in range(i + 1, arraySize): if arr[j] < arr[min]: min = j (arr[i], arr[min]) = (arr[min], arr[i]) def print_list(arr): for i in range(len(arr)): print(arr[i], ...
logo = ''' ______ __ __ _ __ __ / ____/__ __ ___ _____ _____ / /_ / /_ ___ / | / /__ __ ____ ___ / /_ ___ _____ / / __ / / / // _ \ / ___// ___/ / __// __ \ / _ \ / |/ // / / // __ `__ \ / __ \ / _ \ / ___/ / /_/ // ...
logo = '\n ______ __ __ _ __ __ \n / ____/__ __ ___ _____ _____ / /_ / /_ ___ / | / /__ __ ____ ___ / /_ ___ _____\n / / __ / / / // _ \\ / ___// ___/ / __// __ \\ / _ \\ / |/ // / / // __ `__ \\ / __ \\ / _ \\ / ___/\n/...
'''https://leetcode.com/problems/symmetric-tree/''' # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isMirror(self, left, right): if left is None and right is None: ...
"""https://leetcode.com/problems/symmetric-tree/""" class Solution: def is_mirror(self, left, right): if left is None and right is None: return True if left is None or right is None: return False if left.val == right.val: return self.isMirror(left.left, ...
''' LeetCode LinkedList Q.876 Middle of the Linked List Recusion and Slow/Fast Pointer Solution ''' def middleNode(self, head: ListNode) -> ListNode: def rec(slow, fast): if not fast: return slow elif not fast.next: return slow return rec(slow.next, fast.next.nex...
""" LeetCode LinkedList Q.876 Middle of the Linked List Recusion and Slow/Fast Pointer Solution """ def middle_node(self, head: ListNode) -> ListNode: def rec(slow, fast): if not fast: return slow elif not fast.next: return slow return rec(slow.next, fast.next.nex...
class ParameterDefinition(object): def __init__(self, name, param_type=None, value=None): self.name = name self.param_type = param_type self.value = value class Parameter(object): def __init__(self, definition): self.definition = definition self.value = definition.val...
class Parameterdefinition(object): def __init__(self, name, param_type=None, value=None): self.name = name self.param_type = param_type self.value = value class Parameter(object): def __init__(self, definition): self.definition = definition self.value = definition.valu...
load(":import_external.bzl", import_external = "import_external") def dependencies(): import_external( name = "org_apache_httpcomponents_client5_httpclient5", artifact = "org.apache.httpcomponents.client5:httpclient5:5.1", artifact_sha256 = "b7a30296763a4d5dbf840f0b79df7439cf3d2341c8990aee4...
load(':import_external.bzl', import_external='import_external') def dependencies(): import_external(name='org_apache_httpcomponents_client5_httpclient5', artifact='org.apache.httpcomponents.client5:httpclient5:5.1', artifact_sha256='b7a30296763a4d5dbf840f0b79df7439cf3d2341c8990aee4111591b61b50935', srcjar_sha256='...
class Solution: def imageSmoother(self, M: list) -> list: l = len(M) if l == 0: return M m = len(M[0]) res = [] for i in range(l): res.append([0] * m) # print(res) for x in range(l): for y in range(m): summ =...
class Solution: def image_smoother(self, M: list) -> list: l = len(M) if l == 0: return M m = len(M[0]) res = [] for i in range(l): res.append([0] * m) for x in range(l): for y in range(m): summ = 0 ...
#!/usr/bin/env python3 # pylint: disable=invalid-name,missing-docstring def test_get_arns(oa, shared_datadir): with open("%s/saml_assertion.txt" % shared_datadir) as fh: assertion = fh.read() arns = oa.get_arns(assertion) # Principal assert arns[0] == 'arn:aws:iam::012345678901:saml-provider/...
def test_get_arns(oa, shared_datadir): with open('%s/saml_assertion.txt' % shared_datadir) as fh: assertion = fh.read() arns = oa.get_arns(assertion) assert arns[0] == 'arn:aws:iam::012345678901:saml-provider/OKTA' assert arns[1] == 'arn:aws:iam::012345678901:role/Okta_AdministratorAccess'
__all__ = [ "cart_factory", "cart", "environment", "job_factory", "job", "location", "trace", ]
__all__ = ['cart_factory', 'cart', 'environment', 'job_factory', 'job', 'location', 'trace']
TITLE = "The World of Light and Shadow" ALPHABET = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] ALPHABET += ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", ...
title = 'The World of Light and Shadow' alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] alphabet += ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', ...
class Solution: def closedIsland(self, grid: List[List[int]]) -> int: def dfs(r, c, val): grid[r][c] = val for nr, nc in (r-1, c), (r+1, c), (r, c-1), (r, c+1): if 0 <= nr < len(grid) and 0 <= nc < len(grid[0]) and grid[nr][nc] != val: dfs(nr, nc, ...
class Solution: def closed_island(self, grid: List[List[int]]) -> int: def dfs(r, c, val): grid[r][c] = val for (nr, nc) in ((r - 1, c), (r + 1, c), (r, c - 1), (r, c + 1)): if 0 <= nr < len(grid) and 0 <= nc < len(grid[0]) and (grid[nr][nc] != val): ...
# you can use print for debugging purposes, e.g. # print "this is a debug message" def solution(A): # write your code in Python 2.7 N = len(A) counter = [] leader = -1 leader_count = 0 left_leader_count = 0 equi_count = 0 for i in xrange(N): if not counter: ...
def solution(A): n = len(A) counter = [] leader = -1 leader_count = 0 left_leader_count = 0 equi_count = 0 for i in xrange(N): if not counter: counter.append((A[i], 1)) elif counter[0][0] == A[i]: counter[0] = (counter[0][0], counter[0][1] + 1) ...
# this py file will be strictly dedicated to "Boolean Logic" # Boolean Logic is best defined as the combination of phrases that can result in printing different values # define two variables a = True b = False # if-statement... output: True # the if condition prints, if the "if statement" evaluates to True i...
a = True b = False if a: print('True') else: print('False') if b: print('True') else: print('False') ' \nand: both clauses must be True \nor: one of the clauses must be True\n' if a and b: print('Both') else: print('Neither') if a or b: print('Both') else: print('Neither') x = True y = T...
words = set( ( "scipy", "Combinatorics", "rhs", "lhs", "df", "AttributeError", "Cymru", "FiniteSet", "Jupyter", "LaTeX", "Modularisation", "NameError", "PyCons", "allclose", "ax", "bc", ...
words = set(('scipy', 'Combinatorics', 'rhs', 'lhs', 'df', 'AttributeError', 'Cymru', 'FiniteSet', 'Jupyter', 'LaTeX', 'Modularisation', 'NameError', 'PyCons', 'allclose', 'ax', 'bc', 'boolean', 'docstring', 'dtype', 'dx', 'dy', 'expr', 'frisbee', 'inv', 'ipynb', 'isclose', 'itertools', 'jupyter', 'len', 'nbs', 'nd', '...
#Booleans are operators that allow you to convey True or False statements print(True) print(False) type(False) print(1>2) print(1==1) b= None #None is used as a placeholder for an object that has not been assigned , so that object unassigned errors can be avoided type(b) print(b) type(True)
print(True) print(False) type(False) print(1 > 2) print(1 == 1) b = None type(b) print(b) type(True)
def for_g(): for row in range(6): for col in range(3): if row-col==2 or col-row==1 or row+col==4 or col==2 and row>0 or row==5 and col==1 or row==1 and col==0: print("*",end=" ") else: print(" ",end=" ") print() def while_g(): row=...
def for_g(): for row in range(6): for col in range(3): if row - col == 2 or col - row == 1 or row + col == 4 or (col == 2 and row > 0) or (row == 5 and col == 1) or (row == 1 and col == 0): print('*', end=' ') else: print(' ', end=' ') print() ...
ERR_SVR_NOT_FOUND = 1 ERR_CLSTR_NOT_FOUND = 2 ERR_IMG_NOT_FOUND = 3 ERR_SVR_EXISTS = 4 ERR_CLSTR_EXISTS = 5 ERR_IMG_EXISTS = 6 ERR_IMG_TYPE_INVALID = 7 ERR_OPR_ERROR = 8 ERR_GENERAL_ERROR = 9 ERR_MATCH_KEY_NOT_PRESENT = 10 ERR_MATCH_VALUE_NOT_PRESENT = 11 ERR_INVALID_MATCH_KEY = 12
err_svr_not_found = 1 err_clstr_not_found = 2 err_img_not_found = 3 err_svr_exists = 4 err_clstr_exists = 5 err_img_exists = 6 err_img_type_invalid = 7 err_opr_error = 8 err_general_error = 9 err_match_key_not_present = 10 err_match_value_not_present = 11 err_invalid_match_key = 12
def swap_case(s): # sWAP cASE in Python - HackerRank Solution START Output = '' for char in s: if(char.isupper()==True): Output += (char.lower()) elif(char.islower()==True): Output += (char.upper()) else: Output += char return Output
def swap_case(s): output = '' for char in s: if char.isupper() == True: output += char.lower() elif char.islower() == True: output += char.upper() else: output += char return Output
a=10 b=1.5 c= 'Arpan' print (c,"is of type",type(c) )
a = 10 b = 1.5 c = 'Arpan' print(c, 'is of type', type(c))
KNOWN_BINARIES = [ "*.avi", # video "*.bin", # binary "*.bmp", # image "*.docx", # ms-word "*.eot", # font "*.exe", # binary "*.gif", # image "*.gz", # compressed "*.heic", # image "*.heif", #...
known_binaries = ['*.avi', '*.bin', '*.bmp', '*.docx', '*.eot', '*.exe', '*.gif', '*.gz', '*.heic', '*.heif', '*.ico', '*.jpeg', '*.jpg', '*.m1v', '*.m2a', '*.mov', '*.mp2', '*.mp3', '*.mp4', '*.mpa', '*.mpe', '*.mpeg', '*.mpg', '*.opus', '*.otf', '*.pdf', '*.png', '*.pptx', '*.qt', '*.rar', '*.tar', '*.tif', '*.tiff',...
ecc_fpga_constants_v128 = [ [ # Parameter name "p192", # base word size 16, # extended word size 128, # number of bits added 9, # number of words 2, # prime 6277101735386680763835789423207666416083908700390324961279, # prime size in bits 192, # prime+1 6277101735386680763835789423207666416083908700390324961280,...
ecc_fpga_constants_v128 = [['p192', 16, 128, 9, 2, 6277101735386680763835789423207666416083908700390324961279, 192, 6277101735386680763835789423207666416083908700390324961280, 340282366920938463444927863358058659841, 0, 12554203470773361527671578846415332832167817400780649922558, 340282366920938463481821351505477763072...
OpenVZ_EXIT_STATUS = { 'vzctl': {0: 'Command executed successfully', 1: 'Failed to set a UBC parameter', 2: 'Failed to set a fair scheduler parameter', 3: 'Generic system error', 5: 'The running kernel is not an OpenVZ kernel (or some OpenVZ modules are not lo...
open_vz_exit_status = {'vzctl': {0: 'Command executed successfully', 1: 'Failed to set a UBC parameter', 2: 'Failed to set a fair scheduler parameter', 3: 'Generic system error', 5: 'The running kernel is not an OpenVZ kernel (or some OpenVZ modules are not loaded)', 6: 'Not enough system resources', 7: 'ENV_CREATE ioc...
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/4/16 13:02 # @Author : Yunhao Cao # @File : exceptions.py __author__ = 'Yunhao Cao' __all__ = [ 'CrawlerBaseException', 'RuleManyMatchedError', ] class CrawlerBaseException(Exception): pass class RuleManyMatchedError(CrawlerBaseExcep...
__author__ = 'Yunhao Cao' __all__ = ['CrawlerBaseException', 'RuleManyMatchedError'] class Crawlerbaseexception(Exception): pass class Rulemanymatchederror(CrawlerBaseException): pass