content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
"""Exception hierarchy for the zeekscript package.""" class Error(Exception): """Base class for all zeekscript errors.""" class FileError(Error): """System errors while processing script files""" class ParserError(Error): """A hard parsing error, producing no parse tree."""
"""Exception hierarchy for the zeekscript package.""" class Error(Exception): """Base class for all zeekscript errors.""" class Fileerror(Error): """System errors while processing script files""" class Parsererror(Error): """A hard parsing error, producing no parse tree."""
# # PySNMP MIB module ENTERASYS-POWER-ETHERNET-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-POWER-ETHERNET-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:04:21 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pyt...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ...
""" version which can be consumed from within the module """ VERSION_STR = "0.0.11" DESCRIPTION = "module to help you tag interesting places in your code" APP_NAME = "pytags" LOGGER_NAME = "pytags"
""" version which can be consumed from within the module """ version_str = '0.0.11' description = 'module to help you tag interesting places in your code' app_name = 'pytags' logger_name = 'pytags'
# vim: fdm=indent ''' author: Fabio Zanini date: 31/08/15 content: Module that contains fast conversion factories between private and anonymyzed versions of data. Such a module is useful during research development, when consensus on anonymized patient/sample names has ...
""" author: Fabio Zanini date: 31/08/15 content: Module that contains fast conversion factories between private and anonymyzed versions of data. Such a module is useful during research development, when consensus on anonymized patient/sample names has not been reached y...
def get_index(word): while True: try: pos = int(input("Enter an index: ")) if pos == -1: return pos elif pos >= len(word): print("invalid index") elif pos <= -1: print("invalid index") els...
def get_index(word): while True: try: pos = int(input('Enter an index: ')) if pos == -1: return pos elif pos >= len(word): print('invalid index') elif pos <= -1: print('invalid index') else: ...
""" lists """ myUniqueList = [] myLeftovers = [] def addToList(animal): if animal in myUniqueList: addToLeftovers(animal) return False else: myUniqueList.append(animal) return True def addToLeftovers(animal): myLeftovers.append(animal) # Test the addToList function p...
""" lists """ my_unique_list = [] my_leftovers = [] def add_to_list(animal): if animal in myUniqueList: add_to_leftovers(animal) return False else: myUniqueList.append(animal) return True def add_to_leftovers(animal): myLeftovers.append(animal) print(myUniqueList) print(add...
x = 50 def func(x): print('x is', x) x = 2 print('Changed local x to', x) func(x) print('x is still', x)
x = 50 def func(x): print('x is', x) x = 2 print('Changed local x to', x) func(x) print('x is still', x)
# package information. INFO = dict( name = "latexutils", description = "Utils for making Latex documents", author = "Daisuke Kataoka", author_email = "daisuke.1221.canoe@gmail.com", url = "https://github.com/dai39suke/latexutils", classifiers = [ "Programming Language :: Python :: 3....
info = dict(name='latexutils', description='Utils for making Latex documents', author='Daisuke Kataoka', author_email='daisuke.1221.canoe@gmail.com', url='https://github.com/dai39suke/latexutils', classifiers=['Programming Language :: Python :: 3.6'])
## (y - y1) / (x - x1) = (y2 - y1) / (x2 - x1) y = lambda x, x1, x2, y1, y2: y1 + (y2-y1) / (x2-x1) * (x-x1) def interpolation(xp, X, Y): if xp < X[0]: print("Given x-value is out of range") return None for i, Xi in enumerate(X): if xp < Xi: return y(xp, X[i-1], X[i], Y[i-1...
y = lambda x, x1, x2, y1, y2: y1 + (y2 - y1) / (x2 - x1) * (x - x1) def interpolation(xp, X, Y): if xp < X[0]: print('Given x-value is out of range') return None for (i, xi) in enumerate(X): if xp < Xi: return y(xp, X[i - 1], X[i], Y[i - 1], Y[i]) else: print('Gi...
''' Let us say your expense for every month are listed below, January - 2200 February - 2350 March - 2600 April - 2130 May - 2190 Create a list to store these monthly expenses and using that find out, 1. In Feb, how many dollars you spent extra compare to January? 2. Find out your total expense in first quarter (first...
""" Let us say your expense for every month are listed below, January - 2200 February - 2350 March - 2600 April - 2130 May - 2190 Create a list to store these monthly expenses and using that find out, 1. In Feb, how many dollars you spent extra compare to January? 2. Find out your total expense in first quarter (first...
# Course: CS 30 # Period: 1 # Date created: 2020/02/12 # Date last modified: 2020/03/11 # Name: Kate Pepper # Desrcription: A set of lists for a Clue RPG """A list of all of the suspects of the murder""" # Original suspect list suspects = ['Evelyn Finch', 'George Brown', 'Madeline Brown', 'Stephen Turner'] p...
"""A list of all of the suspects of the murder""" suspects = ['Evelyn Finch', 'George Brown', 'Madeline Brown', 'Stephen Turner'] print(' ') print(suspects) suspects.append('Chantal Steele') suspects.insert(2, 'Justin Jones') print(' ') print(suspects) for suspect in suspects: print(f'\n{suspect.title()} is a suspe...
class Solution: def shortestWordDistance(self, words: 'List[str]', word1: 'str', word2: 'str') -> 'int': i1 = i2 = -1 ans = math.inf equal = word1 == word2 for i, word in enumerate(words): if word == word1: i1 = i if word == word2: ...
class Solution: def shortest_word_distance(self, words: 'List[str]', word1: 'str', word2: 'str') -> 'int': i1 = i2 = -1 ans = math.inf equal = word1 == word2 for (i, word) in enumerate(words): if word == word1: i1 = i if word == word2: ...
class Solution: def generateMatrix(self, n): """ :type n: int :rtype: List[List[int]] """ def dirToIndex(x, y, d): if d == "r": return (x, y + 1, d) if y + 1 < n and matrix[x][y + 1] == 0 else (x + 1, y, "d") elif d == "d": return (x + 1, y, d) if x + ...
class Solution: def generate_matrix(self, n): """ :type n: int :rtype: List[List[int]] """ def dir_to_index(x, y, d): if d == 'r': return (x, y + 1, d) if y + 1 < n and matrix[x][y + 1] == 0 else (x + 1, y, 'd') elif d == 'd': ...
f = open("HaltestellenVVS_simplified_utf8.csv", "r") r = open("HaltestellenVVS_simplified_utf8_stationID.csv", "w") r.write(f.readline()) lines = f.readlines() for line in lines: stationID = line.split(",")[0] newStationID = int(stationID)+5000000 outLine = str(newStationID) + line[len(stationID):] r.write(outL...
f = open('HaltestellenVVS_simplified_utf8.csv', 'r') r = open('HaltestellenVVS_simplified_utf8_stationID.csv', 'w') r.write(f.readline()) lines = f.readlines() for line in lines: station_id = line.split(',')[0] new_station_id = int(stationID) + 5000000 out_line = str(newStationID) + line[len(stationID):] ...
name = QInputDialog.getText(self, "Name", "Enter the name of your sidebar here:") if name[1]: name = name[0] url = QInputDialog.getText(self, "URL", "Enter the URL of your sidebar here:") if url[1]: url = url[0] common.sidebar_maker_path = os.path.join(settings.extensions_folder, name.lower(...
name = QInputDialog.getText(self, 'Name', 'Enter the name of your sidebar here:') if name[1]: name = name[0] url = QInputDialog.getText(self, 'URL', 'Enter the URL of your sidebar here:') if url[1]: url = url[0] common.sidebar_maker_path = os.path.join(settings.extensions_folder, name.lower(...
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return a list of lists of integers def levelOrder(self, root): vals = [] if not roo...
class Solution: def level_order(self, root): vals = [] if not root: return vals cache = [root] while len(cache) > 0: tmp = [] level = [] for node in cache: level.append(node.val) if node.left: ...
def quicksorted(L): #base case if len(L) < 2: return L[:] # Divide! pivot = L[-1] LT = [e for e in L if e < pivot] ET = [e for e in L if e == pivot] GT = [e for e in L if e > pivot] # Conquer A = quicksorted(LT) B = quicksorted(GT) # Combine return A + ET + B ...
def quicksorted(L): if len(L) < 2: return L[:] pivot = L[-1] lt = [e for e in L if e < pivot] et = [e for e in L if e == pivot] gt = [e for e in L if e > pivot] a = quicksorted(LT) b = quicksorted(GT) return A + ET + B def quicksort(L, left=0, right=None): if right is None: ...
""" WGS84 constants Reference: Paul Groves http://www.oosa.unvienna.org/pdf/icg/2012/template/WGS_84.pdf """ R0 = 6378137.0 f = 298.257223563 omega_E = 7.2921151467e-5 GM = 3.986005e14 ecc = 0.0818191908425 Rp = 6356752.314245
""" WGS84 constants Reference: Paul Groves http://www.oosa.unvienna.org/pdf/icg/2012/template/WGS_84.pdf """ r0 = 6378137.0 f = 298.257223563 omega_e = 7.2921151467e-05 gm = 398600500000000.0 ecc = 0.0818191908425 rp = 6356752.314245
# Parsed from https://www.ibm.com/docs/en/spectrum-lsf/10.1.0?topic=options-o bjobs_fields = [ {"name": "jobid", "width": 7, "aliases": "id", "unit": None}, {"name": "jobindex", "width": 8, "aliases": None, "unit": None}, {"name": "stat", "width": 5, "aliases": None, "unit": None}, {"name": "user", "wid...
bjobs_fields = [{'name': 'jobid', 'width': 7, 'aliases': 'id', 'unit': None}, {'name': 'jobindex', 'width': 8, 'aliases': None, 'unit': None}, {'name': 'stat', 'width': 5, 'aliases': None, 'unit': None}, {'name': 'user', 'width': 7, 'aliases': None, 'unit': None}, {'name': 'user_group', 'width': 15, 'aliases': 'ugroup'...
# In eg 0.0.x, this file could be used to invoke eg directly, without installing # via pip. Eg 0.1.x switched to also support python 3. This meant changing the # way imports were working, which meant this script had to move up a level to be # a sibling of the eg module directory. This file will exist for a time in orde...
deprecation_warning = "\nYou are invoking eg via the script at <eg-repo>/eg/eg_exec.py. This file has\nbeen deprecated in order to work with both python 2 and 3.\n\nPlease instead invoke <eg-repo>/eg_exec.py, or install with pip.\n\nIf you're using a symlink and need to update it, try something like the\nfollowing:\n\n...
# from ncats.translator.module.disease.gene import disease_associated_genes @given('a disease term {disease_identifier} for disease label {disease_label} in Translator Modules') def step_impl(context, disease_identifier, disease_label): context.disease = {"disease_identifier":disease_identifier, "disease_label":di...
@given('a disease term {disease_identifier} for disease label {disease_label} in Translator Modules') def step_impl(context, disease_identifier, disease_label): context.disease = {'disease_identifier': disease_identifier, 'disease_label': disease_label} @when('we run the disease associated genes Translator Module'...
N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) count=0 for i in range(N): count+=min(A[i],B[i]) if A[i]<B[i]: if A[i+1]<B[i]-A[i]: count+=A[i+1] A[i+1]=0 else: count+=B[i]-A[i] A[i+1]-=B[i]-A[i] print(count)
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) count = 0 for i in range(N): count += min(A[i], B[i]) if A[i] < B[i]: if A[i + 1] < B[i] - A[i]: count += A[i + 1] A[i + 1] = 0 else: count += B[i] - A[i] A[i ...
def ground_ship(weight): flat = 20 if weight <= 2: return weight*1.5 + flat elif weight > 2 and weight <= 6: return weight*3.0 + flat elif weight > 6 and weight <= 10: return weight*4.0 + flat else: return weight*4.75 + flat cost = ground_ship(8.4) print(cost) def drone_ship(weight): flat ...
def ground_ship(weight): flat = 20 if weight <= 2: return weight * 1.5 + flat elif weight > 2 and weight <= 6: return weight * 3.0 + flat elif weight > 6 and weight <= 10: return weight * 4.0 + flat else: return weight * 4.75 + flat cost = ground_ship(8.4) print(cost)...
# Copyright 2018 ZTE Corporation. # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
grant_data = {'vnfInstanceId': '1', 'vnfLcmOpOccId': '2', 'vnfdId': '3', 'flavourId': '4', 'operation': 'INSTANTIATE', 'isAutomaticInvocation': True, 'instantiationLevelId': '5', 'addResources': [{'id': '1', 'type': 'COMPUTE', 'vduId': '2', 'resourceTemplateId': '3', 'resourceTemplate': {'vimConnectionId': '4', 'resour...
def my_func(): print("Foo") my_other_func = lambda: print("Bar") my_arr = [my_func, my_other_func] for i in range (0, 2): my_arr[i]() # Bots Position BOT_POS = [(5401, 1530),(3686, 1857),(3733, 2626),(2325, 1814), (1718, 1282),(1288, 2418),(1249, 506),(2513,1286) ] prin...
def my_func(): print('Foo') my_other_func = lambda : print('Bar') my_arr = [my_func, my_other_func] for i in range(0, 2): my_arr[i]() bot_pos = [(5401, 1530), (3686, 1857), (3733, 2626), (2325, 1814), (1718, 1282), (1288, 2418), (1249, 506), (2513, 1286)] print('\n') for (x, y) in BOT_POS: print(x, y)
class Solution: # @return a string def convert(self, s, nRows): if nRows == 1 or len(s) <= 2: return s # compute the length of the zigzag zigzagLen = 2*nRows - 2; lens = len(s) res = '' for i in range(nRows): idx = i while idx...
class Solution: def convert(self, s, nRows): if nRows == 1 or len(s) <= 2: return s zigzag_len = 2 * nRows - 2 lens = len(s) res = '' for i in range(nRows): idx = i while idx < lens: res = res + s[idx] if i ...
amountNumbers = int(input()) arrNumbers = set(map(int, input().split())) amountCommands = int(input()) for i in range(amountCommands): command = input().split() if command[0] == "pop": arrNumbers.pop() elif command[0] == "remove": if int(command[1]) in arrNumbers: arrNumbers.r...
amount_numbers = int(input()) arr_numbers = set(map(int, input().split())) amount_commands = int(input()) for i in range(amountCommands): command = input().split() if command[0] == 'pop': arrNumbers.pop() elif command[0] == 'remove': if int(command[1]) in arrNumbers: arrNumbers.r...
"""Tense analysis and detection related utilities.""" # pylint: disable=E0611 PRESENT = 'PRESENT' PAST = 'PAST' FUTURE = 'FUTURE' MODAL = 'MODAL' NORMAL = 'NORMAL'
"""Tense analysis and detection related utilities.""" present = 'PRESENT' past = 'PAST' future = 'FUTURE' modal = 'MODAL' normal = 'NORMAL'
# 238. Product of Array Except Self class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: cur, n = 1, len(nums) out = [1]*n for i in range(1, n): cur *= nums[i-1] out[i] = cur cur = 1 for i in range(n-2, -1, -1): ...
class Solution: def product_except_self(self, nums: List[int]) -> List[int]: (cur, n) = (1, len(nums)) out = [1] * n for i in range(1, n): cur *= nums[i - 1] out[i] = cur cur = 1 for i in range(n - 2, -1, -1): cur *= nums[i + 1] ...
try: myfile1=open("E:\\python_progs\\demochange\\mydir2\\pic1.jpg","rb") myfile2=open("E:\\python_progs\\demochange\\mydir2\\newpic1.jpg","wb") bytes=myfile1.read() myfile2.write(bytes) print("A new Image is available having name as: newpic1.jpg") finally: myfile1.close() myfile2.close()
try: myfile1 = open('E:\\python_progs\\demochange\\mydir2\\pic1.jpg', 'rb') myfile2 = open('E:\\python_progs\\demochange\\mydir2\\newpic1.jpg', 'wb') bytes = myfile1.read() myfile2.write(bytes) print('A new Image is available having name as: newpic1.jpg') finally: myfile1.close() myfile2.clo...
expected_output = { 'power-usage-information': { 'power-usage-item': [ { 'name': 'PSM 0', 'state': 'Online', 'dc-input-detail2': { 'dc-input-status': 'OK (INP0 feed expected, INP0 feed connected)' ...
expected_output = {'power-usage-information': {'power-usage-item': [{'name': 'PSM 0', 'state': 'Online', 'dc-input-detail2': {'dc-input-status': 'OK (INP0 feed expected, INP0 feed connected)'}, 'pem-capacity-detail': {'capacity-actual': '2100', 'capacity-max': '2500'}, 'dc-output-detail2': {'str-dc-power': '489.25', 's...
def list3(str): result = 0 for i in str: if i == 'a': result += 1 return result def main(): print(list3(['Hello', 'world', 'a'])) print(list3(['a', 'a'])) print(list3(['Computational', 'thinking'])) print(list3(['a', 'A', 'A'])) if __name__ == '__main__': main()
def list3(str): result = 0 for i in str: if i == 'a': result += 1 return result def main(): print(list3(['Hello', 'world', 'a'])) print(list3(['a', 'a'])) print(list3(['Computational', 'thinking'])) print(list3(['a', 'A', 'A'])) if __name__ == '__main__': main()
""" CS241 Checkpoint 01A Written by Chad Macbeth """ print("Hello Python World!")
""" CS241 Checkpoint 01A Written by Chad Macbeth """ print('Hello Python World!')
# EG8-13 Average Sales # test sales data sales=[50,54,29,33,22,100,45,54,89,75] def average_sales(): ''' Print out the average sales value ''' total=0 for sales_value in sales: total = total+sales_value average_sales=total/len(sales) print('Average sales are:', average_sales) aver...
sales = [50, 54, 29, 33, 22, 100, 45, 54, 89, 75] def average_sales(): """ Print out the average sales value """ total = 0 for sales_value in sales: total = total + sales_value average_sales = total / len(sales) print('Average sales are:', average_sales) average_sales()
TRACK_WORDS = ["coronavirus"] TABLE_NAME = "coronavirus" TABLE_ATTRIBUTES = "id_str VARCHAR(255), created_at DATETIME, text VARCHAR(255), \ polarity INT, subjectivity INT, user_location VARCHAR(255), \ user_description VARCHAR(255), longitude DOUBLE, latitude DOUBLE, \ retweet_count ...
track_words = ['coronavirus'] table_name = 'coronavirus' table_attributes = 'id_str VARCHAR(255), created_at DATETIME, text VARCHAR(255), polarity INT, subjectivity INT, user_location VARCHAR(255), user_description VARCHAR(255), longitude DOUBLE, latitude DOUBLE, retweet_count INT, f...
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
""" Errors for the library All exceptions defined by the library should be defined in this file. """ class Unchangedinstancenameerror(IOError): """The new instance name is the same as the original one's""" pass class Invalidtargetnetworkerror(IOError): """Migrate to a non-VPC network""" pass class Z...
print ("Hello Guys!") #Hello Guys! print (2+3) #5 #windows - use F9 key for execution of the selected line """ learning flow data types input from the User control flow - if else elif looping - while for string operations internal datastructure - list, dict, tuple.. file handling """ a = 10 b = 2.3 c = True d = "Fo...
print('Hello Guys!') print(2 + 3) ' learning flow \ndata types\ninput from the User\ncontrol flow - if else elif\nlooping - while for\nstring operations\ninternal datastructure - list, dict, tuple..\nfile handling\n' a = 10 b = 2.3 c = True d = 'Forsk' e = 'Forsk' f = 'F' g = 'F' h = None ' data types \nint\nfloat\nboo...
''' 1. Write a Python program to find the first triangle number to have over n(given) divisors. From Wikipedia: A triangular number is a number that is the sum of all of the natural numbers up to a certain number. For example, 10 is a triangular number because 1 + 2 + 3 + 4 = 10. The first 25 triangular numbers are: 1...
""" 1. Write a Python program to find the first triangle number to have over n(given) divisors. From Wikipedia: A triangular number is a number that is the sum of all of the natural numbers up to a certain number. For example, 10 is a triangular number because 1 + 2 + 3 + 4 = 10. The first 25 triangular numbers are: 1...
def predict(lr, sample): return lr.predict(sample.reshape(1, -1)) def predict2(lr, sample): return lr.predict([sample])
def predict(lr, sample): return lr.predict(sample.reshape(1, -1)) def predict2(lr, sample): return lr.predict([sample])
class Solution: def getMoneyAmount(self, n: int) -> int: # dp[i][j] means minimum amount of money [i , j] # dp[i][j] = min(n + max(dp[i][n-1] , dp[n+1][j])) dp = [[-1 for _ in range(n+1)] for _ in range(n+1)] def cal_range(i,j): # basic situation if i >= len(...
class Solution: def get_money_amount(self, n: int) -> int: dp = [[-1 for _ in range(n + 1)] for _ in range(n + 1)] def cal_range(i, j): if i >= len(dp) or j >= len(dp) or i <= 0 or (j <= 0): return 0 if i >= j: dp[i][j] = 0 if dp[...
class Question: def __init__(self, q_text, q_answer): self._text = q_text self._answer = q_answer @property def text(self): return self._text @text.setter def text(self, d): self._text = d @property def answer(self): return self._answer
class Question: def __init__(self, q_text, q_answer): self._text = q_text self._answer = q_answer @property def text(self): return self._text @text.setter def text(self, d): self._text = d @property def answer(self): return self._answer
# Given a string, find the first uppercase character. # Solve using both an iterative and recursive solution. input_str_1 = "lucidProgramming" input_str_2 = "LucidProgramming" input_str_3 = "lucidprogramming" def find_uppercase_iterative(input_str): for i in range(len(input_str)): if input_str[i].isupper...
input_str_1 = 'lucidProgramming' input_str_2 = 'LucidProgramming' input_str_3 = 'lucidprogramming' def find_uppercase_iterative(input_str): for i in range(len(input_str)): if input_str[i].isupper(): return input_str[i] return 'No uppercase character found' def find_uppercase_recursive(inpu...
def phi1(n): ''' sqrt(n) ''' res=n i=2 while(i*i<=n): if n%i==0: res=res//i res=res*(i-1) while(n%i==0): n=n//i i+=1 if n>1: res=res//n res=res*(n-1) return res ''' log(log(n)) ''' def phi2(maxn)...
def phi1(n): """ sqrt(n) """ res = n i = 2 while i * i <= n: if n % i == 0: res = res // i res = res * (i - 1) while n % i == 0: n = n // i i += 1 if n > 1: res = res // n res = res * (n - 1) return res ...
""" Helita python library """ __all__ = ["io", "obs", "sim", "utils"] #from . import io #from . import obs #from . import sim #from . import utils
""" Helita python library """ __all__ = ['io', 'obs', 'sim', 'utils']
# Given an unsorted integer array, find the smallest missing positive integer. # # Example 1: # # Input: [1,2,0] # Output: 3 # Example 2: # # Input: [3,4,-1,1] # Output: 2 # Example 3: # # Input: [7,8,9,11,12] # Output: 1 # Note: # # Your algorithm should run in O(n) time and uses constant extra space. class Solution(...
class Solution(object): def first_missing_positive(self, nums): """ :type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only have to care about those elements in this ra...
def say_(func): func() def hi(): print("Hello") # Estoy pasando hi como argumento de say_ say_(hi)
def say_(func): func() def hi(): print('Hello') say_(hi)
__author__ = 'chris' """ Package for holding all of our protobuf classes """
__author__ = 'chris' '\nPackage for holding all of our protobuf classes\n'
N, A, B = map(int, input().split()) print(min(A, B), end=" ") if N - A <= B: print(B - N + A) else: print(0)
(n, a, b) = map(int, input().split()) print(min(A, B), end=' ') if N - A <= B: print(B - N + A) else: print(0)
class Solution: def countStudents(self, students: List[int], sandwiches: List[int]) -> int: hashStudent = {0:0, 1:0} for student in students: hashStudent[student] += 1 for sandwich in sandwiches: if hashStudent[sandwich] == 0: break ...
class Solution: def count_students(self, students: List[int], sandwiches: List[int]) -> int: hash_student = {0: 0, 1: 0} for student in students: hashStudent[student] += 1 for sandwich in sandwiches: if hashStudent[sandwich] == 0: break el...
def main(): a = 1.0 b = 397.0 print(a/b) return(0) main()
def main(): a = 1.0 b = 397.0 print(a / b) return 0 main()
class Solution: def nextGreaterElement(self, n: int) -> int: num = list(str(n)) i = len(num) - 2 while i >= 0: if num[i] < num[i + 1]: break i -= 1 if i == -1: return -1 j = len(num) - 1 while num[j] <= nu...
class Solution: def next_greater_element(self, n: int) -> int: num = list(str(n)) i = len(num) - 2 while i >= 0: if num[i] < num[i + 1]: break i -= 1 if i == -1: return -1 j = len(num) - 1 while num[j] <= num[i]: ...
def cake(candles,debris): res = 0 for i,v in enumerate(debris): if i%2: res+=ord(v)-97 else: res+=ord(v) if res>0.7*candles and candles: return "Fire!" else: return 'That was close!'
def cake(candles, debris): res = 0 for (i, v) in enumerate(debris): if i % 2: res += ord(v) - 97 else: res += ord(v) if res > 0.7 * candles and candles: return 'Fire!' else: return 'That was close!'
class ColorTheme: def __init__(self, name: str, display_name: str, version: str): self.name = name self.display_name = display_name self.version = version
class Colortheme: def __init__(self, name: str, display_name: str, version: str): self.name = name self.display_name = display_name self.version = version
class ProjectStatus: def __init__(self, name): self.name = name self.icon = None self.status = None def add_icon(self, icon): self.icon = icon def set_status(self, status): self.status = status class ProjectStatusDictionary(object): def __init__(self): ...
class Projectstatus: def __init__(self, name): self.name = name self.icon = None self.status = None def add_icon(self, icon): self.icon = icon def set_status(self, status): self.status = status class Projectstatusdictionary(object): def __init__(self): ...
class Vitals: LEARNING_RATE = 0.1 MOMENTUM_RATE = 0.8 FIRST_LAYER = 5 * 7 SECOND_LAYER = 14 OUTPUT_LAYER = 3
class Vitals: learning_rate = 0.1 momentum_rate = 0.8 first_layer = 5 * 7 second_layer = 14 output_layer = 3
# We will register here processors for the message types by name VM_ENGINE_REGISTER = dict() def register_vm_engine(engine_name, engine_class): """ Verifies a message is valid before forwarding it, handling it (should it be different?). """ VM_ENGINE_REGISTER[engine_name] = engine_class
vm_engine_register = dict() def register_vm_engine(engine_name, engine_class): """ Verifies a message is valid before forwarding it, handling it (should it be different?). """ VM_ENGINE_REGISTER[engine_name] = engine_class
print('C L A S S I C S O L U T I O N') range_of_numbers = [] div_by_2 = [] div_by_3 = [] other_numbers = [] for i in range(1,11): range_of_numbers.append(i) if i%2 == 0: div_by_2.append(i) elif i%3 == 0: div_by_3.append(i) else: other_numbers.append(i) print('The range of numbe...
print('C L A S S I C S O L U T I O N') range_of_numbers = [] div_by_2 = [] div_by_3 = [] other_numbers = [] for i in range(1, 11): range_of_numbers.append(i) if i % 2 == 0: div_by_2.append(i) elif i % 3 == 0: div_by_3.append(i) else: other_numbers.append(i) print('The range of ...
""" Helper modules. These should be stand alone modules that could reasonably be their own PyPI package. This comes with two benefits: 1. The library is void of any business data, which makes it easier to understand. 2. It means that it is decoupled making it easy to reuse the code in different sections of the ...
""" Helper modules. These should be stand alone modules that could reasonably be their own PyPI package. This comes with two benefits: 1. The library is void of any business data, which makes it easier to understand. 2. It means that it is decoupled making it easy to reuse the code in different sections of the ...
# limitation :pattern count of each char to be max 1 text = "912873129" pat = "123" window_found = False prev_min = 0 prev_max = 0 prev_pos = -1 lookup_tab = dict() # detect first window formation when all characters are found # change window whenever new character was the previous minimum # if new window smaller t...
text = '912873129' pat = '123' window_found = False prev_min = 0 prev_max = 0 prev_pos = -1 lookup_tab = dict() for (pos, c) in enumerate(text): if c in pat: prev_pos = lookup_tab.get(c, -1) lookup_tab[c] = pos if window_found == True: cur_max = pos if prev_pos == cur...
class ResponseKeys(object): POST = 'post' POSTS = 'posts' POST_SAVED = 'The post was saved successfully' POST_UPDATED = 'The post was updated successfully' POST_DELETED = 'The post was deleted successfully' POST_NOT_FOUND = 'The post could not be found'
class Responsekeys(object): post = 'post' posts = 'posts' post_saved = 'The post was saved successfully' post_updated = 'The post was updated successfully' post_deleted = 'The post was deleted successfully' post_not_found = 'The post could not be found'
# This problem was recently asked by Google: # Given a singly-linked list, reverse the list. This can be done iteratively or recursively. Can you get both solutions? class ListNode(object): def __init__(self, x): self.val = x self.next = None # Function to print the list def printList...
class Listnode(object): def __init__(self, x): self.val = x self.next = None def print_list(self): node = self output = '' while node != None: output += str(node.val) output += ' ' node = node.next print(output) def rever...
# Longest Substring Without Repeating Characters # Medium class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ # DP Solution based on map, not satisfactory. if not s: return 0 word_set = {} ...
class Solution(object): def length_of_longest_substring(self, s): """ :type s: str :rtype: int """ if not s: return 0 word_set = {} counts = [0] * len(s) word_set[s[0]] = 0 counts[0] = 1 for i in range(1, len(s)): ...
""" ======================================================================== Placeholder.py ======================================================================== Author : Shunning Jiang Date : June 1, 2019 """ class Placeholder: pass
""" ======================================================================== Placeholder.py ======================================================================== Author : Shunning Jiang Date : June 1, 2019 """ class Placeholder: pass
#!/usr/bin/env python # -*- coding: utf-8 -*- def LF_flux(FL, FR, lmax, lmin, UR, UL, dt, dx): ctilde = dx / dt return 0.5 * (FL + FR) - 0.5 * ctilde * (UR - UL)
def lf_flux(FL, FR, lmax, lmin, UR, UL, dt, dx): ctilde = dx / dt return 0.5 * (FL + FR) - 0.5 * ctilde * (UR - UL)
""" Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1, 3], [2, 6], [8, 10], [15, 18]], Output: [[1, 6], [8, 10], [15, 18]] Explanation: Since intervals [1, 3] and [2, 6] overlaps, merge them into [1, 6]. Example 2: Input: [[1, 4], [4, 5]], Output: [[1, 5]] Explanation: Interval...
""" Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1, 3], [2, 6], [8, 10], [15, 18]], Output: [[1, 6], [8, 10], [15, 18]] Explanation: Since intervals [1, 3] and [2, 6] overlaps, merge them into [1, 6]. Example 2: Input: [[1, 4], [4, 5]], Output: [[1, 5]] Explanation: Interval...
def get_circles(image): img = image.copy() gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 2, 100) if circles is not None: circles = np.round(circles[0, :]).astype("int") for x, y, r in circles: cv2.circle(img, (x, y), r, ...
def get_circles(image): img = image.copy() gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 2, 100) if circles is not None: circles = np.round(circles[0, :]).astype('int') for (x, y, r) in circles: cv2.circle(img, (x, y), r, (2...
# Ciholas, Inc. - www.ciholas.com # Licensed under: creativecommons.org/licenses/by/4.0 class Zone: """A zone in the form of a polygon""" def __init__(self, name, vertices, color): self.name = name self.vertices = vertices self.color = color x_list = [] y_list = [] ...
class Zone: """A zone in the form of a polygon""" def __init__(self, name, vertices, color): self.name = name self.vertices = vertices self.color = color x_list = [] y_list = [] for vertex in self.vertices: x_list.append(vertex[0]) y_list....
x, y, w, h = map(int,input().split()) if x >= w-x: a = w-x else: a = x if y >= h-y: b = h-y else: b = y if a >= b: print(b) else: print(a)
(x, y, w, h) = map(int, input().split()) if x >= w - x: a = w - x else: a = x if y >= h - y: b = h - y else: b = y if a >= b: print(b) else: print(a)
#3-1 Names names = ["Jason", "Bob", "James", "Brian", "Marie"] print(names[0]) print(names[1]) print(names[2]) print(names[3]) print(names[4]) #3-2 Greetings message = " you are a friend" print(names[0] + message) print(names[1] + message) print(names[2] + message) print(names[3] + message) print(names[4] + message) ...
names = ['Jason', 'Bob', 'James', 'Brian', 'Marie'] print(names[0]) print(names[1]) print(names[2]) print(names[3]) print(names[4]) message = ' you are a friend' print(names[0] + message) print(names[1] + message) print(names[2] + message) print(names[3] + message) print(names[4] + message) cars = ['BMW', 'BatMobile', ...
# import pytest def test_with_authenticated_client(client, django_user_model): username = "admin" password = "123456" django_user_model.objects.create_user(username=username, password=password) # Use this: # client.login(username=username, password=password) response = client.get('/') asse...
def test_with_authenticated_client(client, django_user_model): username = 'admin' password = '123456' django_user_model.objects.create_user(username=username, password=password) response = client.get('/') assert response.status_code == 302 response = client.get(response.url) assert response....
def setup(): global s, x_count, y_count, tiles, covers s = 50 x_count = width//s y_count = height//s size(800, 600) tiles = [] covers = [] for x in range(x_count): tiles.append([]) covers.append([]) for y in range(y_count): tiles[x].append("...
def setup(): global s, x_count, y_count, tiles, covers s = 50 x_count = width // s y_count = height // s size(800, 600) tiles = [] covers = [] for x in range(x_count): tiles.append([]) covers.append([]) for y in range(y_count): tiles[x].append('bomb' i...
#forma de somar comprar de carrinho virtual carrinho = [] carrinho.append(('Produto 1', 30)) carrinho.append(('Produto 2', '20')) carrinho.append(('Produto 3', 50)) #no python essa baixo nao eh muito boa # total = [] # for produto in carrinho: # total.append(produto[1]) # print(sum(total)) total = sum([float(y)...
carrinho = [] carrinho.append(('Produto 1', 30)) carrinho.append(('Produto 2', '20')) carrinho.append(('Produto 3', 50)) total = sum([float(y) for (x, y) in carrinho]) print(total)
# -*- coding: utf-8 -*- { "name": "Import Settings", "vesion": "10.0.1.0.0", "summary": "Allows to save import settings to don't specify columns to fields mapping each time.", "category": "Extra Tools", "images": ["images/icon.png"], "author": "IT-Projects LLC, Dinar Gabbasov", "website": "h...
{'name': 'Import Settings', 'vesion': '10.0.1.0.0', 'summary': "Allows to save import settings to don't specify columns to fields mapping each time.", 'category': 'Extra Tools', 'images': ['images/icon.png'], 'author': 'IT-Projects LLC, Dinar Gabbasov', 'website': 'https://www.twitter.com/gabbasov_dinar', 'license': 'O...
room_cost = { 'room for one person': {'cost': 18, 'discount': (0, 0, 0)}, 'apartment': {'cost': 25, 'discount': (0.3, 0.35, 0.5)}, 'president apartment': {'cost': 35, 'discount': (0.1, 0.15, 0.2)} } def discount_index(days_: int) -> int: if days_ < 10: return 0 elif 10 <= days_ <= 15: ...
room_cost = {'room for one person': {'cost': 18, 'discount': (0, 0, 0)}, 'apartment': {'cost': 25, 'discount': (0.3, 0.35, 0.5)}, 'president apartment': {'cost': 35, 'discount': (0.1, 0.15, 0.2)}} def discount_index(days_: int) -> int: if days_ < 10: return 0 elif 10 <= days_ <= 15: return 1 ...
for left in range(7): for right in range(left,7): print("[" + str(left) + "|" + str(right) + "]", end=" ") print
for left in range(7): for right in range(left, 7): print('[' + str(left) + '|' + str(right) + ']', end=' ') print
"""Exceptions used throughout Eelbrain""" class DefinitionError(Exception): "MneExperiment definition error" class DimensionMismatchError(Exception): "Trying to align NDVars with mismatching dimensions" @classmethod def from_dims_list(cls, message, dims_list): unique_dims = [] for d...
"""Exceptions used throughout Eelbrain""" class Definitionerror(Exception): """MneExperiment definition error""" class Dimensionmismatcherror(Exception): """Trying to align NDVars with mismatching dimensions""" @classmethod def from_dims_list(cls, message, dims_list): unique_dims = [] ...
number = int(input()) bonus_points = 0 if number <= 100: bonus_points += 5 elif number > 1000: bonus_points += number * 0.10 else: bonus_points += number * 0.20 if number % 2 == 0: bonus_points += 1 if number % 10 == 5: bonus_points += 2 print(bonus_points) print(bonus_points + number)
number = int(input()) bonus_points = 0 if number <= 100: bonus_points += 5 elif number > 1000: bonus_points += number * 0.1 else: bonus_points += number * 0.2 if number % 2 == 0: bonus_points += 1 if number % 10 == 5: bonus_points += 2 print(bonus_points) print(bonus_points + number)
def if_hexagon_enabled(a): return select({ "//micro:hexagon_enabled": a, "//conditions:default": [], }) def if_not_hexagon_enabled(a): return select({ "//micro:hexagon_enabled": [], "//conditions:default": a, }) def new_local_repository_env_impl(repository_ctx): ech...
def if_hexagon_enabled(a): return select({'//micro:hexagon_enabled': a, '//conditions:default': []}) def if_not_hexagon_enabled(a): return select({'//micro:hexagon_enabled': [], '//conditions:default': a}) def new_local_repository_env_impl(repository_ctx): echo_cmd = 'echo ' + repository_ctx.attr.path ...
DATABASE = '/tmp/tmc2.db' DEBUG = False # By default we only listen on localhost. Set this to '0.0.0.0' to accept # requests from any interface HOST = '127.0.0.1' PORT = 5000 # How many quotes per page PAGE_SIZE = 10 # How should dates be formatted. The format is defined in # http://arrow.readthedocs.io/en/latest/in...
database = '/tmp/tmc2.db' debug = False host = '127.0.0.1' port = 5000 page_size = 10 date_formats = {'en_US': 'MMMM D, YYYY', 'fr_FR': 'D MMMM YYYY'} locale = 'en_US'
# -*- coding: utf-8 -*- ''' File name: code\lychrel_numbers\sol_55.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #55 :: Lychrel numbers # # For more information see: # https://projecteuler.net/problem=55 # Problem Statement ''' If we ...
""" File name: code\\lychrel_numbers\\sol_55.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nIf we take 47, reverse and add, 47 + 74 = 121, which is palindromic.\nNot all numbers produce palindromes so quickly. For example,\n349 + 943 = 1292,\n1292 + 2921 = 4213\n4213 + 312...
n,v = map(int,input().split()) mx = -1 for i in range(n): l,w,h = map(int,input().split()) vo = l*w*h #print(vo) if vo>mx: mx = vo print(mx - v)
(n, v) = map(int, input().split()) mx = -1 for i in range(n): (l, w, h) = map(int, input().split()) vo = l * w * h if vo > mx: mx = vo print(mx - v)
# # PySNMP MIB module TIARA-IP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIARA-IP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:09:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) ...
# # PySNMP MIB module HP-ICF-CHAIN (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-CHAIN # Produced by pysmi-0.3.4 at Wed May 1 13:33:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ...
''' Missing number in an array Given an array of size N-1 such that, it can only contain distinct integers in the range of 1 to N. Find the missing element. Example: Input: N = 5 A[] = {1,2,3,5} Output: 4 Input: N = 10 A[] = {1,2,3,4,5,6,7,8,10} Output: 9 ''' # Approach-1 ''' We know that sum of N natu...
""" Missing number in an array Given an array of size N-1 such that, it can only contain distinct integers in the range of 1 to N. Find the missing element. Example: Input: N = 5 A[] = {1,2,3,5} Output: 4 Input: N = 10 A[] = {1,2,3,4,5,6,7,8,10} Output: 9 """ ' \nWe know that sum of N natural number is ...
# # PySNMP MIB module CADANT-HW-MEAS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CADANT-HW-MEAS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:45:55 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
class A: def __init__(self, var=0): self.var = var def __str__(self): return "This is class A" a = A() print(a) """ All classes are inherited from object class. > class MyClass: > pass > > print(MyClass.__class__.__bases__) (<class 'object'>,) "...
class A: def __init__(self, var=0): self.var = var def __str__(self): return 'This is class A' a = a() print(a) "\n All classes are inherited from object class. \n > class MyClass:\n > pass\n >\n > print(MyClass.__class__.__bases__)\n (<class 'object'>,)\n" class B: ...
YT_API_SERVICE_NAME = 'youtube' DEVELOPER_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" MAX_RESULTS = 50 YT_API_VERSION = 'v3' LINK = 'https://www.youtube.com/watch?v='
yt_api_service_name = 'youtube' developer_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' max_results = 50 yt_api_version = 'v3' link = 'https://www.youtube.com/watch?v='
""" info.py - module to store Info class """ class Info: """ Info - class to store retreived Info from DB """ def __init__(self, ids, texts, name = 'Info'): """ Infor class constructor Inputs: - ids : list of integers Unique ids for info pieces - texts : list of texts Infor texts """ self...
""" info.py - module to store Info class """ class Info: """ Info - class to store retreived Info from DB """ def __init__(self, ids, texts, name='Info'): """ Infor class constructor Inputs: - ids : list of integers Unique ids for info pieces - texts : list of texts Infor texts "...
out_data = b"\x1c\x91\x73\x94\xba\xfb\x3c\x30" + \ b"\x3c\x30\xac\x26\x62\x09\x74\x65" + \ b"\x73\x74\x31\x2e\x74\x78\x74\x5e" + \ b"\xc5\xf7\x32\x4c\x69\x76\x65\x20" + \ b"\x66\x72\x65\x65\x20\x6f\x72\x20" + \ b"\x64\x69\x65\x20\x68\x61\x72\x64" + \ ...
out_data = b'\x1c\x91s\x94\xba\xfb<0' + b'<0\xac&b\tte' + b'st1.txt^' + b'\xc5\xf72Live ' + b'free or ' + b'die hard' + b'\r\n\xd3\x14|.\x86\x89' + b'zBX\xed\x06S\x9f\x15' + b'\xcc\xca~{7(_<'
class A(): @staticmethod def staticMethod(): print("STATIC method fired!") print("Nothing is bound to me") print("~"*30) @classmethod def classMethod(cls): print("CLASS method fired!") print(str(cls)+" is bound to me") print("~"*30) # normal method def normalMethod(self): print...
class A: @staticmethod def static_method(): print('STATIC method fired!') print('Nothing is bound to me') print('~' * 30) @classmethod def class_method(cls): print('CLASS method fired!') print(str(cls) + ' is bound to me') print('~' * 30) def normal...
class Solution: def removeDuplicates(self, S: str) -> str: def process(S): lst = [] for key, g in itertools.groupby(S): n = len(list(g)) if n % 2: lst.append(key) return lst S_lst = list(S) while True: ...
class Solution: def remove_duplicates(self, S: str) -> str: def process(S): lst = [] for (key, g) in itertools.groupby(S): n = len(list(g)) if n % 2: lst.append(key) return lst s_lst = list(S) while Tru...
class User: ''' class that generates new instance of user ''' user_list = [] def __init__ (self, user_name, password): self.user_name = user_name self.password = password def save_user(self): User.user_list.append(self) def delete_user(self): ''' ...
class User: """ class that generates new instance of user """ user_list = [] def __init__(self, user_name, password): self.user_name = user_name self.password = password def save_user(self): User.user_list.append(self) def delete_user(self): """ del...
print("Example 05: [The else Statement] \n" " Print a message once the condition is false") i = 1 while i < 6: print(i) i += 1 else: print("The condition is false")
print('Example 05: [The else Statement] \n Print a message once the condition is false') i = 1 while i < 6: print(i) i += 1 else: print('The condition is false')
def isPalindrome(s): temp = [c for c in s] temp.reverse() return ''.join(temp) == s def twodigit(): return reversed(range(100, 999)) q = reversed(sorted([a * b for a in twodigit() for b in twodigit()])) found = False for s in q: if isPalindrome(str(s)): print(s) found = True break...
def is_palindrome(s): temp = [c for c in s] temp.reverse() return ''.join(temp) == s def twodigit(): return reversed(range(100, 999)) q = reversed(sorted([a * b for a in twodigit() for b in twodigit()])) found = False for s in q: if is_palindrome(str(s)): print(s) found = True ...
def mutations(inputs): item_a = set(inputs[0].lower()) item_b = set(inputs[1].lower()) return item_b.intersection(item_a) == item_b print(mutations(["hello", "Hello"])) print(mutations(["hello", "hey"])) print(mutations(["Alien", "line"]))
def mutations(inputs): item_a = set(inputs[0].lower()) item_b = set(inputs[1].lower()) return item_b.intersection(item_a) == item_b print(mutations(['hello', 'Hello'])) print(mutations(['hello', 'hey'])) print(mutations(['Alien', 'line']))
while True: try: n = int(input("Enter N: ")) except ValueError: print("Enter correct number!") else: if n <= 100: print("Error: N must be greater than 100!") else: for i in range(11, n + 1): s = i i = (i-1) + i*i ...
while True: try: n = int(input('Enter N: ')) except ValueError: print('Enter correct number!') else: if n <= 100: print('Error: N must be greater than 100!') else: for i in range(11, n + 1): s = i i = i - 1 + i * i ...
# PySNMP SMI module. Autogenerated from smidump -f python RUCKUS-SCG-TTG-MIB # by libsmi2pysnmp-0.1.3 # Python version sys.version_info(major=2, minor=7, micro=11, releaselevel='final', serial=0) # pylint:disable=C0302 mibBuilder = mibBuilder # pylint:disable=undefined-variable,used-before-assignment # Imports (Int...
mib_builder = mibBuilder (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, single_value_constraint, value_range_constraint...
class Slot: def __init__(name, _type=None, item=None): self.name = name, if _type is not None: self.type = _type else: self.type = name self.item = item, def equip(self): pass def unequip(self): pass def show(sel...
class Slot: def __init__(name, _type=None, item=None): self.name = (name,) if _type is not None: self.type = _type else: self.type = name self.item = (item,) def equip(self): pass def unequip(self): pass def show(self): ...
def test_modulemap(snapshot): snapshot.assert_match([1, 2, 4]) def test_runlist(): assert 1 == 1
def test_modulemap(snapshot): snapshot.assert_match([1, 2, 4]) def test_runlist(): assert 1 == 1
# Charlie Conneely # Dictionary parser file def parse(f): file = open(f, "r") words = file.read().split() file.close() return words if __name__ == "__main__": print("please run runner.py instead")
def parse(f): file = open(f, 'r') words = file.read().split() file.close() return words if __name__ == '__main__': print('please run runner.py instead')