content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# a place to hold event type constants used among many data models, rules, or policies ADMIN_ROLE_ASSIGNED = "admin_role_assigned" FAILED_LOGIN = "failed_login" MFA_DISABLED = "mfa_disabled" SUCCESSFUL_LOGIN = "successful_login" SUCCESSFUL_LOGOUT = "successful_logout" USER_ACCOUNT_CREATED = "user_account_created" # ACC...
admin_role_assigned = 'admin_role_assigned' failed_login = 'failed_login' mfa_disabled = 'mfa_disabled' successful_login = 'successful_login' successful_logout = 'successful_logout' user_account_created = 'user_account_created' account_created = 'account_created' user_account_deleted = 'user_account_deleted' user_accou...
# # PySNMP MIB module WebGraph-AnalogIO-57662-US-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WebGraph-AnalogIO-57662-US-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:32:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) ...
#!/usr/bin/env python PART1SOL = 388611 PART2SOL = 27763113 # Right on the first try! def part1(x): count = 0 loc = 0 while True: try: dat = x[loc] except IndexError: return count count += 1 x[loc] += 1 loc += dat # 137 too low # 169 too ...
part1_sol = 388611 part2_sol = 27763113 def part1(x): count = 0 loc = 0 while True: try: dat = x[loc] except IndexError: return count count += 1 x[loc] += 1 loc += dat def part2(x): count = 0 loc = 0 while True: try: ...
''' This problem was recently asked by AirBNB: Given a sorted array, A, with possibly duplicated elements, find the indices of the first and last occurrences of a target element, x. Return -1 if the target is not found. Example: Input: A = [1,3,3,5,7,8,9,9,9,15], target = 9 Output: [6,8] Input: A = [100, 150, 150, 1...
""" This problem was recently asked by AirBNB: Given a sorted array, A, with possibly duplicated elements, find the indices of the first and last occurrences of a target element, x. Return -1 if the target is not found. Example: Input: A = [1,3,3,5,7,8,9,9,9,15], target = 9 Output: [6,8] Input: A = [100, 150, 150, 1...
# -*- coding: utf-8 -*- """ Created on Tue Mar 31 08:21:14 2020 @author: Shivadhar SIngh """ def sum_odd_digits(number): dsum = 0 # only count odd digits while number > 0: # add the last digit to the sum digit = number % 10 if digit % 2 != 0 : dsum = dsum + digit # ...
""" Created on Tue Mar 31 08:21:14 2020 @author: Shivadhar SIngh """ def sum_odd_digits(number): dsum = 0 while number > 0: digit = number % 10 if digit % 2 != 0: dsum = dsum + digit number = number // 10 return dsum def sum_even_digits(number): m = 1 dsum = 0 ...
def foo(a, b): return a * b foo(1, 2) ## OK foo(1) ## error: wrong number of arguments
def foo(a, b): return a * b foo(1, 2) foo(1)
# 7. Sa se scrie o functie care primeste ca parametri un numar x default egal cu 1, # un numar variabil de siruri de caractere # si un flag boolean setat default pe True. # Pentru fiecare sir de caractere, sa se genereze o lista care sa contina caracterele care au codul ASCII divizibil cu x # in caz ca flag-ul este...
def generate_by_condition(x=1, flag=True, *strings): generated_lists = [] for string in strings: if flag: generated_lists.append([c for c in string if ord(c) % x == 0]) else: generated_lists.append([c for c in string if ord(c) % x != 0]) return generated_lists print(g...
#!/usr/bin/python # ENVIRONMENT / WORLD DEFINITIONS class world(object): def __init__(self): return def get_outcome(self): print("Abstract method, not implemented") return def get_all_outcomes(self): outcomes = {} for state in xrange(self.n_states): fo...
class World(object): def __init__(self): return def get_outcome(self): print('Abstract method, not implemented') return def get_all_outcomes(self): outcomes = {} for state in xrange(self.n_states): for action in xrange(self.n_actions): (...
"""Status Messeges string formats.""" FLIGHT_RECORD_NOT_FOUND = "File: {filename} not found" # TODO: Add a link to upload new files once endpoint to upload files implemented. FLIGHT_RECORDS_EXISTING = """ Available flight records:\n{flight_records} """
"""Status Messeges string formats.""" flight_record_not_found = 'File: {filename} not found' flight_records_existing = '\nAvailable flight records:\n{flight_records}\n'
while True: print("1. Addition") print("2. Substraction") print("3. Multiplication") print("4. Division") print("5. Exit") choice = input("Your choice: ") print() if choice == "1": first_addend = float(input("First addend: ")) second_addend = float(input("Second adde...
while True: print('1. Addition') print('2. Substraction') print('3. Multiplication') print('4. Division') print('5. Exit') choice = input('Your choice: ') print() if choice == '1': first_addend = float(input('First addend: ')) second_addend = float(input('Second addend: '...
class A: def foo(self): print('in A foo') def hello(self): print('A hello') class B: def bar(self): print('in B bar') def hello(self): print('B hello') class C(B, A): pass # def hello(self): # print('C hello') if __name__ == '__main__': c = C() ...
class A: def foo(self): print('in A foo') def hello(self): print('A hello') class B: def bar(self): print('in B bar') def hello(self): print('B hello') class C(B, A): pass if __name__ == '__main__': c = c() c.foo() c.bar() c.hello()
print(1 == 2 and 1 == 1) # False print(1 == 1 and 2 == 2) # True print(5 > 2 and True) # True print(False and True) print(False and False) print(True and True)
print(1 == 2 and 1 == 1) print(1 == 1 and 2 == 2) print(5 > 2 and True) print(False and True) print(False and False) print(True and True)
class Param: """ Param class """ def __init__(self, id=None, name="", type=""): self.id = id self.name = name self.type = type @staticmethod def get_by_name(paramList, paramName): for param in paramList: if param.name == paramName: return param return None
class Param: """ Param class """ def __init__(self, id=None, name='', type=''): self.id = id self.name = name self.type = type @staticmethod def get_by_name(paramList, paramName): for param in paramList: if param.name == paramName: return par...
for _ in range(int(input())): n=int(input()) s=list(input()) ans="" for i in s: if i == "U": ans+="D" elif i=="D": ans+="U" else: ans+=i print(ans)
for _ in range(int(input())): n = int(input()) s = list(input()) ans = '' for i in s: if i == 'U': ans += 'D' elif i == 'D': ans += 'U' else: ans += i print(ans)
test_board_1 = [ [None, 6, None, None, 4, None, 7, None, None,], [None, 2, None, 1, None, None, None, None, None], [8, None, 5, 2, None, 6, None, 9, 4], [None, None, 1, None, 9, 3, None, None, 7], [4, 3, None, 5, None, 8, None, 2, 9], [5, None, None, 4, 7, Non...
test_board_1 = [[None, 6, None, None, 4, None, 7, None, None], [None, 2, None, 1, None, None, None, None, None], [8, None, 5, 2, None, 6, None, 9, 4], [None, None, 1, None, 9, 3, None, None, 7], [4, 3, None, 5, None, 8, None, 2, 9], [5, None, None, 4, 7, None, 8, None, None], [6, 5, None, 7, None, 4, 3, None, 8], [None...
a = 0 while(1): a = a+1 if(a%15 == 0): print("FIZZ BUZZ") elif(a%5 == 0): print("BUZZ") elif(a%3 == 0): print("FIZZ") else: print(a)
a = 0 while 1: a = a + 1 if a % 15 == 0: print('FIZZ BUZZ') elif a % 5 == 0: print('BUZZ') elif a % 3 == 0: print('FIZZ') else: print(a)
class Config: BOT_USE = False BOT_TOKEN = '5022399250:AAH4xUY7OgDGHyUlp5_J9DZMhNU8NXgeyh8' # from @botfather APP_ID = 18454593 # from https://my.telegram.org/apps API_HASH = 'b536EkRHLyviZMtSjodB4gByQJwyYxPmBE1x' # from https:...
class Config: bot_use = False bot_token = '5022399250:AAH4xUY7OgDGHyUlp5_J9DZMhNU8NXgeyh8' app_id = 18454593 api_hash = 'b536EkRHLyviZMtSjodB4gByQJwyYxPmBE1x' auth_users = [1337171491]
class Node(object): def __init__(self, value=None, pointer=None): self.value = value self.pointer = pointer class Stack(object): def __init__(self): self.head = None def isEmpty(self): return not bool(self.head) def push(self, item): self.head = Node(item, self.h...
class Node(object): def __init__(self, value=None, pointer=None): self.value = value self.pointer = pointer class Stack(object): def __init__(self): self.head = None def is_empty(self): return not bool(self.head) def push(self, item): self.head = node(item, s...
class Solution: def ladderLength(self, beginWord, endWord, wordList): wordList.append(beginWord) m, n = len(wordList[0]), len(wordList) words_inverse = {w:i for i, w in enumerate(wordList)} words_graph = defaultdict(set) alphabet = "abcdefghijklmnopqrstuvwxyz" ...
class Solution: def ladder_length(self, beginWord, endWord, wordList): wordList.append(beginWord) (m, n) = (len(wordList[0]), len(wordList)) words_inverse = {w: i for (i, w) in enumerate(wordList)} words_graph = defaultdict(set) alphabet = 'abcdefghijklmnopqrstuvwxyz' ...
""" @file @brief This module contains various string useful when a html page has to be produced. It contains the following variables: @var html_header a HTML header to use this way: html_header % (title, author, keywords) @var html_footr a HTML footer """ html_header = ...
""" @file @brief This module contains various string useful when a html page has to be produced. It contains the following variables: @var html_header a HTML header to use this way: html_header % (title, author, keywords) @var html_footr a HTML footer """ html_header = '...
DATA = { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "name": "Afghanistan" }, "geometry": { "type": "Polygon", "coordinates": [ [ [61.210817, 35.650072], ...
data = {'type': 'FeatureCollection', 'features': [{'type': 'Feature', 'properties': {'name': 'Afghanistan'}, 'geometry': {'type': 'Polygon', 'coordinates': [[[61.210817, 35.650072], [62.230651, 35.270664], [62.984662, 35.404041], [63.193538, 35.857166], [63.982896, 36.007957], [64.546479, 36.312073], [64.746105, 37.111...
m, n = map(int, input().split()) d = [1]+[0]*99 for i in range(n): d[i+1]+=d[i] d[i+m]=d[i] print (d[n])
(m, n) = map(int, input().split()) d = [1] + [0] * 99 for i in range(n): d[i + 1] += d[i] d[i + m] = d[i] print(d[n])
INVALID_AMOUNT = -2 INVALID_ACTION = -4 TRANSACTION_NOT_FOUND = -6 ORDER_NOT_FOUND = -5 PREPARE = '0' COMPLETE = '1' A_LACK_OF_MONEY = '-5017' A_LACK_OF_MONEY_CODE = -9 AUTHORIZATION_FAIL = 'AUTHORIZATION_FAIL' AUTHORIZATION_FAIL_CODE = -1 ORDER_FOUND = True
invalid_amount = -2 invalid_action = -4 transaction_not_found = -6 order_not_found = -5 prepare = '0' complete = '1' a_lack_of_money = '-5017' a_lack_of_money_code = -9 authorization_fail = 'AUTHORIZATION_FAIL' authorization_fail_code = -1 order_found = True
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Gender, obj[4]: Age, obj[5]: Education, obj[6]: Occupation, obj[7]: Bar, obj[8]: Coffeehouse, obj[9]: Restaurant20to50, obj[10]: Direction_same, obj[11]: Distance # {"feature": "Education", "instances": 127, "metric_value": 0.9989, "depth...
def find_decision(obj): if obj[5] <= 3: if obj[6] <= 12.937768545455379: if obj[2] > 1: if obj[0] > 0: if obj[4] > 1: if obj[3] <= 0: if obj[9] > -1.0: if obj[8] <= 3.0: ...
def to_list(arr): """Transform an numpy array into a list with homogeneous element type.""" return arr.astype(type(arr.ravel()[0])).tolist() def to_builtin(arr): """Transform an numpy array into a numpy array with homogeneous element type.""" return arr.astype(type(arr.ravel()[0]))
def to_list(arr): """Transform an numpy array into a list with homogeneous element type.""" return arr.astype(type(arr.ravel()[0])).tolist() def to_builtin(arr): """Transform an numpy array into a numpy array with homogeneous element type.""" return arr.astype(type(arr.ravel()[0]))
""" Replace the placeholders below with valid credentials from an active AerisWeather API account. Don't have an active AerisWeather API client account? Accessing the API data requires an active AerisWeather API subscription, and registration of your application or namespace. You can sign up for a free developer acco...
""" Replace the placeholders below with valid credentials from an active AerisWeather API account. Don't have an active AerisWeather API client account? Accessing the API data requires an active AerisWeather API subscription, and registration of your application or namespace. You can sign up for a free developer accou...
#!/usr/bin/python # -*- coding: utf-8 -*- # Function to rotate each letter with the specified key def BasicRotate(letter, key): # Checks if letter is lowercase if letter.islower(): # As long as letter is lowercase, key is added new = ord(letter) + key ...
def basic_rotate(letter, key): if letter.islower(): new = ord(letter) + key if new > ord('z'): new = new - 26 new = chr(new) else: new = letter if letter.isupper(): new = ord(letter) + key if new > ord('Z'): new = new - ...
class Employee: def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay self.email = f"{first}.{last}@compani.com" def fullname(self): return f"{self.first} {self.last}" emp1 = Employee("john", "smit", 5000) emp2 = Employee("Morramed...
class Employee: def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay self.email = f'{first}.{last}@compani.com' def fullname(self): return f'{self.first} {self.last}' emp1 = employee('john', 'smit', 5000) emp2 = employee('Morramed', '...
def wrap_data_as_list(data): # Check the type of data if isinstance(data, list): # Return the original list return data elif isinstance(data, tuple): # Convert the tuple to the list and return return list(data) elif isinstance(data, dict): # Wrap the data with lis...
def wrap_data_as_list(data): if isinstance(data, list): return data elif isinstance(data, tuple): return list(data) elif isinstance(data, dict): return [data] else: raise value_error('Data must be a list, tuple or dict') def convert_plotly_to_dict(plotly_obj): try: ...
def validate_square(n): if n < 1: raise ValueError('square must be 1 or greater') elif n > 64: raise ValueError('square must be 64 or less') def on_square(n): validate_square(n) return pow(2, n - 1) def total_after(n): validate_square(n) return sum([on_square(i)...
def validate_square(n): if n < 1: raise value_error('square must be 1 or greater') elif n > 64: raise value_error('square must be 64 or less') def on_square(n): validate_square(n) return pow(2, n - 1) def total_after(n): validate_square(n) return sum([on_square(i) for i in rang...
class SCREENSHOT: SC_DATA = b"" def __init__(self): self.generate() def generate(self): obj = io.BytesIO() im = pyscreenshot.grab() im.save(obj, format="PNG") self.SC_DATA = obj.getvalue() def get_data(self): return self.SC_DATA
class Screenshot: sc_data = b'' def __init__(self): self.generate() def generate(self): obj = io.BytesIO() im = pyscreenshot.grab() im.save(obj, format='PNG') self.SC_DATA = obj.getvalue() def get_data(self): return self.SC_DATA
""" 040 Ask for a number below 50 and then count down from 50 to that number, making sure you show the number they entered in the output. """ number = int(input("Enter a number please : ")) for i in range(number , 0,-1): print(i)
""" 040 Ask for a number below 50 and then count down from 50 to that number, making sure you show the number they entered in the output. """ number = int(input('Enter a number please : ')) for i in range(number, 0, -1): print(i)
# by Kami Bigdely # PEP8 - whitespaces and variable names. # This is a guess game. Guess what number the computer has chosen! class Pizza: def __init__ (obj, mybread_type, CHEESE_TYPE, meat_type, pizza_toppings, size): obj.bread_type= mybread_type obj.cheese_type = CHEESE_TYPE obj.meat_type=...
class Pizza: def __init__(obj, mybread_type, CHEESE_TYPE, meat_type, pizza_toppings, size): obj.bread_type = mybread_type obj.cheese_type = CHEESE_TYPE obj.meat_type = meat_type obj.toppings = pizza_toppings obj.size = size @classmethod def create_chicago_pizza(clas...
class SDADriver: def InitAI(self): return def UpdateAI(self,SDAData): return (0.4, 0.2, 0.5, 1)
class Sdadriver: def init_ai(self): return def update_ai(self, SDAData): return (0.4, 0.2, 0.5, 1)
# sorting using custom key employees = [ {'Name': 'Alan Turing', 'age': 25, 'salary': 10000}, {'Name': 'Sharon Lin', 'age': 30, 'salary': 8000}, {'Name': 'John Hopkins', 'age': 18, 'salary': 1000}, {'Name': 'Mikhail Tal', 'age': 40, 'salary': 15000}, ] # custom functions to get employee info def get_na...
employees = [{'Name': 'Alan Turing', 'age': 25, 'salary': 10000}, {'Name': 'Sharon Lin', 'age': 30, 'salary': 8000}, {'Name': 'John Hopkins', 'age': 18, 'salary': 1000}, {'Name': 'Mikhail Tal', 'age': 40, 'salary': 15000}] def get_name(employee): return employee.get('Name') def get_age(employee): return emplo...
string = "Test String" key = "4381" k_o = key[0] + key[1] k_e = key[2] + key[3] final_op = "" for i in range(0 , len(string)): if(i % 2 == 0): op = ord(string[i]) print(op) xor = hex((int(op)) ^ (int(k_o)) ) final_op.join(str(op)) else: op = ord(string[i]) ...
string = 'Test String' key = '4381' k_o = key[0] + key[1] k_e = key[2] + key[3] final_op = '' for i in range(0, len(string)): if i % 2 == 0: op = ord(string[i]) print(op) xor = hex(int(op) ^ int(k_o)) final_op.join(str(op)) else: op = ord(string[i]) xor = hex(int(...
# -*- coding: utf-8 -*- ''' @author: Gabriele Girelli @contact: gigi.ga90@gmail.com @description: methods for basic nucleic acid sequence management. ''' # CONSTANTS ==================================================================== AB_DNA = ["ACGTRYKMSWBDHVN", "TGCAYRMKSWVHDBN"] AB_RNA = ["ACGURYKMSWBDHVN", "UGCA...
""" @author: Gabriele Girelli @contact: gigi.ga90@gmail.com @description: methods for basic nucleic acid sequence management. """ ab_dna = ['ACGTRYKMSWBDHVN', 'TGCAYRMKSWVHDBN'] ab_rna = ['ACGURYKMSWBDHVN', 'UGCAYRMKSWVHDBN'] def rc(na, t): """ Args: na (string): nucleic acid sequence. t (strin...
class Cell: # default constructor def __init__(self, value): self._clicked = False self._value = value def get_value(self): return self._value def get_clicked(self): return self._clicked def set_clicked(self, clicked): self._clicked = clicked
class Cell: def __init__(self, value): self._clicked = False self._value = value def get_value(self): return self._value def get_clicked(self): return self._clicked def set_clicked(self, clicked): self._clicked = clicked
"""A tiny English to Spanish dictionary is created, using the Python dictionary type dict. Then the dictionary is used. """ def createDictionary(): '''Returns a tiny Spanish dictionary''' spanish = dict() spanish['hello'] = 'hola' spanish['yes'] = 'si' spanish['one'] = 'uno' spanish['two'] = 'd...
"""A tiny English to Spanish dictionary is created, using the Python dictionary type dict. Then the dictionary is used. """ def create_dictionary(): """Returns a tiny Spanish dictionary""" spanish = dict() spanish['hello'] = 'hola' spanish['yes'] = 'si' spanish['one'] = 'uno' spanish['two'] = '...
# Finding the smallest number smallest = None print('Before') for value in [9, 24, 12, 57, 6, 32, 2] : if smallest is None : smallest = value elif value < smallest : smallest = value print(smallest, value) print('After', smallest)
smallest = None print('Before') for value in [9, 24, 12, 57, 6, 32, 2]: if smallest is None: smallest = value elif value < smallest: smallest = value print(smallest, value) print('After', smallest)
aliens=[] #make 30 green aliens for y in range(30): new_alien={'color':'green','points':5,'speed':'slow'} aliens.append(new_alien) #show the first 5 aliens for yy in aliens[:5]: print(yy) print('...') for zzz in aliens[3:9]: for y in aliens[6:9]: if y['color']=='green': y['color']='yellow' y['s...
aliens = [] for y in range(30): new_alien = {'color': 'green', 'points': 5, 'speed': 'slow'} aliens.append(new_alien) for yy in aliens[:5]: print(yy) print('...') for zzz in aliens[3:9]: for y in aliens[6:9]: if y['color'] == 'green': y['color'] = 'yellow' y['speed'] = 'm...
#Result class constants with ANSI colors ALERT = '\033[91mAlert!\033[0m' WARNING = '\033[93mWarning\033[0m' NOTHING = '\033[92mCheck passed\033[0m' BIG_FILE = 'Big file found' NOT_PLAIN_TEXT = 'File is not plain text' MATCH = 'Match' NOT_MATCH = 'Nothing found' FILETYPE_NOT_ALLOWED = 'Extension not allowed'
alert = '\x1b[91mAlert!\x1b[0m' warning = '\x1b[93mWarning\x1b[0m' nothing = '\x1b[92mCheck passed\x1b[0m' big_file = 'Big file found' not_plain_text = 'File is not plain text' match = 'Match' not_match = 'Nothing found' filetype_not_allowed = 'Extension not allowed'
while 1: number = input("Type a negabinary number here: ") try: number = int(number) break except ValueError: pass total = 0 loop = 0 for char in str(number)[::-1]: if char == "1": total += (-2) ** loop elif char == "0": pass else: print("You enterned an invalid number") quit() loop += 1 print(t...
while 1: number = input('Type a negabinary number here: ') try: number = int(number) break except ValueError: pass total = 0 loop = 0 for char in str(number)[::-1]: if char == '1': total += (-2) ** loop elif char == '0': pass else: print('You enter...
class Solution: def getRow(self, rowIndex: int) -> List[int]: triangle=[] for i in range(rowIndex+1): row=[None for _ in range(i+1)] row[0],row[-1]=1,1 for j in range(1,len(row)-1): row[j]=triangle[i-1][j]+triangle[i-1][j-1] ...
class Solution: def get_row(self, rowIndex: int) -> List[int]: triangle = [] for i in range(rowIndex + 1): row = [None for _ in range(i + 1)] (row[0], row[-1]) = (1, 1) for j in range(1, len(row) - 1): row[j] = triangle[i - 1][j] + triangle[i - 1]...
# Change our pairplot to # * plot more samples # * reduce the number of variables to the first three (leave out the group) # * make the plot a bit larger # Optional # * fit linear regression models to the scatter plots # * give each group a different type of marker, use https://matplotlib.org/api/markers_api.html as a...
sample_df = df.sample(n=300, random_state=42) sns.set(font_scale=2) sns.pairplot(sample_df, hue='group', palette={0: '#AA4444', 1: '#006000', 2: '#EEEE44'}, vars=['speed', 'age', 'miles'], height=5, markers=['o', 's', 'D'])
class CreateBeam(): def __init__(self,concrete,x,y,z): self.concrete = concrete.concrete_type self.concrete_price = concrete.concrete_price self.x = int(x) self.y = int(y) self.y = int(y) self.volume = x * y * z self.price = self.volume * self.concre...
class Createbeam: def __init__(self, concrete, x, y, z): self.concrete = concrete.concrete_type self.concrete_price = concrete.concrete_price self.x = int(x) self.y = int(y) self.y = int(y) self.volume = x * y * z self.price = self.volume * self.concrete_pric...
""" sentry_kavenegar ~~~~~~~~~~~~~ :copyright: (c) 2012 by Amir Asaran. :license: BSD, see LICENSE for more details. """ try: VERSION = __import__('pkg_resources') \ .get_distribution('sentry-kavenegar').version except Exception as e: VERSION = 'unknown'
""" sentry_kavenegar ~~~~~~~~~~~~~ :copyright: (c) 2012 by Amir Asaran. :license: BSD, see LICENSE for more details. """ try: version = __import__('pkg_resources').get_distribution('sentry-kavenegar').version except Exception as e: version = 'unknown'
class MyshowsAPIError(Exception): """Root exception for all errors related to this library""" class APIError(MyshowsAPIError): """An error occurred while performing a request to API""" class ResponseParseError(MyshowsAPIError): """An error occurred while parse a response from API""" class AuthError(My...
class Myshowsapierror(Exception): """Root exception for all errors related to this library""" class Apierror(MyshowsAPIError): """An error occurred while performing a request to API""" class Responseparseerror(MyshowsAPIError): """An error occurred while parse a response from API""" class Autherror(Mysho...
N = int(input()) if N%2 == 0: print(1 / 2) else: print((N//2+1) / N)
n = int(input()) if N % 2 == 0: print(1 / 2) else: print((N // 2 + 1) / N)
N_ELEMNT = 10000 CBOW_N_WORDS = 3 SKIPGRAM_N_WORDS = 3 # context = 3 words before, 3 words after the target word MIN_WORD_FREQUENCY = 30 MAX_SEQ_LENGTH = 256 # define it to 0 for no truncature EMBEDDING_DIM = 256 VOCAB_SIZE = 4096 BATCH_SIZE = 64 LANGUAGE = 'french' BUFFER_SIZE = 8192
n_elemnt = 10000 cbow_n_words = 3 skipgram_n_words = 3 min_word_frequency = 30 max_seq_length = 256 embedding_dim = 256 vocab_size = 4096 batch_size = 64 language = 'french' buffer_size = 8192
# Setting to True clearly shows the neat Fibonacci pattern of: # Odd, Odd, Even, O, O, E, O, O, E.... DEBUG = False total = 0 curr = 1 prev = 1 while curr < 4000000: if curr % 2 == 0: if DEBUG: print('adding {}'.format(curr)) total += curr else: if DEBUG: print...
debug = False total = 0 curr = 1 prev = 1 while curr < 4000000: if curr % 2 == 0: if DEBUG: print('adding {}'.format(curr)) total += curr elif DEBUG: print('skipping {}'.format(curr)) curr = prev + curr prev = curr - prev print(total)
class Node: def __init__(self,value=None): self.value = value self.next = None def __str__(self): return str(self.value) class LinkedList: def __init__(self): self.head = None self.tail = None def __iter__(self): node = self.head while n...
class Node: def __init__(self, value=None): self.value = value self.next = None def __str__(self): return str(self.value) class Linkedlist: def __init__(self): self.head = None self.tail = None def __iter__(self): node = self.head while node: ...
a = input().split(" ") l,b = int(a[0]), int(a[1]) y = 0 while( l<=b ) : l=l*3 b=b*2 y+=1 print(y)
a = input().split(' ') (l, b) = (int(a[0]), int(a[1])) y = 0 while l <= b: l = l * 3 b = b * 2 y += 1 print(y)
class Folder: def __init__(self, **kwargs): self.folder = { 'rescanIntervalS' : 60, 'copiers' : 0, 'pullerPauseS' : 0, 'autoNormalize' : True, 'id' : kwargs['id'] , 'scanProgressIntervalS' : 0, 'hashers' : 0, 'pullers' : 0, 'invalid' : '', 'label' : kw...
class Folder: def __init__(self, **kwargs): self.folder = {'rescanIntervalS': 60, 'copiers': 0, 'pullerPauseS': 0, 'autoNormalize': True, 'id': kwargs['id'], 'scanProgressIntervalS': 0, 'hashers': 0, 'pullers': 0, 'invalid': '', 'label': kwargs['label'], 'minDiskFreePct': 1, 'pullerSleepS': 0, 'type': 'rea...
class User: ''' class to creates instances of class User. ''' user_list = [] def save_user(self): ''' save user method that appends objects to our user_list list. ''' User.user_list.append(self) def delete_user(self): ''' method to d...
class User: """ class to creates instances of class User. """ user_list = [] def save_user(self): """ save user method that appends objects to our user_list list. """ User.user_list.append(self) def delete_user(self): """ method to delete user fr...
x=range(1,10,2) print (x) for item in x: print(item,end=",")
x = range(1, 10, 2) print(x) for item in x: print(item, end=',')
""" Module containing exceptions raised in various scenarios during execution of both client and server programs. """ class VariableNotSettableError(Exception): """ Raised when the configuration variable, which is not marked as settable is being set. """ def __init__(self, *args): super(Va...
""" Module containing exceptions raised in various scenarios during execution of both client and server programs. """ class Variablenotsettableerror(Exception): """ Raised when the configuration variable, which is not marked as settable is being set. """ def __init__(self, *args): super(Va...
"""Response decoder: The Strategic Environmental Archaeology Database.""" def occurrences(resp_json, return_obj, options): """Taxa in time and space.""" # from ..elc import ages # Currently SEAD does not support age parameterization # The database also does not include age in the occurrence response...
"""Response decoder: The Strategic Environmental Archaeology Database.""" def occurrences(resp_json, return_obj, options): """Taxa in time and space.""" for rec in resp_json: data = dict() data.update(occ_id='sead:occ:{0:d}'.format(rec.get('occ_id'))) data.update(taxon_id='sead:txn:{0:d...
def fizzbuzz(n): """ This function prints integer 1 to N(N included), but print 'Fizz' if an integer is divisible by 3, 'Buzz' if an integer is divisible by 5 and 'FizzBuzz' if an integer is divisible by both 3 and 5 """ for no in range(1,n+1): if no % 3 == 0 and no % 5 == 0: ...
def fizzbuzz(n): """ This function prints integer 1 to N(N included), but print 'Fizz' if an integer is divisible by 3, 'Buzz' if an integer is divisible by 5 and 'FizzBuzz' if an integer is divisible by both 3 and 5 """ for no in range(1, n + 1): if no % 3 == 0 and no % 5 == 0: ...
# coding: utf-8 ROUTING_VIEWS = [ ("/", "app.IndexController", "foo"), ("/hoge/<id>", "hoge.HogeController", "hoge"), ("/fuga", "template.TemplateController", "fuga") ]
routing_views = [('/', 'app.IndexController', 'foo'), ('/hoge/<id>', 'hoge.HogeController', 'hoge'), ('/fuga', 'template.TemplateController', 'fuga')]
class Solution: def allCellsDistOrder(self, R, C, r0, c0): cells = [[x, y] for x in range(R) for y in range(C)] cells = sorted(cells, key=lambda c: abs(c[0] - r0) + abs(c[1] - c0)) return cells
class Solution: def all_cells_dist_order(self, R, C, r0, c0): cells = [[x, y] for x in range(R) for y in range(C)] cells = sorted(cells, key=lambda c: abs(c[0] - r0) + abs(c[1] - c0)) return cells
# Equation checker def is_balanced(equation): parenthesis = ''.join([p for p in equation if p in '(){}[]']) return is_valid(parenthesis) def is_valid(parenthesis): stack = [] for p in parenthesis: if p in '(': stack.append(p) elif p in ')': if stack == []: ...
def is_balanced(equation): parenthesis = ''.join([p for p in equation if p in '(){}[]']) return is_valid(parenthesis) def is_valid(parenthesis): stack = [] for p in parenthesis: if p in '(': stack.append(p) elif p in ')': if stack == []: return Fa...
class crafting: def __init__(self,inv,items): self.inv = inv self.items = items def getCrafts(self): itemsChecked = [] itemAmounts = [] for i in range(len(self.inv.inventory)): if self.inv.inventory[i][0] != None: item = self.inv.inventory[i] ...
class Crafting: def __init__(self, inv, items): self.inv = inv self.items = items def get_crafts(self): items_checked = [] item_amounts = [] for i in range(len(self.inv.inventory)): if self.inv.inventory[i][0] != None: item = self.inv.invento...
class Foo(object): pass @decorator class Bar(object): def foo(self): pass def baz(arg1, arg2): pass foo() | bar()
class Foo(object): pass @decorator class Bar(object): def foo(self): pass def baz(arg1, arg2): pass foo() | bar()
{ 'targets': [ { 'target_name': 'xwalk_test_base', 'type': 'static_library', 'dependencies': [ # FIXME(tmpsantos): we should depend on runtime # here but it is not really a module yet. '../../../base/base.gyp:base', '../../../base/base.gyp:test_support_base', ...
{'targets': [{'target_name': 'xwalk_test_base', 'type': 'static_library', 'dependencies': ['../../../base/base.gyp:base', '../../../base/base.gyp:test_support_base', '../../../content/content.gyp:content_browser', '../../../content/content_shell_and_tests.gyp:test_support_content../../../net/net.gyp:net', '../../../ski...
for i in range(5): print("I will not chew gum in class.") repetitions = int(input("How many times should i repeat?")) for i in range(repetitions): print("I will not chew gum in class") def print_about_gum(repetitions): for i in range(repetitions): print("I will not chew gum in class.") def main...
for i in range(5): print('I will not chew gum in class.') repetitions = int(input('How many times should i repeat?')) for i in range(repetitions): print('I will not chew gum in class') def print_about_gum(repetitions): for i in range(repetitions): print('I will not chew gum in class.') def main():...
def get_current_channel_planning(mist_session, site_id): uri = "/api/v1/sites/%s/rrm/current" % site_id resp = mist_session.mist_get(uri, site_id=site_id) return resp def get_device_rrm_info(mist_session, site_id, device_id, band): uri = "/api/v1/sites/%s/rrm/current/devices/%s/band/%s" % (site_id, d...
def get_current_channel_planning(mist_session, site_id): uri = '/api/v1/sites/%s/rrm/current' % site_id resp = mist_session.mist_get(uri, site_id=site_id) return resp def get_device_rrm_info(mist_session, site_id, device_id, band): uri = '/api/v1/sites/%s/rrm/current/devices/%s/band/%s' % (site_id, dev...
class MovingAverage: def __init__(self, size): """ Initialize your data structure here. :type size: int """ self.__size = size self.__sum = 0 self.__q = deque([]) def next(self, val): """ :type val: int :rtype: float """ ...
class Movingaverage: def __init__(self, size): """ Initialize your data structure here. :type size: int """ self.__size = size self.__sum = 0 self.__q = deque([]) def next(self, val): """ :type val: int :rtype: float """ ...
class Solution: def canVisitAllRooms(self, rooms: List[List[int]]) -> bool: seen = [False] * len(rooms) seen[0] = True stack = [0] #At the beginning, we have a todo list "stack" of keys to use. #'seen' represents at some point we have entered this room. while stack: ...
class Solution: def can_visit_all_rooms(self, rooms: List[List[int]]) -> bool: seen = [False] * len(rooms) seen[0] = True stack = [0] while stack: node = stack.pop() for nei in rooms[node]: if not seen[nei]: seen[nei] = Tru...
# https://open.kattis.com/problems/greetingcard n = int(input()) points = {tuple(map(int, input().split())) for _ in range(n)} neighbor_distances = {(0, 2018), (1118, 1680), (1680, 1118), (2018, 0), (1118, -1680), ...
n = int(input()) points = {tuple(map(int, input().split())) for _ in range(n)} neighbor_distances = {(0, 2018), (1118, 1680), (1680, 1118), (2018, 0), (1118, -1680), (1680, -1118), (0, -2018), (-1118, -1680), (-1680, -1118), (-2018, 0), (-1118, 1680), (-1680, 1118)} pairs = 0 for point in points: for nd in neighbor...
def make_car(manufacturer_name,model_name,**props): car = { 'manufacturer': manufacturer_name, 'model': model_name, } for prop,value in props.items(): car[prop] = value print(car) car = make_car('subaru', 'outback', color='blue', tow_package=True)
def make_car(manufacturer_name, model_name, **props): car = {'manufacturer': manufacturer_name, 'model': model_name} for (prop, value) in props.items(): car[prop] = value print(car) car = make_car('subaru', 'outback', color='blue', tow_package=True)
# import pretty_midi # from omnizart.music import app as music_app # from omnizart.drum import app as drum_app # from omnizart.chord import app as chord_app def process(input_audio, model_path=None, output="./"): pass
def process(input_audio, model_path=None, output='./'): pass
n = int(input()) p = list(map(int, input().split())) cnt = 0 for i in range(1, n-1): if (p[i-1] <= p[i] <= p[i+1]) or (p[i+1] <= p[i] <= p[i-1]): cnt += 1 print(cnt)
n = int(input()) p = list(map(int, input().split())) cnt = 0 for i in range(1, n - 1): if p[i - 1] <= p[i] <= p[i + 1] or p[i + 1] <= p[i] <= p[i - 1]: cnt += 1 print(cnt)
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isSubStructure(self, A: TreeNode, B: TreeNode) -> bool: if B is None: return False if A is None: return False result = Fals...
class Solution: def is_sub_structure(self, A: TreeNode, B: TreeNode) -> bool: if B is None: return False if A is None: return False result = False if A.val == B.val: result = self.hasSubTree(A, B) if result == False: result = s...
class fun1: # test testVal = 1 def __init__(self, a): print("class init") self.a = a def __call__(self, x): return x + self.a def __str__(self) -> str: return "Sina changed this function as" def id(self): return 'a=%a' % self.a @classmethod ...
class Fun1: test_val = 1 def __init__(self, a): print('class init') self.a = a def __call__(self, x): return x + self.a def __str__(self) -> str: return 'Sina changed this function as' def id(self): return 'a=%a' % self.a @classmethod def update_v...
#pj24 foo = '0123456789' def thingamy(foo): foo.sort()
foo = '0123456789' def thingamy(foo): foo.sort()
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def binaryTreePaths(self, root: TreeNode) -> List[str]: if not root: return [] ans = [] self.dfs(root...
class Solution: def binary_tree_paths(self, root: TreeNode) -> List[str]: if not root: return [] ans = [] self.dfs(root, ans, '' + str(root.val)) return ans def dfs(self, root, ans, path): if root.left == None and root.right == None: ans.append(p...
SURFACE_HARD = 1 SURFACE_CLAY = 2 ADAM_EL_MIHDAWY = 'Adam El Mihdawy' ADAM_MOUNDIR = 'Adam Moundir' ADAM_PAVLASEK = 'Adam Pavlasek' ADHAM_GABER = 'Adham Gabr' ADMIR_KALENDER = 'Admir Kalender' ANDRES_MOLTENI = 'Andres Molteni' ADRIAN_ANDREEV = 'Adrian Andreev' ADRIAN_BODMER = 'Adrian Bodmer' ADRIAN_MANNARINO = 'Adrian...
surface_hard = 1 surface_clay = 2 adam_el_mihdawy = 'Adam El Mihdawy' adam_moundir = 'Adam Moundir' adam_pavlasek = 'Adam Pavlasek' adham_gaber = 'Adham Gabr' admir_kalender = 'Admir Kalender' andres_molteni = 'Andres Molteni' adrian_andreev = 'Adrian Andreev' adrian_bodmer = 'Adrian Bodmer' adrian_mannarino = 'Adrian ...
net_type = 'resnet' #type=str, workers = 4 # type=int, help='number of data loading workers (default: 4)' epochs = 2 # type=int, metavar='N', help='number of total epochs to run' batch_size = 128 #type=int, help='mini-batch size (default: 256)' lr = 0.1 #help='initial learning rate') momentum = 0.9 # help='momentum') w...
net_type = 'resnet' workers = 4 epochs = 2 batch_size = 128 lr = 0.1 momentum = 0.9 weight_decay = 0.0001 print_freq = 1 depth = 32 dataset = '../../Datasets/Kvasir - Aziz' verbose = False alpha = 300 expname = 'TEST' beta = 0 cutmix_prob = 0 iterations = 2
class ApiException(Exception): pass class DBConnectionIssue(ApiException): def __str__(self): return "Database Error: %s" % self.message class DBError(ApiException): def __init__(self, *args): # args can have 1 or 2 parameters try: self.errno = args[0] self....
class Apiexception(Exception): pass class Dbconnectionissue(ApiException): def __str__(self): return 'Database Error: %s' % self.message class Dberror(ApiException): def __init__(self, *args): try: self.errno = args[0] self.message = args[1] except IndexEr...
""" On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions: "G": go straight 1 unit; "L": turn 90 degrees to the left; "R": turn 90 degrees to the right. The robot performs the instructions given in order, and repeats them forever. Return true if and...
""" On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions: "G": go straight 1 unit; "L": turn 90 degrees to the left; "R": turn 90 degrees to the right. The robot performs the instructions given in order, and repeats them forever. Return true if and ...
class Tweet: def __init__(self, uuid, name, screen_name, tweet_id, tweet, date_time, retweet_count, favourites_count, link): self.uuid = uuid self.name = name self.screen_name = screen_name self.tweet_id = tweet_id self.tweet = tweet self.date_time = date_time ...
class Tweet: def __init__(self, uuid, name, screen_name, tweet_id, tweet, date_time, retweet_count, favourites_count, link): self.uuid = uuid self.name = name self.screen_name = screen_name self.tweet_id = tweet_id self.tweet = tweet self.date_time = date_time ...
""" Basic hash func """ def my_hashing_func(str, table_size): bytes_representation = str.encode() sum = 0 for byte in bytes_representation: sum += byte return sum % table_size class HashTable: #basic hash template code def __init__(self, capacity): self.capacity = capacity ...
""" Basic hash func """ def my_hashing_func(str, table_size): bytes_representation = str.encode() sum = 0 for byte in bytes_representation: sum += byte return sum % table_size class Hashtable: def __init__(self, capacity): self.capacity = capacity self.storage = [None] * c...
def part1(): x, y = 0, 0 for line in open("in.txt").read().splitlines(): direction, num = line.split() num = int(num) if direction == "forward": x += num elif direction == "down": y += num elif direction == "up": y -= num print(x * ...
def part1(): (x, y) = (0, 0) for line in open('in.txt').read().splitlines(): (direction, num) = line.split() num = int(num) if direction == 'forward': x += num elif direction == 'down': y += num elif direction == 'up': y -= num prin...
""" Write a program that iterates over a large set (from 1 to 10000) of numbers and compute a total running sum. NOTE: 1 + 2 + 3 + ... + N - 1 + N = N(N+1)/2 """ def validate_sum(final_num): total = final_num * (final_num + 1) // 2 return total # def python_summation(a_list): # return sum(a_list) ...
""" Write a program that iterates over a large set (from 1 to 10000) of numbers and compute a total running sum. NOTE: 1 + 2 + 3 + ... + N - 1 + N = N(N+1)/2 """ def validate_sum(final_num): total = final_num * (final_num + 1) // 2 return total def main(): total = 0 for i in range(10000 + 1): ...
arr = [] for arr_i in range(6): arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')] arr.append(arr_t) smax = -9 * 7 for row in range(len(arr) - 2): for column in range(len(arr[row]) - 2): tl = arr[row][column] tc = arr[row][column + 1] tr = arr[row][column + 2] mc = arr[row + 1][column + 1] ...
arr = [] for arr_i in range(6): arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')] arr.append(arr_t) smax = -9 * 7 for row in range(len(arr) - 2): for column in range(len(arr[row]) - 2): tl = arr[row][column] tc = arr[row][column + 1] tr = arr[row][column + 2] ...
class LSystem(object): def __init__(self): self.steps = 0 self.axiom = "F" self.rule = "F+F-F" self.startLength = 190.0 self.theta = radians(120.0) self.reset() def reset(self): self.production = self.axiom self.drawLength = self.startLength ...
class Lsystem(object): def __init__(self): self.steps = 0 self.axiom = 'F' self.rule = 'F+F-F' self.startLength = 190.0 self.theta = radians(120.0) self.reset() def reset(self): self.production = self.axiom self.drawLength = self.startLength ...
threshold = 0 today = "2020-06-01" github_tokens = [] clone_all = True delete_after = False FEATURES = ['architecture', 'management' 'community', 'continuous_integration', 'documentation', 'history', 'license', 'unit_test']
threshold = 0 today = '2020-06-01' github_tokens = [] clone_all = True delete_after = False features = ['architecture', 'managementcommunity', 'continuous_integration', 'documentation', 'history', 'license', 'unit_test']
class Write_file: """ This class holds: write_file() method """ def write_file(self,input,cwd): """ This method is responsible for writing] given contents into a given file name if no file name is given it creates a file with that name if no contents...
class Write_File: """ This class holds: write_file() method """ def write_file(self, input, cwd): """ This method is responsible for writing] given contents into a given file name if no file name is given it creates a file with that name if no contents were g...
frase = 'Curso em Video Python' print(frase[3:13]) print(frase[1:15]) print(frase[2:18:2]) print(frase[::3]) print(frase.replace('Python','Android')) print(frase.split()) print(len(frase)) print(frase.count('o')) print(frase.upper().split()) print(frase.lower().find('em'))
frase = 'Curso em Video Python' print(frase[3:13]) print(frase[1:15]) print(frase[2:18:2]) print(frase[::3]) print(frase.replace('Python', 'Android')) print(frase.split()) print(len(frase)) print(frase.count('o')) print(frase.upper().split()) print(frase.lower().find('em'))
str_original = 'Hello' bytes_encoded = str_original.encode(encoding='utf-8') print(type(bytes_encoded)) str_decoded = bytes_encoded.decode() print(type(str_decoded)) print('Encoded bytes =', bytes_encoded) print('Decoded String =', str_decoded) print('str_original equals str_decoded =', str_original == str_decoded) ...
str_original = 'Hello' bytes_encoded = str_original.encode(encoding='utf-8') print(type(bytes_encoded)) str_decoded = bytes_encoded.decode() print(type(str_decoded)) print('Encoded bytes =', bytes_encoded) print('Decoded String =', str_decoded) print('str_original equals str_decoded =', str_original == str_decoded) str...
def mst_prim(G, w, r): for u in G.V: u.key = float('inf') u.p = None r.key = 0 Q = G.V while len(Q) != 0: u = extract_min(Q) for i in range(n): if G.matrix[u][i] == 1 and i in Q and w(u, i) < v.key: i.p = u i.key = w(u, i)
def mst_prim(G, w, r): for u in G.V: u.key = float('inf') u.p = None r.key = 0 q = G.V while len(Q) != 0: u = extract_min(Q) for i in range(n): if G.matrix[u][i] == 1 and i in Q and (w(u, i) < v.key): i.p = u i.key = w(u, i)
lr = 0.0001 dropout_rate = 0.5 max_epoch = 3136 #3317 batch_size = 4096 w = 19 u = 9 num_hidden_1 = 512 num_hidden_2 = 512
lr = 0.0001 dropout_rate = 0.5 max_epoch = 3136 batch_size = 4096 w = 19 u = 9 num_hidden_1 = 512 num_hidden_2 = 512
# # PySNMP MIB module TPLINK-TC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-TC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:16:42 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, single_value_constraint, value_range_constraint) ...
# Time: O((m + n)^2) # Space: O((m + n)^2) class Solution(object): def longestPalindrome(self, word1, word2): """ :type word1: str :type word2: str :rtype: int """ s = word1+word2 dp = [[0]*len(s) for _ in xrange(len(s))] result = 0 for j in ...
class Solution(object): def longest_palindrome(self, word1, word2): """ :type word1: str :type word2: str :rtype: int """ s = word1 + word2 dp = [[0] * len(s) for _ in xrange(len(s))] result = 0 for j in xrange(len(s)): dp[j][j] = ...
# Author : Guru prasad Raju ''' This program will print index of each characters in the string''' def givenString(new_string): for i in range(len(new_string)): print("index[", i, "]", new_string[i]) givenString("Life")
""" This program will print index of each characters in the string""" def given_string(new_string): for i in range(len(new_string)): print('index[', i, ']', new_string[i]) given_string('Life')
[ ## this file was manually modified by jt { 'functor' : { 'description' :['This function is mainly for inner usage and allows', 'speedy writing of \c next, \c nextafter and like functions','\par', 'It transforms a floating point value in a pattern of ...
[{'functor': {'description': ['This function is mainly for inner usage and allows', 'speedy writing of \\c next, \\c nextafter and like functions', '\\par', 'It transforms a floating point value in a pattern of bits', 'stored in an integer with different formulas according to', 'the floating point sign (it is the conve...
# -*- coding: utf-8 -*- class BaseError(Exception): """ There was an exception that occurred while handling BaseImage""" def __init__(self, message="", *args, **kwargs): self.message = message def __repr__(self): return repr(self.message) class NoImageDataError(BaseError): """ No Im...
class Baseerror(Exception): """ There was an exception that occurred while handling BaseImage""" def __init__(self, message='', *args, **kwargs): self.message = message def __repr__(self): return repr(self.message) class Noimagedataerror(BaseError): """ No Image Data in variable""" c...
def make_instance(cls): def get_value(name): if name in attributes: return attributes[name] else: value = cls['get'](name) return bind_method(value, instance) def set_value(name, value): attributes[name] = value attributes = {} instance = {'g...
def make_instance(cls): def get_value(name): if name in attributes: return attributes[name] else: value = cls['get'](name) return bind_method(value, instance) def set_value(name, value): attributes[name] = value attributes = {} instance = {'g...
# -*- coding: utf-8 -*- def mean(x): return sum(x) / len(x)
def mean(x): return sum(x) / len(x)