content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
HIGH = 0x1 LOW = 0x0 INPUT = 0x0 OUTPUT = 0x1 INPUT_PULLUP = 0x2 PI = 3.1415926535897932384626433832795 HALF_PI = 1.5707963267948966192313216916398 TWO_PI = 6.283185307179586476925286766559 DEG_TO_RAD = 0.017453292519943295769236907684886 RAD_TO_DEG = 57.295779513082320876798154814105 EULER = 2.7182818284590452353602...
high = 1 low = 0 input = 0 output = 1 input_pullup = 2 pi = 3.141592653589793 half_pi = 1.5707963267948966 two_pi = 6.283185307179586 deg_to_rad = 0.017453292519943295 rad_to_deg = 57.29577951308232 euler = 2.718281828459045 serial = 0 display = 1 lsbfirst = 0 msbfirst = 1 change = 1 falling = 2 rising = 3
def listUsers(actors, name='azmy', age=20): raise NotImplementedError()
def list_users(actors, name='azmy', age=20): raise not_implemented_error()
# # script_globals = dict() # script_locals = dict() # exec(open("./npc1.py").read(), script_globals, script_locals) # # script_locals['touched']() # npc_sprite_path = "./assets/sprites/npc_male_1.png" palette = ( (248, 112, 32), # primary - orange shirt (0, 0, 0), # secondary - black hair (94, 50, 18) ...
npc_sprite_path = './assets/sprites/npc_male_1.png' palette = ((248, 112, 32), (0, 0, 0), (94, 50, 18)) name = 'Greg' is_pushable = False def on_create(self): self.character.face_north() def on_collided(self, collided_by, delta_x, delta_y): print(f'{self.character.name}: Watch your step!') def on_touched(sel...
class BaseError(Exception): pass class BadRequestError(BaseError): pass class UnauthorizedError(BaseError): pass class NotFoundError(BaseError): pass class MethodNotAllowedError(BaseError): pass class ConflictError(BaseError): pass class ServerError(BaseError): pass class Servi...
class Baseerror(Exception): pass class Badrequesterror(BaseError): pass class Unauthorizederror(BaseError): pass class Notfounderror(BaseError): pass class Methodnotallowederror(BaseError): pass class Conflicterror(BaseError): pass class Servererror(BaseError): pass class Serviceunava...
# We generate all the possible powers in the given range, put each value # into a set, and let the set count the number of unique values present. def compute(): seen = set(a**b for a in range(2, 101) for b in range(2, 101)) return str(len(seen)) if __name__ == "__main__": print(compute())
def compute(): seen = set((a ** b for a in range(2, 101) for b in range(2, 101))) return str(len(seen)) if __name__ == '__main__': print(compute())
kofy = [7, 286, 200, 176, 120, 165, 206, 75, 129, 109, 123, 111, 43, 52, 99, 128, 111, 110, 98, 135, 112, 78, 118, 64, 77, 227, 93, 88, 69, 60, 34, 30, 73, 54, 45, 83, 182, 88, 75, 85, 54, 53, 89, 59, 37, 35, 38, 29, 18, 4...
kofy = [7, 286, 200, 176, 120, 165, 206, 75, 129, 109, 123, 111, 43, 52, 99, 128, 111, 110, 98, 135, 112, 78, 118, 64, 77, 227, 93, 88, 69, 60, 34, 30, 73, 54, 45, 83, 182, 88, 75, 85, 54, 53, 89, 59, 37, 35, 38, 29, 18, 45, 60, 49, 62, 55, 78, 96, 29, 22, 24, 13, 14, 11, 11, 18, 12, 12, 30, 52, 52, 44, 28, 28, 20, 56,...
def read_properties(path: str) -> dict: dictionary = dict() with open(path+".properties", "r") as arguments: for line in arguments: temp = line.strip().replace(" ", "").replace("%20", " ").split("=") if len(temp) == 2: if temp[1].isdigit(): tem...
def read_properties(path: str) -> dict: dictionary = dict() with open(path + '.properties', 'r') as arguments: for line in arguments: temp = line.strip().replace(' ', '').replace('%20', ' ').split('=') if len(temp) == 2: if temp[1].isdigit(): t...
__author__ = 'raca' ''' The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s. We shall consider fractions like, 30/50 = 3/5, to be trivial examples. There are exactly four ...
__author__ = 'raca' '\nThe fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly\nbelieve that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s.\n\nWe shall consider fractions like, 30/50 = 3/5, to be trivial examples.\n\nThere are exactly fo...
def apply_discound(price, discount): return price * (100 - discount) / 100 # def discound_product(price): # pass basket = [5768.32, 4213.23, 12356, 12456] basket_sum = sum(basket) print(basket_sum) basket_sum_discounted = 0 discount_1 = 7 for product in basket: basket_sum_discounted += apply_discound(pr...
def apply_discound(price, discount): return price * (100 - discount) / 100 basket = [5768.32, 4213.23, 12356, 12456] basket_sum = sum(basket) print(basket_sum) basket_sum_discounted = 0 discount_1 = 7 for product in basket: basket_sum_discounted += apply_discound(product, discount_1) print(basket_sum_discounted...
__author__ = 'roberto' def AddNewPlane1Curve(parent, cat_constructor, curve): pass
__author__ = 'roberto' def add_new_plane1_curve(parent, cat_constructor, curve): pass
# -*- coding: utf-8 -*- __all__ = ['get_currency', 'Currency'] _CURRENCIES = {} def get_currency(currency_code): "Retrieve currency by the ISO currency code." return _CURRENCIES[currency_code] class Currency: "Class representing a currency, such as USD, or GBP" __slots__ = ['code', 'name', 'symbol...
__all__ = ['get_currency', 'Currency'] _currencies = {} def get_currency(currency_code): """Retrieve currency by the ISO currency code.""" return _CURRENCIES[currency_code] class Currency: """Class representing a currency, such as USD, or GBP""" __slots__ = ['code', 'name', 'symbol', 'precision'] ...
#3Sum closest class Solution: def threeSumClosest(self, nums: List[int], target: int) -> int: nums.sort() ans=0 diff=10000000 for i in range(0,len(nums)-2): #print(i) left=i+1 right=len(nums)-1 while(left<right): #print(...
class Solution: def three_sum_closest(self, nums: List[int], target: int) -> int: nums.sort() ans = 0 diff = 10000000 for i in range(0, len(nums) - 2): left = i + 1 right = len(nums) - 1 while left < right: if nums[left] + nums[rig...
""" File: caesar.py Name: ------------------------------ This program demonstrates the idea of caesar cipher. Users will be asked to input a number to produce shifted ALPHABET as the cipher table. After that, any strings typed in will be encrypted. """ # This constant shows the original order of alphabetic sequence. ...
""" File: caesar.py Name: ------------------------------ This program demonstrates the idea of caesar cipher. Users will be asked to input a number to produce shifted ALPHABET as the cipher table. After that, any strings typed in will be encrypted. """ alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' n = int(input('Secret numbe...
class StorageNode: """ Filters class represents the filter data """ def __init__(self, id, name, location, type): self.id = id self.name = name self.location = location self.type = type
class Storagenode: """ Filters class represents the filter data """ def __init__(self, id, name, location, type): self.id = id self.name = name self.location = location self.type = type
# 04. Atomic symbols #Split the sentence "Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can". into words, and extract the first letter from the 1st, 5th, 6th, 7th, 8th, 9th, 15th, 16th, 19th words and the first two letters from the other words. Crea...
s = 'Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can' s_list = s.split(' ') new_list = {} for i in range(1, len(sList) + 1): if i in [1, 5, 6, 7, 8, 9, 15, 16, 19]: newList[sList[i - 1][:1]] = i else: newList[sList[i - 1][:2...
# This comes with no warranty, implied or otherwise # This data structure was designed to support Proportional fonts # on Arduinos. It can however handle any ttf font that has been converted # using the conversion program. These could be fixed width or proportional # fonts. Individual characters do not have to b...
tft__comic24 = [0, 25, 0, 0, 32, 21, 0, 0, 0, 7, 33, 2, 2, 20, 1, 6, 255, 255, 255, 252, 45, 34, 3, 6, 8, 2, 10, 207, 60, 243, 207, 60, 243, 35, 3, 20, 18, 1, 20, 1, 129, 128, 24, 24, 1, 129, 128, 48, 48, 3, 3, 7, 255, 255, 127, 255, 240, 96, 96, 6, 6, 0, 192, 192, 12, 12, 15, 255, 254, 255, 255, 225, 129, 128, 24, 24,...
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def deleteDuplicates(self, head): if head is None: return None if head.next is None: return head now = head _dict = ...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def delete_duplicates(self, head): if head is None: return None if head.next is None: return head now = head _dict = {} while now.next: ...
tokenizer_special_cases = [ 'xxbos', 'xxeos', ]
tokenizer_special_cases = ['xxbos', 'xxeos']
"""Meta Data Categories.""" class Categories: """Meta Data Categories.""" BIOSPECIMEN = "Biospecimen" DEMOGRAPHICS = "Demographics" SC_RNA_SEQ_LEVEL_1 = "ScRNA-seqLevel1" SC_RNA_SEQ_LEVEL_2 = "ScRNA-seqLevel2" SC_RNA_SEQ_LEVEL_3 = "ScRNA-seqLevel3" SC_RNA_SEQ_LEVEL_4 = "ScRNA-seqLevel4" ...
"""Meta Data Categories.""" class Categories: """Meta Data Categories.""" biospecimen = 'Biospecimen' demographics = 'Demographics' sc_rna_seq_level_1 = 'ScRNA-seqLevel1' sc_rna_seq_level_2 = 'ScRNA-seqLevel2' sc_rna_seq_level_3 = 'ScRNA-seqLevel3' sc_rna_seq_level_4 = 'ScRNA-seqLevel4' ...
def int_exp_sin(a, w): """ Finds the primitive integral of the function, f(t | a, w) := C e^(at + b) sin(wt + p) where C, b, and p are arbitrary constants. Said primitive integral, hencforth 'A_f', has the general form: A_f = Ce^(at + b)(A sin(wt + p) + B cos(wt + p)). Returns 'A' and 'B' found in the above ide...
def int_exp_sin(a, w): """ Finds the primitive integral of the function, f(t | a, w) := C e^(at + b) sin(wt + p) where C, b, and p are arbitrary constants. Said primitive integral, hencforth 'A_f', has the general form: A_f = Ce^(at + b)(A sin(wt + p) + B cos(wt + p)). Returns 'A' and 'B' found in the above ...
# Space : O(n) # Time : O(n) class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: n = len(numbers) hashmap = {numbers[i]: (i+1) for i in range(n)} for i in range(n): if target - numbers[i] in hashmap: return [i+1, hashmap[target - num...
class Solution: def two_sum(self, numbers: List[int], target: int) -> List[int]: n = len(numbers) hashmap = {numbers[i]: i + 1 for i in range(n)} for i in range(n): if target - numbers[i] in hashmap: return [i + 1, hashmap[target - numbers[i]]] return []
""" Problem 14 ========== """ def collatz_sequence(n): u = n c = 1 while u != 1: c += 1 if u % 2 == 0: u = u // 2 else: u = 3 * u + 1 return c def collatz_list_naive(N): L = [0, 1] for i in range(2, N): L.append(collatz_sequence(i)) ...
""" Problem 14 ========== """ def collatz_sequence(n): u = n c = 1 while u != 1: c += 1 if u % 2 == 0: u = u // 2 else: u = 3 * u + 1 return c def collatz_list_naive(N): l = [0, 1] for i in range(2, N): L.append(collatz_sequence(i)) r...
GUEST_USER = { "Properties": { "highvalue": False, "name": "GUEST@DOMAIN_NAME.DOMAIN_SUFFIX", "domain": "DOMAIN_NAME.DOMAIN_SUFFIX", "objectid": "DOMAIN_SID-501", "distinguishedname": "CN=Guest,CN=Users,DC=DOMAIN_NAME,DC=DOMAIN_SUFFIX", "description": "Built-in acco...
guest_user = {'Properties': {'highvalue': False, 'name': 'GUEST@DOMAIN_NAME.DOMAIN_SUFFIX', 'domain': 'DOMAIN_NAME.DOMAIN_SUFFIX', 'objectid': 'DOMAIN_SID-501', 'distinguishedname': 'CN=Guest,CN=Users,DC=DOMAIN_NAME,DC=DOMAIN_SUFFIX', 'description': 'Built-in account for guest access to the computer/domain', 'dontreqpr...
# -*- coding: utf-8 -*- """ Config """ SECRET_KEY = 'your-secret-key' GITLAB_URL = 'http://my-gitlab' GITLAB_APP_ID = 'my-app-id' GITLAB_APP_SECRET = 'my-app-secret'
""" Config """ secret_key = 'your-secret-key' gitlab_url = 'http://my-gitlab' gitlab_app_id = 'my-app-id' gitlab_app_secret = 'my-app-secret'
expected_output = { "location": { "R0 R1": { "auto_abort_timer": "inactive", "pkg_state": { 1: {"filename_version": "10.106.1.0.277", "state": "I", "type": "IMG"}, 2: {"filename_version": "10.106.1.0.277", "state": "C", "type": "IMG"}, }, ...
expected_output = {'location': {'R0 R1': {'auto_abort_timer': 'inactive', 'pkg_state': {1: {'filename_version': '10.106.1.0.277', 'state': 'I', 'type': 'IMG'}, 2: {'filename_version': '10.106.1.0.277', 'state': 'C', 'type': 'IMG'}}}}}
#!/usr/bin/env python # # Copyright (c) 2018 10X Genomics, Inc. All rights reserved. # # tsne TSNE_N_COMPONENTS = 2 TSNE_DEFAULT_KEY = '2' TSNE_DEFAULT_PERPLEXITY = 30 TSNE_THETA = 0.5 RANDOM_STATE = 0 TSNE_MAX_ITER = 1000 TSNE_STOP_LYING_ITER = 250 TSNE_MOM_SWITCH_ITER = 250 ANALYSIS_H5_TSNE_GROUP = 'tsne' # cluster...
tsne_n_components = 2 tsne_default_key = '2' tsne_default_perplexity = 30 tsne_theta = 0.5 random_state = 0 tsne_max_iter = 1000 tsne_stop_lying_iter = 250 tsne_mom_switch_iter = 250 analysis_h5_tsne_group = 'tsne' analysis_h5_clustering_group = 'clustering' analysis_h5_kmeans_group = 'kmeans' analysis_h5_kmedoids_grou...
if body== True: force_vec = ass.loadasem(loads, IBC, neq) + aux.body_forces(elements, nodes, neq, DME , force_y=aux.force_y ) else: force_vec = ass.loadasem(loads, IBC, neq) + aux.body_forces(elements, nodes, neq, DME ) UG = sol.static_sol(mat_rigidez, force_vec) UC = pos.complete_disp(IBC, nodes, UG)
if body == True: force_vec = ass.loadasem(loads, IBC, neq) + aux.body_forces(elements, nodes, neq, DME, force_y=aux.force_y) else: force_vec = ass.loadasem(loads, IBC, neq) + aux.body_forces(elements, nodes, neq, DME) ug = sol.static_sol(mat_rigidez, force_vec) uc = pos.complete_disp(IBC, nodes, UG)
#!/usr/bin/python # Filename: print_tuple.py age = 22 myempty = () print(len(myempty)) a1 = ('aa',) print(len(a1)) a2 = ('abcd') print(len(a2),a2[3]) name = ('Swaroop') print ('%s is %d years old' % (name, age)) print ('Why is %s playing with that python?' % name)
age = 22 myempty = () print(len(myempty)) a1 = ('aa',) print(len(a1)) a2 = 'abcd' print(len(a2), a2[3]) name = 'Swaroop' print('%s is %d years old' % (name, age)) print('Why is %s playing with that python?' % name)
"""converted from ..\fonts\ami-ega__8x14.bin """ WIDTH = 8 HEIGHT = 14 FIRST = 0x20 LAST = 0x7f _FONT =\ b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\ b'\x00\x00\x18\x18\x18\x18\x18\x18\x00\x18\x18\x00\x00\x00'\ b'\x00\xcc\xcc\xcc\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00'\ b'\x00\x00\x36\x6c\x6c\xfe\x6c\x...
"""converted from ..\x0conts\x07mi-ega__8x14.bin """ width = 8 height = 14 first = 32 last = 127 _font = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\x18\x18\x18\x18\x18\x00\x18\x18\x00\x00\x00\x00\xcc\xcc\xccH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x006ll\xfel\xfell\xd8\x00\x00\x00\x00\x18\x...
cashed_results = {} def calc_costs(i): """Memoization of the function to store results and not have to calculate them multiple times. """ global cashed_results if i not in cashed_results: cashed_results[i] = ((i**2) + i) / 2 return cashed_results[i] # Parse data with open('data.txt') as f: ...
cashed_results = {} def calc_costs(i): """Memoization of the function to store results and not have to calculate them multiple times. """ global cashed_results if i not in cashed_results: cashed_results[i] = (i ** 2 + i) / 2 return cashed_results[i] with open('data.txt') as f: data = [int(x...
"""Global options for the Interactive Tables""" """Show the index? Possible values: True, False and 'auto'. In mode 'auto', the index is not shown if it has no name and its content is range(N)""" showIndex = "auto" """Default styling options. See https://datatables.net/manual/styling/classes""" classes = ["display"] ...
"""Global options for the Interactive Tables""" "Show the index? Possible values: True, False and 'auto'. In mode 'auto', the index is not shown\nif it has no name and its content is range(N)" show_index = 'auto' 'Default styling options. See https://datatables.net/manual/styling/classes' classes = ['display'] 'Default...
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Date : 2018-01-02 11:33:15 # @Author : YeHarold (1174484433@qq.com) # @Link : https://github.com/Yeharold def add(a,b): c = a + b return c
def add(a, b): c = a + b return c
# -*- encoding:utf8 -*- class BaseEvaluator: def evaluate(self, candidate): # Develop your evaluation functions return 0 def select_best(self, candidates): if not candidates: return None scored = [(c, self.evaluate(c)) for c in candidates] best = sorted(score...
class Baseevaluator: def evaluate(self, candidate): return 0 def select_best(self, candidates): if not candidates: return None scored = [(c, self.evaluate(c)) for c in candidates] best = sorted(scored, key=lambda x: -x[1])[0][0] return best class Simpleeoje...
"""Write a function that takes in a Binary Tree and returns its diameter. The diameter of a binary tree is defined as the length of its longest path, even if that path doesn't pass through the root of the tree. A path is a collection of connected nodes in a tree, where no node is connected to more than two other node...
"""Write a function that takes in a Binary Tree and returns its diameter. The diameter of a binary tree is defined as the length of its longest path, even if that path doesn't pass through the root of the tree. A path is a collection of connected nodes in a tree, where no node is connected to more than two other node...
# # PySNMP MIB module CISCO-WAN-MODULE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-MODULE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:20:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint, constraints_union) ...
entrada = input('Digite qualquer coisa: ') print(type(entrada)) print(entrada.isnumeric()) print(entrada.isalnum()) print(entrada.isalpha())
entrada = input('Digite qualquer coisa: ') print(type(entrada)) print(entrada.isnumeric()) print(entrada.isalnum()) print(entrada.isalpha())
s = list(input()) s.pop() sans = [] for i, char in enumerate(s): if (i + 1) % 2: sans.insert( len(sans) // 2,char) else: sans.insert( (len(sans) + 1) // 2,char) print(''.join(sans))
s = list(input()) s.pop() sans = [] for (i, char) in enumerate(s): if (i + 1) % 2: sans.insert(len(sans) // 2, char) else: sans.insert((len(sans) + 1) // 2, char) print(''.join(sans))
nums = input().split() reverse = [] while nums: reverse.append(nums.pop()) print(" ".join(reverse))
nums = input().split() reverse = [] while nums: reverse.append(nums.pop()) print(' '.join(reverse))
article_body = "1. I thought of putting pen into book, turning dark ink\ into colorful, rainbow letters of love to express my feelings for you.\ But I figured I'd write the longest book in history. So, I thought\ to show off my love for you, then, I imagined, I'll have to bring\ the worl...
article_body = "1. I thought of putting pen into book, turning dark ink into colorful, rainbow letters of love to express my feelings for you. But I figured I'd write the longest book in history. So, I thought to show off my love for you, then, I imagined, I'll have to bring the world at you...
while True: highSchoolGrade=float(input("Please enter your highschool grade : ")) QudaratGrade= float(input("Please enter your Qudarat grade : ")) TahsiliGrade= float(input("Please enter your Tahsili grade : ")) if (highSchoolGrade > 100 or QudaratGrade > 100 or TahsiliGrade > 100): ...
while True: high_school_grade = float(input('Please enter your highschool grade : ')) qudarat_grade = float(input('Please enter your Qudarat grade : ')) tahsili_grade = float(input('Please enter your Tahsili grade : ')) if highSchoolGrade > 100 or QudaratGrade > 100 or TahsiliGrade > 100: print(...
""" Functions for computing merit of particular positions """ def BoundingBox(newPart, candidatePositionIndex, sheet): candidatePosition = sheet.extremePoints[candidatePositionIndex] X = candidatePosition[0] + newPart.Dim[0] Y = candidatePosition[1] + newPart.Dim[1] for i in range(len(sheet.currentPart...
""" Functions for computing merit of particular positions """ def bounding_box(newPart, candidatePositionIndex, sheet): candidate_position = sheet.extremePoints[candidatePositionIndex] x = candidatePosition[0] + newPart.Dim[0] y = candidatePosition[1] + newPart.Dim[1] for i in range(len(sheet.currentPa...
def bubble(arr): for i in range(0, len(arr) - 1): for j in range(0, len(arr)-i-1): if arr[j] > arr[j+1]: arr[j] , arr[j+1] = arr[j+1], arr[j] print(arr) if __name__ == '__main__': bubble([32,43,54,54,45,3,2,4,1,56, 9])
def bubble(arr): for i in range(0, len(arr) - 1): for j in range(0, len(arr) - i - 1): if arr[j] > arr[j + 1]: (arr[j], arr[j + 1]) = (arr[j + 1], arr[j]) print(arr) if __name__ == '__main__': bubble([32, 43, 54, 54, 45, 3, 2, 4, 1, 56, 9])
# coding=utf-8 """ Tests for Algorithms running RL models. """
""" Tests for Algorithms running RL models. """
""" Variable Assignment : we assign a value to the variable using the "=" operator. In python we need not declare the variable before assigning to it unless like other IDEs We needn't tell Python what type of value variable is going to refer to. In fact we can refer the variable to a different sort of thing like a st...
""" Variable Assignment : we assign a value to the variable using the "=" operator. In python we need not declare the variable before assigning to it unless like other IDEs We needn't tell Python what type of value variable is going to refer to. In fact we can refer the variable to a different sort of thing like a st...
class Node(): def __init__(self, data): self.data = data self.next = None class Add(): def __init__(self): print('Add class initialized') # Append a node def append(self, data): if data is None: print('No data received') return node = Nod...
class Node: def __init__(self, data): self.data = data self.next = None class Add: def __init__(self): print('Add class initialized') def append(self, data): if data is None: print('No data received') return node = node(data) if sel...
# Network Delay Time # There are N network nodes, labelled 1 to N. Given times, a list of travel times as directed edges times[i] = (u, v, w), # where u is the source node, v is the target node, and w is the time it takes for a signal to travel from source to target. # Now send a signal from node K. How long will it ta...
class Solution(object): def network_delay_time(self, times, N, K): """ :type times: List[List[int]] :type N: int :type K: int :rtype: int """ adj_map = collections.defaultdict(dict) dist = {i: float('inf') for i in range(1, N + 1)} dist[K] = 0...
DESCRIPTION = 'multiplica por 3' def get_query(): """ Retorna um objeto query das coisas que precisam ser migradas """ raise Exception("Deu pau na query") def migrate_one(entity): """ Executa a migracao pra um elemento retornado pela query """ raise Exception("Deu pau na migracao")
description = 'multiplica por 3' def get_query(): """ Retorna um objeto query das coisas que precisam ser migradas """ raise exception('Deu pau na query') def migrate_one(entity): """ Executa a migracao pra um elemento retornado pela query """ raise exception('Deu pau na migracao')
Lidar = { "LocationX": -64.0, "LocationY": 7.0, "LocationZ": 3.74, "Pitch": 0, "Yaw": 0, "Roll": 0 } Lidar_Town03 = { "LocationX": -95, "LocationY": 120, "LocationZ": 2.74, "Pitch": 0, "Yaw": 0, "Roll": 0 } Lidar_KITTI = { "LocationX": -93, "...
lidar = {'LocationX': -64.0, 'LocationY': 7.0, 'LocationZ': 3.74, 'Pitch': 0, 'Yaw': 0, 'Roll': 0} lidar__town03 = {'LocationX': -95, 'LocationY': 120, 'LocationZ': 2.74, 'Pitch': 0, 'Yaw': 0, 'Roll': 0} lidar_kitti = {'LocationX': -93, 'LocationY': 124, 'LocationZ': 1.73, 'Pitch': 0, 'Yaw': 0, 'Roll': 0} camera = {'Lo...
n = int(input()) okay = [int(x) for x in input().split()] a = set() a.add(0) counter = n for i in range(n): k = okay[i] if not k in a: counter -= 1 a.add(k) print(counter)
n = int(input()) okay = [int(x) for x in input().split()] a = set() a.add(0) counter = n for i in range(n): k = okay[i] if not k in a: counter -= 1 a.add(k) print(counter)
h = int(input()) cnt = 0 while h > 1: h //= 2 cnt += 1 print(2 ** (cnt + 1) - 1)
h = int(input()) cnt = 0 while h > 1: h //= 2 cnt += 1 print(2 ** (cnt + 1) - 1)
''' For your reference: class TreeNode: def __init__(self): self.children = [] ''' # Perform a DFS but at each leaf perform max # Pass along the level in recursive calls def find_height(root): def dfs_helper(node, level, hmax): if not node.children: if level >...
""" For your reference: class TreeNode: def __init__(self): self.children = [] """ def find_height(root): def dfs_helper(node, level, hmax): if not node.children: if level > hmax[0]: hmax[0] = level return for n in node.chil...
def _openssl_dgst_sign_impl(ctx): ctx.actions.expand_template( template = ctx.file._template, output = ctx.outputs.executable, substitutions = { "{{SRC}}": ctx.file.src.short_path, }, is_executable = True, ) return [DefaultInfo( runfiles = ctx.run...
def _openssl_dgst_sign_impl(ctx): ctx.actions.expand_template(template=ctx.file._template, output=ctx.outputs.executable, substitutions={'{{SRC}}': ctx.file.src.short_path}, is_executable=True) return [default_info(runfiles=ctx.runfiles([ctx.file.src]))] openssl_dgst_sign = rule(implementation=_openssl_dgst_sig...
#!/bin/python def getName(t, i): if "location" in i: t = t + "_" t = t + i["location"] if "name" in i: t = t + "_" t = t + i["name"] if "unit" in i: t = t + "_" t = t + i["unit"] return t def parse(spacename,r): lat = r["location"]["lat"] lon...
def get_name(t, i): if 'location' in i: t = t + '_' t = t + i['location'] if 'name' in i: t = t + '_' t = t + i['name'] if 'unit' in i: t = t + '_' t = t + i['unit'] return t def parse(spacename, r): lat = r['location']['lat'] lon = r['location'][...
class InvalidBetException(Exception): """ Exception raised when player places an invalid set of bets. """ pass
class Invalidbetexception(Exception): """ Exception raised when player places an invalid set of bets. """ pass
# Databricks notebook source # MAGIC %md # MAGIC ## Rubric for this module # MAGIC - Using the silver delta table(s) that were setup by your ETL module train and validate your token recommendation engine. Split, Fit, Score, Save # MAGIC - Log all experiments using mlflow # MAGIC - capture model parameters, signature, t...
(wallet_address, start_date) = Utils.create_widgets() print(wallet_address, start_date) dbutils.notebook.exit(json.dumps({'exit_code': 'OK'}))
class Bird: def fly(self): raise NotImplementedError class Eagle(Bird): def fly(self): print("very fast") if __name__ == "__main__": eagle = Eagel() eagle.fly()
class Bird: def fly(self): raise NotImplementedError class Eagle(Bird): def fly(self): print('very fast') if __name__ == '__main__': eagle = eagel() eagle.fly()
fib = [0, 1] for x in range(60): b = fib[-2] + fib[-1] fib.append(b) vzs = int(input()) i = [int(input()) for x in range(vzs)] [print(f'Fib({x}) = {fib[x]}') for x in i]
fib = [0, 1] for x in range(60): b = fib[-2] + fib[-1] fib.append(b) vzs = int(input()) i = [int(input()) for x in range(vzs)] [print(f'Fib({x}) = {fib[x]}') for x in i]
# Author: James Tam # Version: November 2016 # Exercise 1: modifying list elements def start(): list = [1,2,3,4] print(list) index = int(input("Enter index of element to change: ")) while((index<0) or (index>3)): index = int(input("Invalid index! Enter again: ")) #here we check if the in...
def start(): list = [1, 2, 3, 4] print(list) index = int(input('Enter index of element to change: ')) while index < 0 or index > 3: index = int(input('Invalid index! Enter again: ')) new_value = int(input('Enter the new integer value for element: ')) while newValue < 0: new_value...
lst = ["A", "B", "C"] item = {"key": "value"} print(item["key"]) item2 = {"name": "Drew"} print(item2["name"]) #dictionary can contain multiple pair of information hero = {"name": "Iron Man", "nationality": "United States", "type": False} item3 = {"bag": ["laptop", "usb", "food"], "pocket": [5.00, 1.00, 'gum'], ...
lst = ['A', 'B', 'C'] item = {'key': 'value'} print(item['key']) item2 = {'name': 'Drew'} print(item2['name']) hero = {'name': 'Iron Man', 'nationality': 'United States', 'type': False} item3 = {'bag': ['laptop', 'usb', 'food'], 'pocket': [5.0, 1.0, 'gum'], 'reddit': {'key': [1, 2, 3, 4]}} print(item3['bag']) print(ite...
""" === Big O Notations Rules - Drop Non Dominants === Drop non dominants terms since these aren't going to change significantly the amount of operations according to the input size In Big O, our main concern is scalability and as the input size gets larger, then we should analyze the operations that are going to ...
""" === Big O Notations Rules - Drop Non Dominants === Drop non dominants terms since these aren't going to change significantly the amount of operations according to the input size In Big O, our main concern is scalability and as the input size gets larger, then we should analyze the operations that are going to ...
# Calculate the score for each word # 4 letter word = 1 pt # For a word longer than 4 letters: # 1 pt for each letter # A 5 letter word receives 5 pts. # Panagrams receive 7 extra pts. def get_word_points(word, letters): word_len = len(word) if word_len == 4: points = 1 else: points ...
def get_word_points(word, letters): word_len = len(word) if word_len == 4: points = 1 else: points = word_len if is_panagram(word, letters): points += 7 return points def is_panagram(word, letters): for letter in letters: if letter not in word: return...
def maxSubArraySum(a,size): max_so_far = -1000000000000000000000 max_ending_here = 0 for i in range(0, size): max_ending_here = max_ending_here + a[i] if (max_so_far < max_ending_here): max_so_far = max_ending_here if max_ending_here < 0: max_ending_h...
def max_sub_array_sum(a, size): max_so_far = -1000000000000000000000 max_ending_here = 0 for i in range(0, size): max_ending_here = max_ending_here + a[i] if max_so_far < max_ending_here: max_so_far = max_ending_here if max_ending_here < 0: max_ending_here = 0...
# 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 """ 422 / 422 test cases passed. Runtime: 28 ms Memory Usage: 37.9 MB """ class Solution: def findTarget(self, root: Option...
""" 422 / 422 test cases passed. Runtime: 28 ms Memory Usage: 37.9 MB """ class Solution: def find_target(self, root: Optional[TreeNode], k: int) -> bool: if not root: return False que = collections.deque([root]) rec = set() while que: node = que.popleft() ...
WAVAX = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7" PNG = "0x60781c2586d68229fde47564546784ab3faca982" WETH = "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab" # WETH.e DAI = "0xd586e7f844cea2f87f50152665bcbc2c279d8d70" # DAI.e USDC = "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664" # USDC.e USDT = "0xc7198437980c041c805a1edcb...
wavax = '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7' png = '0x60781c2586d68229fde47564546784ab3faca982' weth = '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab' dai = '0xd586e7f844cea2f87f50152665bcbc2c279d8d70' usdc = '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664' usdt = '0xc7198437980c041c805a1edcba50c1ce5db95118'
class Hero: #private class variabel __jumlah = 0; def __init__(self,name): self.__name = name Hero.__jumlah += 1 # method ini hanya berlaku untuk objek def getJumlah(self): return Hero.__jumlah # method ini tidak berlaku untuk objek tapi berlaku untuk class def getJumlah1(): return Hero.__jumlah # ...
class Hero: __jumlah = 0 def __init__(self, name): self.__name = name Hero.__jumlah += 1 def get_jumlah(self): return Hero.__jumlah def get_jumlah1(): return Hero.__jumlah @staticmethod def get_jumlah2(): return Hero.__jumlah @classmethod def ...
"""List of repositories to check.""" repolist = [] class Repositories(): """Class representing list of repositories.""" def __init__(self, config): """Load list of repositories from the provided config object.""" self._repolist = config.get_repolist() @property def repolist(self): ...
"""List of repositories to check.""" repolist = [] class Repositories: """Class representing list of repositories.""" def __init__(self, config): """Load list of repositories from the provided config object.""" self._repolist = config.get_repolist() @property def repolist(self): ...
class SVC: """C-Support Vector Classification. The implementation is based on libsvm. The fit time scales at least quadratically with the number of samples and may be impractical beyond tens of thousands of samples. For large datasets consider using :class:`sklearn.svm.LinearSVC` or :class:`skle...
class Svc: """C-Support Vector Classification. The implementation is based on libsvm. The fit time scales at least quadratically with the number of samples and may be impractical beyond tens of thousands of samples. For large datasets consider using :class:`sklearn.svm.LinearSVC` or :class:`skle...
l1 = [1,4,5,6] l2 = l1[:] l1.append('gern') print(l1) print(l2)
l1 = [1, 4, 5, 6] l2 = l1[:] l1.append('gern') print(l1) print(l2)
PROJECT_TITLE = 'xmolpp2' PLUGINS = [ ] INPUT_PAGES = ['index.rst'] OUTPUT = f'../_/site' LINKS_NAVBAR1 = [ ('C++ API', './api/c++', []), ('Python API', './api/python', []), ('Github', 'https://github.com/sizmailov/pyxmolpp2', []) ] SEARCH_DISABLED = True
project_title = 'xmolpp2' plugins = [] input_pages = ['index.rst'] output = f'../_/site' links_navbar1 = [('C++ API', './api/c++', []), ('Python API', './api/python', []), ('Github', 'https://github.com/sizmailov/pyxmolpp2', [])] search_disabled = True
try: arr= [] print(" Enter the integer inputs and type 'stop' when you are done\n" ) while True: arr.append(int(input())) except:# if the input is not-integer, just continue to the next step unique=[] repeat=[] s=0 for i in arr: if i not in unique: unique.append...
try: arr = [] print(" Enter the integer inputs and type 'stop' when you are done\n") while True: arr.append(int(input())) except: unique = [] repeat = [] s = 0 for i in arr: if i not in unique: unique.append(i) s = s + i elif i not in repeat: ...
#!/usr/bin/env python3 def merge_data(dfl, dfr, col_name): for column in dfr.columns.values: col = col_name + str(column) dfl[col] = dfr[column]
def merge_data(dfl, dfr, col_name): for column in dfr.columns.values: col = col_name + str(column) dfl[col] = dfr[column]
################## # General Errors # ################## # No error occurred. NO_ERROR = 0 # General error occurred. FAILED = 1 # Operating system error occurred. SYS_ERROR = 2 # Out of memory. OUT_OF_MEMORY = 3 # Internal error occurred. INTERNAL = 4 # Illegal number representation given. ILLEGAL_NUMBER = 5 # N...
no_error = 0 failed = 1 sys_error = 2 out_of_memory = 3 internal = 4 illegal_number = 5 numeric_overflow = 6 illegal_option = 7 dead_pid = 8 not_implemented = 9 bad_parameter = 10 forbidden = 11 out_of_memory_mmap = 12 corrupted_csv = 13 file_not_found = 14 cannot_write_file = 15 cannot_overwrite_file = 16 type_error =...
class BinaryTree(LogicalBase): def _get(self, node, key): while node is not None: if key < node.key: node = self._follow(node.left_ref) elif node.key < key: node = self._follow(node.right_ref) else: return self._follow(node.value_ref) raise KeyError def _insert(self, node, key, value_...
class Binarytree(LogicalBase): def _get(self, node, key): while node is not None: if key < node.key: node = self._follow(node.left_ref) elif node.key < key: node = self._follow(node.right_ref) else: return self._follow(node...
class BagOfHolding: '''Generic holder class; allows for .<anything> attribute usage ''' pass class FreqPair: '''Container for an arbitrary object and an observed frequency count ''' item = None freq = 0 def __init__(self, item, freq=0): self.item = item self.freq = freq...
class Bagofholding: """Generic holder class; allows for .<anything> attribute usage """ pass class Freqpair: """Container for an arbitrary object and an observed frequency count """ item = None freq = 0 def __init__(self, item, freq=0): self.item = item self.freq = freq...
def fav_city(name): print(f"One of my favorite cities is {name}.") fav_city("Santa Barbara, California!") fav_city("Madrid, Spain") fav_city("Moscow, Russia") # Library: A grouping of variables and functions that someone else has written and verified for day to day usage. # Tiobe-index is a great tracker to see w...
def fav_city(name): print(f'One of my favorite cities is {name}.') fav_city('Santa Barbara, California!') fav_city('Madrid, Spain') fav_city('Moscow, Russia')
#encoding:utf-8 subreddit = 'climbing' t_channel = '@r_climbing' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'climbing' t_channel = '@r_climbing' def send_post(submission, r2t): return r2t.send_simple(submission)
# # PySNMP MIB module CISCO-GSLB-TC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-GSLB-TC-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:59:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
pessoas = {'nome': 'Gustavo', 'sexo': 'M', 'idade': 22} del pessoas['sexo'] # APAGA O ITEM (chave + valor) "SEXO" for k, v in pessoas.items(): print(f'{k} = {v}') print() pessoas['nome'] = 'Leandro' # A CHAVE "NOME" PASSA A SER O VALOR "LEANDRO" for k, v in pessoas.items(): print(f'{k} = {v}') print() ...
pessoas = {'nome': 'Gustavo', 'sexo': 'M', 'idade': 22} del pessoas['sexo'] for (k, v) in pessoas.items(): print(f'{k} = {v}') print() pessoas['nome'] = 'Leandro' for (k, v) in pessoas.items(): print(f'{k} = {v}') print() pessoas['peso'] = 98.5 for (k, v) in pessoas.items(): print(f'{k} = {v}')
TICKET_PRICE = 10 tickets_remaining = 100 SERVICE_FEE = 5 def calculate_price(number_of_tickets): return number_of_tickets * TICKET_PRICE + SERVICE_FEE while tickets_remaining > 0: print("There are {} tickets remaining.".format(tickets_remaining)) username = input("What is your name? ") try: ...
ticket_price = 10 tickets_remaining = 100 service_fee = 5 def calculate_price(number_of_tickets): return number_of_tickets * TICKET_PRICE + SERVICE_FEE while tickets_remaining > 0: print('There are {} tickets remaining.'.format(tickets_remaining)) username = input('What is your name? ') try: t...
print("Tugas Pratikum 3. Latihan 3") a=100000000 for s in range(1,9): if(s>=1 and s<=2): b=a*0 print("Laba bulan ke-",s,":",b) if(s>=3 and s<=4): c=a*0.1 print("Laba bulan ke-",s,":",c) if(s>=5 and s<=7): d=a*0.5 print("Laba bulan ke-",s,":",d) if(s==8...
print('Tugas Pratikum 3. Latihan 3') a = 100000000 for s in range(1, 9): if s >= 1 and s <= 2: b = a * 0 print('Laba bulan ke-', s, ':', b) if s >= 3 and s <= 4: c = a * 0.1 print('Laba bulan ke-', s, ':', c) if s >= 5 and s <= 7: d = a * 0.5 print('Laba bulan...
''' From projecteuler.net If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. ''' #list comprehension solution def solution(n): return sum(num for num in range(1,n,1) if num%3==0 ...
""" From projecteuler.net If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def solution(n): return sum((num for num in range(1, n, 1) if num % 3 == 0 or num % 5 == 0)) def ...
size = [165, 167, 160, 173, 105, 135, 149, 122, 147, 145, 126, 99, 116, 164, 101, 175] flag = "" for s in size: flag += chr(s - 50) print(flag)
size = [165, 167, 160, 173, 105, 135, 149, 122, 147, 145, 126, 99, 116, 164, 101, 175] flag = '' for s in size: flag += chr(s - 50) print(flag)
# In this program we iterate from 1 to m with iterator i, if which, it yeilds 0 as remainder, we add it to the factors of m in fm list. # Similarly we do for n and store it in fn. # we compare fm and fn for common factors, if we found any, we store it on another list called cf. # We then return the last element of the ...
def gcd(m, n): fm = [] for i in range(1, m + 1): if m % i == 0: fm.append(i) fn = [] for j in range(1, n + 1): if n % j == 0: fn.append(j) cf = [] for f in fm: if f in fn: cf.append(f) return cf[-1] print(gcd(8, 6))
class ListNode: def __init__(self, x): self.val = x self.next = None def cre_linked_list(arr): head = ListNode(arr[0]) res = head for a in arr[1:]: tmp = ListNode(a) head.next, head = tmp, tmp return res head = cre_linked_list([1, 1, 2, 2, 3, 3, 4, 4]) class Sol...
class Listnode: def __init__(self, x): self.val = x self.next = None def cre_linked_list(arr): head = list_node(arr[0]) res = head for a in arr[1:]: tmp = list_node(a) (head.next, head) = (tmp, tmp) return res head = cre_linked_list([1, 1, 2, 2, 3, 3, 4, 4]) class ...
def compute_lcm(x, y): if x > y: greater = x else: greater = y while(True): if((greater % x == 0) and (greater % y == 0)): lcm = greater break greater += 1 return lcm def hcfnaive(a,b): if(b==0): return a else: return hcfnaive(b,a%b...
def compute_lcm(x, y): if x > y: greater = x else: greater = y while True: if greater % x == 0 and greater % y == 0: lcm = greater break greater += 1 return lcm def hcfnaive(a, b): if b == 0: return a else: return hcfnaive(...
"""Count the number of Duplicates Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits Example: "abcde"...
"""Count the number of Duplicates Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits Example: "abcde"...
''' URL: https://leetcode.com/problems/groups-of-special-equivalent-strings/ Difficulty: Easy Description: Groups of Special-Equivalent Strings You are given an array A of strings. A move onto S consists of swapping any two even indexed characters of S, or any two odd indexed characters of S. Two strings S and T a...
""" URL: https://leetcode.com/problems/groups-of-special-equivalent-strings/ Difficulty: Easy Description: Groups of Special-Equivalent Strings You are given an array A of strings. A move onto S consists of swapping any two even indexed characters of S, or any two odd indexed characters of S. Two strings S and T a...
# # This file contains definitions of text and functions useful for debugging # def hexdump(s): print(":".join("{:02x}".format(c) for c in s)) # Textual messages for the bits in the status message response status_summary_text = [ # byte 0 [ ['Command not complete','Command complete'], # bit 0 ...
def hexdump(s): print(':'.join(('{:02x}'.format(c) for c in s))) status_summary_text = [[['Command not complete', 'Command complete'], ['Cash receipt not in right home position', 'Cash receipt in right home position'], ['Print head is not in left home position', 'Print head is in left home position'], ['Print head ...
''' Given an array of n distinct non-empty strings, you need to generate minimal possible abbreviations for every word following rules below. Begin with the first character and then the number of characters abbreviated, which followed by the last character. If there are any conflict, that is more than one words share ...
""" Given an array of n distinct non-empty strings, you need to generate minimal possible abbreviations for every word following rules below. Begin with the first character and then the number of characters abbreviated, which followed by the last character. If there are any conflict, that is more than one words share ...
def get_new_board(dimension): """ Return a multidimensional list that represents an empty board (i.e. empty string at every position). :param: dimension: integer representing the nxn dimension of your board. For example, if dimension is 3, you should return a 3x3 board :return: For example i...
def get_new_board(dimension): """ Return a multidimensional list that represents an empty board (i.e. empty string at every position). :param: dimension: integer representing the nxn dimension of your board. For example, if dimension is 3, you should return a 3x3 board :return: For example i...
FOL_TEST_WORLD = { 'domain': [1, 2, 3, 4], 'constants': { 'a': 1, 'b': 2, 'c': 3 }, 'extensions': { "P": [[1]], "R": [[1], [2], [4]], "Q": [[1], [2], [3], [4]], "C": [[1, 2], [2, 3]], "D": [[2, 3]] } } # see readme for link to original...
fol_test_world = {'domain': [1, 2, 3, 4], 'constants': {'a': 1, 'b': 2, 'c': 3}, 'extensions': {'P': [[1]], 'R': [[1], [2], [4]], 'Q': [[1], [2], [3], [4]], 'C': [[1, 2], [2, 3]], 'D': [[2, 3]]}} fol_medium_world = {'domain': [1, 2, 3, 4, 5], 'constants': {'j': 1, 'm': 2, 'r': 3, 'c': 4}, 'extensions': {'I': [[1], [2],...
input = """ a(1). a(2) :- true. true. """ output = """ a(1). a(2) :- true. true. """
input = '\na(1).\na(2) :- true.\ntrue.\n' output = '\na(1).\na(2) :- true.\ntrue.\n'
# # PySNMP MIB module ZYXEL-VLAN-STACK-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-VLAN-STACK-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:46:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
def callwith(f, *args, **kwargs): def inner(*ignoreargs, **ignorekwargs): return f(*args, **kwargs) return inner def eq(target): def inner(index, item: dict): return item == target return inner def veq(key, val): def inner(index: int, item: dict): return item[key] == val ...
def callwith(f, *args, **kwargs): def inner(*ignoreargs, **ignorekwargs): return f(*args, **kwargs) return inner def eq(target): def inner(index, item: dict): return item == target return inner def veq(key, val): def inner(index: int, item: dict): return item[key] == val...
html_data = ''' <div class="main-container container-sm"> <h3 class="text-center"> links for <a href=/abs/1987gady.book.....B/abstract><b>1987gady.book.....B</b></a></h3> <div class="list-group"> <div class="list-group-item"> <a href="http://...
html_data = '\n <div class="main-container container-sm">\n \n <h3 class="text-center"> links for <a href=/abs/1987gady.book.....B/abstract><b>1987gady.book.....B</b></a></h3>\n <div class="list-group">\n \n <div class="list-group-item">\n <a href="ht...
def get_density(medium, temp_K): if medium == "water": A = 206.7 B = 7.01013 C = -0.0195311 D = 0.0000164685 elif medium == "glycol": #From Internet (2016/04/08) Propylene Glycol A = 1187.6 B = -0.3789 C = -0.0003 D = -0.0000007 else: ...
def get_density(medium, temp_K): if medium == 'water': a = 206.7 b = 7.01013 c = -0.0195311 d = 1.64685e-05 elif medium == 'glycol': a = 1187.6 b = -0.3789 c = -0.0003 d = -7e-07 else: return 0 water_density_kg_per_cubic_meter = A +...
class Sku: def __init__(self, sku, price, storage, shipping_fee, style_color, style_size, image_url, extra_image_list, weight=300): self.sku = sku self.price = price self.storage = storage self.shipping_fee = shipping_fee self.style_color = style_color ...
class Sku: def __init__(self, sku, price, storage, shipping_fee, style_color, style_size, image_url, extra_image_list, weight=300): self.sku = sku self.price = price self.storage = storage self.shipping_fee = shipping_fee self.style_color = style_color self.style_siz...
""" STATEMENT Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. CLARIFICATIONS - EXAMPLES (needs to be drawn) COMMENTS - A recursive solution over the left and right subtree should work. - The base cases are tricky, si...
""" STATEMENT Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. CLARIFICATIONS - EXAMPLES (needs to be drawn) COMMENTS - A recursive solution over the left and right subtree should work. - The base cases are tricky, si...
class A: """ Namespaces: The Whole Story:: 1. qualified and unqualified names are treated differently, and that some scopes serve to initialize object namespaces; 2. Unqualified names (e.g., X) deal with scopes; 3. Qualified attribute names (e.g., object.x) use object namespaces; 4. Some scopes initialize o...
class A: """ Namespaces: The Whole Story:: 1. qualified and unqualified names are treated differently, and that some scopes serve to initialize object namespaces; 2. Unqualified names (e.g., X) deal with scopes; 3. Qualified attribute names (e.g., object.x) use object namespaces; 4. Some scopes initializ...
if 5<6: print('Linija1') print('Linija2') print("Linija3") print("Linija4") if 5>6: print("Linija1") print("Linija2") print("Linija3") print("Linija4")
if 5 < 6: print('Linija1') print('Linija2') print('Linija3') print('Linija4') if 5 > 6: print('Linija1') print('Linija2') print('Linija3') print('Linija4')