content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/bin/env python3 def gift_area(l, w, h): side_a = l*w side_b = w*h side_c = l*h return 2*side_a+2*side_b+2*side_c+min((side_a, side_b, side_c)) def gift_ribbon(l, w, h): side_a = 2*l+2*w side_b = 2*w+2*h side_c = 2*l+2*h ribbon = min((side_a, side_b, side_c)) ribbon += l*w*h r...
def gift_area(l, w, h): side_a = l * w side_b = w * h side_c = l * h return 2 * side_a + 2 * side_b + 2 * side_c + min((side_a, side_b, side_c)) def gift_ribbon(l, w, h): side_a = 2 * l + 2 * w side_b = 2 * w + 2 * h side_c = 2 * l + 2 * h ribbon = min((side_a, side_b, side_c)) ribb...
class C: pass def method(x): pass c = C() method(1)
class C: pass def method(x): pass c = c() method(1)
tb = [54, 0,55,54,61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0,64,66,61, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 54, 0,55,54,61, 0,66, 0,64] expander = lambda i: [i, 300] if i > 0 else [0,0] tkm = [expander(i) for i in tb] print(tkm)
tb = [54, 0, 55, 54, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 64, 66, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 55, 54, 61, 0, 66, 0, 64] expander = lambda i: [i, 300] if i > 0 else [0, 0] tkm = [expander(i) for i in tb] print(tkm)
if __name__ == '__main__': with open("../R/problem_module.R") as filename: lines = filename.readlines() for line in lines: if "<- function(" in line: function_name = line.split("<-")[0] print(f"### {function_name.strip()}\n") print("#### Ma...
if __name__ == '__main__': with open('../R/problem_module.R') as filename: lines = filename.readlines() for line in lines: if '<- function(' in line: function_name = line.split('<-')[0] print(f'### {function_name.strip()}\n') print('#### Ma...
for t in range(int(input())): word=input() ispalin=True for i in range(int(len(word)/2)): if word[i]=="*" or word[len(word)-1-i]=="*": break elif word[i]!=word[len(word)-1-i]: ispalin=False print(f"#{t+1} Not exist") break else: ...
for t in range(int(input())): word = input() ispalin = True for i in range(int(len(word) / 2)): if word[i] == '*' or word[len(word) - 1 - i] == '*': break elif word[i] != word[len(word) - 1 - i]: ispalin = False print(f'#{t + 1} Not exist') bre...
''' Program implemented to count number of 1's in its binary number ''' def countSetBits(n): if n == 0: return 0 else: return (n&1) + countSetBits(n>>1) n = int(input()) print(countSetBits(n))
""" Program implemented to count number of 1's in its binary number """ def count_set_bits(n): if n == 0: return 0 else: return (n & 1) + count_set_bits(n >> 1) n = int(input()) print(count_set_bits(n))
#in=42 #golden=8 n = input_int() c = 0 while (n > 1): c = c + 1 if n % 2 == 0: n = n // 2 else: n = 3 * n + 1 print(c)
n = input_int() c = 0 while n > 1: c = c + 1 if n % 2 == 0: n = n // 2 else: n = 3 * n + 1 print(c)
def outer(): a = 0 b = 1 def inner(): print(a) b=4 print(b) # b += 1 # A #b = 4 # B inner() outer() for i in range(10): print(i) print(i)
def outer(): a = 0 b = 1 def inner(): print(a) b = 4 print(b) inner() outer() for i in range(10): print(i) print(i)
class MyClass: count = 0 def __init__(self, val): self.val = self.filterint(val) MyClass.count += 1 @staticmethod def filterint(value): if not isinstance(value, int): print("Entered value is not an INT, value set to 0") return 0 else: ...
class Myclass: count = 0 def __init__(self, val): self.val = self.filterint(val) MyClass.count += 1 @staticmethod def filterint(value): if not isinstance(value, int): print('Entered value is not an INT, value set to 0') return 0 else: ...
# # PySNMP MIB module RETIX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RETIX-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:47:44 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, 09:23...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) ...
class StudentAssignmentService: def __init__(self, student, AssignmentClass): self.assignment = AssignmentClass() self.assignment.student = student self.attempts = 0 self.correct_attempts = 0 def check(self, code): self.attempts += 1 result = self.assignment.chec...
class Studentassignmentservice: def __init__(self, student, AssignmentClass): self.assignment = assignment_class() self.assignment.student = student self.attempts = 0 self.correct_attempts = 0 def check(self, code): self.attempts += 1 result = self.assignment.ch...
# get the dimension of the query location i.e. latitude and logitude # raise an exception of the given query Id not found in the input file def getDimensionsofQueryLoc(inputFile, queryLocId): with open(inputFile) as infile: header = infile.readline().strip() headerIndex={ headerName.lower...
def get_dimensionsof_query_loc(inputFile, queryLocId): with open(inputFile) as infile: header = infile.readline().strip() header_index = {headerName.lower(): index for (index, header_name) in enumerate(header.split(','))} for line in infile: values = line.strip().split(',') ...
n = int(input()) s = input().lower() output = 'YES' for letter in 'abcdefghijklmnopqrstuvwxyz': if letter not in s: output = 'NO' break print(output)
n = int(input()) s = input().lower() output = 'YES' for letter in 'abcdefghijklmnopqrstuvwxyz': if letter not in s: output = 'NO' break print(output)
num1, num2 = 5,0 try: quotient = num1/num2 message = "Quotient is" + ' ' + str(quotient) where (quotient = num1/num2) except ZeroDivisionError: message = "Cannot divide by zero" print(message)
(num1, num2) = (5, 0) try: quotient = num1 / num2 message = 'Quotient is' + ' ' + str(quotient) where(quotient=num1 / num2) except ZeroDivisionError: message = 'Cannot divide by zero' print(message)
''' Created on 30-Oct-2017 @author: Gokulraj ''' def mergesort(a,left,right): if len(right)-len(left)<=1: return(left) elif right-left>1: mid=(right+left)//2; l=a[left:mid] r=a[mid+1:right] mergesort(a,l,r) mergesort(a,l,r) merge(a,l,r) d...
""" Created on 30-Oct-2017 @author: Gokulraj """ def mergesort(a, left, right): if len(right) - len(left) <= 1: return left elif right - left > 1: mid = (right + left) // 2 l = a[left:mid] r = a[mid + 1:right] mergesort(a, l, r) mergesort(a, l, r) merge(...
class Enum: def __init__(self, name, value): self.name = name self.value = value def __init_subclass__(cls): cls._enum_names_ = {} cls._enum_values_ = {} for key, value in cls.__dict__.items(): if not key.startswith('_') and isinstance(value, cls._enum_type_...
class Enum: def __init__(self, name, value): self.name = name self.value = value def __init_subclass__(cls): cls._enum_names_ = {} cls._enum_values_ = {} for (key, value) in cls.__dict__.items(): if not key.startswith('_') and isinstance(value, cls._enum_typ...
# config.sample.py # Rename this file to config.py before running this application and change the database values below # LED GPIO Pin numbers - these are the default values, feel free to change them as needed LED_PINS = { 'green': 12, 'yellow': 25, 'red': 18 } EMAIL_CONFIG = { 'username':...
led_pins = {'green': 12, 'yellow': 25, 'red': 18} email_config = {'username': '<USERNAME>', 'password': '<PASSWORD>', 'smtpServer': 'smtp.gmail.com', 'port': 465, 'sender': 'Email of who will send it', 'recipient': 'Email of who will receive it'} database_config = {'host': 'localhost', 'dbname': 'uptime', 'dbuser': 'DA...
def selection_sort(A: list): for i in range(len(A) - 1): smallest_index = i for j in range(i + 1, len(A)): if A[i] > A[j]: smallest_index = j A[i], A[smallest_index] = A[smallest_index], A[i] A = [4, 2, 1, 5, 62, 5] B = [3, 3, 2, 4, 6, 65, 8, 5] C = [5, 4, 3, 2,...
def selection_sort(A: list): for i in range(len(A) - 1): smallest_index = i for j in range(i + 1, len(A)): if A[i] > A[j]: smallest_index = j (A[i], A[smallest_index]) = (A[smallest_index], A[i]) a = [4, 2, 1, 5, 62, 5] b = [3, 3, 2, 4, 6, 65, 8, 5] c = [5, 4, 3, ...
inventory = [ {"name": "apples", "quantity": 2}, {"name": "bananas", "quantity": 0}, {"name": "cherries", "quantity": 5}, {"name": "oranges", "quantity": 10}, {"name": "berries", "quantity": 7}, ] def checkIfFruitPresent(foodlist: list, target: str): # Check if the name is present ins the list ...
inventory = [{'name': 'apples', 'quantity': 2}, {'name': 'bananas', 'quantity': 0}, {'name': 'cherries', 'quantity': 5}, {'name': 'oranges', 'quantity': 10}, {'name': 'berries', 'quantity': 7}] def check_if_fruit_present(foodlist: list, target: str): print(f'We keep {target} inventory') if target in list(map(lambd...
# The goal is divide a bill print("Let's go divide the bill in Brazil. Insert the values and insert '0' for finish") sum = 0 valor = 1 while valor != 0: valor = float(input('Enter the value here in R$: ')) sum = sum + valor p = float(input('Enter the number of payers: ')) print(input('The total was R$ {}. Getti...
print("Let's go divide the bill in Brazil. Insert the values and insert '0' for finish") sum = 0 valor = 1 while valor != 0: valor = float(input('Enter the value here in R$: ')) sum = sum + valor p = float(input('Enter the number of payers: ')) print(input('The total was R$ {}. Getting R$ {:.2f} for each person...
#SearchEmployeeScreen BACK_BUTTON_TEXT = u"Back" CODE_TEXT = u"Code" DEPARTMENT_TEXT = u"Department" DOB_TEXT = u"DOB" DROPDOWN_DEPARTMENT_TEXT = u"Department" DROPDOWN_DOB_TEXT = u"DOB" DROPDOWN_EMPCODE_TEXT = u"Employee Code" DROPDOWN_NAME_TEXT = u"Name" DROPDOWN_SALARY_TEXT = u"Salary" GENDER_TEXT = u"Gender" HELP...
back_button_text = u'Back' code_text = u'Code' department_text = u'Department' dob_text = u'DOB' dropdown_department_text = u'Department' dropdown_dob_text = u'DOB' dropdown_empcode_text = u'Employee Code' dropdown_name_text = u'Name' dropdown_salary_text = u'Salary' gender_text = u'Gender' help_option_text = u'Here yo...
print ("Pythagorean Triplets with smaller side upto 10 -->") # form : (m^2 - n^2, 2*m*n, m^2 + n^2) # generate all (m, n) pairs such that m^2 - n^2 <= 10 # if we take (m > n), for m >= 6, m^2 - n^2 will always be greater than 10 # so m ranges from 1 to 5 and n ranges from 1 to m-1 pythTriplets = [(m*m - n*n, 2*m*n, m*m...
print('Pythagorean Triplets with smaller side upto 10 -->') pyth_triplets = [(m * m - n * n, 2 * m * n, m * m + n * n) for (m, n) in [(x, y) for x in range(1, 6) for y in range(1, x)] if m * m - n * n <= 10] print(pythTriplets)
print("What is your name?") name = input() print("How old are you?") age = int(input()) print("Where do you live?") residency = input() print("This is `{0}` \nIt is `{1}` \n(S)he live in `{2}` ".format(name, age, residency))
print('What is your name?') name = input() print('How old are you?') age = int(input()) print('Where do you live?') residency = input() print('This is `{0}` \nIt is `{1}` \n(S)he live in `{2}` '.format(name, age, residency))
#!/usr/bin/env python3 class TypeCacher(): def __init__(self): self.cached_types = {} self.num_cached_types = 0 def get_cached_type_str(self, type_str): if type_str in self.cached_types: cached_type_str = 'cached_type_%d' % self.cached_types[type_str] else: ...
class Typecacher: def __init__(self): self.cached_types = {} self.num_cached_types = 0 def get_cached_type_str(self, type_str): if type_str in self.cached_types: cached_type_str = 'cached_type_%d' % self.cached_types[type_str] else: cached_type_str = 'ca...
#!/usr/bin/env python # coding: utf-8 # In[172]: #Algorithm: S(A) is like a Pascal's Triangle #take string "ZY" for instance #S(A) of "ZY" can look like this: row 0 " " # row 1 Z Y # row 2 ZZ ZY YZ YY # row 3 ZZZ Z...
repetition = [] def generate_words(N, A): global repetition l = list(A) if N == 0: return L else: new_list = [] for elem in repetition: l1 = [e + elem for e in L] new_list = newList + L1 return generate_words(N - 1, newList) def append_words(A): ...
SECRET_KEY = '' DEBUG = False ALLOWED_HOSTS = [ #"example.com" ]
secret_key = '' debug = False allowed_hosts = []
# Sort Alphabetically presenters=[ {'name': 'Arthur', 'age': 9}, {'name': 'Nathaniel', 'age': 11} ] presenters.sort(key=lambda item: item['name']) print('--Alphabetically--') print(presenters) # Sort by length (Shortest to longest ) presenters.sort(key=lambda item: len (item['name'])) print('-- length --') pri...
presenters = [{'name': 'Arthur', 'age': 9}, {'name': 'Nathaniel', 'age': 11}] presenters.sort(key=lambda item: item['name']) print('--Alphabetically--') print(presenters) presenters.sort(key=lambda item: len(item['name'])) print('-- length --') print(presenters)
class SingletonMeta(type): _instance = {} def __call__(cls, *args, **kwargs): if cls not in cls._instance: cls._instance[cls] = super(SingletonMeta, cls).__call__(*args, **kwargs) return cls._instance[cls]
class Singletonmeta(type): _instance = {} def __call__(cls, *args, **kwargs): if cls not in cls._instance: cls._instance[cls] = super(SingletonMeta, cls).__call__(*args, **kwargs) return cls._instance[cls]
# Created by MechAviv # Full of Stars Damage Skin (30 Day) | (2436479) if sm.addDamageSkin(2436479): sm.chat("'Full of Stars Damage Skin (30 Day)' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
if sm.addDamageSkin(2436479): sm.chat("'Full of Stars Damage Skin (30 Day)' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
FIREWALL_FORWARDING = 1 FIREWALL_INCOMING_ALLOW = 2 FIREWALL_INCOMING_BLOCK = 3 FIREWALL_OUTGOING_BLOCK = 4 FIREWALL_CFG_PATH = '/etc/clearos/firewall.conf' def getFirewall(fw_type): with open(FIREWALL_CFG_PATH,'r') as f: lines = f.readlines() lines = [line.strip('\t\r\n\\ ') for line in lines] ...
firewall_forwarding = 1 firewall_incoming_allow = 2 firewall_incoming_block = 3 firewall_outgoing_block = 4 firewall_cfg_path = '/etc/clearos/firewall.conf' def get_firewall(fw_type): with open(FIREWALL_CFG_PATH, 'r') as f: lines = f.readlines() lines = [line.strip('\t\r\n\\ ') for line in lines] ...
# SPDX-License-Identifier: MIT # Copyright (c) 2021 Akumatic # # https://adventofcode.com/2021/day/02 def read_file() -> list: with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: return [(s[0], int(s[1])) for s in (line.split() for line in f.read().strip().split("\n"))] def part1(commands: list...
def read_file() -> list: with open(f"{__file__.rstrip('code.py')}input.txt", 'r') as f: return [(s[0], int(s[1])) for s in (line.split() for line in f.read().strip().split('\n'))] def part1(commands: list) -> int: (position, depth) = (0, 0) for com in commands: if com[0] == 'forward': ...
#!/usr/bin/env python # coding: utf-8 # #### We create a function cleanQ so we can do the cleaning and preperation of our data # #### INPUT: String # #### OUTPUT: Cleaned String def cleanQ(query): query = query.lower() tokenizer = RegexpTokenizer(r'\w+') tokens = tokenizer.tokenize(query) stemmer=[p...
def clean_q(query): query = query.lower() tokenizer = regexp_tokenizer('\\w+') tokens = tokenizer.tokenize(query) stemmer = [ps.stem(i) for i in tokens] filtered_q = [w for w in stemmer if not w in stopwords.words('english')] return filtered_Q def compute_tf(doc_words): bow = 0 for (k, ...
#5times range print('my name i') for i in range (5): print('jimee my name ('+ str(i) +')')
print('my name i') for i in range(5): print('jimee my name (' + str(i) + ')')
class Node(): def __init__(self, val): self.val = val self.left = None self.right = None class BST(): def __init__(self): self.root = Node(None) def insert(self, new_data): if self.root is None: self.root = Node(new_data) else: if...
class Node: def __init__(self, val): self.val = val self.left = None self.right = None class Bst: def __init__(self): self.root = node(None) def insert(self, new_data): if self.root is None: self.root = node(new_data) elif self.root.val < new_d...
# https://app.codesignal.com/arcade/code-arcade/loop-tunnel/xzeZqCQjpfDJuN72S def additionWithoutCarrying(param1, param2): # Add the values of each column of each number without carrying. # Order them smaller and larger value. param1, param2 = sorted([param1, param2]) # Convert both values to strings. ...
def addition_without_carrying(param1, param2): (param1, param2) = sorted([param1, param2]) (str1, str2) = (str(param1), str(param2)) str1 = '0' * (len(str2) - len(str1)) + str1 res = '' for i in range(len(str2)): res += str((int(str1[i]) + int(str2[i])) % 10) return int(res)
# 1137. N-th Tribonacci Number # Runtime: 32 ms, faster than 35.84% of Python3 online submissions for N-th Tribonacci Number. # Memory Usage: 14.3 MB, less than 15.94% of Python3 online submissions for N-th Tribonacci Number. class Solution: # Space Optimisation - Dynamic Programming def tribonacci(self, n:...
class Solution: def tribonacci(self, n: int) -> int: if n < 3: return 1 if n else 0 (x, y, z) = (0, 1, 1) for _ in range(n - 2): (x, y, z) = (y, z, x + y + z) return z
# Exercise2.p1 # Variables, Strings, Ints and Print Exercise # Given two variables - name and age. # Use the format() function to create a sentence that reads: # "Hi my name is Julie and I am 42 years old" # Set that equal to the variable called sentence name = "Julie" age = "42" sentence = "Hi my name is {} and i ...
name = 'Julie' age = '42' sentence = 'Hi my name is {} and i am {} years old'.format(name, age) print(sentence)
def ordinal(num): suffixes = {1: 'st', 2: 'nd', 3: 'rd'} if 10 <= num % 100 <= 20: suffix = 'th' else: suffix = suffixes.get(num % 10, 'th') return str(num) + suffix def num_to_text(num): texts = { 1: 'first', 2: 'second', 3: 'third', 4: 'fourth', ...
def ordinal(num): suffixes = {1: 'st', 2: 'nd', 3: 'rd'} if 10 <= num % 100 <= 20: suffix = 'th' else: suffix = suffixes.get(num % 10, 'th') return str(num) + suffix def num_to_text(num): texts = {1: 'first', 2: 'second', 3: 'third', 4: 'fourth', 5: 'fifth', 6: 'sixth', 7: 'seventh'...
#To reverse a given number def ReverseNo(num): num = str(num) reverse = ''.join(reversed(num)) print(reverse) Num = int(input('N= ')) ReverseNo(Num)
def reverse_no(num): num = str(num) reverse = ''.join(reversed(num)) print(reverse) num = int(input('N= ')) reverse_no(Num)
def age_assignment(*args, **kwargs): answer = {} for arg in args: for k, v in kwargs.items(): if arg[0] == k: answer[arg] = v return answer
def age_assignment(*args, **kwargs): answer = {} for arg in args: for (k, v) in kwargs.items(): if arg[0] == k: answer[arg] = v return answer
class Solution: def restoreString(self, s: str, indices: List[int]) -> str: answer = "" for i in range(len(indices)): answer += s[indices.index(i)] return answer
class Solution: def restore_string(self, s: str, indices: List[int]) -> str: answer = '' for i in range(len(indices)): answer += s[indices.index(i)] return answer
{ ".py": { "from osv import osv, fields": [regex("^from osv import osv, fields$"), "from odoo import models, fields, api"], "from osv import fields, osv": [regex("^from osv import fields, osv$"), "from odoo import models, fields, api"], "(osv.osv)": [regex("\(osv\.osv\)"), "(models.Model)"],...
{'.py': {'from osv import osv, fields': [regex('^from osv import osv, fields$'), 'from odoo import models, fields, api'], 'from osv import fields, osv': [regex('^from osv import fields, osv$'), 'from odoo import models, fields, api'], '(osv.osv)': [regex('\\(osv\\.osv\\)'), '(models.Model)'], 'from osv.orm import excep...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findTarget(self, root: Optional[TreeNode], k: int) -> bool: nums = [] self.nodeValueExtr...
class Solution: def find_target(self, root: Optional[TreeNode], k: int) -> bool: nums = [] self.nodeValueExtract(root, nums) for i in range(len(nums)): if k - nums[i] in nums[i + 1:]: return True return False def node_value_extract(self, root, nums):...
# Encapsulation: intance variables and methods can be kept private. # Abtraction: each object should only expose a high level mechanism # for using it. It should hide internal implementation details and only # reveal operations relvant for other objects. # ex. HR dept setting salary using setter method class Software...
class Softwareengineer: def __init__(self, name, age): self.name = name self.age = age self._salary = None self.__salary = 5000 self._nums_bugs_solved = 0 def code(self): self._nums_bugs_solved += 1 def _calcluate_salary(self, base_value): if self._...
n, m = map(int, input().split()) student = [tuple(map(int, input().split())) for _ in range(n)] check_points = [tuple(map(int, input().split())) for _ in range(m)] for a, b in student: dst_min = float('inf') ans = float('inf') for i, (c, d) in enumerate(check_points): now = abs(a - c) + abs(b - d) ...
(n, m) = map(int, input().split()) student = [tuple(map(int, input().split())) for _ in range(n)] check_points = [tuple(map(int, input().split())) for _ in range(m)] for (a, b) in student: dst_min = float('inf') ans = float('inf') for (i, (c, d)) in enumerate(check_points): now = abs(a - c) + abs(b ...
# # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # grantable = { 'can_add_my_signatory': 'kAddMySignatory', 'can_remove_my_signatory': 'kRemoveMySignatory', 'can_set_my_account_detail': 'kSetMyAccountDetail', 'can_set_my_quorum': 'kSetMyQuorum', 'can_tran...
grantable = {'can_add_my_signatory': 'kAddMySignatory', 'can_remove_my_signatory': 'kRemoveMySignatory', 'can_set_my_account_detail': 'kSetMyAccountDetail', 'can_set_my_quorum': 'kSetMyQuorum', 'can_transfer_my_assets': 'kTransferMyAssets'} role = {'can_add_asset_qty': 'kAddAssetQty', 'can_add_domain_asset_qty': 'kAddD...
def printName(): print("I absolutely \nlove coding \nwith Python!".format()) if __name__ == '__main__': printName()
def print_name(): print('I absolutely \nlove coding \nwith Python!'.format()) if __name__ == '__main__': print_name()
#6 uniform distribution p=[0.2, 0.2, 0.2, 0.2, 0.2] print(p) #7 generalized uniform distribution p=[] n=5 for i in range(n): p.append(1/n) print(p) #11 pHit and pMiss # not elegent but does the job pHit=0.6 pMiss=0.2 p[0]=p[0]*pMiss p[1]=p[1]*pHit p[2]=p[2]*pHit p[3]=p[3]*pMiss p[4]=p[4]*pMiss ...
p = [0.2, 0.2, 0.2, 0.2, 0.2] print(p) p = [] n = 5 for i in range(n): p.append(1 / n) print(p) p_hit = 0.6 p_miss = 0.2 p[0] = p[0] * pMiss p[1] = p[1] * pHit p[2] = p[2] * pHit p[3] = p[3] * pMiss p[4] = p[4] * pMiss print(p) print(sum(p)) p = [0.2, 0.2, 0.2, 0.2, 0.2] world = ['green', 'red', 'red', 'green', 'gr...
BASE_DEPS = [ "//jflex", "//jflex:testing", "//java/jflex/testing/testsuite", "//third_party/com/google/truth", ] def jflex_testsuite(**kwargs): args = update_args(kwargs) native.java_test(**args) def update_args(kwargs): if ("deps" in kwargs): kwargs["deps"] = kwargs["deps"] + BAS...
base_deps = ['//jflex', '//jflex:testing', '//java/jflex/testing/testsuite', '//third_party/com/google/truth'] def jflex_testsuite(**kwargs): args = update_args(kwargs) native.java_test(**args) def update_args(kwargs): if 'deps' in kwargs: kwargs['deps'] = kwargs['deps'] + BASE_DEPS else: ...
ISCSI_CONNECTIVITY_TYPE = "iscsi" FC_CONNECTIVITY_TYPE = "fc" SPACE_EFFICIENCY_THIN = 'thin' SPACE_EFFICIENCY_COMPRESSED = 'compressed' SPACE_EFFICIENCY_DEDUPLICATED = 'deduplicated' SPACE_EFFICIENCY_THICK = 'thick' SPACE_EFFICIENCY_NONE = 'none' # volume context CONTEXT_POOL = "pool"
iscsi_connectivity_type = 'iscsi' fc_connectivity_type = 'fc' space_efficiency_thin = 'thin' space_efficiency_compressed = 'compressed' space_efficiency_deduplicated = 'deduplicated' space_efficiency_thick = 'thick' space_efficiency_none = 'none' context_pool = 'pool'
bch_code_parameters = { 3:{ 1:4 }, 4:{ 1:11, 2:7, 3:5 }, 5:{ 1:26, 2:21, 3:16, 5:11, 7:6 }, 6:{ 1:57, 2:51, 3:45, 4:39, 5:36, 6:30, 7:24, 10:18, 11:...
bch_code_parameters = {3: {1: 4}, 4: {1: 11, 2: 7, 3: 5}, 5: {1: 26, 2: 21, 3: 16, 5: 11, 7: 6}, 6: {1: 57, 2: 51, 3: 45, 4: 39, 5: 36, 6: 30, 7: 24, 10: 18, 11: 16, 13: 10, 15: 7}, 7: {1: 120, 2: 113, 3: 106, 4: 99, 5: 92, 6: 85, 7: 78, 9: 71, 10: 64, 11: 57, 13: 50, 14: 43, 15: 36, 21: 29, 23: 22, 27: 15, 31: 8}, 8: ...
XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX
CONFIGS = { "session": "1", "store_location": ".", "folder": "Estudiante_1", "video": True, "audio": False, "mqtt_hostname": "10.42.0.1", "mqtt_username" : "james", "mqtt_password" : "james", "mqtt_port" : 1883, "dev_id": "1", "rap_server": "10.42.0.1" } CAMERA = { "brig...
configs = {'session': '1', 'store_location': '.', 'folder': 'Estudiante_1', 'video': True, 'audio': False, 'mqtt_hostname': '10.42.0.1', 'mqtt_username': 'james', 'mqtt_password': 'james', 'mqtt_port': 1883, 'dev_id': '1', 'rap_server': '10.42.0.1'} camera = {'brightness': 60, 'saturation': -60, 'contrast': 0, 'resolut...
def solution(A): exchange_0 = exchange_1 = pos = -1 idx = 1 while idx < len(A): if A[idx] < A[idx - 1]: if exchange_0 == -1: exchange_0 = A[idx - 1] exchange_1 = A[idx] else: return False if exchange_0 > 0: if A[idx] > exchange_0: if A[idx - 1] > exchan...
def solution(A): exchange_0 = exchange_1 = pos = -1 idx = 1 while idx < len(A): if A[idx] < A[idx - 1]: if exchange_0 == -1: exchange_0 = A[idx - 1] exchange_1 = A[idx] else: return False if exchange_0 > 0: i...
### WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ### ### This file MUST be edited properly and copied to settings.py in order for ### SMS functionality to work. Get set up on Twilio.com for the required API ### keys and phone number settings. ### ### WARNING WARNING WARNING WARNING WARNING WA...
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' auth_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' phone_from = '+1213XXXYYYY' phone_to = '+1808XXXYYYY'
# attributes are characteristics of an object defined in a "magic method" called __init__, which method is called when a new object is instantiated class User: # declare a class and give it name User def __init__(self): self.name = "Steven" self.email = "swm9220@gmail.com" self.account_bala...
class User: def __init__(self): self.name = 'Steven' self.email = 'swm9220@gmail.com' self.account_balance = 0 guido = user() monty = user() print(guido.name) print(monty.name) guido.name = 'Guido' monty.name = 'Monty' class User: def __init__(self, username, email_address): s...
# Algorithmic question ## Longest Palindromic Subsequence # Given a string S, a subsequence s is obtained by combining characters in their order of appearance in S, whatever their position. The longest palindromic subsequence could be found checking all subsequences of a string, but that would take a running time of O...
def toolongpalindromic(S): maxlen = 0 if len(S) <= 1: return len(S) if S[0] == S[-1]: maxlen += 2 + toolongpalindromic(S[1:-1]) else: maxlen += max(toolongpalindromic(S[:-1]), toolongpalindromic(S[1:])) return maxlen def substrings(S, l): l = [] for i in range(len(S)...
# import numpy as np # import matplotlib.pyplot as plt class TimeBlock: def __init__(self,name,level,time,percentage): self.name = name self.level = int(level) self.percentage = float(percentage) self.time = float(time) self.children = [] self.parent = [] def A...
class Timeblock: def __init__(self, name, level, time, percentage): self.name = name self.level = int(level) self.percentage = float(percentage) self.time = float(time) self.children = [] self.parent = [] def add_child(self, block): self.children.append(...
_base_ = [ '../../_base_/models/swin/swin_small.py', '../../_base_/default_runtime.py' ] pretrained_path='pretrained/swin_small_patch244_window877_kinetics400_1k.pth' model=dict(backbone=dict(patch_size=(2,4,4), drop_path_rate=0.1, pretrained2d=False, pretrained=pretrained_path),cls_head=dict(num_classes=2),test_c...
_base_ = ['../../_base_/models/swin/swin_small.py', '../../_base_/default_runtime.py'] pretrained_path = 'pretrained/swin_small_patch244_window877_kinetics400_1k.pth' model = dict(backbone=dict(patch_size=(2, 4, 4), drop_path_rate=0.1, pretrained2d=False, pretrained=pretrained_path), cls_head=dict(num_classes=2), test_...
permissions_admin = {} permissions_kigstn = {} permissions_socialist = {} # todo
permissions_admin = {} permissions_kigstn = {} permissions_socialist = {}
print("Python has three numeric types: int, float, and complex") myValue=1 print(myValue) print(type(myValue)) print(str(myValue) + " is of the data type " + str(type(myValue))) myValue=3.14 print(myValue) print(type(myValue)) print(str(myValue) + " is of the data type " + str(type(myValue))) myValue=5j print(myValue) ...
print('Python has three numeric types: int, float, and complex') my_value = 1 print(myValue) print(type(myValue)) print(str(myValue) + ' is of the data type ' + str(type(myValue))) my_value = 3.14 print(myValue) print(type(myValue)) print(str(myValue) + ' is of the data type ' + str(type(myValue))) my_value = 5j print(...
N=int(input("numero? ")) if N % 2 == 0: valor = False else: valor = True i=3 while valor and i <= N-1: valor=valor and (N % i != 0) i = i + 2 print(valor)
n = int(input('numero? ')) if N % 2 == 0: valor = False else: valor = True i = 3 while valor and i <= N - 1: valor = valor and N % i != 0 i = i + 2 print(valor)
NSNAM_CODE_BASE_URL = "http://code.nsnam.org/" PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen' LOCAL_PYBINDGEN_PATH = 'pybindgen' # # The last part of the path name to use to find the regression traces tarball. # path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX + TRACEBALL_SUFFIX, # e.g., ns-3-dev-ref-tr...
nsnam_code_base_url = 'http://code.nsnam.org/' pybindgen_branch = 'https://launchpad.net/pybindgen' local_pybindgen_path = 'pybindgen' traceball_suffix = '.tar.bz2' netanim_repo = 'http://code.nsnam.org/netanim' netanim_release_url = 'http://www.nsnam.org/tools/netanim' local_netanim_path = 'netanim' bake_repo = 'http:...
class Person: def __init__(self, person_id, name): self.person_id = person_id self.name = name self.first_page = None self.last_pages = [] class Link: def __init__(self, current_page_number, person=None, colour_id=None, image_id=None, group_id=None): self.current_page_...
class Person: def __init__(self, person_id, name): self.person_id = person_id self.name = name self.first_page = None self.last_pages = [] class Link: def __init__(self, current_page_number, person=None, colour_id=None, image_id=None, group_id=None): self.current_page_...
class KeyHolder(): key = "(_e0p73$co#nse*^-(3b60(f*)6h1bmaaada@kleyb)pj5=1)6" email_user = 'HuntAdminLototron' email_password = '0a4c9be34e616e91c9516fdd07bf7de2'
class Keyholder: key = '(_e0p73$co#nse*^-(3b60(f*)6h1bmaaada@kleyb)pj5=1)6' email_user = 'HuntAdminLototron' email_password = '0a4c9be34e616e91c9516fdd07bf7de2'
A = Matrix([[1, 2], [-2, 1]]) A.is_positive_definite # True A.is_positive_semidefinite # True p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
a = matrix([[1, 2], [-2, 1]]) A.is_positive_definite A.is_positive_semidefinite p = plot3d((x.T * A * x)[0, 0], (a, -1, 1), (b, -1, 1))
# x, y: arguments x = 2 y = 3 # a, b: parameters def function(a, b): print(a, b) function(x, y) # default arguments def function2(a, b=None): if b: print(a, b) else: print(a) function2(x) function2(x, b=y) # bei default parametern immer variable= -> besser lesbar # Funktionen ohne retu...
x = 2 y = 3 def function(a, b): print(a, b) function(x, y) def function2(a, b=None): if b: print(a, b) else: print(a) function2(x) function2(x, b=y)
class LogMessage: text = "EMPTY" stack = 1 # for more than one equal message in a row replaceable = False color = (200, 200, 200) def __init__(self, text, replaceable=False, color=(200, 200, 200)): self.text = text self.replaceable = replaceable self.color = color
class Logmessage: text = 'EMPTY' stack = 1 replaceable = False color = (200, 200, 200) def __init__(self, text, replaceable=False, color=(200, 200, 200)): self.text = text self.replaceable = replaceable self.color = color
cfiles = {"train_features":'./legacy_tests/data/class_train.features', "train_labels":'./legacy_tests/data/class_train.labels', "test_features":'./legacy_tests/data/class_test.features', "test_labels":'./legacy_tests/data/class_test.labels'} ...
cfiles = {'train_features': './legacy_tests/data/class_train.features', 'train_labels': './legacy_tests/data/class_train.labels', 'test_features': './legacy_tests/data/class_test.features', 'test_labels': './legacy_tests/data/class_test.labels'} rfiles = {'train_features': './legacy_tests/data/reg_train.features', 'tra...
class Solution: def findAnagrams(self, s: str, p: str) -> List[int]: if len(s) < len(p): return [] sl = [] ans = [] pl =[0]*26 for i in p: pl[ord(i)-97]+=1 for ix, i in enumerate(s): if not sl: ...
class Solution: def find_anagrams(self, s: str, p: str) -> List[int]: if len(s) < len(p): return [] sl = [] ans = [] pl = [0] * 26 for i in p: pl[ord(i) - 97] += 1 for (ix, i) in enumerate(s): if not sl: sl = [0] * ...
#!/usr/bin/env python3 s = '{19}' print('s is:', s) n = s[2:-1] print(n) # make n=20 copies of '1': # idea: use a loop def make_N_copies_of_1(s): n = s[2:-1] # number of copies i = 0 result = '' while i < int(n): result += '1' i += 1 return result print(make_20_copies_of_1(s))
s = '{19}' print('s is:', s) n = s[2:-1] print(n) def make_n_copies_of_1(s): n = s[2:-1] i = 0 result = '' while i < int(n): result += '1' i += 1 return result print(make_20_copies_of_1(s))
# Usage: python3 l2bin.py source = open('MCZ.PROM.78089.L', 'r') dest = open('MCZ.PROM.78089.BIN', 'wb') next = 0 for line in source: # Useful lines are like: 0013 210000 if len(line) >= 8 and line[0] != ' ' and line[7] != ' ': parts = line.split() try: address = int(parts[0], 16)...
source = open('MCZ.PROM.78089.L', 'r') dest = open('MCZ.PROM.78089.BIN', 'wb') next = 0 for line in source: if len(line) >= 8 and line[0] != ' ' and (line[7] != ' '): parts = line.split() try: address = int(parts[0], 16) code = bytes.fromhex(parts[1]) while next <...
#encoding:utf-8 subreddit = 'cyberpunkgame+LowSodiumCyberpunk' t_channel = '@r_cyberpunk2077' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'cyberpunkgame+LowSodiumCyberpunk' t_channel = '@r_cyberpunk2077' def send_post(submission, r2t): return r2t.send_simple(submission)
global_var = 0 def outter(): def inner(): global global_var global_var = 10 inner() outter() print(global_var)
global_var = 0 def outter(): def inner(): global global_var global_var = 10 inner() outter() print(global_var)
# 0 - establish connection # 1 - service number 1 # 2 - service number 2 # 3 - service number 3 # 4 - service number 4 # 5 - non-idempotent service - check number of flights # 6 - idempotent service - give this information service a like and retrieve how many likes this system has # 11 - int # 12 - string # 13 - date-...
int = 11 str = 12 date = 13 fp = 14 fli = 15 at_least_once = 100 at_most_once = 101 error = 126
def f(n): max_even=len(str(n))-1 if str(n)[0]=="1": max_even-=1 for i in range(n-1, -1, -1): if i%2==0 or i%3==0: continue if count_even(i)<max_even: continue if isPrime(i): return i def isPrime(n): for i in range(2, int(n**0.5)+1): ...
def f(n): max_even = len(str(n)) - 1 if str(n)[0] == '1': max_even -= 1 for i in range(n - 1, -1, -1): if i % 2 == 0 or i % 3 == 0: continue if count_even(i) < max_even: continue if is_prime(i): return i def is_prime(n): for i in range...
# We have to find no of numbers between range (a,b) which has consecutive set bits. # Hackerearth n, q = map(int, input().split()) arr = list(map(int, input().split())) for k in range(n): l, h = map(int, input().split()) count = 0 for i in range(l-1, h): if "11" in bin(arr[i]): count+=1 print(count)
(n, q) = map(int, input().split()) arr = list(map(int, input().split())) for k in range(n): (l, h) = map(int, input().split()) count = 0 for i in range(l - 1, h): if '11' in bin(arr[i]): count += 1 print(count)
# Twitter API Keys #Given # consumer_key = "Ed4RNulN1lp7AbOooHa9STCoU" # consumer_secret = "P7cUJlmJZq0VaCY0Jg7COliwQqzK0qYEyUF9Y0idx4ujb3ZlW5" # access_token = "839621358724198402-dzdOsx2WWHrSuBwyNUiqSEnTivHozAZ" # access_token_secret = "dCZ80uNRbFDjxdU2EckmNiSckdoATach6Q8zb7YYYE5ER" #Generated on June 21st 2018 # ...
consumer_key = 'n9WXASBiuLis9IxX0KE6VqWLN' consumer_secret = 'FqJmd8cCiFhX4tKr91xAJoBL0s5xxp9lmv3czEW84mT3jsLCj7' access_token = '1009876849122521089-Sok0ZuMt7EYOLucBhgyDefaQlYJkXX' access_token_secret = 'IDt79lugJ9rsqa9n9Oly38Xr4rvFlrSzRWb0quPxJNnUg'
numbers = input().split(" ") max_number = '' biggest = sorted(numbers, reverse = True) for num in biggest: max_number += num print(max_number)
numbers = input().split(' ') max_number = '' biggest = sorted(numbers, reverse=True) for num in biggest: max_number += num print(max_number)
########################################################################## # Author: Samuca # # brief: change and gives information about a string # # this is a list exercise available on youtube: # https://www.youtube.com/playlist?list=PLHz_AreHm4dm6wYOIW20Nyg12TAjmMGT- ##############################################...
name = str(input('Write down your name: ')).strip() print('analysing your name...') print('It in Upper: {}'.format(name.upper())) print('It in Lower: {}'.format(name.lower())) print('Number of letters: {}'.format(len(name) - name.count(' '))) sep = name.split() print(sep) print('Yout first name is {}, it has {} letters...
end_line_chars = (".", ",", ";", ":", "!", "?", "-") def split_into_blocks(text, line_length, block_size): words = text.strip("\n").split() current_line = "" lines = [] blocks = [] char_counter = 0 for i, word in enumerate(words): # check every word if len(lines) < (block_size - 1): ...
end_line_chars = ('.', ',', ';', ':', '!', '?', '-') def split_into_blocks(text, line_length, block_size): words = text.strip('\n').split() current_line = '' lines = [] blocks = [] char_counter = 0 for (i, word) in enumerate(words): if len(lines) < block_size - 1: if char_co...
#Set the request parameters url = 'https://instanceName.service-now.com/api/now/table/sys_script' #Eg. User name="username", Password="password" for this code sample. user = 'yourUserName' pwd = 'yourPassword' #Set proper headers headers = {"Content-Type":"application/json","Accept":"application/json"} # Set Business...
url = 'https://instanceName.service-now.com/api/now/table/sys_script' user = 'yourUserName' pwd = 'yourPassword' headers = {'Content-Type': 'application/json', 'Accept': 'application/json'} post_business_rule = '{\r\n "abort_action": "false",\r\n "access": "package_private",\r\n "action_delete": "false",...
{ 'targets' : [{ 'variables': { 'lib_root' : '../libio', }, 'target_name' : 'fake', 'sources' : [ ], 'dependencies' : [ './export.gyp:export', ], }] }
{'targets': [{'variables': {'lib_root': '../libio'}, 'target_name': 'fake', 'sources': [], 'dependencies': ['./export.gyp:export']}]}
# # PySNMP MIB module AT-PVSTPM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-PVSTPM-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:30:33 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, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ...
class ShiftCipher: def __init__(self, affineMultiplier, constantShift): self.affineMultiplier = affineMultiplier self.constantShift = constantShift def encode(self, messageInList): for i in range(len(messageInList)): if ord(messageInList[i])!=32: messageInLis...
class Shiftcipher: def __init__(self, affineMultiplier, constantShift): self.affineMultiplier = affineMultiplier self.constantShift = constantShift def encode(self, messageInList): for i in range(len(messageInList)): if ord(messageInList[i]) != 32: messageIn...
all_nums = [] for i in range(10, 1000000): total = 0 for l in str(i): total += int(l) ** 5 if int(total) == int(i): all_nums.append(int(total)) print(sum(all_nums))
all_nums = [] for i in range(10, 1000000): total = 0 for l in str(i): total += int(l) ** 5 if int(total) == int(i): all_nums.append(int(total)) print(sum(all_nums))
def do(self): self.components.Open.label="Open" self.components.Delete.label="Delete" self.components.Duplicate.label="Duplicate" self.components.Run.label="Run" self.components.Files.text="Files" self.components.Call.label="Call"
def do(self): self.components.Open.label = 'Open' self.components.Delete.label = 'Delete' self.components.Duplicate.label = 'Duplicate' self.components.Run.label = 'Run' self.components.Files.text = 'Files' self.components.Call.label = 'Call'
# 3rd question # 12 se 421 takkk k sare no. ka sum print kre. # akshra=12 # sum=0 # while akshra<=421: # sum=sum+akshra # print(s) # akshra=akshra+1 # 4th question # 30 se 420 se vo no. print kro jo 8 se devied ho # var=30 # while var<=420: # if var%8==0: # print(var) # ...
n = 6 s = 0 i = 1 while i <= n: s = s + i i = i + 1 print(s)
# Project Euler Problem 5 ###################################### # Find smallest pos number that is # evenly divisible by all numbers from # 1 to 20 ###################################### #essentially getting the lcm of several numbers # formula for lcm is lcm(a,b) = a*b / gcd(a,b) def gcd(a, b): assert type(a) i...
def gcd(a, b): assert type(a) is int, 'arg1 non int' assert type(b) is int, 'arg2 non int' if a < b: while a: (b, a) = (a, b % a) return b else: while b: (a, b) = (b, a % b) return a def gcd_test(): print(gcd(1, 1)) print(gcd(5, 35)) p...
print('hello world') print("hello world") print("hello \nworld") print("hello \tworld") print('length=',len('hello')) # len returns the length of the string mystring="python" # assigning value python to variable mystring print(mystring) # it returns python # Indexing print('the element at Index[0]=',m...
print('hello world') print('hello world') print('hello \nworld') print('hello \tworld') print('length=', len('hello')) mystring = 'python' print(mystring) print('the element at Index[0]=', mystring[0]) print('the element at Index[3]=', mystring[3]) print('the elements starting at Index[0] and it goes upto Index[4]', my...
# -*- coding: utf-8 -*- def main(): a, b = map(int, input().split()) if a + 0.5 - b > 0: print(1) else: print(0) if __name__ == '__main__': main()
def main(): (a, b) = map(int, input().split()) if a + 0.5 - b > 0: print(1) else: print(0) if __name__ == '__main__': main()
values = input("Please fill value:") result = [] for value in values : if str(value).isdigit() : dec = int(value) if dec % 2 != 0 : result.append(dec) print(result) print(len(result))
values = input('Please fill value:') result = [] for value in values: if str(value).isdigit(): dec = int(value) if dec % 2 != 0: result.append(dec) print(result) print(len(result))
class Instrument: def __init__(self, exchange_name, instmt_name, instmt_code, **param): self.exchange_name = exchange_name self.instmt_name = instmt_name self.instmt_code = instmt_code self.instmt_snapshot_table_name...
class Instrument: def __init__(self, exchange_name, instmt_name, instmt_code, **param): self.exchange_name = exchange_name self.instmt_name = instmt_name self.instmt_code = instmt_code self.instmt_snapshot_table_name = '' def get_exchange_name(self): return self.exchang...
class NoProjectYaml(Exception): pass class NoDockerfile(Exception): pass class CheckCallFailed(Exception): pass class WaitLinkFailed(Exception): pass
class Noprojectyaml(Exception): pass class Nodockerfile(Exception): pass class Checkcallfailed(Exception): pass class Waitlinkfailed(Exception): pass
class Role: def __init__(self, data): self.data = data @property def id(self): return self.data["id"] @property def name(self): return self.data["name"] @classmethod def from_dict(cls, data): return cls(data)
class Role: def __init__(self, data): self.data = data @property def id(self): return self.data['id'] @property def name(self): return self.data['name'] @classmethod def from_dict(cls, data): return cls(data)
__author__ = "Abdul Dakkak" __email__ = "dakkak@illinois.edu" __license__ = "Apache 2.0" __version__ = "0.2.4"
__author__ = 'Abdul Dakkak' __email__ = 'dakkak@illinois.edu' __license__ = 'Apache 2.0' __version__ = '0.2.4'
def sum(arr): if len(arr) == 0: return 0 return arr[0] + sum(arr[1:]) if __name__ == '__main__': arr = [1,2,3,4,5,6,7,8] print('Test arr: %s' % arr) print('sum = %s' % sum(arr))
def sum(arr): if len(arr) == 0: return 0 return arr[0] + sum(arr[1:]) if __name__ == '__main__': arr = [1, 2, 3, 4, 5, 6, 7, 8] print('Test arr: %s' % arr) print('sum = %s' % sum(arr))
#!/usr/bin/env python3 file = 'input.txt' with open(file) as f: input = f.read().splitlines() def more_ones(list, truth): data = [] for i in range(0, len(list[0])): more_ones = sum([1 for x in list if x[i] == '1']) >= sum([1 for x in list if x[i] == '0']) if more_ones: if trut...
file = 'input.txt' with open(file) as f: input = f.read().splitlines() def more_ones(list, truth): data = [] for i in range(0, len(list[0])): more_ones = sum([1 for x in list if x[i] == '1']) >= sum([1 for x in list if x[i] == '0']) if more_ones: if truth: data.a...
class Config(object): MONGO_URI = 'mongodb://172.17.0.2:27017/bibtexreader' MONGO_HOST = 'mongodb://172.17.0.2:27017' DB_NAME = 'bibtexreader' BIB_DIR = 'bibtexfiles'
class Config(object): mongo_uri = 'mongodb://172.17.0.2:27017/bibtexreader' mongo_host = 'mongodb://172.17.0.2:27017' db_name = 'bibtexreader' bib_dir = 'bibtexfiles'
DATABASES = { 'default': { 'NAME': ':memory:', 'ENGINE': 'django.db.backends.sqlite3', } } SECRET_KEY = 'secret' INSTALLED_APPS = ( 'django_nose', ) TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' NOSE_ARGS = ( 'stopwatch', '--verbosity=2', '--nologcapture', '--with-doctest',...
databases = {'default': {'NAME': ':memory:', 'ENGINE': 'django.db.backends.sqlite3'}} secret_key = 'secret' installed_apps = ('django_nose',) test_runner = 'django_nose.NoseTestSuiteRunner' nose_args = ('stopwatch', '--verbosity=2', '--nologcapture', '--with-doctest', '--with-coverage', '--cover-package=stopwatch', '--...