content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def firstPalindrome(self, words: List[str]) -> str: def checkPalindrome(word): l = len(word) for i in range(l // 2): last = l - 1 - i if word[i] != word[last]: return False ...
class Solution: def first_palindrome(self, words: List[str]) -> str: def check_palindrome(word): l = len(word) for i in range(l // 2): last = l - 1 - i if word[i] != word[last]: return False return True for wor...
# import DevsExpo zee5 = "https://userapi.zee5.com/v1/user/loginemail?email={email}&password={password}" nord = "https://zwyr157wwiu6eior.com/v1/users/tokens" vortex = "https://vortex-api.gg/login" vypr = "https://api.goldenfrog.com/settings"
zee5 = 'https://userapi.zee5.com/v1/user/loginemail?email={email}&password={password}' nord = 'https://zwyr157wwiu6eior.com/v1/users/tokens' vortex = 'https://vortex-api.gg/login' vypr = 'https://api.goldenfrog.com/settings'
class Vehicle: def __init__(self, cost): self.cost = cost def description(self): return "Vehicle cost is {}".format(self.cost) car1 = Vehicle(12000) car2 = Vehicle(5999.99) print(car1.description()) print(car2.description())
class Vehicle: def __init__(self, cost): self.cost = cost def description(self): return 'Vehicle cost is {}'.format(self.cost) car1 = vehicle(12000) car2 = vehicle(5999.99) print(car1.description()) print(car2.description())
class Solution: def shortestPath(self, grid: List[List[int]], k: int) -> int: m = len(grid) n = len(grid[0]) if m == 1 and n == 1: return 0 dirs = [0, 1, 0, -1, 0] steps = 0 q = deque([(0, 0, k)]) seen = {(0, 0, k)} while q: steps += 1 for _ in range(len(q)): ...
class Solution: def shortest_path(self, grid: List[List[int]], k: int) -> int: m = len(grid) n = len(grid[0]) if m == 1 and n == 1: return 0 dirs = [0, 1, 0, -1, 0] steps = 0 q = deque([(0, 0, k)]) seen = {(0, 0, k)} while q: s...
for i in range(1, 21): for j in range(2, i): if(i % 2 == 0): break else: print(i)
for i in range(1, 21): for j in range(2, i): if i % 2 == 0: break else: print(i)
Totalplyers = int(input("Number of players: ")) Starplayers = 0 for i in range(Totalplyers): Numberofpoints = int(input("Number of goals: ")) Numberoffouls = int(input("Number of fouls: ")) Numberofstars = Numberofpoints * 5 - Numberoffouls * 3 if Numberofstars > 40: Starplayers = Starplayers +...
totalplyers = int(input('Number of players: ')) starplayers = 0 for i in range(Totalplyers): numberofpoints = int(input('Number of goals: ')) numberoffouls = int(input('Number of fouls: ')) numberofstars = Numberofpoints * 5 - Numberoffouls * 3 if Numberofstars > 40: starplayers = Starplayers + ...
__all__ = () class InfoException(Exception): def __init__(self, info=None): self.info = info or {} super().__init__(self.info) class DeepQMCError(Exception): pass class NanError(DeepQMCError): def __init__(self, rs): super().__init__() self.rs = rs class TrainingBlowu...
__all__ = () class Infoexception(Exception): def __init__(self, info=None): self.info = info or {} super().__init__(self.info) class Deepqmcerror(Exception): pass class Nanerror(DeepQMCError): def __init__(self, rs): super().__init__() self.rs = rs class Trainingblowup(...
# # PySNMP MIB module NETSCREEN-VR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-VR-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:20:42 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) ...
pasword = '123456' username = 'kamilklkn' a,b,c,d = 5,5,10,4 result = (a==b) #True result = (a == c) #False result = ('sdktrn' == username) result = (a != b) result = (a != c) result = (a >= b) result = (True == 1) result = (False == 1) print(result)
pasword = '123456' username = 'kamilklkn' (a, b, c, d) = (5, 5, 10, 4) result = a == b result = a == c result = 'sdktrn' == username result = a != b result = a != c result = a >= b result = True == 1 result = False == 1 print(result)
__title__ = 'sellsy_api' __description__ = 'sellsy_api is a tiny client for Sellsy API' __url__ = 'https://github.com/Annouar/sellsy-api' __version__ = '0.0.2' __author__ = 'Annouar' __license__ = 'MIT'
__title__ = 'sellsy_api' __description__ = 'sellsy_api is a tiny client for Sellsy API' __url__ = 'https://github.com/Annouar/sellsy-api' __version__ = '0.0.2' __author__ = 'Annouar' __license__ = 'MIT'
buses = [] n, m, h = map(int, input().split()) for i in range(n): buses.append(int(input())) count = 0 for i in range(n - 1): while buses[n - i - 1] - buses[n - i - 2] > h: buses[n - i - 2] += m count += 1 print(count)
buses = [] (n, m, h) = map(int, input().split()) for i in range(n): buses.append(int(input())) count = 0 for i in range(n - 1): while buses[n - i - 1] - buses[n - i - 2] > h: buses[n - i - 2] += m count += 1 print(count)
#pembuatan fungsi def hitung_gaji(): nama =(input("masukan Nama anda :")) gol=(input("masukan golongan:")) if gol =="1": gaji=1000000 tunjangan= 250000 total=gaji+tunjangan print(f"total gaji yang anda terima {total}") elif gol == "2": gaji = 2000000...
def hitung_gaji(): nama = input('masukan Nama anda :') gol = input('masukan golongan:') if gol == '1': gaji = 1000000 tunjangan = 250000 total = gaji + tunjangan print(f'total gaji yang anda terima {total}') elif gol == '2': gaji = 2000000 tunjangan = 5000...
def add(x, y): return x + y def times(func, x, y): return func(x, y) a = 2 b = 4 r = times(add, a, b) print(' - Resultado = ', r)
def add(x, y): return x + y def times(func, x, y): return func(x, y) a = 2 b = 4 r = times(add, a, b) print(' - Resultado = ', r)
# ##Create 5 dictionaries which have list values dict1 = {'State': 'Maharashtra', 'City': 'Pune', 'Best Places to Visit': ['Shanivarwada', "Pataleshwar", "Dagdusheth", "Tulshibag"]} dict2 = {'State': 'Goa', 'Cty': 'North Goa', 'Best Places to Visit': ["panji", "Baga", "Calngut", "Meeramaar"]} dict3 = {'State': 'Mahara...
dict1 = {'State': 'Maharashtra', 'City': 'Pune', 'Best Places to Visit': ['Shanivarwada', 'Pataleshwar', 'Dagdusheth', 'Tulshibag']} dict2 = {'State': 'Goa', 'Cty': 'North Goa', 'Best Places to Visit': ['panji', 'Baga', 'Calngut', 'Meeramaar']} dict3 = {'State': 'Maharashtra', 'City': 'Pune', 'Best Hotel to Visit': ['P...
description = 'TOF counter devices' group = 'lowlevel' devices = dict( monitor = device('nicos.devices.generic.VirtualCounter', description = 'TOFTOF monitor', fmtstr = '%d', type = 'monitor', lowlevel = True, pollinterval = None, ), timer = device('nicos.devices.ge...
description = 'TOF counter devices' group = 'lowlevel' devices = dict(monitor=device('nicos.devices.generic.VirtualCounter', description='TOFTOF monitor', fmtstr='%d', type='monitor', lowlevel=True, pollinterval=None), timer=device('nicos.devices.generic.VirtualTimer', description='TOFTOF timer', fmtstr='%.2f', unit='s...
# -*- coding: utf-8 -*- # @Time : 2020/12/20 17:54:58 # @Author : ddvv # @Site : https://ddvvmmzz.github.io # @File : filetypes.py # @Software: Visual Studio Code FILE_TYPE_MAPPING = { 'eml': 'eml', 'html': 'html', 'zip': 'zip', 'doc': 'ole', 'docx': 'zip', 'xls': 'ole', 'xlsx': ...
file_type_mapping = {'eml': 'eml', 'html': 'html', 'zip': 'zip', 'doc': 'ole', 'docx': 'zip', 'xls': 'ole', 'xlsx': 'zip', 'ppt': 'ole', 'pptx': 'zip', 'rtf': 'rtf', 'vba': 'vba', 'exe': 'exe', 'pdf': 'pdf', 'ole': 'ole', 'lnk': 'lnk'} other_list = ['vba', 'exe', 'pdf', 'bat'] def get_support_file_type(ext): retur...
# Enter your code here. Read input from STDIN. Print output to STDOUT NumOfLines = int(input()) # taking first input 2 for j in range(NumOfLines): # makes sure we take all the lines as n s = input() # taking 1st and 2nd line evens, odds = '','' for ...
num_of_lines = int(input()) for j in range(NumOfLines): s = input() (evens, odds) = ('', '') for i in range(len(s)): if i % 2 == 0: evens += s[i] else: odds += s[i] print(evens, odds)
def add_feature(training_df): training_df["bin_label"] = training_df.label.apply(lambda l: "O" if l == "O" else "I") training_df["token_num"] = training_df.token.apply(lambda t: len(t.doc)) training_df["loc"] = training_df.token.apply(lambda t: t.i) training_df["len"] = training_df.token.apply(lambda t:...
def add_feature(training_df): training_df['bin_label'] = training_df.label.apply(lambda l: 'O' if l == 'O' else 'I') training_df['token_num'] = training_df.token.apply(lambda t: len(t.doc)) training_df['loc'] = training_df.token.apply(lambda t: t.i) training_df['len'] = training_df.token.apply(lambda t:...
''' @Author: CSY @Date: 2020-01-28 09:55:04 @LastEditors : CSY @LastEditTime : 2020-01-28 09:55:17 ''' a=5%2==1 print(a)
""" @Author: CSY @Date: 2020-01-28 09:55:04 @LastEditors : CSY @LastEditTime : 2020-01-28 09:55:17 """ a = 5 % 2 == 1 print(a)
# sum of n to n verbose 1 print('sum of n to n') number1 = int(input('input number1: ')) number2 = int(input('input number2: ')) if number1 > number2: number1, number2 = number2, number1 sum = 0 for i in range(number1, number2 + 1): if i < number2: print(f'{i} + ', end='') else: print(f'{...
print('sum of n to n') number1 = int(input('input number1: ')) number2 = int(input('input number2: ')) if number1 > number2: (number1, number2) = (number2, number1) sum = 0 for i in range(number1, number2 + 1): if i < number2: print(f'{i} + ', end='') else: print(f'{i} = ', end='') sum +...
#!/usr/bin/python3 # Read the file in to an array input = [] f = open("input.txt", "r") for l in f: input.append(l) def find_search_bit(position, input_list): v = "" for i in input_list: v = v + i[position] if v.count('1') == v.count('0'): return 1 elif v.count('1') > v.count('...
input = [] f = open('input.txt', 'r') for l in f: input.append(l) def find_search_bit(position, input_list): v = '' for i in input_list: v = v + i[position] if v.count('1') == v.count('0'): return 1 elif v.count('1') > v.count('0'): return 1 else: return 0 def f...
class SudokuGrid : def __init__(self,grid=[]) : if grid : i = iter(grid) j = len(next(i)) if j == 9 and all(len(l) == j for l in i): self.grid = grid return self.grid = [[0 for i in range(9)] for j in range(9)] def sho...
class Sudokugrid: def __init__(self, grid=[]): if grid: i = iter(grid) j = len(next(i)) if j == 9 and all((len(l) == j for l in i)): self.grid = grid return self.grid = [[0 for i in range(9)] for j in range(9)] def show(self):...
class Heapsort: def sort(self, arr): self.__build_max_heap(arr) size = len(arr) - 1 for i in range(size, -1, -1): self.__max_heapify(arr, 0, i) # swap last index with first index already sorted arr[0], arr[i] = arr[i], arr[0] def __build_max_heap(self, arr): size = len(arr) - 1 ...
class Heapsort: def sort(self, arr): self.__build_max_heap(arr) size = len(arr) - 1 for i in range(size, -1, -1): self.__max_heapify(arr, 0, i) (arr[0], arr[i]) = (arr[i], arr[0]) def __build_max_heap(self, arr): size = len(arr) - 1 for i in rang...
# # PySNMP MIB module ADTRAN-AOS-VQM (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-AOS-VQM # Produced by pysmi-0.3.4 at Mon Apr 29 16:58:58 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...
(ad_gen_aos_voice, ad_gen_aos_conformance) = mibBuilder.importSymbols('ADTRAN-AOS', 'adGenAOSVoice', 'adGenAOSConformance') (ad_identity,) = mibBuilder.importSymbols('ADTRAN-MIB', 'adIdentity') (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (n...
def fahrenheit(T): return (float(9.0) / 5) * T + 32 print(fahrenheit(0)) temp = [0, 22.5, 40, 100] print(map(fahrenheit, temp)) # ?????????????? <map object at 0x00000214D009E080> c = map(lambda T: (9.0 / 5) * T + 32, temp) print(c) # <map object at 0x00000214D009E080> print(lambda x, y: x + y) a = [1, 2, 3...
def fahrenheit(T): return float(9.0) / 5 * T + 32 print(fahrenheit(0)) temp = [0, 22.5, 40, 100] print(map(fahrenheit, temp)) c = map(lambda T: 9.0 / 5 * T + 32, temp) print(c) print(lambda x, y: x + y) a = [1, 2, 3] b = [4, 5, 6] c = [7, 8, 9] print(map(lambda x, y: x + y, a, b)) print(map(lambda num: num * -1, a)...
def j(n, k): p, i, seq = list(range(n)), 0, [] while p: i = (i+k-1) % len(p) seq.append(p.pop(i)) return 'Prisoner killing order: %s.\nSurvivor: %i' % (', '.join(str(i) for i in seq[:-1]), seq[-1]) print(j(5, 2)) print(j(41, 3))
def j(n, k): (p, i, seq) = (list(range(n)), 0, []) while p: i = (i + k - 1) % len(p) seq.append(p.pop(i)) return 'Prisoner killing order: %s.\nSurvivor: %i' % (', '.join((str(i) for i in seq[:-1])), seq[-1]) print(j(5, 2)) print(j(41, 3))
rfile = open("dictionary.txt", "r") wfile = open("dict-5.txt","w") for line in rfile: if len(line) == 6: wfile.write(line)
rfile = open('dictionary.txt', 'r') wfile = open('dict-5.txt', 'w') for line in rfile: if len(line) == 6: wfile.write(line)
class Solution: def solve(self, matrix): leaders = {(r,c):(r,c) for r in range(len(matrix)) for c in range(len(matrix[0])) if matrix[r][c] == 1} followers = {(r,c):[(r,c)] for r in range(len(matrix)) for c in range(len(matrix[0])) if matrix[r][c] == 1} for r in range(len(matrix)): ...
class Solution: def solve(self, matrix): leaders = {(r, c): (r, c) for r in range(len(matrix)) for c in range(len(matrix[0])) if matrix[r][c] == 1} followers = {(r, c): [(r, c)] for r in range(len(matrix)) for c in range(len(matrix[0])) if matrix[r][c] == 1} for r in range(len(matrix)): ...
def countValues(values): resultSet = {-1:0, 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0} for value in values: i = 0 valuesList = list(value) while i < len(valuesList): resultSet[i] += int(valuesList[i]) i += 1 resultSet[-1] += 1 ...
def count_values(values): result_set = {-1: 0, 0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0} for value in values: i = 0 values_list = list(value) while i < len(valuesList): resultSet[i] += int(valuesList[i]) i += 1 resultSet[-1]...
expected_output = { "flow_drop": { "inspect-fail": 67870, "last_clearing": "10:43:33 EDT Mar 27 2019 by genie", "nat-failed": 528, "ssl-received-close-alert": 9, }, "frame_drop": { "acl-drop": 29, "l2_acl": 35, "last_clearing": "10:43:33 EDT Mar 27 201...
expected_output = {'flow_drop': {'inspect-fail': 67870, 'last_clearing': '10:43:33 EDT Mar 27 2019 by genie', 'nat-failed': 528, 'ssl-received-close-alert': 9}, 'frame_drop': {'acl-drop': 29, 'l2_acl': 35, 'last_clearing': '10:43:33 EDT Mar 27 2019 by genie', 'no-mcast-intrf': 31, 'rpf-violated': 23, 'sp-security-faile...
#O(n^2) Time / O(n) Space def threeNumberSum(arr,targetSum): triplets=[] arr.sort() for i in range(len(arr)-2): left=i+1 right=len(arr)-1 while(left<right): currentSum=arr[i]+arr[left]+arr[right] if currentSum==targetSum: triplets.append([arr[i],arr[left],arr[right]]) left+...
def three_number_sum(arr, targetSum): triplets = [] arr.sort() for i in range(len(arr) - 2): left = i + 1 right = len(arr) - 1 while left < right: current_sum = arr[i] + arr[left] + arr[right] if currentSum == targetSum: triplets.append([arr[i]...
Space = " " class Solution: def lengthOfLastWord(self, s: str) -> int: found_word = False word_length = 0 for i in range(len(s) - 1, -1, -1): letter = s[i] if letter == Space: if found_word: break else: ...
space = ' ' class Solution: def length_of_last_word(self, s: str) -> int: found_word = False word_length = 0 for i in range(len(s) - 1, -1, -1): letter = s[i] if letter == Space: if found_word: break else: ...
action_space={'11':0,'12':1,'13':2,'14':3,'15':4,'21':5,'22':6,'23':7,'24':8,'25':9,'31':10,'32':11,'33':12,'34':13,'35':14,'41':15,'42':16,'43':17,'44':18,'45':19,'51':20,'52':21,'53':22,'54':23,'55':24,'1112':25,'1121':26,'1122':27,'1113':28,'1131':29,'1133':30,'1213':31,'1211':32,'1222':33,'1232':34,'1214':35,'1312'...
action_space = {'11': 0, '12': 1, '13': 2, '14': 3, '15': 4, '21': 5, '22': 6, '23': 7, '24': 8, '25': 9, '31': 10, '32': 11, '33': 12, '34': 13, '35': 14, '41': 15, '42': 16, '43': 17, '44': 18, '45': 19, '51': 20, '52': 21, '53': 22, '54': 23, '55': 24, '1112': 25, '1121': 26, '1122': 27, '1113': 28, '1131': 29, '113...
# # PySNMP MIB module Juniper-Fractional-T1-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-Fractional-T1-CONF # Produced by pysmi-0.3.4 at Mon Apr 29 19:51:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint) ...
''' QUESTION: 455. Assign Cookies Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a cookie that the child will be content with; and each cookie j has a size sj. If sj >= gi...
""" QUESTION: 455. Assign Cookies Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a cookie that the child will be content with; and each cookie j has a size sj. If sj >= gi...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findDuplicateSubtrees(self, root: TreeNode) -> List[TreeNode]: trees = defaultdict() tre...
class Solution: def find_duplicate_subtrees(self, root: TreeNode) -> List[TreeNode]: trees = defaultdict() trees.default_factory = trees.__len__ count = counter() result = [] def lookup(node): if node: uid = trees[node.val, lookup(node.left), loo...
#!/bin/python3 ''' Generate a vector of length m with exactkly n ones ''' def generate_vec_binary(n, m): res = [] lower = sum(2**i for i in range(m-4)) upper = sum(2**i for i in range(m-4, m))+1 for i in range(lower, upper): val = bin(i)[2:].zfill(8) if sum([int(i) for i in val]) == 4...
""" Generate a vector of length m with exactkly n ones """ def generate_vec_binary(n, m): res = [] lower = sum((2 ** i for i in range(m - 4))) upper = sum((2 ** i for i in range(m - 4, m))) + 1 for i in range(lower, upper): val = bin(i)[2:].zfill(8) if sum([int(i) for i in val]) == 4: ...
def mutate_string(string, position, character): # method_#1 #str_list = list( string ) #str_list[position] = character #str_modified = ''.join(str_list) str_modified = mutate_string_method2( string, position, character) return str_modified # method_#2 def mutate_string_method2(string, p...
def mutate_string(string, position, character): str_modified = mutate_string_method2(string, position, character) return str_modified def mutate_string_method2(string, position, character): str_modified = string[:position] + character + string[position + 1:] return str_modified if __name__ == '__main__...
# line intersection detection # line1: (x1, y1) to (x2, y2) # line2: (x3, y3) to (x4, y4) def Intercept(x1, y1, x2, y2, x3, y3, x4, y4, d): denom = ((y4-y3) * (x2-x1)) - ((x4-x3) * (y2-y1)) if (denom != 0): ua = (((x4-x3) * (y1-y3)) - ((y4-y3) * (x1-x3))) / denom if ((ua >= 0) and (ua <= 1)):...
def intercept(x1, y1, x2, y2, x3, y3, x4, y4, d): denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1) if denom != 0: ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom if ua >= 0 and ua <= 1: ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom if ub >...
def dominantIndex(self, nums): i = nums.index(max(nums)) l = nums[i] del nums[i] if not nums: return 0 return i if l >= 2 * max(nums) else -1
def dominant_index(self, nums): i = nums.index(max(nums)) l = nums[i] del nums[i] if not nums: return 0 return i if l >= 2 * max(nums) else -1
text = 'i love to count words' count = 0 for char in text: if char == ' ': count = count + 1 #must add one extra line for the last word count = count + 1 print(count)
text = 'i love to count words' count = 0 for char in text: if char == ' ': count = count + 1 count = count + 1 print(count)
def sum100(): total = 0; for i in range(101): total += i return total print(sum100())
def sum100(): total = 0 for i in range(101): total += i return total print(sum100())
''' Now You Code 3: Amazon Deals Create a program that downloads and prints Today's Deals from amazon.com (https://www.amazon.com/gp/goldbox) Hint: You will need to use selenium to scrape this page, it is loaded with JavaScript! Example Run: Here are Amazon.com deals! 1.) Shower Hose 79 inch (6.5 Ft.) for Hand Held...
""" Now You Code 3: Amazon Deals Create a program that downloads and prints Today's Deals from amazon.com (https://www.amazon.com/gp/goldbox) Hint: You will need to use selenium to scrape this page, it is loaded with JavaScript! Example Run: Here are Amazon.com deals! 1.) Shower Hose 79 inch (6.5 Ft.) for Hand Held...
class Solution(object): def isValidSudoku(self, board): rows = [{} for i in range(9) ] cols = [{} for i in range(9) ] squares = [ {} for i in range(9)] for i in range(9): for j in range(9): #print("iter", i, j, board[i][j]) #print(rows) ...
class Solution(object): def is_valid_sudoku(self, board): rows = [{} for i in range(9)] cols = [{} for i in range(9)] squares = [{} for i in range(9)] for i in range(9): for j in range(9): cur_val = board[i][j] if cur_val == '.': ...
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
{'variables': {'use_libjpeg_turbo%': '<(use_libjpeg_turbo)', 'conditions': [['use_libjpeg_turbo==1', {'libjpeg_include_dir%': ['<(DEPTH)/third_party/libjpeg_turbo']}, {'libjpeg_include_dir%': ['<(DEPTH)/third_party/libjpeg']}]]}, 'includes': ['../build/common.gypi'], 'targets': [{'target_name': 'common_video', 'type': ...
def portrayCell(cell): ''' This function is registered with the visualization server to be called each tick to indicate how to draw the cell in its current state. :param cell: the cell in the simulation :return: the portrayal dictionary. ''' assert cell is not None return { "Sha...
def portray_cell(cell): """ This function is registered with the visualization server to be called each tick to indicate how to draw the cell in its current state. :param cell: the cell in the simulation :return: the portrayal dictionary. """ assert cell is not None return {'Shape': 'he...
# -*- coding: utf-8 -*- class User_stopword(object): user_stop = ['html','head','title','base','link','meta','style','body','article','section','nav','aside','header','footer','address','p','hr','pre','blockquote','ol','ul','li','dl','dt','dd','figure','figcaption','div','main','a','em','strong','small','s','cite','...
class User_Stopword(object): user_stop = ['html', 'head', 'title', 'base', 'link', 'meta', 'style', 'body', 'article', 'section', 'nav', 'aside', 'header', 'footer', 'address', 'p', 'hr', 'pre', 'blockquote', 'ol', 'ul', 'li', 'dl', 'dt', 'dd', 'figure', 'figcaption', 'div', 'main', 'a', 'em', 'strong', 'small', 's...
def clojure_binary_impl(ctx): toolchain = ctx.toolchains["@rules_clojure//:toolchain"] deps = depset( direct = toolchain.files.runtime, transitive = [dep[JavaInfo].transitive_runtime_deps for dep in ctx.attr.deps], ) executable = ctx.actions.declare_file(ctx.label.name) ctx.action...
def clojure_binary_impl(ctx): toolchain = ctx.toolchains['@rules_clojure//:toolchain'] deps = depset(direct=toolchain.files.runtime, transitive=[dep[JavaInfo].transitive_runtime_deps for dep in ctx.attr.deps]) executable = ctx.actions.declare_file(ctx.label.name) ctx.actions.write(output=executable, con...
# # PySNMP MIB module CHIPNET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHIPNET-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:31:30 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, 0...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) ...
electricity_bill = 0 water_bill = 20 internet_bill = 15 other_bills = 0 number_of_months = int(input()) total_el = 0 total_water = number_of_months * water_bill total_net = number_of_months * internet_bill total_other_bills = 0 for i in range (number_of_months): electricity_bill = float(input()) other_bills = w...
electricity_bill = 0 water_bill = 20 internet_bill = 15 other_bills = 0 number_of_months = int(input()) total_el = 0 total_water = number_of_months * water_bill total_net = number_of_months * internet_bill total_other_bills = 0 for i in range(number_of_months): electricity_bill = float(input()) other_bills = wa...
def test_errors_404(survey_runner): response = survey_runner.test_client().get('/hfjdskahfjdkashfsa') assert response.status_code == 404 assert '<title>Error</title' in response.get_data(True)
def test_errors_404(survey_runner): response = survey_runner.test_client().get('/hfjdskahfjdkashfsa') assert response.status_code == 404 assert '<title>Error</title' in response.get_data(True)
#from cStringIO import StringIO class Message(object): ''' Represents an AMQP message. ''' def __init__(self, body=None, delivery_info=None, **properties): if isinstance(body, unicode): if properties.get('content_encoding', None) is None: properties['content_encoding'] = 'utf-8' body ...
class Message(object): """ Represents an AMQP message. """ def __init__(self, body=None, delivery_info=None, **properties): if isinstance(body, unicode): if properties.get('content_encoding', None) is None: properties['content_encoding'] = 'utf-8' body = body...
class Solution: def lengthOfLIS(self, nums) -> int: # dp=[0 for i in range(len(nums))] # res=1 # dp[0]=1 # for i in range(1,len(nums)): # if nums[i]>nums[i-1]: # dp[i]=dp[i-1]+1 # else: # dp[i]=1 # res=max(res,dp[i]...
class Solution: def length_of_lis(self, nums) -> int: dp = [[] for i in nums] res = 1 dp[0] = [nums[0]] for i in range(1, len(nums)): res = max(res, self.dfs([], nums[:i + 1], res)) return res def dfs(self, track, nums, res): if not nums or len(nums)...
destinations = input() command = input() while not command == "Travel": command = command.split(":") if command[0] == "Add Stop": index = int(command[1]) stop = command[2] if index in range(len(destinations)): destinations = destinations[:index] + stop + destination...
destinations = input() command = input() while not command == 'Travel': command = command.split(':') if command[0] == 'Add Stop': index = int(command[1]) stop = command[2] if index in range(len(destinations)): destinations = destinations[:index] + stop + destinations[index:] ...
# Storage for table names to remove tables_to_remove = [ 'The Barbarian', 'The Bard', 'The Cleric', 'The Druid', 'The Fighter', 'The Monk', 'The Paladin', 'The Ranger', 'The Rogue', 'The Sorcerer', 'The Warlock', 'The Wizard', 'Character Advancement', 'Multiclass...
tables_to_remove = ['The Barbarian', 'The Bard', 'The Cleric', 'The Druid', 'The Fighter', 'The Monk', 'The Paladin', 'The Ranger', 'The Rogue', 'The Sorcerer', 'The Warlock', 'The Wizard', 'Character Advancement', 'Multiclass Spellcaster: Spell Slots per Spell Level', 'Standard Exchange Rates', 'Ability Scores and Mod...
#program to find maximum and the minimum value in a set. #Create a set seta = set([5, 10, 3, 15, 2, 20]) #Find maximum value print(max(seta)) #Find minimum value print(min(seta))
seta = set([5, 10, 3, 15, 2, 20]) print(max(seta)) print(min(seta))
n=input("enter the enumber:") length=len(n) org=int(n) sum=0 n1=int(n) while(n1!=0): rem=n1%10 sum+=(rem**length) n1=n1//10 if(sum==org): print("it is a armstrong number") else: print("it is not an armstrong number")
n = input('enter the enumber:') length = len(n) org = int(n) sum = 0 n1 = int(n) while n1 != 0: rem = n1 % 10 sum += rem ** length n1 = n1 // 10 if sum == org: print('it is a armstrong number') else: print('it is not an armstrong number')
# https://leetcode.com/problems/simplify-path class Solution: def simplifyPath(self, path: str) -> str: stack = [] for i in path.split('/'): if stack and i == "..": stack.pop() elif i not in [".", "", ".."]: stack.append(i) ...
class Solution: def simplify_path(self, path: str) -> str: stack = [] for i in path.split('/'): if stack and i == '..': stack.pop() elif i not in ['.', '', '..']: stack.append(i) return '/' + '/'.join(stack)
#!/usr/bin/python '''! Program to compute the odds for the game of Baccarat. @author <a href="email:fulkgl@gmail.com">George L Fulk</a> ''' def bacc_value(num1, num2): '''! Compute the baccarat value with 2 inputed integer rank values (0..12). ''' if num1 > 9: num1 = 0 if num2 > 9: ...
"""! Program to compute the odds for the game of Baccarat. @author <a href="email:fulkgl@gmail.com">George L Fulk</a> """ def bacc_value(num1, num2): """! Compute the baccarat value with 2 inputed integer rank values (0..12). """ if num1 > 9: num1 = 0 if num2 > 9: num2 = 0 num1...
def hashify(string): dict={} res=string+string[0] for i,j in enumerate(string): if dict.get(j, None): if isinstance(dict[j], str): dict[j]=list(dict[j])+[res[i+1]] else: dict[j].append(res[i+1]) else: dict[j]=res[i+1] re...
def hashify(string): dict = {} res = string + string[0] for (i, j) in enumerate(string): if dict.get(j, None): if isinstance(dict[j], str): dict[j] = list(dict[j]) + [res[i + 1]] else: dict[j].append(res[i + 1]) else: dict[j...
# https://github.com/ycm-core/YouCompleteMe/blob/321700e848595af129d5d75afac92d0060d3cdf9/README.md#configuring-through-vim-options def Settings( **kwargs ): client_data = kwargs[ 'client_data' ] return { 'interpreter_path': client_data[ 'g:ycm_python_interpreter_path' ], 'sys_path': client_data[ 'g:ycm_pyt...
def settings(**kwargs): client_data = kwargs['client_data'] return {'interpreter_path': client_data['g:ycm_python_interpreter_path'], 'sys_path': client_data['g:ycm_python_sys_path']}
#!/usr/bin/env python # -*- coding: utf-8 -*- class PyobsException(Exception): pass class ConnectionFailure(PyobsException): pass class MessageTimeout(PyobsException): pass class ObjectError(PyobsException): pass
class Pyobsexception(Exception): pass class Connectionfailure(PyobsException): pass class Messagetimeout(PyobsException): pass class Objecterror(PyobsException): pass
class Student: cname='DurgaSoft' #static variable def __init__(self,name,rollno): self.name=name #instance variable self.rollno=rollno s1=Student('durga',101) s2=Student('pawan',102) print(s1.name,s1.rollno,s1.cname) print(s2.name,s2.rollno,s2.cname)
class Student: cname = 'DurgaSoft' def __init__(self, name, rollno): self.name = name self.rollno = rollno s1 = student('durga', 101) s2 = student('pawan', 102) print(s1.name, s1.rollno, s1.cname) print(s2.name, s2.rollno, s2.cname)
a = [[1, 2, 3], [1, 2, 3], [1, 2, 3]] b = [4, 5, 6] c = [0, 0, 0] def t(): for j in range(len(a)): for [A1, A2, A3] in [[1, 2, 3], [1, 2, 3], [1, 2, 3]]: for B in b: c[A1-1] = B + A1*2 c[A2-1] = B + A2*2 c[A3-1] = B + A3*2 t() print(c)
a = [[1, 2, 3], [1, 2, 3], [1, 2, 3]] b = [4, 5, 6] c = [0, 0, 0] def t(): for j in range(len(a)): for [a1, a2, a3] in [[1, 2, 3], [1, 2, 3], [1, 2, 3]]: for b in b: c[A1 - 1] = B + A1 * 2 c[A2 - 1] = B + A2 * 2 c[A3 - 1] = B + A3 * 2 t() print(c)
class Item: def __init__(self, profit, weight): self.profit = profit self.weight = weight def zeroKnapsack(items, capacity, currentIndex): if capacity <= 0 or currentIndex < 0 or currentIndex>=len(items): return 0 elif items[currentIndex].weight <= capacity: profit1 = items[currentIndex].profit + zeroKnapsa...
class Item: def __init__(self, profit, weight): self.profit = profit self.weight = weight def zero_knapsack(items, capacity, currentIndex): if capacity <= 0 or currentIndex < 0 or currentIndex >= len(items): return 0 elif items[currentIndex].weight <= capacity: profit1 = it...
# # PySNMP MIB module WL400-SNMPGEN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WL400-SNMPGEN-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:36:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) ...
__all__ = [ 'update_network_static_route_model', 'rule11_model', 'rule10_model', 'update_network_content_filtering_model', 'rule8_model', 'update_network_ssid_traffic_shaping_model', 'rule7_model', 'update_organization_snmp_model', 'move_network_sm_devices_model', 'lock_...
__all__ = ['update_network_static_route_model', 'rule11_model', 'rule10_model', 'update_network_content_filtering_model', 'rule8_model', 'update_network_ssid_traffic_shaping_model', 'rule7_model', 'update_organization_snmp_model', 'move_network_sm_devices_model', 'lock_network_sm_devices_model', 'update_network_sm_devi...
file = open('helloworld.txt', 'w+') file.write('file: helloworld.txt\n\n') for y in range(10): line = '' if y == 0: line = 'y | x\n' for x in range(10): if x == 0: line += f'{y} | ' line += x.__str__() + ' ' file.write(line + '\n') file.close()
file = open('helloworld.txt', 'w+') file.write('file: helloworld.txt\n\n') for y in range(10): line = '' if y == 0: line = 'y | x\n' for x in range(10): if x == 0: line += f'{y} | ' line += x.__str__() + ' ' file.write(line + '\n') file.close()
# # PySNMP MIB module CISCO-DMN-DSG-REMINDER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DMN-DSG-REMINDER-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:55:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_size_constraint, constraints_union, value_range_constraint) ...
PI = 3.14 r = 6 area = PI * r * r #print(area) #calulate the surface area of a circle. def findArea(r): PI = 3.14 return PI * (r*r); print('area of circle',findArea(6));
pi = 3.14 r = 6 area = PI * r * r def find_area(r): pi = 3.14 return PI * (r * r) print('area of circle', find_area(6))
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
load('@rules_rust//rust:defs.bzl', 'rust_binary') def _wasm_rust_transition_impl(settings, attr): return {'//command_line_option:platforms': '@rules_rust//rust/platform:wasm'} def _wasi_rust_transition_impl(settings, attr): return {'//command_line_option:platforms': '@rules_rust//rust/platform:wasi'} wasm_rus...
schema = { "transaction": { "attributes": ["category", "execution-date", "amount", "reference"], "key": "identifier", "representation": [ "execution-date", "reference", "account-of-receiver.account-number", "amount", ], }, "cont...
schema = {'transaction': {'attributes': ['category', 'execution-date', 'amount', 'reference'], 'key': 'identifier', 'representation': ['execution-date', 'reference', 'account-of-receiver.account-number', 'amount']}, 'contract': {'attributes': ['sign-date'], 'key': 'identifier', 'representation': ['identifier']}, 'accou...
''' Get the name and the value of various products. The program should ask if the user wants to continue. In the end show the following: 1 - The total value. 2 - How many products costs more than R$1000. 3 - The name of cheaper product. ''' dlength = 20 division = '=-' * dlength print(f'{divis...
""" Get the name and the value of various products. The program should ask if the user wants to continue. In the end show the following: 1 - The total value. 2 - How many products costs more than R$1000. 3 - The name of cheaper product. """ dlength = 20 division = '=-' * dlength print(f"{divisi...
def countWordsFromFile(): fileName = input("Enter the file name:- ") numberOfWords = 0 file = open(fileName, 'r') for line in file: words = line.split() numberOfWords=numberOfWords+len(words) print("The number of words in this file are: ") print(numberOfWords) countWordsFro...
def count_words_from_file(): file_name = input('Enter the file name:- ') number_of_words = 0 file = open(fileName, 'r') for line in file: words = line.split() number_of_words = numberOfWords + len(words) print('The number of words in this file are: ') print(numberOfWords) count_w...
def rearrange(arr, n): # Auxiliary array to hold modified array temp = n*[None] # Indexes of smallest and largest elements # from remaining array. small,large =0,n-1 # To indicate whether we need to copy rmaining # largest or remaining smallest at next position flag = True ...
def rearrange(arr, n): temp = n * [None] (small, large) = (0, n - 1) flag = True for i in range(n): if flag is True: temp[i] = arr[large] large -= 1 else: temp[i] = arr[small] small += 1 flag = bool(1 - flag) for i in range(n): ...
# def start_end_decorator(func): # def wrapper(number): # print("Start") # result = func(number) # print("End") # return result # return wrapper # @start_end_decorator # def func(number): # print("Inside func") # return number + 5 # result = func(5) # print(result) ...
def func1(func): def now(): print('Start') func() print('End') return now @func1 def func(): print('Jatin Yadav') func()
# O(NlogM) / O(1) class Solution: def splitArray(self, nums: List[int], m: int) -> int: def count(d): ans, cur = 1, 0 for num in nums: cur += num if cur > d: ans += 1 cur = num return ans ...
class Solution: def split_array(self, nums: List[int], m: int) -> int: def count(d): (ans, cur) = (1, 0) for num in nums: cur += num if cur > d: ans += 1 cur = num return ans (l, r) = (max(n...
# calculo del perimetro del cuadrado print('calculo del perimetro cuadrado') lado = int(input('introduce el valor del lado que conoces del cuadrado: ')) lado *= 4 print('el perimetro del cuadrado es: ',lado)
print('calculo del perimetro cuadrado') lado = int(input('introduce el valor del lado que conoces del cuadrado: ')) lado *= 4 print('el perimetro del cuadrado es: ', lado)
def load(h): return ({'abbr': 'msl', 'code': 1, 'title': 'MSL Pressure reduced to MSL Pa'}, {'abbr': 't', 'code': 11, 'title': 'T Temperature Deg C'}, {'abbr': 'pt', 'code': 13, 'title': 'PT Potential temperature K'}, {'abbr': 'ws1', 'code': 28, 'title': 'WS1 Wave spectra (1) -'}...
def load(h): return ({'abbr': 'msl', 'code': 1, 'title': 'MSL Pressure reduced to MSL Pa'}, {'abbr': 't', 'code': 11, 'title': 'T Temperature Deg C'}, {'abbr': 'pt', 'code': 13, 'title': 'PT Potential temperature K'}, {'abbr': 'ws1', 'code': 28, 'title': 'WS1 Wave spectra (1) -'}, {'abbr': 'ws2', 'code': 29, 'title...
# 9. Find the minimum element in an array of integers. # You can carry some extra information through method # arguments such as minimum value. def findmin(A, n): # if size = 0 means whole array # has been traversed if (n == 1): #if it's the last value just return it for comparison with ...
def findmin(A, n): if n == 1: return A[0] minval = min(A[n - 1], findmin(A, n - 1)) return minval if __name__ == '__main__': a = [10, 14, 45, 6, 50, 10, 22] n = len(A) print('Smallest value in array is: {}'.format(findmin(A, n)))
{ 'target_defaults': { 'variables': { 'deps': [ 'libchrome-<(libbase_ver)', ], }, }, 'targets': [ { 'target_name': 'touch_keyboard_handler', 'type': 'executable', 'sources': [ 'evdevsource.cc', 'fakekeyboard.cc', 'faketouchpad.cc', ...
{'target_defaults': {'variables': {'deps': ['libchrome-<(libbase_ver)']}}, 'targets': [{'target_name': 'touch_keyboard_handler', 'type': 'executable', 'sources': ['evdevsource.cc', 'fakekeyboard.cc', 'faketouchpad.cc', 'haptic/ff_driver.cc', 'haptic/touch_ff_manager.cc', 'main.cc', 'statemachine/eventkey.cc', 'statemac...
def insertSort(arr): for i in range(1, len(arr)): val = arr[i] j = i-1 while j >=0 and val < arr[j] : arr[j+1] = arr[j] j -= 1 arr[j+1] = val arr = [67, 12, 1, 6, 9] insertSort(arr) print(arr)
def insert_sort(arr): for i in range(1, len(arr)): val = arr[i] j = i - 1 while j >= 0 and val < arr[j]: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = val arr = [67, 12, 1, 6, 9] insert_sort(arr) print(arr)
# this files contains basic metadata about the project. This data will be used # (by default) in the base.html and index.html PROJECT_METADATA = { 'title': 'Thunau', 'author': 'Peter Andorfer', 'subtitle': 'An Exavation Docu', 'description': 'A web application to manage and publish data gathered around...
project_metadata = {'title': 'Thunau', 'author': 'Peter Andorfer', 'subtitle': 'An Exavation Docu', 'description': 'A web application to manage and publish data gathered around the excavations in Thunau', 'github': 'https://github.com/acdh-oeaw/thunau', 'purpose_de': 'Ziel ist die Publikation von Forschungsdaten', 'pur...
def last_sqrt(x): n = 1 sqr = 0 while x>=sqr: sqr = sqr + ((2*n)-1) n+=1 return n-2 list = [] n = int(input("Enter the Number:")) for num in range(2,(n+1)): list.append(num) for ltsqrt in range(0,(last_sqrt(n)-1)): if list[ltsqrt]!=0: for nums in range((lts...
def last_sqrt(x): n = 1 sqr = 0 while x >= sqr: sqr = sqr + (2 * n - 1) n += 1 return n - 2 list = [] n = int(input('Enter the Number:')) for num in range(2, n + 1): list.append(num) for ltsqrt in range(0, last_sqrt(n) - 1): if list[ltsqrt] != 0: for nums in range(ltsqrt ...
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftPLUSMINUSleftTIMESDIVIDErightUMINUSDIVIDE EQUALS LPAREN MINUS NAME NUMBER PLUS RPAREN TIMESstatement : expressionexpression : expression PLUS expression\n ...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftPLUSMINUSleftTIMESDIVIDErightUMINUSDIVIDE EQUALS LPAREN MINUS NAME NUMBER PLUS RPAREN TIMESstatement : expressionexpression : expression PLUS expression\n | expression MINUS expression\n | expression TIMES expression\n ...
## Aim : ## You are given two strings, A and B. ## Find if there is a substring that appears in both A and B. # Input: # The first line of the input will contain a single integer , tthe number of test cases. # Then there will be t descriptions of the test cases. Each description contains two lines. # The first line ...
n = int(input().strip()) a = [] for a_i in range(2 * n): a_t = [a_temp for a_temp in input().strip().split(' ')][0] a.append(a_t) for i in range(2 * n): if i % 2 == 0: s1 = set(a[i]) s2 = set(a[i + 1]) s = s1.intersection(s2) if len(S) == 0: print('NO') el...
''' * @File: main.py * @Author: CSY * @Date: 2019/7/27 - 9:40 '''
""" * @File: main.py * @Author: CSY * @Date: 2019/7/27 - 9:40 """
def show_free(cal_name, d, m, t1, t2): "String x Integer x String x String x String ->" day = new_day(d) mon = new_month(m) start = convert_time(t1) end = convert_time(t2) cal_day = calendar_day(day, calendar_month(mon, fetch_calendar(cal_name))) show_time_spans(free_spans(cal_day, start, ...
def show_free(cal_name, d, m, t1, t2): """String x Integer x String x String x String ->""" day = new_day(d) mon = new_month(m) start = convert_time(t1) end = convert_time(t2) cal_day = calendar_day(day, calendar_month(mon, fetch_calendar(cal_name))) show_time_spans(free_spans(cal_day, start...
def list_comprehension(): matrix = [ [1 if row == 2 or column == 2 else 0 for column in range(5)] for row in range(5) ] print(matrix) # von Jonas(JoBo12) aus dem Discord def with_for(): matrix_1 = [] for item in range(5): matrix_1.append([]) for item2 in range(5): ...
def list_comprehension(): matrix = [[1 if row == 2 or column == 2 else 0 for column in range(5)] for row in range(5)] print(matrix) def with_for(): matrix_1 = [] for item in range(5): matrix_1.append([]) for item2 in range(5): matrix_1[item].append(int(item == 2 or item2 == ...
# dataset settings data_source_cfg = dict(type='CIFAR10', root='data/cifar10/') dataset_type = 'ExtractDataset' img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) train_pipeline = [ dict( type='RandomResizedCrop', size=224, scale=(0.2, 1.0), interpolation=3), dict(type='RandomHo...
data_source_cfg = dict(type='CIFAR10', root='data/cifar10/') dataset_type = 'ExtractDataset' img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) train_pipeline = [dict(type='RandomResizedCrop', size=224, scale=(0.2, 1.0), interpolation=3), dict(type='RandomHorizontalFlip')] prefetch = True if not...
travel_mode = {"1": "car", "2": "plane"} items = { "can opener", "fuel", "jumper", "knife", "matches", "razor blades", "razor", "scissors", "shampoo", "shaving cream", "shirts (3)", "shorts", "sleeping bag(s)", "soap", "socks (3 pairs)", "stove", "ten...
travel_mode = {'1': 'car', '2': 'plane'} items = {'can opener', 'fuel', 'jumper', 'knife', 'matches', 'razor blades', 'razor', 'scissors', 'shampoo', 'shaving cream', 'shirts (3)', 'shorts', 'sleeping bag(s)', 'soap', 'socks (3 pairs)', 'stove', 'tent', 'mug', 'toothbrush', 'toothpaste', 'towel', 'underwear (3 pairs)',...
class Solution: def removeOuterParentheses(self, S: str) -> str: primitiveEndIndices = set([0]) count = 0 for i, char in enumerate(S): if char == '(': count += 1 elif char == ')': count -= 1 if count == 0: pr...
class Solution: def remove_outer_parentheses(self, S: str) -> str: primitive_end_indices = set([0]) count = 0 for (i, char) in enumerate(S): if char == '(': count += 1 elif char == ')': count -= 1 if count == 0: ...
person = { "name": "Bernardo", "age": 21 } print(person) print(person.items()) print(person["name"]) person["wright"] = "78kg" print(person)
person = {'name': 'Bernardo', 'age': 21} print(person) print(person.items()) print(person['name']) person['wright'] = '78kg' print(person)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- BASE_CF_TEMPLATE = ''' AWSTemplateFormatVersion: 2010-09-09 Description: AWS CloudFormation template Parameters: EcsAmiId: Type: String Description: ECS AMI Id EcsInstanceType: Type: String Description: ECS EC2 instance type Default: t2.micro C...
base_cf_template = "\nAWSTemplateFormatVersion: 2010-09-09\nDescription: AWS CloudFormation template\nParameters:\n EcsAmiId:\n Type: String\n Description: ECS AMI Id\n EcsInstanceType:\n Type: String\n Description: ECS EC2 instance type\n Default: t2.micro\n ConstraintDescription: must be a valid E...
STABLECOIN_SYMBOLS = ['USDC', 'DAI', 'USDT', 'BUSD', 'TUSD', 'PAX', 'VAI'] FREE_RPC_ENDPOINTS = ['https://api.mycryptoapi.com/eth', 'https://nodes.mewapi.io/rpc/eth', 'https://mainnet-nethermind.blockscout.com/', 'https://mainnet.eth.cloud.ava.do/', ...
stablecoin_symbols = ['USDC', 'DAI', 'USDT', 'BUSD', 'TUSD', 'PAX', 'VAI'] free_rpc_endpoints = ['https://api.mycryptoapi.com/eth', 'https://nodes.mewapi.io/rpc/eth', 'https://mainnet-nethermind.blockscout.com/', 'https://mainnet.eth.cloud.ava.do/', 'https://cloudflare-eth.com/'] chainlink_addresses = {'1INCH-ETH': '0x...
# based on nuts_and_bolts.scad from MCAD library # https:# github.com/elmom/MCAD/ # Copyright 2010 D1plo1d # This library is dual licensed under the GPL 3.0 and the GNU Lesser General Public License as per http:# creativecommons.org/licenses/LGPL/2.1/ . MM = "mm" INCH = "inch" # Not yet supported # Based on: htt...
mm = 'mm' inch = 'inch' metric_nut_ac_widths = [-1, -1, -1, 6.4, 8.1, 9.2, 11.5, -1, 15.0, -1, 19.6, -1, 22.1, -1, -1, -1, 27.7, -1, -1, -1, 34.6, -1, -1, -1, 41.6, -1, -1, -1, -1, -1, 53.1, -1, -1, -1, -1, -1, 63.5] metric_nut_thickness = [-1, -1, -1, 2.4, 3.2, 4.0, 5.0, -1, 6.5, -1, 8.0, -1, 10.0, -1, -1, -1, 13.0, -...
var = 77 def func(): global var var = 100 print(locals()) func() print(var)
var = 77 def func(): global var var = 100 print(locals()) func() print(var)
def solution(xs): mn = -1000 count = 0 product = 0 for element in xs: if element != 0: if product != 0: product = product * element else: product = element count += 1 if element < 0 and element > mn: ...
def solution(xs): mn = -1000 count = 0 product = 0 for element in xs: if element != 0: if product != 0: product = product * element else: product = element count += 1 if element < 0 and element > mn: ...
first_num = 2 secord_num = 3 sum = first_num + secord_num print(sum)
first_num = 2 secord_num = 3 sum = first_num + secord_num print(sum)
# # PySNMP MIB module NOKIA-NTP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NOKIA-NTP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:13:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ...