content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
my_variabel = "hai darmawan" for variabel_baru in my_variabel: print("for string: ",variabel_baru) my_list =["aku", "kamu", "dia"] my_tuple=(1,5,6,7) for variabel_baru3 in my_tuple: print("for list or tuple", variabel_baru3)
my_variabel = 'hai darmawan' for variabel_baru in my_variabel: print('for string: ', variabel_baru) my_list = ['aku', 'kamu', 'dia'] my_tuple = (1, 5, 6, 7) for variabel_baru3 in my_tuple: print('for list or tuple', variabel_baru3)
def main(): x=11 y=2 print("Addition X+Y=",x+y) print("Subtraction X-Y=",x-y) print("Multiplication X*Y=",x*y) print("Division X/Y=",x/y) print("Modulus X%Y=",x%y) print("Exponent X**Y=",x**y) print("Floor Division X//Y=",x//y) if __name__ == '__main__': main()
def main(): x = 11 y = 2 print('Addition X+Y=', x + y) print('Subtraction X-Y=', x - y) print('Multiplication X*Y=', x * y) print('Division X/Y=', x / y) print('Modulus X%Y=', x % y) print('Exponent X**Y=', x ** y) print('Floor Division X//Y=', x // y) if __name__ == '__main__': ...
def test_screen_two(): for num in range(0, 100): col = int(num * 0.01 * 2.0) y = (num * 0.01 - float(col) / 2.0) * 2.0 newY = y / 960.0 * 480.0 + 1.0 / 4.0 print('col:' + str(col) + ' num: ' + str(num) + ' y: ' + str(y) + ' newY: ' + str(newY)) # print(str(newY)) def test_sc...
def test_screen_two(): for num in range(0, 100): col = int(num * 0.01 * 2.0) y = (num * 0.01 - float(col) / 2.0) * 2.0 new_y = y / 960.0 * 480.0 + 1.0 / 4.0 print('col:' + str(col) + ' num: ' + str(num) + ' y: ' + str(y) + ' newY: ' + str(newY)) def test_scale(): for num in rang...
__project__ = "o3seespy" __author__ = "Maxim Millen & Minjie Zhu" __version__ = "3.1.0.18" __license__ = "MIT with OpenSees License"
__project__ = 'o3seespy' __author__ = 'Maxim Millen & Minjie Zhu' __version__ = '3.1.0.18' __license__ = 'MIT with OpenSees License'
class MyClass: def __init__(self): self.var = 'var' def method(self): print('method') x = MyClass() x.method() m = x.method m()
class Myclass: def __init__(self): self.var = 'var' def method(self): print('method') x = my_class() x.method() m = x.method m()
''' @author: l4zyc0d3r People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt ''' class Solution: def kthFactor(self, n: int, k: int) -> int: for i in range(1, n+1): if n % i == 0: k-=1 if k == 0: return i return -1
""" @author: l4zyc0d3r People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt """ class Solution: def kth_factor(self, n: int, k: int) -> int: for i in range(1, n + 1): if n % i == 0: k -= 1 if k == 0: return i ...
_base_ = [ '../_base_/datasets/nus-mono3d.py', '../_base_/models/fcos3d.py', '../_base_/schedules/mmdet_schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), # ...
_base_ = ['../_base_/datasets/nus-mono3d.py', '../_base_/models/fcos3d.py', '../_base_/schedules/mmdet_schedule_1x.py', '../_base_/default_runtime.py'] model = dict(backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval...
#! /usr/bin/env python3 def main(): languages = { "Python": "Guido van Rossum", "Ruby": "Yukihiro Matsumoto", "PHP": "Rasmus Lerdorf" } for each in languages: print(each + " was created by " + languages[each]) if __name__ == "__main__": main()
def main(): languages = {'Python': 'Guido van Rossum', 'Ruby': 'Yukihiro Matsumoto', 'PHP': 'Rasmus Lerdorf'} for each in languages: print(each + ' was created by ' + languages[each]) if __name__ == '__main__': main()
ziehungen = input().split(",") ziehungen = [int(x) for x in ziehungen] boards = [] while True: leer = input() zeile = [input().split(" ")] zeile[0] = [int(x) for x in zeile[0] if x != ''] if zeile[0] != []: for i in range(1,5): zeile.append(input().split(" ")) zeile[i] ...
ziehungen = input().split(',') ziehungen = [int(x) for x in ziehungen] boards = [] while True: leer = input() zeile = [input().split(' ')] zeile[0] = [int(x) for x in zeile[0] if x != ''] if zeile[0] != []: for i in range(1, 5): zeile.append(input().split(' ')) zeile[i] =...
def insertion_sort(arr): for i in range(1, len(arr)): key = arr[i] j = i - 1 while(j>=0 and arr[j]>key): arr[j+1]=arr[j] j = j - 1 arr[j+1] = key return arr def main(): arr = [6, 5, 8, 9, 3, 1, 4, 7, 2] sorted_arr = insertion_sort(arr) ...
def insertion_sort(arr): for i in range(1, len(arr)): key = arr[i] j = i - 1 while j >= 0 and arr[j] > key: arr[j + 1] = arr[j] j = j - 1 arr[j + 1] = key return arr def main(): arr = [6, 5, 8, 9, 3, 1, 4, 7, 2] sorted_arr = insertion_sort(arr) ...
# # PySNMP MIB module DNS-SERVER-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/DNS-SERVER-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:08:40 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52) # ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
#MAIN PROGRAM STARTS HERE: num = int(input('Enter the number of rows and columns for the square: ')) k = 1 for x in range(0, num ): for y in range(0, num): print ('%d ' % (k), end='') k += 2 print()
num = int(input('Enter the number of rows and columns for the square: ')) k = 1 for x in range(0, num): for y in range(0, num): print('%d ' % k, end='') k += 2 print()
class Point(object): def __init__(self, x, y): self.x, self.y = x, y class PointHash(object): def __init__(self, x, y): self.x, self.y = x, y def __hash__(self): return hash((self.x, self.y)) def __eq__(self, other): return self.x == other.x and self.y == other.y if...
class Point(object): def __init__(self, x, y): (self.x, self.y) = (x, y) class Pointhash(object): def __init__(self, x, y): (self.x, self.y) = (x, y) def __hash__(self): return hash((self.x, self.y)) def __eq__(self, other): return self.x == other.x and self.y == oth...
# -*- coding: utf-8 -*- # 18/1/30 # create by: snower version = "0.1.1" version_info = (0,1.1)
version = '0.1.1' version_info = (0, 1.1)
class Logger: PRINT_INTERVAL = 10 def __init__(self): self.buckets = [-1 for _ in range(self.PRINT_INTERVAL)] self.sets = [set() for _ in range(self.PRINT_INTERVAL)] def shouldPrintMessage(self, timestamp: int, message: str) -> bool: bucket_index = timestamp % self.PRINT_INTERVAL ...
class Logger: print_interval = 10 def __init__(self): self.buckets = [-1 for _ in range(self.PRINT_INTERVAL)] self.sets = [set() for _ in range(self.PRINT_INTERVAL)] def should_print_message(self, timestamp: int, message: str) -> bool: bucket_index = timestamp % self.PRINT_INTERVAL...
#!/usr/bin/env python NAME = 'WebTotem (WebTotem)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return _, page = r # WebTotem returns its name in blockpage if all(i in page for i in (b'The current request was blocked', b'WebTote...
name = 'WebTotem (WebTotem)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return (_, page) = r if all((i in page for i in (b'The current request was blocked', b'WebTotem'))): return True return False
{ 'targets': [ { 'target_name': 'node_expat_object', 'sources': [ 'src/parse.cc', 'src/node-expat-object.cc' ], 'include_dirs': [ '<!(node -e "require(\'nan\')")' ], 'dependencies': [ 'deps/libexpat/libexpat.gyp:expat' ] } ] }
{'targets': [{'target_name': 'node_expat_object', 'sources': ['src/parse.cc', 'src/node-expat-object.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'dependencies': ['deps/libexpat/libexpat.gyp:expat']}]}
list = ['Apple','Orange','Benana','Mango']; name = "Md Tazri"; print('"Apple" in list : ',"Apple" in list); print('"Kiwi" in list : ',"Kiwi" in list); print('"Water" not in list : ',"Water" not in list); print("'Md' in name : ",'Md' in name); print("'Tazri' not in name : ",'Tazri' not in name);
list = ['Apple', 'Orange', 'Benana', 'Mango'] name = 'Md Tazri' print('"Apple" in list : ', 'Apple' in list) print('"Kiwi" in list : ', 'Kiwi' in list) print('"Water" not in list : ', 'Water' not in list) print("'Md' in name : ", 'Md' in name) print("'Tazri' not in name : ", 'Tazri' not in name)
class DiceLoss(nn.Module): def __init__(self, tolerance=1e-8): super(DiceLoss, self).__init__() self.tolerance = tolerance def forward(self, pred, label): intersection = torch.sum(pred * label) + self.tolerance union = torch.sum(pred) + torch.sum(label) + self.tolerance ...
class Diceloss(nn.Module): def __init__(self, tolerance=1e-08): super(DiceLoss, self).__init__() self.tolerance = tolerance def forward(self, pred, label): intersection = torch.sum(pred * label) + self.tolerance union = torch.sum(pred) + torch.sum(label) + self.tolerance ...
# # This is the Robotics Language compiler # # Transformations.py: Applies tranformations to the XML structure # # Created on: June 22, 2017 # Author: Gabriel A. D. Lopes # Licence: Apache 2.0 # Copyright: 2014-2017 Robot Care Systems BV, The Hague, The Netherlands. All rights reserved. # # Licens...
atoms = {'string': 'Strings', 'boolean': 'Booleans', 'real': 'Reals', 'integer': 'Integers'} def many_same_numbers_or_strings(x): """number or string""" return all(map(lambda y: y in ['Reals', 'Integers'], x)) or all(map(lambda y: y == 'Strings', x)) def single_string(x): """string""" return len(x) ==...
class Contact: def __init__(self, firstname, lastname, company, address, telephone, mobile, tel_work, email, email_1, www): self.firstname = firstname self.lastname = lastname self.company = company self.address = address self.telephone = telephone self.mobile = mobil...
class Contact: def __init__(self, firstname, lastname, company, address, telephone, mobile, tel_work, email, email_1, www): self.firstname = firstname self.lastname = lastname self.company = company self.address = address self.telephone = telephone self.mobile = mobi...
# coding: utf-8 def array_pad(l, size, value): if size >= 0: return l + [value] * (size - len(l)) else: return [value] * (size * -1 - len(l)) + l if __name__ == '__main__': l = [12, 10, 9] print(array_pad(l, 5, 0)) print(array_pad(l, -7, -1)) print(array_pad(l, 2, 999))
def array_pad(l, size, value): if size >= 0: return l + [value] * (size - len(l)) else: return [value] * (size * -1 - len(l)) + l if __name__ == '__main__': l = [12, 10, 9] print(array_pad(l, 5, 0)) print(array_pad(l, -7, -1)) print(array_pad(l, 2, 999))
k=int (input()) l=int (input()) m=int (input()) n=int (input()) d=int (input()) damagedDragons = 0 for i in range (1, d+1): if i%k == 0 or i%l == 0 or i%m == 0 or i%n == 0: damagedDragons = damagedDragons + 1 print(damagedDragons)
k = int(input()) l = int(input()) m = int(input()) n = int(input()) d = int(input()) damaged_dragons = 0 for i in range(1, d + 1): if i % k == 0 or i % l == 0 or i % m == 0 or (i % n == 0): damaged_dragons = damagedDragons + 1 print(damagedDragons)
menu = [ [ "egg", "spam", "bacon"], [ "egg", "sausage", "bacon"], [ "egg", "spam"], [ "egg", "bacon", "spam"], [ "egg", "bacon", "sausage", "spam"], [ "spam", "bacon", "sausage", "spam"], [ "spam", "egg", "spam", "spam", "bacon","spam"], [ "spam", "egg", "sausage", "spam"], [ "chicke...
menu = [['egg', 'spam', 'bacon'], ['egg', 'sausage', 'bacon'], ['egg', 'spam'], ['egg', 'bacon', 'spam'], ['egg', 'bacon', 'sausage', 'spam'], ['spam', 'bacon', 'sausage', 'spam'], ['spam', 'egg', 'spam', 'spam', 'bacon', 'spam'], ['spam', 'egg', 'sausage', 'spam'], ['chicken', 'chips']] meals = [] for meal in menu: ...
def divide(x: int, y: int) -> int: result, power = 0, 32 y_power = y << power while x >= y: while y_power > x: y_power >>=1 power -=1 result += 1<<power x -= y_power return result
def divide(x: int, y: int) -> int: (result, power) = (0, 32) y_power = y << power while x >= y: while y_power > x: y_power >>= 1 power -= 1 result += 1 << power x -= y_power return result
sum = 0 for x in range(10): sum = sum + x print(sum)
sum = 0 for x in range(10): sum = sum + x print(sum)
f = open("io/data/file1") print(f.readline()) print(f.readline(3)) print(f.readline(4)) print(f.readline(5)) print(f.readline()) # readline() on writable file f = open("io/data/file1", "ab") try: f.readline() except OSError: print("OSError") f.close()
f = open('io/data/file1') print(f.readline()) print(f.readline(3)) print(f.readline(4)) print(f.readline(5)) print(f.readline()) f = open('io/data/file1', 'ab') try: f.readline() except OSError: print('OSError') f.close()
# return an integere cycle length K of a permutation. Applying a permutation K-times to a list will return the original list. def permutation_cycle_length(permutation): initialArray = range(len(permutation)) permutedArray = range(len(permutation)) cycles = 0 while True: permutedArray = [permutedArray[permu...
def permutation_cycle_length(permutation): initial_array = range(len(permutation)) permuted_array = range(len(permutation)) cycles = 0 while True: permuted_array = [permutedArray[permutation[i]] for i in range(len(initialArray))] cycles += 1 if are_equal(initialArray, permutedArr...
BLOCKCHAIN = { 'class': 'thenewboston_node.business_logic.blockchain.file_blockchain.FileBlockchain', 'kwargs': {}, } BLOCKCHAIN_URL_PATH_PREFIX = '/blockchain/'
blockchain = {'class': 'thenewboston_node.business_logic.blockchain.file_blockchain.FileBlockchain', 'kwargs': {}} blockchain_url_path_prefix = '/blockchain/'
n = int(input()) a = n // 365 n = n - a*365 m = n // 30 n = n - m*30 d = n print('{} ano(s)'.format(a)) print('{} mes(es)'.format(m)) print('{} dia(s)'.format(d))
n = int(input()) a = n // 365 n = n - a * 365 m = n // 30 n = n - m * 30 d = n print('{} ano(s)'.format(a)) print('{} mes(es)'.format(m)) print('{} dia(s)'.format(d))
num=[10,20,30,40,50,60] n=[i for i in num] print(n) n=[10,20,30,40] s=[10,20] n1=[i for i in n] print(n1) n2=[j*j for j in n] print(n2) n3=[s+s for s in n ] print(n3) for m in n: s.append(m*m) print(s) #using lambda l=[1,2,3,4] p=list(map(lambda a:a*a ,l)) print(p) l=list(filter(lambda x:x%2==0,l)) print(l)...
num = [10, 20, 30, 40, 50, 60] n = [i for i in num] print(n) n = [10, 20, 30, 40] s = [10, 20] n1 = [i for i in n] print(n1) n2 = [j * j for j in n] print(n2) n3 = [s + s for s in n] print(n3) for m in n: s.append(m * m) print(s) l = [1, 2, 3, 4] p = list(map(lambda a: a * a, l)) print(p) l = list(filter(lambda x: ...
# # PySNMP MIB module CISCO-IPSEC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IPSEC-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:02:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
sensorData = open('input.txt').read().splitlines() diff = [-1, 0, 1] key = None trenchMap = set() y = 0 for line in sensorData: if not key: key = line elif len(line) > 0: for x in range(len(line)): if line[x] == '#': trenchMap.add((x, y)) y += 1 neighboorho...
sensor_data = open('input.txt').read().splitlines() diff = [-1, 0, 1] key = None trench_map = set() y = 0 for line in sensorData: if not key: key = line elif len(line) > 0: for x in range(len(line)): if line[x] == '#': trenchMap.add((x, y)) y += 1 neighboorhoo...
class Config(object): CHROME_PATH = '/Library/Application Support/Google/chromedriver76.0.3809.68' BROWSERMOB_PATH = '/usr/local/bin/browsermob-proxy-2.1.4/bin/browsermob-proxy' class Docker(Config): CHROME_PATH = '/usr/local/bin/chromedriver'
class Config(object): chrome_path = '/Library/Application Support/Google/chromedriver76.0.3809.68' browsermob_path = '/usr/local/bin/browsermob-proxy-2.1.4/bin/browsermob-proxy' class Docker(Config): chrome_path = '/usr/local/bin/chromedriver'
numbers = [1, 2, 3, 4, 5] for x in numbers: print(x) print("--------") for x in reversed(numbers): print(x) print(numbers)
numbers = [1, 2, 3, 4, 5] for x in numbers: print(x) print('--------') for x in reversed(numbers): print(x) print(numbers)
a=int(input()) def s(n): if n==3:return['***','* *','***'] x=s(n//3) y=list(zip(x,x,x)) for i in range(len(y)): y[i]=''.join(y[i]) z=list(zip(x,[' '*(n//3)]*(n//3),x)) for i in range(len(z)): z[i]=''.join(z[i]) return y+z+y print('\n'.join(s(a)))
a = int(input()) def s(n): if n == 3: return ['***', '* *', '***'] x = s(n // 3) y = list(zip(x, x, x)) for i in range(len(y)): y[i] = ''.join(y[i]) z = list(zip(x, [' ' * (n // 3)] * (n // 3), x)) for i in range(len(z)): z[i] = ''.join(z[i]) return y + z + y print('...
def dictTolist(data): result = [] if isinstance(data, dict) and data.__len__() > 0: result.append(data) elif isinstance(data, list) and data.__len__() > 0: result = data else: result = None return result
def dict_tolist(data): result = [] if isinstance(data, dict) and data.__len__() > 0: result.append(data) elif isinstance(data, list) and data.__len__() > 0: result = data else: result = None return result
######################## # * First Solution ######################## class Solution: def searchInsert(self, nums: List[int], target: int) -> int: low = 0 high = len(nums)-1 while low < high: mid = (low+high) // 2 if nums[mid] == target: return mid ...
class Solution: def search_insert(self, nums: List[int], target: int) -> int: low = 0 high = len(nums) - 1 while low < high: mid = (low + high) // 2 if nums[mid] == target: return mid elif nums[mid] > target: high = mid - 1...
# Dictionary # length (len), check a key, get, set, add # Dictionary 1 ------------------------------------------- print(" Dictionary with string keys ".center(44, "-")) dict_employee_IDs = {"ID01": 'John Papa', "ID02": 'David Thompson', "ID03": 'Terry Gao', ...
print(' Dictionary with string keys '.center(44, '-')) dict_employee_i_ds = {'ID01': 'John Papa', 'ID02': 'David Thompson', 'ID03': 'Terry Gao', 'ID04': 'Barry Tex'} print(dict_employee_IDs) print(' dictionary length '.center(44, '-')) dict_employee_i_ds_length = len(dict_employee_IDs) print(str(dict_employee_IDs_lengt...
# Processing functions for various USMTF message formats def tacelint(logger_item, message_dict, lines_list, processed_message_list): prev_soi = [] prev_line = [] for line in lines_list: if len(prev_line) == 0: prev_line.append(line) else: del prev_line[0] ...
def tacelint(logger_item, message_dict, lines_list, processed_message_list): prev_soi = [] prev_line = [] for line in lines_list: if len(prev_line) == 0: prev_line.append(line) else: del prev_line[0] prev_line.append(line) line_split = line.split('...
def first(n_1): line_1 = set() for i in range(n_1): number = int(input()) line_1.add(number) return line_1 def second(n_2): line_2 = set() for i in range(n_2): number = int(input()) line_2.add(number) return line_2 data = input().split() n_1 = int(data[0]) n_2 =i...
def first(n_1): line_1 = set() for i in range(n_1): number = int(input()) line_1.add(number) return line_1 def second(n_2): line_2 = set() for i in range(n_2): number = int(input()) line_2.add(number) return line_2 data = input().split() n_1 = int(data[0]) n_2 = ...
class UnityPackException(Exception): pass class ArchiveNotFound(UnityPackException): pass
class Unitypackexception(Exception): pass class Archivenotfound(UnityPackException): pass
# Interview Question #5 # The problem is that we want to find duplicates in a one-dimensional array of integers in O(N) running time # where the integer values are smaller than the length of the array! # For example: if we have a list [1, 2, 3, 1, 5] then the algorithm can detect that there are a duplicate with value 1...
def duplicate_finder_1(nums): duplicates = [] for n in set(nums): if nums.count(n) > 1: duplicates.append(n) return duplicates if duplicates else 'The array does not contain any duplicates!' def duplicate_finder_2(nums): duplicates = set() for (i, n) in enumerate(sorted(nums)): ...
''' sgqlc - Simple GraphQL Client ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Access GraphQL endpoints using Python ===================================== This package provide the following modules: - :mod:`sgqlc.endpoint.base`: with abstract class :class:`sgqlc.endpoint.base.BaseEndpoint` and helpful logging utilities to t...
""" sgqlc - Simple GraphQL Client ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Access GraphQL endpoints using Python ===================================== This package provide the following modules: - :mod:`sgqlc.endpoint.base`: with abstract class :class:`sgqlc.endpoint.base.BaseEndpoint` and helpful logging utilities to t...
START = { "type": "http.response.start", "status": 200, "headers": [ (b"content-length", b"13"), (b"content-type", b"text/html; charset=utf-8"), ], } BODY1 = {"type": "http.response.body", "body": b"Hello"} BODY2 = {"type": "http.response.body", "body": b", world!"} async def hellowor...
start = {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'13'), (b'content-type', b'text/html; charset=utf-8')]} body1 = {'type': 'http.response.body', 'body': b'Hello'} body2 = {'type': 'http.response.body', 'body': b', world!'} async def helloworld(scope, receive, send) -> None: aw...
load("@fbcode_macros//build_defs:platform_utils.bzl", "platform_utils") def get_ppx_bin(): return "third-party-buck/{}/build/ocaml-lwt_ppx/lib/lwt_ppx/ppx.exe".format(platform_utils.get_platform_for_base_path(get_base_path()))
load('@fbcode_macros//build_defs:platform_utils.bzl', 'platform_utils') def get_ppx_bin(): return 'third-party-buck/{}/build/ocaml-lwt_ppx/lib/lwt_ppx/ppx.exe'.format(platform_utils.get_platform_for_base_path(get_base_path()))
# -*- coding: utf-8 -*- class Solution: def maxProduct(self, nums): best_max, current_max, current_min = float('-inf'), 1, 1 for num in nums: current_max, current_min = max(current_min * num, num, current_max * num),\ min(current_min * num, num, current_max * num) ...
class Solution: def max_product(self, nums): (best_max, current_max, current_min) = (float('-inf'), 1, 1) for num in nums: (current_max, current_min) = (max(current_min * num, num, current_max * num), min(current_min * num, num, current_max * num)) best_max = max(best_max, c...
def limpar(tela): telaPrincipal = tela lista = [telaPrincipal.telefone, telaPrincipal.nome, telaPrincipal.cep, telaPrincipal.end, telaPrincipal.numero, telaPrincipal.bairro, telaPrincipal.ref, telaPrincipal.complemento, telaPrincipal...
def limpar(tela): tela_principal = tela lista = [telaPrincipal.telefone, telaPrincipal.nome, telaPrincipal.cep, telaPrincipal.end, telaPrincipal.numero, telaPrincipal.bairro, telaPrincipal.ref, telaPrincipal.complemento, telaPrincipal.devendo, telaPrincipal.taxa_2] for i in lista: i.clear() tela...
#Embedded file name: ACEStream\version.pyo VERSION = '2.0.8.7' VERSION_REV = '2191' VERSION_DATE = '2013/03/28 18:36:41'
version = '2.0.8.7' version_rev = '2191' version_date = '2013/03/28 18:36:41'
credentials = { 'ldap': { 'user': '', 'pass': '' }, 'rocket': { 'user': '', 'pass': '' } }
credentials = {'ldap': {'user': '', 'pass': ''}, 'rocket': {'user': '', 'pass': ''}}
# https://edabit.com/challenge/KWoj7kWiHRqJtG6S2 # There is a single operator in Python # capable of providing the remainder of a division operation. # Two numbers are passed as parameters. # The first parameter divided by the second parameter will have a remainder, possibly zero. # Return that value. def...
def remainder(int1: int, int2: int) -> int: leftovers = int1 % int2 return leftovers print(remainder(5, 5))
# Script Name : data.py # Author : Howard Zhang # Created : 14th June 2018 # Last Modified : 14th June 2018 # Version : 1.0 # Modifications : # Description : The struct of data to sort and display. class Data: # Total of data to sort data_count = 32 def __init__(self,...
class Data: data_count = 32 def __init__(self, value): self.value = value self.set_color() def set_color(self, rgba=None): if not rgba: rgba = (0, 1 - self.value / (self.data_count * 2), self.value / (self.data_count * 2) + 0.5, 1) self.color = rgba
class Plugin: def __init__(self): pass def execute(self): print("HELLO WORLD 2. :D")
class Plugin: def __init__(self): pass def execute(self): print('HELLO WORLD 2. :D')
class NotAuthenticatedError(Exception): pass class AuthenticationFailedError(Exception): pass
class Notauthenticatederror(Exception): pass class Authenticationfailederror(Exception): pass
OPERATION_TYPES = [ 'ADD', 'REMOVE', 'CHANGE_DATA', 'PATCH_METADATA' ] USER_CHANGEABLE_RELEASE_STATUSES = { 'MUTABLE': [ 'DRAFT', 'PENDING_RELEASE', 'PENDING_DELETE' ], 'IMMUTABLE': [ 'RELEASED', 'DELETED' ] } RELEASE_STATUS_ALLOWED_TRANSITIONS =...
operation_types = ['ADD', 'REMOVE', 'CHANGE_DATA', 'PATCH_METADATA'] user_changeable_release_statuses = {'MUTABLE': ['DRAFT', 'PENDING_RELEASE', 'PENDING_DELETE'], 'IMMUTABLE': ['RELEASED', 'DELETED']} release_status_allowed_transitions = {'DRAFT': ['PENDING_RELEASE'], 'PENDING_RELEASE': ['DRAFT'], 'PENDING_DELETE': []...
total_taxis = 100 size = 4 expected_customers = 120 size_without_driver = size - 1 number_of_cars_required = expected_customers/size_without_driver print(f"number of cars required {number_of_cars_required}")
total_taxis = 100 size = 4 expected_customers = 120 size_without_driver = size - 1 number_of_cars_required = expected_customers / size_without_driver print(f'number of cars required {number_of_cars_required}')
lst = ["Peace", "of", "the", "mind", 2, 4, 7] for i in lst: place = "".join(map(str, lst)) print(place)
lst = ['Peace', 'of', 'the', 'mind', 2, 4, 7] for i in lst: place = ''.join(map(str, lst)) print(place)
choice = '' def add(num1, num2): return num1 + num2 def subs(num1, num2): return num1 - num2 def mult(num1, num2): return num1 * num2 def div(num1, num2): return num1 / num2 def mod(num1, num2): return num1 % num2 def power(num1, num2): result = 1 for i in range(num2): result *=...
choice = '' def add(num1, num2): return num1 + num2 def subs(num1, num2): return num1 - num2 def mult(num1, num2): return num1 * num2 def div(num1, num2): return num1 / num2 def mod(num1, num2): return num1 % num2 def power(num1, num2): result = 1 for i in range(num2): result *...
#!/usr/bin/env python '''\ Given two strings, remove all characters contained in the latter from the former. Note that order is preserved. For example: "ab", "b" -> "a" "abcdabcd", "acec" -> "bdbd" What is the run-time of your algorithm? How much memory does it use? Is it optimal? linear search...
"""Given two strings, remove all characters contained in the latter from the former. Note that order is preserved. For example: "ab", "b" -> "a" "abcdabcd", "acec" -> "bdbd" What is the run-time of your algorithm? How much memory does it use? Is it optimal? linear search with memcpy: O(nh**2)...
# Set the following variables and rename to credentials.py USER = RPC_USERNAME PASSWORD = RPC_PASSWORD SITE_SECRET_KEY = BYTE_STRING
user = RPC_USERNAME password = RPC_PASSWORD site_secret_key = BYTE_STRING
def GetXSection(fileName): #[pb] #Cross Section derived from sample name using https://cms-gen-dev.cern.ch/xsdb/ #TODO UL QCD files have PSWeights in their name, but xsdb does not include it in its name fileName = fileName.replace("PSWeights_", "") #TODO: UL Single Top xSection only defined for filename without inc...
def get_x_section(fileName): file_name = fileName.replace('PSWeights_', '') file_name = fileName.replace('5f_InclusiveDecays_', '5f_') file_name = fileName.replace('tZq_ll_4f_ckm_NLO_TuneCP5_13TeV-amcatnlo-pythia8', 'tZq_ll_4f_ckm_NLO_TuneCP5_PSweights_13TeV-amcatnlo-pythia8') if fileName.find('ST_t-cha...
variant = ["_clear", "_scratched", "_crystal", "_dim", "_dark", "_bright", "_ghostly", "_ethereal", "_foreboding", "_strong"] colors = ["white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "silver", "cyan", "purple", "blue", "brown", "green", "red", "black"] for prefix in variant: with open...
variant = ['_clear', '_scratched', '_crystal', '_dim', '_dark', '_bright', '_ghostly', '_ethereal', '_foreboding', '_strong'] colors = ['white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', 'pink', 'gray', 'silver', 'cyan', 'purple', 'blue', 'brown', 'green', 'red', 'black'] for prefix in variant: with open...
[ { 'date': '2011-01-01', 'description': 'Nieuwjaarsdag', 'locale': 'nl-NL', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2011-04-22', 'description': 'Goede Vrijdag', 'locale': 'nl-NL', 'notes': '', 'region': ''...
[{'date': '2011-01-01', 'description': 'Nieuwjaarsdag', 'locale': 'nl-NL', 'notes': '', 'region': '', 'type': 'NF'}, {'date': '2011-04-22', 'description': 'Goede Vrijdag', 'locale': 'nl-NL', 'notes': '', 'region': '', 'type': 'NRV'}, {'date': '2011-04-24', 'description': 'Eerste Paasdag', 'locale': 'nl-NL', 'notes': ''...
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'liying' class Latest(object): def __init__(self): self.package = None self.latest_version = None
__author__ = 'liying' class Latest(object): def __init__(self): self.package = None self.latest_version = None
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-dgidb' ES_DOC_TYPE = 'association' API_PREFIX = 'dgidb' API_VERSION = ''
es_host = 'localhost:9200' es_index = 'pending-dgidb' es_doc_type = 'association' api_prefix = 'dgidb' api_version = ''
class CSVUpperTriangularPlugin: def input(self, filename): infile = open(filename, 'r') self.colnames = infile.readline().strip().split(',') # Assume rownames=colnames self.ADJ = [] for line in infile: self.ADJ.append(line.strip().split(',')[1:]) def run(self): pas...
class Csvuppertriangularplugin: def input(self, filename): infile = open(filename, 'r') self.colnames = infile.readline().strip().split(',') self.ADJ = [] for line in infile: self.ADJ.append(line.strip().split(',')[1:]) def run(self): pass def output(se...
class GithubError(Exception): pass class GithubAPIError(GithubError): pass
class Githuberror(Exception): pass class Githubapierror(GithubError): pass
# Write a function to find the longest common prefix string amongst an array of strings. class Solution(object): def longestCommonPrefix(self, strs): if len(strs) == 0: return "" standard = strs[0] longest_length = len(standard) for string in strs[1:]: index ...
class Solution(object): def longest_common_prefix(self, strs): if len(strs) == 0: return '' standard = strs[0] longest_length = len(standard) for string in strs[1:]: index = 0 while index < len(string) and index < len(standard) and (string[index] ...
# Copyright Notice: # Copyright 2016-2019 DMTF. All rights reserved. # License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Interface-Emulator/blob/master/LICENSE.md # Redfish template REDFISH_TEMPLATE = { "@odata.context": "{rest_base}$metadata#Systems/cs_puid", "@odata.id...
redfish_template = {'@odata.context': '{rest_base}$metadata#Systems/cs_puid', '@odata.id': '{rest_base}Systems/{cs_puid}', '@odata.type': '#ComputerSystem.1.0.0.ComputerSystem', 'Id': None, 'Name': 'WebFrontEnd483', 'SystemType': 'Virtual', 'AssetTag': 'Chicago-45Z-2381', 'Manufacturer': 'Redfish Computers', 'Model': '...
class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int: consecutive = 0 ret = 0 for i in range(len(nums) + 1): if i == len(nums) or nums[i] == 0: ret = max(ret, consecutive) consecutive = 0 else: consec...
class Solution: def find_max_consecutive_ones(self, nums: List[int]) -> int: consecutive = 0 ret = 0 for i in range(len(nums) + 1): if i == len(nums) or nums[i] == 0: ret = max(ret, consecutive) consecutive = 0 else: co...
def get_max_increasing_sub_sequence(arr): i = 1 n = len(arr) j = 0 dp = arr[:] while i < n: while j < i: if dp[j] < dp[i] < dp[i] + dp[j]: dp[i] = dp[j] + dp[i] j += 1 i += 1 return max(dp) if __name__ == '__main__': # arr = [1, 101, ...
def get_max_increasing_sub_sequence(arr): i = 1 n = len(arr) j = 0 dp = arr[:] while i < n: while j < i: if dp[j] < dp[i] < dp[i] + dp[j]: dp[i] = dp[j] + dp[i] j += 1 i += 1 return max(dp) if __name__ == '__main__': test_cases = int(in...
# this file defines available actions # reference: https://github.com/TeamFightingICE/FightingICE/blob/master/python/Feature%20Extractor%20in%20Python/action.py class Actions: def __init__(self): # map digits to actions self.actions = [ "NEUTRAL", "STAND", "FORWA...
class Actions: def __init__(self): self.actions = ['NEUTRAL', 'STAND', 'FORWARD_WALK', 'DASH', 'BACK_STEP', 'CROUCH', 'JUMP', 'FOR_JUMP', 'BACK_JUMP', 'AIR', 'STAND_GUARD', 'CROUCH_GUARD', 'AIR_GUARD', 'STAND_GUARD_RECOV', 'CROUCH_GUARD_RECOV', 'AIR_GUARD_RECOV', 'STAND_RECOV', 'CROUCH_RECOV', 'AIR_RECOV',...
''' Created on 16-10-2012 @author: Jacek Przemieniecki ''' class Mixture(object): def _calc_groups(self): self._groups = {} groups = self._groups tot_grps = 0 for mol in self.moles: m_groups = self.moles[mol].get_groups() for m_grp in m_groups:...
""" Created on 16-10-2012 @author: Jacek Przemieniecki """ class Mixture(object): def _calc_groups(self): self._groups = {} groups = self._groups tot_grps = 0 for mol in self.moles: m_groups = self.moles[mol].get_groups() for m_grp in m_groups: ...
extractable_regions = ["TextRegion", "ImageRegion", "LineDrawingRegion", "GraphicRegion", "TableRegion", "ChartRegion", "MapRegion", "SeparatorRegion", ...
extractable_regions = ['TextRegion', 'ImageRegion', 'LineDrawingRegion', 'GraphicRegion', 'TableRegion', 'ChartRegion', 'MapRegion', 'SeparatorRegion', 'MathsRegion', 'ChemRegion', 'MusicRegion', 'AdvertRegion', 'NoiseRegion', 'NoiseRegion', 'UnknownRegion', 'CustomRegion', 'TextLine'] text_count_supported_elems = ['Te...
# Copyright 2016 Google Inc. # # 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,...
def cram_test(name, srcs, deps=[]): for s in srcs: testname = name + '_' + s script = testname + '_script.sh' gr = '_gen_' + script native.genrule(name=gr, srcs=[s], outs=[script], cmd="echo 'exec $${TEST_SRCDIR}/copybara/integration/cram " + '--xunit-file=$$XML_OUTPUT_FILE $$0\' > "...
# # PySNMP MIB module RADLAN-DHCP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-DHCP-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:01:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ...
def lerp(a, b, amount): return (amount * a) + ((1 - amount) * b) def smoothstep(edge0, edge1, amount): x = clamp((amount - edge0) / (edge1 - edge0), 0.0, 1.0) return x * x * (3 - 2 * x) def smootherstep(edge0, edge1, amount): x = clamp((amount - edge0) / (edge1 - edge0), 0.0, 1.0) return x ...
def lerp(a, b, amount): return amount * a + (1 - amount) * b def smoothstep(edge0, edge1, amount): x = clamp((amount - edge0) / (edge1 - edge0), 0.0, 1.0) return x * x * (3 - 2 * x) def smootherstep(edge0, edge1, amount): x = clamp((amount - edge0) / (edge1 - edge0), 0.0, 1.0) return x * x * x * (...
# Time: O(n); Space: O(n) def next_greater_element(nums1, nums2): stack = [] d = {} i = len(nums2) - 1 while i >= 0: num = nums2[i] if not stack: d[num] = -1 stack.append(num) i -= 1 elif stack[-1] > num: d[num] = stack[-1] ...
def next_greater_element(nums1, nums2): stack = [] d = {} i = len(nums2) - 1 while i >= 0: num = nums2[i] if not stack: d[num] = -1 stack.append(num) i -= 1 elif stack[-1] > num: d[num] = stack[-1] stack.append(num) ...
#!/usr/bin/python # -*- coding: utf-8 -*- DEFAULT_HOST = '127.0.01' DEFAULT_PORT = 3306 DEFAULT_USER_NAME = 'root' DEFAULT_USER_PASS = 'root123' DEFAULT_USER_LIST = 'accounts/user.list' DEFAULT_WORD_LIST = 'accounts/word.list' # text color in console
default_host = '127.0.01' default_port = 3306 default_user_name = 'root' default_user_pass = 'root123' default_user_list = 'accounts/user.list' default_word_list = 'accounts/word.list'
# mock resource classes from peeringdb-py client class Organization: pass class Facility: pass class Network: pass class InternetExchange: pass class InternetExchangeFacility: pass class InternetExchangeLan: pass class InternetExchangeLanPrefix: pass class NetworkFacility: ...
class Organization: pass class Facility: pass class Network: pass class Internetexchange: pass class Internetexchangefacility: pass class Internetexchangelan: pass class Internetexchangelanprefix: pass class Networkfacility: pass class Networkixlan: pass class Networkcontact...
class Player(): def __init__(self, name, start=False, ai_switch=False): self.ai = ai_switch self.values = {0:.5} self.name = name self.turn = start self.epsilon = 1
class Player: def __init__(self, name, start=False, ai_switch=False): self.ai = ai_switch self.values = {0: 0.5} self.name = name self.turn = start self.epsilon = 1
CONFIG_FILE_PATH = 'TypeRacerStats/src/config.json' ACCOUNTS_FILE_PATH = 'TypeRacerStats/src/accounts.json' ALIASES_FILE_PATH = 'TypeRacerStats/src/commands.json' PREFIXES_FILE_PATH = 'TypeRacerStats/src/prefixes.json' SUPPORTERS_FILE_PATH = 'TypeRacerStats/src/supporter_colors.json' UNIVERSES_FILE_PATH = 'TypeRacerSta...
config_file_path = 'TypeRacerStats/src/config.json' accounts_file_path = 'TypeRacerStats/src/accounts.json' aliases_file_path = 'TypeRacerStats/src/commands.json' prefixes_file_path = 'TypeRacerStats/src/prefixes.json' supporters_file_path = 'TypeRacerStats/src/supporter_colors.json' universes_file_path = 'TypeRacerSta...
# # PySNMP MIB module HP-ICF-VRRP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-VRRP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:23:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
def pytest_addoption(parser): parser.addoption('--integration_tests', action='store_true', dest="integration_tests", default=False, help="enable integration tests") def pytest_configure(config): if not config.option.integration_tests: setattr(config.option, 'markexpr', 'not integration...
def pytest_addoption(parser): parser.addoption('--integration_tests', action='store_true', dest='integration_tests', default=False, help='enable integration tests') def pytest_configure(config): if not config.option.integration_tests: setattr(config.option, 'markexpr', 'not integration_tests')
class CountdownCancelAll: def __init__(self): self.symbol = "" self.countdownTime = 0 @staticmethod def json_parse(json_data): result = CountdownCancelAll() result.symbol = json_data.get_string("symbol") result.countdownTime = json_data.get_int("countdownT...
class Countdowncancelall: def __init__(self): self.symbol = '' self.countdownTime = 0 @staticmethod def json_parse(json_data): result = countdown_cancel_all() result.symbol = json_data.get_string('symbol') result.countdownTime = json_data.get_int('countdownTime') ...
def fn1(a,b): print("Subtraction=",a-b) def fn2(c): print(c)
def fn1(a, b): print('Subtraction=', a - b) def fn2(c): print(c)
#taking values through keyboard a,b=[int(i) for i in input('enter two numbers:').split(',')] if(a>b): print(a,'is big') elif(a<b): print(b,'is big') else: print('both are equal') #taking values directly a=5 b=3 if(a>b): print(a,'is big') elif(b>a): print(b,'is big') else: print('both are equa...
(a, b) = [int(i) for i in input('enter two numbers:').split(',')] if a > b: print(a, 'is big') elif a < b: print(b, 'is big') else: print('both are equal') a = 5 b = 3 if a > b: print(a, 'is big') elif b > a: print(b, 'is big') else: print('both are equal')
def flatten(lst): if lst: car,*cdr=lst if isinstance(car,(list,tuple)): if cdr: return flatten(car) + flatten(cdr) return flatten(car) if cdr: return [car] + flatten(cdr) return [car]
def flatten(lst): if lst: (car, *cdr) = lst if isinstance(car, (list, tuple)): if cdr: return flatten(car) + flatten(cdr) return flatten(car) if cdr: return [car] + flatten(cdr) return [car]
class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: res = [] nums.sort() n = len(nums) for i in range(n-2): if i > 0 and nums[i] == nums[i-1]: continue j, k = i + 1, n - 1 while j < k: _sum = nums...
class Solution: def three_sum(self, nums: List[int]) -> List[List[int]]: res = [] nums.sort() n = len(nums) for i in range(n - 2): if i > 0 and nums[i] == nums[i - 1]: continue (j, k) = (i + 1, n - 1) while j < k: _...
def min_rooms_required(intervals): '''Returns the minimum amount of rooms necessary. Input consists of a list of time-intervals (start, stop): >>> min_rooms_required([(10, 20), (15, 25)]) 2 >>> min_rooms_required([(10, 20), (20, 30)]) 1 ''' # transform intervals # [(10, 20), (15, 25...
def min_rooms_required(intervals): """Returns the minimum amount of rooms necessary. Input consists of a list of time-intervals (start, stop): >>> min_rooms_required([(10, 20), (15, 25)]) 2 >>> min_rooms_required([(10, 20), (20, 30)]) 1 """ times = [] for interval in intervals: ...
class Solution: def removeCoveredIntervals(self, intervals: List[List[int]]) -> int: intervals.sort(reverse=True,key=lambda x:(x[1],-x[0])) # print(intervals) slen = len(intervals) count = slen for i in range(slen-1): # print(intervals[i],intervals[i+1]) ...
class Solution: def remove_covered_intervals(self, intervals: List[List[int]]) -> int: intervals.sort(reverse=True, key=lambda x: (x[1], -x[0])) slen = len(intervals) count = slen for i in range(slen - 1): if intervals[i][0] <= intervals[i + 1][0] and intervals[i][1] >= ...
# 312. Burst Balloons # Runtime: 8448 ms, faster than 44.62% of Python3 online submissions for Burst Balloons. # Memory Usage: 19.9 MB, less than 38.33% of Python3 online submissions for Burst Balloons. class Solution: def maxCoins(self, nums: list[int]) -> int: n = len(nums) # Edge case ...
class Solution: def max_coins(self, nums: list[int]) -> int: n = len(nums) nums = [1] + nums + [1] scores = [[0 for _ in range(len(nums))] for _ in range(len(nums))] for i in range(n, -1, -1): for j in range(i + 1, n + 2): for k in range(i + 1, j): ...
## Implementation of a recursive fibonacci series. Extremely inefficient though. ## Author: AJ class fibonacci: def __init__(self): self.number = 0 self.series = [] def fib_series(self, num): if num <=2: if 1 not in self.series: self.series.append(1) ...
class Fibonacci: def __init__(self): self.number = 0 self.series = [] def fib_series(self, num): if num <= 2: if 1 not in self.series: self.series.append(1) return 1 next = self.fib_series(num - 1) + self.fib_series(num - 2) if ne...
#inherits , extend , override class Employee: def __init__(self , name , age , salary): self.name = name self.age = age self.salary = salary def work(self): print( f"{self.name} is working..." ) class SoftwareEngineer(Employee): def __init__(self , name , age , salary , le...
class Employee: def __init__(self, name, age, salary): self.name = name self.age = age self.salary = salary def work(self): print(f'{self.name} is working...') class Softwareengineer(Employee): def __init__(self, name, age, salary, level): super(SoftwareEngineer, ...
MODULE_CONTEXT = {'metadata':{'module':'ANUVAAD-NMT-MODELS'}} def init(): global app_context app_context = { 'application_context' : None }
module_context = {'metadata': {'module': 'ANUVAAD-NMT-MODELS'}} def init(): global app_context app_context = {'application_context': None}
class TestStackiBoxInfo: def test_no_name(self, run_ansible_module): result = run_ansible_module("stacki_box_info") assert result.status == "SUCCESS" assert result.data["changed"] == False assert len(result.data["boxes"]) == 2 def test_with_name(self, run_ansible_module): result = run_ansible_module("sta...
class Teststackiboxinfo: def test_no_name(self, run_ansible_module): result = run_ansible_module('stacki_box_info') assert result.status == 'SUCCESS' assert result.data['changed'] == False assert len(result.data['boxes']) == 2 def test_with_name(self, run_ansible_module): ...
# Dictionaries # https://www.freecodecamp.org/learn/scientific-computing-with-python/python-for-everybody/python-dictionaries # A collection of values each with their own key identifiers - like a java hashmap ddd = dict() ddd['age'] = 21 ddd['course'] = 182 print(ddd) ddd['age'] = 27 print(ddd) # Literals jjj = {'nam...
ddd = dict() ddd['age'] = 21 ddd['course'] = 182 print(ddd) ddd['age'] = 27 print(ddd) jjj = {'name': 'bob', 'age': 21} print(jjj) ccc = dict() ccc['count1'] = 1 ccc['count2'] = 1 print(ccc) ccc['count1'] = ccc['count1'] + 1 print(ccc) counts = dict() names = ['bob', 'bob6', 'bob4', 'bob2', 'bob', 'bob6'] for name in n...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # this is a windows documentation stub, actual code lives in the .ps1 # file of the same name ANSIBLE_METADATA = {'metadata_version': '1.1', ...
ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} documentation = "\n---\nmodule: win_wait_for_process\nversion_added: '2.7'\nshort_description: Waits for a process to exist or not exist before continuing.\ndescription:\n- Waiting for a process to start or stop.\n- This ...
file = 'fer2018surprise.csv' file_path = '../data/original/'+file new_file_path = '../data/converted/'+file num = 0 with open(file_path, 'r') as fp: with open(new_file_path, 'w') as fp2: num = num + 1 line = fp.readline() while line: lineWithCommas = line.replace(' ', ',') ...
file = 'fer2018surprise.csv' file_path = '../data/original/' + file new_file_path = '../data/converted/' + file num = 0 with open(file_path, 'r') as fp: with open(new_file_path, 'w') as fp2: num = num + 1 line = fp.readline() while line: line_with_commas = line.replace(' ', ',') ...
__author__ = 'BeyondSky' class Solution: def climbStairs_dp(self, n): if n < 2: return 1 steps = [] steps.append(1) steps.append(2) for i in range(2,n): steps.append(steps[i-1] + steps[i-2]) return steps[n-1] def main(): outer = Soluti...
__author__ = 'BeyondSky' class Solution: def climb_stairs_dp(self, n): if n < 2: return 1 steps = [] steps.append(1) steps.append(2) for i in range(2, n): steps.append(steps[i - 1] + steps[i - 2]) return steps[n - 1] def main(): outer = ...