content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def findDecision(obj): #obj[0]: Passanger, obj[1]: Coupon, obj[2]: Education, obj[3]: Occupation, obj[4]: Bar, obj[5]: Restaurant20to50, obj[6]: Direction_same, obj[7]: Distance # {"feature": "Passanger", "instances": 51, "metric_value": 0.9526, "depth": 1} if obj[0]>0: # {"feature": "Education", "instances": 47, "...
def find_decision(obj): if obj[0] > 0: if obj[2] <= 2: if obj[3] <= 12: if obj[4] <= 2.0: if obj[5] <= 1.0: if obj[7] <= 2: if obj[6] <= 0: if obj[1] > 1: ...
# Copyright 2020 Chen Bainian # Licensed under the Apache License, Version 2.0 __version__ = '0.2.2'
__version__ = '0.2.2'
# NUCLEOTIDES BASES = ['A' 'C', 'G', 'T'] dna_letters = "GATC" dna_extended_letters = "GATCRYWSMKHBVDN" rna_letters = "GAUC" rna_extended_letters = "GAUCRYWSMKHBVDN" dna_ambiguity = { "A": "A", "C": "C", "G": "G", "T": "T", "M": "AC", "R": "AG", "W": "AT", "S": "CG", "Y": "CT",...
bases = ['AC', 'G', 'T'] dna_letters = 'GATC' dna_extended_letters = 'GATCRYWSMKHBVDN' rna_letters = 'GAUC' rna_extended_letters = 'GAUCRYWSMKHBVDN' dna_ambiguity = {'A': 'A', 'C': 'C', 'G': 'G', 'T': 'T', 'M': 'AC', 'R': 'AG', 'W': 'AT', 'S': 'CG', 'Y': 'CT', 'K': 'GT', 'V': 'ACG', 'H': 'ACT', 'D': 'AGT', 'B': 'CGT', ...
""" Assignment 1 Write a short script that will get some information from the user, reformat the information and print it back to the terminal. """ name = input("What is your name? ") favorite_color = input("What is your favorite color? ") print(f"{name}'s favorite color is {favorite_color}.")
""" Assignment 1 Write a short script that will get some information from the user, reformat the information and print it back to the terminal. """ name = input('What is your name? ') favorite_color = input('What is your favorite color? ') print(f"{name}'s favorite color is {favorite_color}.")
expected_output = { "bgp_id": 5918, "vrf": { "default": { "neighbor": { "192.168.10.253": { "address_family": { "vpnv4 unicast": { "activity_paths": "23637710/17596802", "activ...
expected_output = {'bgp_id': 5918, 'vrf': {'default': {'neighbor': {'192.168.10.253': {'address_family': {'vpnv4 unicast': {'activity_paths': '23637710/17596802', 'activity_prefixes': '11724891/9708585', 'as': 65555, 'attribute_entries': '5101/4700', 'bgp_table_version': 33086714, 'cache_entries': {'filter-list': {'mem...
# File: proofpoint_consts.py # Copyright (c) 2017-2020 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # PP_API_BASE_URL = "https://tap-api-v2.proofpoint.com" PP_API_PATH_CLICKS_BLOCKED = "/v2/siem/clicks/blocked" PP_API_PATH_CLICKS_PERMITTED = "/v2/siem/clicks/permitted" PP...
pp_api_base_url = 'https://tap-api-v2.proofpoint.com' pp_api_path_clicks_blocked = '/v2/siem/clicks/blocked' pp_api_path_clicks_permitted = '/v2/siem/clicks/permitted' pp_api_path_messages_blocked = '/v2/siem/messages/blocked' pp_api_path_messages_delivered = '/v2/siem/messages/delivered' pp_api_path_issues = '/v2/siem...
def caeser(message, key): x = list((map(ord,message))) def foo(a): if 96 < a < 123: if a + key < 123: return chr(a + key) else: return chr(a + key - 123 + 97) else: return chr(a) return ''.join(map(foo,x)).upper()
def caeser(message, key): x = list(map(ord, message)) def foo(a): if 96 < a < 123: if a + key < 123: return chr(a + key) else: return chr(a + key - 123 + 97) else: return chr(a) return ''.join(map(foo, x)).upper()
# Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). # # For example, this binary tree [1,2,2,3,4,4,3] is symmetric: # # 1 # / \ # 2 2 # / \ / \ # 3 4 4 3 class TreeNode: def __init__(self, x): self.val = x self.left = None self.rig...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def is_symmetric(self, root): if not root: return True def helper(node1, node2): if not node1 and (not node2): return True ...
class Solution(object): def combinationSum2(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] >>> sln = Solution() >>> sln.combinationSum2([1, 1, 2, 3], 3) [[3], [1, 2]] >>> sln.combinationSum2([1, 2, ...
class Solution(object): def combination_sum2(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] >>> sln = Solution() >>> sln.combinationSum2([1, 1, 2, 3], 3) [[3], [1, 2]] >>> sln.combinationSum2([1, 2...
# Artifact management. # Forensic artifacts are a way of semantically specifying various parts of # information to collect from a system. They encode domain specific information # into an easily sharable specification. # For more information, see https://github.com/ForensicArtifacts def index(): return dict() ...
def index(): return dict() template = '\n# You can add comments anywhere in the artifact file.\nname: ArtifactTemplate\ndoc: |\n Here you describe the artifact for humans.\n\nsources:\n - type: REKALL_EFILTER\n attributes:\n\n # This is an EFilter query. Here "maps" is a plugin, and "proc_regex" is a\n ...
""" The substrate. """ class Substrate(object): """ Represents a substrate: Input coordinates, output coordinates, hidden coordinates and a resolution defaulting to 10.0. """ def __init__(self, input_coordinates, output_coordinates, hidden_coordinates=(), res=10.0): self.input_coordinates = i...
""" The substrate. """ class Substrate(object): """ Represents a substrate: Input coordinates, output coordinates, hidden coordinates and a resolution defaulting to 10.0. """ def __init__(self, input_coordinates, output_coordinates, hidden_coordinates=(), res=10.0): self.input_coordinates = in...
def adder(good, bad, ugly, **kwargs): tmp = good + bad + ugly for k in kwargs.keys(): tmp += kwargs[k] return tmp
def adder(good, bad, ugly, **kwargs): tmp = good + bad + ugly for k in kwargs.keys(): tmp += kwargs[k] return tmp
#Solution1 def power_of_four(input_number): if input_number==1 or input_number==4: return True if input_number<0 or input_number<4: return False while input_number>4: input_number = input_number/4 remainder = input_number % 4 if remainder>0: return False return True #Tests def p...
def power_of_four(input_number): if input_number == 1 or input_number == 4: return True if input_number < 0 or input_number < 4: return False while input_number > 4: input_number = input_number / 4 remainder = input_number % 4 if remainder > 0: return Fals...
""" Junta todas las constantes del sistema y los metodos que involucran la salida al GUI Esta por separado para evitar importes circulares. """ class Globals: """Proporciona la variable global que se utilizara para mandar al contexto de la GUI y la manipulacion de la variable se definen mas abajo""" resul...
""" Junta todas las constantes del sistema y los metodos que involucran la salida al GUI Esta por separado para evitar importes circulares. """ class Globals: """Proporciona la variable global que se utilizara para mandar al contexto de la GUI y la manipulacion de la variable se definen mas abajo""" result...
data = """ (7 * 5 * 6 + (9 * 8 + 3 * 3 + 5) + 7) * (6 + 3 * 9) + 6 + 7 + (7 * 5) * 4 (4 + 9 + (8 * 2) + 5) * 8 + (3 + 2 * 3 * 7 * (7 * 4 * 5) * 9) * 2 3 + 7 + (9 + 6 + 4 * 7 * 3 + 5) * 9 3 + 3 * (5 + (7 * 5 + 4 * 8 + 9 * 2) + 3) * 8 * 7 (8 + 3 + 7 * 7) + (3 + 8) * 4 + 2 2 + 9 * (7 + 3 * 3 * 8) + 9 + 3 2 * ((5 + 7 + 9 +...
data = '\n(7 * 5 * 6 + (9 * 8 + 3 * 3 + 5) + 7) * (6 + 3 * 9) + 6 + 7 + (7 * 5) * 4\n(4 + 9 + (8 * 2) + 5) * 8 + (3 + 2 * 3 * 7 * (7 * 4 * 5) * 9) * 2\n3 + 7 + (9 + 6 + 4 * 7 * 3 + 5) * 9\n3 + 3 * (5 + (7 * 5 + 4 * 8 + 9 * 2) + 3) * 8 * 7\n(8 + 3 + 7 * 7) + (3 + 8) * 4 + 2\n2 + 9 * (7 + 3 * 3 * 8) + 9 + 3\n2 * ((5 + 7 ...
def somar(): a = float(input("digite um valor: ")) b = float(input("digite outro valor: ")) soma = a + b print(soma) '''import calculadora ou form calculadora import somar #se eu colocar * no somar, nao precisa "calculadora".somar calculadora.somar()''' somar()
def somar(): a = float(input('digite um valor: ')) b = float(input('digite outro valor: ')) soma = a + b print(soma) 'import calculadora\nou \nform calculadora import somar #se eu colocar * no somar, nao precisa "calculadora".somar\ncalculadora.somar()' somar()
def constrainToInterval(val, low, high): return max(low, min(val, high)) def moveVectorTowardByAtMost(fromVec, toVec, maxDelta): """ Return the vector which is obtained by moving from fromVec toward toVec by a total distance of maxDelta. If the distance from fromVec to toVec is less than maxDelta, ...
def constrain_to_interval(val, low, high): return max(low, min(val, high)) def move_vector_toward_by_at_most(fromVec, toVec, maxDelta): """ Return the vector which is obtained by moving from fromVec toward toVec by a total distance of maxDelta. If the distance from fromVec to toVec is less than max...
class Trie: def __init__(self): self.root = Node() def search(self, s): node = self.root for c in s: node = node.next[ord(c) - ord('a')] if not node: return False return node.next[26] != None def insert(self, s): node ...
class Trie: def __init__(self): self.root = node() def search(self, s): node = self.root for c in s: node = node.next[ord(c) - ord('a')] if not node: return False return node.next[26] != None def insert(self, s): node = self....
# @TODO complete the point class class Point: def __init__(self, x, y): self.x = x self.y = y def distanceFrom(self, p2): return ((self.x - p2.x)**2 + (self.y - p2.y)**2)**0.5 # @todo complete the Line class class Line: def __init__(self, p1, p2): self.p1 = p1 sel...
class Point: def __init__(self, x, y): self.x = x self.y = y def distance_from(self, p2): return ((self.x - p2.x) ** 2 + (self.y - p2.y) ** 2) ** 0.5 class Line: def __init__(self, p1, p2): self.p1 = p1 self.p2 = p2 def get_length(self): return self.p...
""" the basic idea is that track every movement of the first player, if the other player can not make a movement, then movement the first player made is a winning movement. the optimization is to use memorization to memorize the string state that we have seen. this is a backtracking problem with memorization optimizati...
""" the basic idea is that track every movement of the first player, if the other player can not make a movement, then movement the first player made is a winning movement. the optimization is to use memorization to memorize the string state that we have seen. this is a backtracking problem with memorization optimizati...
""" lec9 class """ class car: #class name maker = 'toyota' #attribute def __init__(self,input_model): self.model = input_model def report(self): #return the attribute of the instance return self.maker,self.model #my_car= car('corolla') #print(my_car.repor...
""" lec9 class """ class Car: maker = 'toyota' def __init__(self, input_model): self.model = input_model def report(self): return (self.maker, self.model)
def qb_date_format(input_date): """ Converts date to quickbooks date format :param input_date: :return: """ return input_date.strftime("%Y-%m-%d") def qb_datetime_format(input_date): """ Converts datetime to quickbooks datetime format :param input_date: :return: """ re...
def qb_date_format(input_date): """ Converts date to quickbooks date format :param input_date: :return: """ return input_date.strftime('%Y-%m-%d') def qb_datetime_format(input_date): """ Converts datetime to quickbooks datetime format :param input_date: :return: """ retu...
class Solution: def decodeString(self, s: str) -> str: res, _ = self.dfs(s, 0) return res def dfs(self, s, i): res = '' while i < len(s) and s[i] != ']': if s[i].isdigit(): times = 0 while i < len(s) and s[i].isdigit(): ...
class Solution: def decode_string(self, s: str) -> str: (res, _) = self.dfs(s, 0) return res def dfs(self, s, i): res = '' while i < len(s) and s[i] != ']': if s[i].isdigit(): times = 0 while i < len(s) and s[i].isdigit(): ...
class Node: def __init__(self, dado=None) -> None: self.__dado: object = dado self.__prox = None @property def dado(self) -> object: return self.__dado @property def prox(self) -> object: return self.__prox @dado.setter def dado(self, novoDado) -> None: ...
class Node: def __init__(self, dado=None) -> None: self.__dado: object = dado self.__prox = None @property def dado(self) -> object: return self.__dado @property def prox(self) -> object: return self.__prox @dado.setter def dado(self, novoDado) -> None: ...
def is_palindrome(x): s = str(x) return s == s[::-1] def solve(): products = [] for i in range(100, 1000): for j in range(i, 1000): products.append(i * j) products = sorted((i * j for i in range(100, 1000) for j in range(i, 1000)), reverse = True) for p in products: ...
def is_palindrome(x): s = str(x) return s == s[::-1] def solve(): products = [] for i in range(100, 1000): for j in range(i, 1000): products.append(i * j) products = sorted((i * j for i in range(100, 1000) for j in range(i, 1000)), reverse=True) for p in products: if...
def format_metric(text: str): return text.replace('.', '_') def format_period(text: str): return text.split(',', 1)[0] def try_or_else(op, default): try: return op() except: return default
def format_metric(text: str): return text.replace('.', '_') def format_period(text: str): return text.split(',', 1)[0] def try_or_else(op, default): try: return op() except: return default
class QuestRedeemResponsePacket: def __init__(self): self.type = "QUESTREDEEMRESPONSE" self.ok = False self.message = "" def read(self, reader): self.ok = reader.readBool() self.message = reader.readStr()
class Questredeemresponsepacket: def __init__(self): self.type = 'QUESTREDEEMRESPONSE' self.ok = False self.message = '' def read(self, reader): self.ok = reader.readBool() self.message = reader.readStr()
list1 = ['abcd', 786, 2.33, 'baidu', 70.2] tinylist = [123, 'baidu'] print(list1) print(list1[0]) print(list1[1:3]) print(list1[2:]) print(tinylist * 2) print(list1 + tinylist)
list1 = ['abcd', 786, 2.33, 'baidu', 70.2] tinylist = [123, 'baidu'] print(list1) print(list1[0]) print(list1[1:3]) print(list1[2:]) print(tinylist * 2) print(list1 + tinylist)
''' https://leetcode.com/problems/bulls-and-cows/ 299. Bulls and Cows You are playing the Bulls and Cows game with your friend. You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info: The numb...
""" https://leetcode.com/problems/bulls-and-cows/ 299. Bulls and Cows You are playing the Bulls and Cows game with your friend. You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info: The numb...
current = 0 def f(): global current if current == 50: return print(current) current += 1 f() f()
current = 0 def f(): global current if current == 50: return print(current) current += 1 f() f()
""" Tema: Complejidad Algoritmica. Notacion asintotica - Recursividad multiple Curso: Pensamiento Computacional, 2da entrega. Plataforma: Platzi. Profesor: David Aroesti. Alumno: @edinsonrequena. """ def fibonacci(n): ''' Recursividad multiple O(2^n) ''' if n == 0 or n == 1: return 1 return...
""" Tema: Complejidad Algoritmica. Notacion asintotica - Recursividad multiple Curso: Pensamiento Computacional, 2da entrega. Plataforma: Platzi. Profesor: David Aroesti. Alumno: @edinsonrequena. """ def fibonacci(n): """ Recursividad multiple O(2^n) """ if n == 0 or n == 1: return 1 ...
""" Question Source:Leetcode Level: Medium Topic: Stack Solver: Tayyrov Date: 14.03.2022 """ def simplifyPath(path: str) -> str: path = path.split("/") ans = [] for p in path: if p == "." or p == "": continue elif p == "..": if ans: ...
""" Question Source:Leetcode Level: Medium Topic: Stack Solver: Tayyrov Date: 14.03.2022 """ def simplify_path(path: str) -> str: path = path.split('/') ans = [] for p in path: if p == '.' or p == '': continue elif p == '..': if ans: ans.pop() ...
class Solution(object): def permuteUnique(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ perms = set() self.recursive(nums, [], perms) return perms def recursive(self, nums, perm, perms): if len(nums) == 0: perms.a...
class Solution(object): def permute_unique(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ perms = set() self.recursive(nums, [], perms) return perms def recursive(self, nums, perm, perms): if len(nums) == 0: perms....
#factorial.py n=int(input("enter number..")) #calculating factorial of n f=1 for i in range(1,n+1): f=f*i print ('factorial of {} = {}'.format(n,f))
n = int(input('enter number..')) f = 1 for i in range(1, n + 1): f = f * i print('factorial of {} = {}'.format(n, f))
def hitung(): umur=int(input("masukan umur kamu:")) jj = umur *369* 24 * 60 * 60 print(f"kamu sudah hidup selama{jj}.detik") print("Selamat datang di program hitung detik umur") hitung()
def hitung(): umur = int(input('masukan umur kamu:')) jj = umur * 369 * 24 * 60 * 60 print(f'kamu sudah hidup selama{jj}.detik') print('Selamat datang di program hitung detik umur') hitung()
size(300, 300) _total_w = 0 def flow(w, h): global _total_w if _total_w + w*2 >= WIDTH: translate(-_total_w, h) _total_w = 0 else: translate(w, 0) _total_w += w x, y = 10, 10 rect(x, y, 50, 50) flow(60, 60) rect(x, y, 50, 50, 0.6) flow(60, 60) oval(x, y, 50, 50) flow(60, 6...
size(300, 300) _total_w = 0 def flow(w, h): global _total_w if _total_w + w * 2 >= WIDTH: translate(-_total_w, h) _total_w = 0 else: translate(w, 0) _total_w += w (x, y) = (10, 10) rect(x, y, 50, 50) flow(60, 60) rect(x, y, 50, 50, 0.6) flow(60, 60) oval(x, y, 50, 50) flow(6...
class Solution: def recoverFromPreorder(self, S: str) -> TreeNode: if not S: return l = S.split('-') s, depth = [[TreeNode(l[0]), 0]], 1 for item in l[1:]: if not item: depth += 1 continue node = TreeNode(item) while...
class Solution: def recover_from_preorder(self, S: str) -> TreeNode: if not S: return l = S.split('-') (s, depth) = ([[tree_node(l[0]), 0]], 1) for item in l[1:]: if not item: depth += 1 continue node = tree_node(it...
{ 'targets': [ { 'include_dirs': ['/usr/include', '/usr/local/include'], 'libraries': ['-L/usr/lib', '-L/usr/local/lib'], 'target_name': 'gzbz2', 'sources': ['compress.cc'], 'link_settings': { 'libraries': [ '-lbz2' ] }, 'conditions': [ [...
{'targets': [{'include_dirs': ['/usr/include', '/usr/local/include'], 'libraries': ['-L/usr/lib', '-L/usr/local/lib'], 'target_name': 'gzbz2', 'sources': ['compress.cc'], 'link_settings': {'libraries': ['-lbz2']}, 'conditions': [['OS=="linux"', {'cflags': ['-Wall', '-O2', '-fexceptions'], 'cflags_cc!': ['-fno-exception...
# Uses python3 def get_fibonacci_huge_naive(n, m): if n <= 1: return n previous = 0 current = 1 for _ in range(n - 1): previous, current = current, previous + current return current % m def get_fibonacci_period(m): P = [0] prv, cur = 0, 1 while (prv, cur) != (1, 0...
def get_fibonacci_huge_naive(n, m): if n <= 1: return n previous = 0 current = 1 for _ in range(n - 1): (previous, current) = (current, previous + current) return current % m def get_fibonacci_period(m): p = [0] (prv, cur) = (0, 1) while (prv, cur) != (1, 0): P.a...
class DriverNotSet(EnvironmentError): """ webdriver not initialized """ class NoSession(RuntimeError): """ forgot to call new_session()""" class ElementNotFound(ValueError): """ no element to process """ class TabDiscarded(RuntimeError): """ tab no longer exists""" class FireFoxCrashed(Environme...
class Drivernotset(EnvironmentError): """ webdriver not initialized """ class Nosession(RuntimeError): """ forgot to call new_session()""" class Elementnotfound(ValueError): """ no element to process """ class Tabdiscarded(RuntimeError): """ tab no longer exists""" class Firefoxcrashed(EnvironmentEr...
#----------------------------------------------------------------------------- # Runtime: 44ms # Memory Usage: # Link: #----------------------------------------------------------------------------- class Solution: def intToRoman(self, num: int) -> str: result = [] if num >= 1000: resu...
class Solution: def int_to_roman(self, num: int) -> str: result = [] if num >= 1000: result.append('M' * (num // 1000)) num %= 1000 if num >= 900: result.append('CM') num -= 900 if num >= 500: result.append('D') ...
""" RCIR Module Consits of representations for Candidate, Voter and Election """ print("This is the RCIR module")
""" RCIR Module Consits of representations for Candidate, Voter and Election """ print('This is the RCIR module')
# is_hot = False # is_clod = False # # # if is_hot: # print("it is hot day ") # print("drink plentry of water ") # elif is_clod: # print("it is clod day ") # print("Wear warm Clothes") # else: # print("it is a Lovely day ") # print("Enjoy Your Day ") # has_high_income = False # has_good_credi...
name = 'shivam singh' if len(name) < 3: print('name must at least 3 charters') elif len(name) > 50: print('name must be a maximum 50 charters') else: print('name Looks Good ')
class AnyObject(object): """ def get_address(self): order_list = self.parentsDict.order_list address = list() for i in range(len(order_list))[::-1]: if isinstance(self.parentsDict[order_list[i]], Collection): continue elif isinstance(se...
class Anyobject(object): """ def get_address(self): order_list = self.parentsDict.order_list address = list() for i in range(len(order_list))[::-1]: if isinstance(self.parentsDict[order_list[i]], Collection): continue elif isinstance(self.parentsDi...
""" ----------- Discussion: ----------- Paper: ------ NLP-based ontology learning from legal texts. A case study paper Ontology -------- Formally-defined vocabulary for a particular domain of interest used to capture knowledge about that (restricted) domain of interest. The ontology describes the concepts in the do...
""" ----------- Discussion: ----------- Paper: ------ NLP-based ontology learning from legal texts. A case study paper Ontology -------- Formally-defined vocabulary for a particular domain of interest used to capture knowledge about that (restricted) domain of interest. The ontology describes the concepts in the do...
# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2020 Ericsson AB name = "paf"
name = 'paf'
# -*- coding: utf-8 -*- class Solution: def bitwiseComplement(self, N: int) -> int: return int(''.join('1' if c == '0' else '0' for c in format(N, 'b')), 2) if __name__ == '__main__': solution = Solution() assert 2 == solution.bitwiseComplement(5) assert 0 == solution.bitwiseComplement(7) ...
class Solution: def bitwise_complement(self, N: int) -> int: return int(''.join(('1' if c == '0' else '0' for c in format(N, 'b'))), 2) if __name__ == '__main__': solution = solution() assert 2 == solution.bitwiseComplement(5) assert 0 == solution.bitwiseComplement(7) assert 5 == solution.b...
description = 'Placeholders for devices not yet present.' group = 'lowlevel' devices = dict( xs = device('nicos.devices.generic.VirtualMotor', description = 'Sample x position', abslimits = (0, 730), unit = 'mm', curvalue = 2500 ), xd2 = device('nicos.devices.generic.Virtua...
description = 'Placeholders for devices not yet present.' group = 'lowlevel' devices = dict(xs=device('nicos.devices.generic.VirtualMotor', description='Sample x position', abslimits=(0, 730), unit='mm', curvalue=2500), xd2=device('nicos.devices.generic.VirtualMotor', description='Diaphragm2 x position', abslimits=(0, ...
# -*- coding: utf-8 -*- # 2021/10/29 # create by: snower class Parser(object): def __init__(self, content): self.content = content def parse(self): raise NotImplementedError
class Parser(object): def __init__(self, content): self.content = content def parse(self): raise NotImplementedError
class GreatClass: def __init__(self, x): self.x = x def do_stuff(self): pass class LilGreatClass: def __init__(self, things, stuff): self.things = things self.stuff = stuff
class Greatclass: def __init__(self, x): self.x = x def do_stuff(self): pass class Lilgreatclass: def __init__(self, things, stuff): self.things = things self.stuff = stuff
""" Loan Calculator You take a loan from a friend and need to calculate how much you will owe him after 3 months. You are going to pay him back 10% of the remaining loan amount each month. Create a program that takes the loan amount as input, calculates and outputs the remaining amount after 3 months. Sample Input: 2...
""" Loan Calculator You take a loan from a friend and need to calculate how much you will owe him after 3 months. You are going to pay him back 10% of the remaining loan amount each month. Create a program that takes the loan amount as input, calculates and outputs the remaining amount after 3 months. Sample Input: 2...
# Grid elements STRUCT = 0 P1 = 1 P2 = 2 WALL = 3 HOLE = 4 # Timeout (in ms) ROUND_TIMEOUT = 6000.0 GLOBAL_TIMEOUT = 60000.0 # Gauges state and speed # Gauge state is in gauge units GAUGE_STATE_INIT = 65535 # Gauges speed are in gauge units per milliseconds ROUND_GAUGE_SPEED_INIT = GAUGE_STATE_INIT/R...
struct = 0 p1 = 1 p2 = 2 wall = 3 hole = 4 round_timeout = 6000.0 global_timeout = 60000.0 gauge_state_init = 65535 round_gauge_speed_init = GAUGE_STATE_INIT / ROUND_TIMEOUT global_gauge_speed = GAUGE_STATE_INIT / GLOBAL_TIMEOUT m = 15 n = 6 tap_left = 2001 tap_right = 2002 two_finger_swipe = 2003 hide_struct = 2004
# A simple User model for logging in/registering # Created by: Mark Mott class User: # A single underline denotes a private method/variable. # Default is a Guest user def __init__(self, username='Guest', password='guest', permission=0): print(username) self.username = username self.p...
class User: def __init__(self, username='Guest', password='guest', permission=0): print(username) self.username = username self.password = password self.permission = permission def setusername(self, username): self.username = username def getusername(self): ...
""" topic_config """ def read_config(): """ read JSON config file for topic options """ topic_data = { "platform_type": ["buoy", "station", "glider"], "ra": [ "aoos", "caricoos", "cencoos", "gcoos", "glos", "marac...
""" topic_config """ def read_config(): """ read JSON config file for topic options """ topic_data = {'platform_type': ['buoy', 'station', 'glider'], 'ra': ['aoos', 'caricoos', 'cencoos', 'gcoos', 'glos', 'maracoos', 'nanoos', 'neracoos', 'pacioos', 'secoora', 'sccoos'], 'platform': ['a', 'b', 'c', 'd...
#!/usr/bin/python # -*- coding: utf-8 -*- # created: 2015-04-15 class WebConst(object): ROUTER_PARAM_PATH = '_http_router_url' ROUTER_PARAM_OPT = '_http_router_opt' ROUTER_PARAM_VIEW_FUNC_PARAMS = '_http_router_view_params' ROUTER_VIEW_FUNC_KWS_REQUEST = 'request' ROUTER_VIEW_FUNC_KWS_METHOD = 'm...
class Webconst(object): router_param_path = '_http_router_url' router_param_opt = '_http_router_opt' router_param_view_func_params = '_http_router_view_params' router_view_func_kws_request = 'request' router_view_func_kws_method = 'method' request_method_get = 'GET' request_method_post = 'PO...
def cgi_content(type="text/html"): return('Content type: ' + type + '\n\n') def webpage_start(): return('<html>') def web_title(title): return('<head><title>' + title + '</title></head>') def body_start(h1_message): return('<h1 align="center">' + h1_message + '</h1><p align="center">') def body_end(): return("...
def cgi_content(type='text/html'): return 'Content type: ' + type + '\n\n' def webpage_start(): return '<html>' def web_title(title): return '<head><title>' + title + '</title></head>' def body_start(h1_message): return '<h1 align="center">' + h1_message + '</h1><p align="center">' def body_end(): ...
class GTDException(Exception): '''single parameter indicates exit code for the interpreter, because this exception typically results in a return of control to the terminal''' def __init__(self, errno): self.errno = errno
class Gtdexception(Exception): """single parameter indicates exit code for the interpreter, because this exception typically results in a return of control to the terminal""" def __init__(self, errno): self.errno = errno
class ExcalValueError(ValueError): pass class ExcalFileExistsError(FileExistsError): pass
class Excalvalueerror(ValueError): pass class Excalfileexistserror(FileExistsError): pass
my_family = { 'wife': { 'name': 'Julia', 'age': 32 }, 'daughter': { 'name': 'Aurelia', 'age': 2 }, 'son': { 'name': 'Lazarus', 'age': .5 }, 'father': { 'name': 'Rodney', 'age': 62 } } # use a dictionary comprehension to produce output that looks like this: # Krista is my siste...
my_family = {'wife': {'name': 'Julia', 'age': 32}, 'daughter': {'name': 'Aurelia', 'age': 2}, 'son': {'name': 'Lazarus', 'age': 0.5}, 'father': {'name': 'Rodney', 'age': 62}} for (relationship, information) in my_family.items(): family_member = relationship name = information['name'] age = information['age'...
fieldname_list = [ "file_name", "file_path", "v_format", "v_info", "v_profile", "v_settings", "v_settings_cabac", "v_settings_reframes", "v_format_settings_gop", "v_codec_id", "v_codec_id_info", "v_duration", "v_bit_rate_mode", "v_bit_rate", "v_max_bit_rate", ...
fieldname_list = ['file_name', 'file_path', 'v_format', 'v_info', 'v_profile', 'v_settings', 'v_settings_cabac', 'v_settings_reframes', 'v_format_settings_gop', 'v_codec_id', 'v_codec_id_info', 'v_duration', 'v_bit_rate_mode', 'v_bit_rate', 'v_max_bit_rate', 'v_frame_rate', 'v_frame_rate_mode', 'v_width', 'v_height', '...
#binary search class BinarySearch: def __init__(self): self.elements = [10,12,15,18,19,22,27,32,38] def SearchElm(self,elem): start = 0 stop = len(self.elements)-1 while start <= stop: mid_point = start + (stop - start) if self.elements[mid_point] == ...
class Binarysearch: def __init__(self): self.elements = [10, 12, 15, 18, 19, 22, 27, 32, 38] def search_elm(self, elem): start = 0 stop = len(self.elements) - 1 while start <= stop: mid_point = start + (stop - start) if self.elements[mid_point] == elem: ...
''' This problem was asked by Facebook. Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed). For example, given the string "([])[]({})", you should return true. Given the string "([)]" or "((()", you should return false. ''' bracket_vocab = {...
""" This problem was asked by Facebook. Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed). For example, given the string "([])[]({})", you should return true. Given the string "([)]" or "((()", you should return false. """ bracket_vocab = {'(...
# -*- encoding: utf-8 -*- # Copyright (c) 2021 Stephen Bunn <stephen@bunn.io> # ISC License <https://choosealicense.com/licenses/isc> """Contains module-wide constants.""" APP_NAME = "brut" APP_VERSION = "0.1.0"
"""Contains module-wide constants.""" app_name = 'brut' app_version = '0.1.0'
# Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. # Once 'done' is entered, print out the largest and smallest of the numbers. # If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. ...
ps = None tss = None while True: new = input('Enter any number') if new == 'done': break try: new = int(new) except: print('Invalid input') continue if ps == None or ps > new: ps = new if tss == None or tss < new: tss = new print('Maximum is', tss)...
# Can you find the needle in the haystack? # Write a function findNeedle() that takes an array full of junk but containing one "needle" # After your function finds the needle it should return a message (as a string) that says: # "found the needle at position " plus the index it found the needle, so: # Python, Ruby ...
def find_needle(haystack): for el in haystack: if el == 'needle': return 'found the needle at position ' + str(haystack.index(el)) print(find_needle([1, 2, 3, 4, 'needle']))
class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ dict1, dict2 = {}, {} for item in s: dict1[item] = dict1.get(item, 0) + 1 for item in t: dict2[item] = dict2.get(item, 0) + 1 ...
class Solution(object): def is_anagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ (dict1, dict2) = ({}, {}) for item in s: dict1[item] = dict1.get(item, 0) + 1 for item in t: dict2[item] = dict2.get(item, 0) + ...
# # @lc app=leetcode id=859 lang=python3 # # [859] Buddy Strings # # @lc code=start class Solution: def buddyStrings(self, A: str, B: str) -> bool: if len(A) <= 1 or len(B) <= 1 or len(A) != len(B): return False if A == B: return len(set(A)) < len(A) i = 0 wh...
class Solution: def buddy_strings(self, A: str, B: str) -> bool: if len(A) <= 1 or len(B) <= 1 or len(A) != len(B): return False if A == B: return len(set(A)) < len(A) i = 0 while A[i] == B[i]: i += 1 for j in range(i + 1, len(A)): ...
# # @lc app=leetcode.cn id=114 lang=python3 # # [114] flatten-binary-tree-to-linked-list # None # @lc code=end
None
def get_counter_and_increment(filename="counter.dat"): with open(filename, "a+") as f: f.seek(0) val = int(f.read() or 0) + 1 f.seek(0) f.truncate() f.write(str(val)) return val def get_counter(filename="counter.dat"): with open(filename, "a+") as f: f....
def get_counter_and_increment(filename='counter.dat'): with open(filename, 'a+') as f: f.seek(0) val = int(f.read() or 0) + 1 f.seek(0) f.truncate() f.write(str(val)) return val def get_counter(filename='counter.dat'): with open(filename, 'a+') as f: f.se...
# # Keys under which options are stored. OPTIONS_UNKNOWN = 0 OPTIONS_FILE_OUTPUT = 1 OPTIONS_CPU = 2 OPTIONS_STANDARD = 3 # General options that belong to no specific collection. OPTION_UNKNOWN = 0 OPTION_DISABLE_OPTIMISATIONS = 1 OPTION_DEFAULT_FILE_NAME = 2 # CPU optons. CPU_UNKNOWN = 0 CPU_MC60000 = 1 CPU_MC60010...
options_unknown = 0 options_file_output = 1 options_cpu = 2 options_standard = 3 option_unknown = 0 option_disable_optimisations = 1 option_default_file_name = 2 cpu_unknown = 0 cpu_mc60000 = 1 cpu_mc60010 = 2 cpu_mc60020 = 3 cpu_mc60030 = 4 cpu_mc60040 = 5 cpu_mc60060 = 7 def get_cpu_name_by_id(cpu_id): for (k, v...
class seq: def __init__(self, strbases): self.strbases = strbases def len(self): return len(self.strbases) def complement(self): comp = '' for e in self.strbases: if e == 'A': comp += 'T' elif e == 'C': comp += 'G' ...
class Seq: def __init__(self, strbases): self.strbases = strbases def len(self): return len(self.strbases) def complement(self): comp = '' for e in self.strbases: if e == 'A': comp += 'T' elif e == 'C': comp += 'G' ...
"""Change the config values.""" branches = ('master', 'dev') # Note: Single element requires a comma at end. add_codeowners_file = True signed_commit = False branch_rules = {"required_approving_review_count": 1, "require_code_owner_reviews": True, "contexts": ["CodeQL"], ...
"""Change the config values.""" branches = ('master', 'dev') add_codeowners_file = True signed_commit = False branch_rules = {'required_approving_review_count': 1, 'require_code_owner_reviews': True, 'contexts': ['CodeQL'], 'strict': True}
""" LC322 -- Coin Change time complexity -- O(N*M) space complexiy -- O(M) M is len(coins), N is amount Runtime: 1080 ms, faster than 85.13% of Python3 online submissions for Coin Change. Memory Usage: 13.8 MB, less than 30.56% of Python3 online submissions for Coin Change. normal dp small trick is to build a n+1 leng...
""" LC322 -- Coin Change time complexity -- O(N*M) space complexiy -- O(M) M is len(coins), N is amount Runtime: 1080 ms, faster than 85.13% of Python3 online submissions for Coin Change. Memory Usage: 13.8 MB, less than 30.56% of Python3 online submissions for Coin Change. normal dp small trick is to build a n+1 leng...
class TimeSlot: """A class to store time slot""" minutes_in_hour = 60 def __init__(self, name='name'): # initialize an empty slot self._h = 0 self._m = 0 self.name = name # timeslot is an instance attribute # (attribute of the object) @property def m(self):...
class Timeslot: """A class to store time slot""" minutes_in_hour = 60 def __init__(self, name='name'): self._h = 0 self._m = 0 self.name = name @property def m(self): return self._m @property def h(self): return self._h @m.setter def m(self...
class Solution: def dominantIndex(self, nums: List[int]) -> int: max_num = max(nums) for i in nums: if i != max_num and max_num < 2*i: return -1 return nums.index(max_num)
class Solution: def dominant_index(self, nums: List[int]) -> int: max_num = max(nums) for i in nums: if i != max_num and max_num < 2 * i: return -1 return nums.index(max_num)
# Program to print first n tribonacci # numbers Matrix Multiplication # function for 3*3 matrix def multiply(T, M): a = (T[0][0] * M[0][0] + T[0][1] * M[1][0] + T[0][2] * M[2][0]) b = (T[0][0] * M[0][1] + T[0][1] * M[1][1] + T[0][2] * M[2][1]) c = (T[0][0] * M[0][2] + T[0...
def multiply(T, M): a = T[0][0] * M[0][0] + T[0][1] * M[1][0] + T[0][2] * M[2][0] b = T[0][0] * M[0][1] + T[0][1] * M[1][1] + T[0][2] * M[2][1] c = T[0][0] * M[0][2] + T[0][1] * M[1][2] + T[0][2] * M[2][2] d = T[1][0] * M[0][0] + T[1][1] * M[1][0] + T[1][2] * M[2][0] e = T[1][0] * M[0][1] + T[1][1] ...
''' Problem 5. Write a program that finds out whether a given name is present in a list or not.''' # Name search genrator using the Python names = ["Vasudev","Ridhi","hritik","Hanuman", "Gaurav"] name = input("Enter the Name : ") if name in names: print("Your name is in the list") else: print("Your name is ...
""" Problem 5. Write a program that finds out whether a given name is present in a list or not.""" names = ['Vasudev', 'Ridhi', 'hritik', 'Hanuman', 'Gaurav'] name = input('Enter the Name : ') if name in names: print('Your name is in the list') else: print('Your name is not in the list')
class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ max_sum = (10 ** 4) * -1 restart = True tmp_sum = (10 ** 4) * -1 for n in nums: if restart: tmp_sum = n resta...
class Solution(object): def max_sub_array(self, nums): """ :type nums: List[int] :rtype: int """ max_sum = 10 ** 4 * -1 restart = True tmp_sum = 10 ** 4 * -1 for n in nums: if restart: tmp_sum = n restart = ...
FLAG_OK = 0 FLAG_WARNING = 1 FLAG_ERROR = 2 FLAG_UNKNOWN = 3 FLAG_OK_STR = "OK" FLAG_WARNING_STR = "WARNING" FLAG_ERROR_STR = "ERROR" FLAG_UNKNOWN_STR = "UNKNOWN" FLAG_MAP = { FLAG_OK_STR: FLAG_OK, FLAG_WARNING_STR: FLAG_WARNING, FLAG_ERROR_STR: FLAG_ERROR, FLAG_UNKNOWN_STR: FLAG_UNKNOWN, }
flag_ok = 0 flag_warning = 1 flag_error = 2 flag_unknown = 3 flag_ok_str = 'OK' flag_warning_str = 'WARNING' flag_error_str = 'ERROR' flag_unknown_str = 'UNKNOWN' flag_map = {FLAG_OK_STR: FLAG_OK, FLAG_WARNING_STR: FLAG_WARNING, FLAG_ERROR_STR: FLAG_ERROR, FLAG_UNKNOWN_STR: FLAG_UNKNOWN}
kernel_weight = 0.03 bias_weight = 0.03 model_iris_l1 = models.Sequential([ layers.Input(shape = (4,)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kernel_weight), bias_regularizer=regularizers.l2(bias_weight)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kern...
kernel_weight = 0.03 bias_weight = 0.03 model_iris_l1 = models.Sequential([layers.Input(shape=(4,)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kernel_weight), bias_regularizer=regularizers.l2(bias_weight)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kernel_weight...
DEBUG = False # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '{{ secret_key }}' ALLOWED_HOSTS = ['{{ host }}'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': '{{ database_name }}', 'USER': '{{ database_user }}', 'PASS...
debug = False secret_key = '{{ secret_key }}' allowed_hosts = ['{{ host }}'] databases = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME': '{{ database_name }}', 'USER': '{{ database_user }}', 'PASSWORD': '{{ database_password }}', 'HOST': '{{ database_host }}', 'PORT': '{{database_port }}', 'CONN_MAX_AGE...
"""Constants used in the openapi_builder package.""" EXTENSION_NAME = "__open_api_doc__" # Name of the extension in the Flask application. HIDDEN_ATTR_NAME = "__option_api_attr" # Attribute name for adding options. DOCUMENTATION_URL = "https://flyingbird95.github.io/openapi-builder"
"""Constants used in the openapi_builder package.""" extension_name = '__open_api_doc__' hidden_attr_name = '__option_api_attr' documentation_url = 'https://flyingbird95.github.io/openapi-builder'
class ParkingSystem: def __init__(self, big: int, medium: int, small: int): self.bigSize, self.bigCount, self.mediumSize, self.mediumCount, self.smallSize, self.smallCount = big, 0, medium, 0, small, 0 def addCar(self, carType: int) -> bool: if carType == 1: if self.bigCount < self...
class Parkingsystem: def __init__(self, big: int, medium: int, small: int): (self.bigSize, self.bigCount, self.mediumSize, self.mediumCount, self.smallSize, self.smallCount) = (big, 0, medium, 0, small, 0) def add_car(self, carType: int) -> bool: if carType == 1: if self.bigCount <...
# # PySNMP MIB module CISCO-IMAGE-TC (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IMAGE-TC # Produced by pysmi-0.3.4 at Mon Apr 29 17:39:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
# Addresses LOAD_R3_ADDR = 0x0C00C650 OSFATAL_ADDR = 0x01031618 class PayloadAddress: pass CHAIN_END = "#Execute ROP chain\nexit\n\n#Dunno why but I figured I might as well put it here, should never hit this though\nend" def write_rop_chain(rop_chain, path): with open('rop_setup.s', 'r') as f: setup ...
load_r3_addr = 201377360 osfatal_addr = 16979480 class Payloadaddress: pass chain_end = '#Execute ROP chain\nexit\n\n#Dunno why but I figured I might as well put it here, should never hit this though\nend' def write_rop_chain(rop_chain, path): with open('rop_setup.s', 'r') as f: setup = f.read() w...
""" Wriggler crawler module. """ class Error(Exception): """ All exceptions returned are subclass of this one. """
""" Wriggler crawler module. """ class Error(Exception): """ All exceptions returned are subclass of this one. """
class DisjointSet: def __init__(self, n, data): self.graph = data self.n = n self.parent = [i for i in range(self.n)] self.rank = [1] * self.n def find_parent(self, x): if self.parent[x] != x: self.parent[x] = self.find_parent(self.parent[x]) return s...
class Disjointset: def __init__(self, n, data): self.graph = data self.n = n self.parent = [i for i in range(self.n)] self.rank = [1] * self.n def find_parent(self, x): if self.parent[x] != x: self.parent[x] = self.find_parent(self.parent[x]) return ...
# island count problem big hint (use a Stack) # data structures (stack queue etc) class OLDStack: def __init__(self): self.storage = [] """ Push method ----------- takes in a value and appends it to the storage """ def push(self, value): self.storage.append(v...
class Oldstack: def __init__(self): self.storage = [] ' \n Push method\n -----------\n takes in a value and appends it to the storage\n ' def push(self, value): self.storage.append(value) '\n Pop Method\n ----------\n checks if there is data...
# coding: utf-8 DEFAULT_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) ' \ 'Chrome/55.0.2883.95 Safari/537.36 ' DATA_FOLDER = "data"
default_user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36 ' data_folder = 'data'
def my_decorator(func): def wrapper(): print("before the function is called.") func() print("after the function is called.") return wrapper @my_decorator def say_hi_HTA_with_syntax(): print("Hi! HTA with_syntax") def say_hi_HTA_without_syntax(): print('Hi! HTA without_syntax') ...
def my_decorator(func): def wrapper(): print('before the function is called.') func() print('after the function is called.') return wrapper @my_decorator def say_hi_hta_with_syntax(): print('Hi! HTA with_syntax') def say_hi_hta_without_syntax(): print('Hi! HTA without_syntax')...
N = int(input()) XL = [list(map(int, input().split())) for _ in range(N)] t = [(x + l, x - l) for x, l in XL] t.sort() max_r = -float('inf') result = 0 for i in range(N): r, l = t[i] if max_r <= l: result += 1 max_r = r print(result)
n = int(input()) xl = [list(map(int, input().split())) for _ in range(N)] t = [(x + l, x - l) for (x, l) in XL] t.sort() max_r = -float('inf') result = 0 for i in range(N): (r, l) = t[i] if max_r <= l: result += 1 max_r = r print(result)
def solution(xs): maxp = 1 negs = [] for i in xs: if i < 0: negs.append(i) elif i > 1: maxp *= i if len(negs) < 2 and max(xs) < 2: return str(max(xs)) negs.sort() while len(negs) > 1: maxp *= negs.pop(0) * negs.pop(0) return str(maxp)
def solution(xs): maxp = 1 negs = [] for i in xs: if i < 0: negs.append(i) elif i > 1: maxp *= i if len(negs) < 2 and max(xs) < 2: return str(max(xs)) negs.sort() while len(negs) > 1: maxp *= negs.pop(0) * negs.pop(0) return str(maxp)
# Stairs # https://www.interviewbit.com/problems/stairs/ # # You are climbing a stair case. It takes n steps to reach to the top. # # Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? # # Example : # # Input : 3 # Return : 3 # # Steps : [1 1 1], [1 2], [2 1] # # # # # # # ...
class Solution: def climb_stairs(self, A): result = [0] * A if A < 2: return A (result[0], result[1]) = (1, 2) for i in range(2, A): result[i] = result[i - 1] + result[i - 2] return result[-1]
''' A Python program to add two objects if both objects are an integer type. ''' def areObjectsInteger (inputNum01, inputNum02): if not (isinstance(inputNum01, int) and isinstance(inputNum02, int)): return False return inputNum01 + inputNum02 def main (): a,b = [float(x) for x in input("Enter ...
""" A Python program to add two objects if both objects are an integer type. """ def are_objects_integer(inputNum01, inputNum02): if not (isinstance(inputNum01, int) and isinstance(inputNum02, int)): return False return inputNum01 + inputNum02 def main(): (a, b) = [float(x) for x in input('Enter t...
def next_line(line): res = [] prev = 0 nb = 0 for i in range(len(line)): if prev == 0: prev = line[i] nb = 1 else: if prev == line[i]: nb += 1 else: res.append(nb) res.append(prev) ...
def next_line(line): res = [] prev = 0 nb = 0 for i in range(len(line)): if prev == 0: prev = line[i] nb = 1 elif prev == line[i]: nb += 1 else: res.append(nb) res.append(prev) prev = line[i] nb =...
""" See statsmodels.tsa.arima.model.ARIMA and statsmodels.tsa.SARIMAX. """ ARIMA_DEPRECATION_ERROR = """ statsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have been removed in favor of statsmodels.tsa.arima.model.ARIMA (note the . between arima and model) and statsmodels.tsa.SARIMAX. statsmodels....
""" See statsmodels.tsa.arima.model.ARIMA and statsmodels.tsa.SARIMAX. """ arima_deprecation_error = '\nstatsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have\nbeen removed in favor of statsmodels.tsa.arima.model.ARIMA (note the .\nbetween arima and model) and statsmodels.tsa.SARIMAX.\n\nstatsmodel...
class UserPoolDeleteError(Exception): """ User pool delete error handler """ pass
class Userpooldeleteerror(Exception): """ User pool delete error handler """ pass
#!/usr/bin/env python name = 'Bob' age = 2002 if name == 'Alice': print('Hi, Alice!') elif age < 12: print('You are not Alice, kiddo!') elif age > 2000: print('Unlike you, Alice is not undead, immortal vampire.') elif age > 100: print('You are not Alice, grannie.')
name = 'Bob' age = 2002 if name == 'Alice': print('Hi, Alice!') elif age < 12: print('You are not Alice, kiddo!') elif age > 2000: print('Unlike you, Alice is not undead, immortal vampire.') elif age > 100: print('You are not Alice, grannie.')
# 1. CREATE A DICTIONARY # Remember, dictionaries are essentially objects. # Make a dictionary with five different keys relating to your favorite celebrity. You must include at least four different data types as values for those keys. # ================ CODE HERE ================ # ================ END CODE ========...
fruits = ['apple', 'banana', 'strawberry', 'orange', 'grape'] count = 1
#!/usr/bin/python with open('README.md', 'w') as README: with open('docs/list_of__modules.rst', 'r') as index: README.write(''' # Cisco ACI modules for Ansible This project is working on upstreaming Cisco ACI support within the Ansible project. We currently have 30+ modules available, and many more are b...
with open('README.md', 'w') as readme: with open('docs/list_of__modules.rst', 'r') as index: README.write('\n# Cisco ACI modules for Ansible\n\nThis project is working on upstreaming Cisco ACI support within the Ansible project.\nWe currently have 30+ modules available, and many more are being added.\n\n\n#...