content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- class ScraperError(Exception): pass
class Scrapererror(Exception): pass
PYTHON = "python" CPP = "cpp" CSHARP = "csharp" JAVA = 'java' CHOICES = ( (PYTHON, 'Python3'), (CPP, 'C++'), (CSHARP, 'C#'), (JAVA, 'Java') )
python = 'python' cpp = 'cpp' csharp = 'csharp' java = 'java' choices = ((PYTHON, 'Python3'), (CPP, 'C++'), (CSHARP, 'C#'), (JAVA, 'Java'))
# %% Building out get asset events limit = 50 collection_slug, token_id, ='gutter-cat-gang', None asset_contract_addresses, offset, only_opensea, auction_type, occurred_before, occurred_after = None, None, None, None, None, None account_address = None # initiatie query with limit: query = {"limit" : str(limit)} # C...
limit = 50 (collection_slug, token_id) = ('gutter-cat-gang', None) (asset_contract_addresses, offset, only_opensea, auction_type, occurred_before, occurred_after) = (None, None, None, None, None, None) account_address = None query = {'limit': str(limit)} if collection_slug: query['collection_slug'] = collection_slu...
class AWSCloudWatchAlarmPermissions: def get_permissions(self, resname, res): alarmname = self._get_property_or_default(res, "*", "AlarmName") alarmactions = self._get_property_or_default(res, None, "AlarmActions") insufficientdataactions = self._get_property_or_default(res, None, "Insuffici...
class Awscloudwatchalarmpermissions: def get_permissions(self, resname, res): alarmname = self._get_property_or_default(res, '*', 'AlarmName') alarmactions = self._get_property_or_default(res, None, 'AlarmActions') insufficientdataactions = self._get_property_or_default(res, None, 'Insuffic...
#!/usr/bin/env python3 distro={ } library=[] distro["name"]="RedHat" distro["versions"]=["4.0","5.0","6.0","7.0","8.0"] library.append(distro.copy()) distro["name"]="Suse" distro["versions"]=["10.0","11.0","15.0","42.0"] library.append(distro.copy()) print(library)
distro = {} library = [] distro['name'] = 'RedHat' distro['versions'] = ['4.0', '5.0', '6.0', '7.0', '8.0'] library.append(distro.copy()) distro['name'] = 'Suse' distro['versions'] = ['10.0', '11.0', '15.0', '42.0'] library.append(distro.copy()) print(library)
class Method(): def __init__(self): self.methodDefinition = None self.locals = [] self.instructions = [] self.maxStack = -1 self.returnType = None self.parameters = [] self.attributes = []
class Method: def __init__(self): self.methodDefinition = None self.locals = [] self.instructions = [] self.maxStack = -1 self.returnType = None self.parameters = [] self.attributes = []
class Elevator: occupancy_limit = 8 def __init__(self, occupants): if occupants > self.occupancy_limit: print("The maximum occupancy limit has been exceeded." f" {occupants - self.occupancy_limit} occupants must exit the elevator.") self.occupants = occupants ele...
class Elevator: occupancy_limit = 8 def __init__(self, occupants): if occupants > self.occupancy_limit: print(f'The maximum occupancy limit has been exceeded. {occupants - self.occupancy_limit} occupants must exit the elevator.') self.occupants = occupants elevator1 = elevator(6) pr...
first = ['Aousnik', 'Ronodeep', 'Anirban'] last = ['Gupta', 'Gupta', 'Chaudhuri'] names = zip(first, last) # joins the first and last list in the tuples 'names' for a, b in names: print(a, b) ''' this function just basically makes a list of tuples like: [('Aousnik', 'Gupta'), ('Ronodeep', Gup...
first = ['Aousnik', 'Ronodeep', 'Anirban'] last = ['Gupta', 'Gupta', 'Chaudhuri'] names = zip(first, last) for (a, b) in names: print(a, b) " this function just basically makes a list of tuples like:\n [('Aousnik', 'Gupta'), ('Ronodeep', Gupta), ('Anirban', 'Chaudhuri')] just like tuples\n"
# x = 5 # y = 10 # z = 20 # x, y, z = 5, 16, 20 # x, y = y, x # x += 5 #x = x + 5 # x -= 5 #x = x - 5 # x *= 5 #x = x * 5 # x /= 5 #x = x / 5 # x %= 5 #x = x % 5 # y //= 5 #y = y // 5 # y **= z #y = y ** z values ...
values = (1, 2, 3, 4, 5) print(values) print(type(values)) (x, y, *z) = values print(x, y, z) print(x, y, z[1])
hght = 420 wdth = 1188 #size(1188,420) #define window size - doesnt work unless in setup inix = int(random(10,50)) #define x as first value for loop iniy1 = int(random(0,hght)) #define y1 as random between 0 and 420=height, no global value yet #iniy2 = iniy1 iniy2 = int(random(...
hght = 420 wdth = 1188 inix = int(random(10, 50)) iniy1 = int(random(0, hght)) iniy2 = int(random(0, hght)) while iniy1 == iniy2: iniy2 = int(random(0, hght)) cnt = 0 x = 0 isw = int(random(1, 3)) x_values = [] y_values = [] def setup(): global x background(255) stroke(0) size(wdth, hght) x = i...
class InvalidWithdrawal(Exception): pass raise InvalidWithdrawal("You don't have $50 in your account")
class Invalidwithdrawal(Exception): pass raise invalid_withdrawal("You don't have $50 in your account")
speed_light_si = 299792458.0 electron_mass_si = 9.10938215e-31 elementary_charge_si = 1.602176487e-19 mu_0_si = 4.0*math.pi*1e-7 epsilon_0_si = 1.0/(mu_0_si*speed_light_si**2) planck_si = 6.62606896e-34 hbar_si = planck_si / (2.0 * math.pi) fine_structure_si = elementary_charge_si**2/(4.0*math.pi*epsilon_0_si*hbar_si*s...
speed_light_si = 299792458.0 electron_mass_si = 9.10938215e-31 elementary_charge_si = 1.602176487e-19 mu_0_si = 4.0 * math.pi * 1e-07 epsilon_0_si = 1.0 / (mu_0_si * speed_light_si ** 2) planck_si = 6.62606896e-34 hbar_si = planck_si / (2.0 * math.pi) fine_structure_si = elementary_charge_si ** 2 / (4.0 * math.pi * eps...
def print_sum(*values): s = 0 for number in values: s += number print(f'The sum of {values} is {s}') print_sum(5, 2) print_sum(2, 9, 4)
def print_sum(*values): s = 0 for number in values: s += number print(f'The sum of {values} is {s}') print_sum(5, 2) print_sum(2, 9, 4)
x = 0 soma = 0 i = 0 while x != -1: x = int(input('digite uma idade: ')) if x != -1: soma += x i += 1 print(soma/i)
x = 0 soma = 0 i = 0 while x != -1: x = int(input('digite uma idade: ')) if x != -1: soma += x i += 1 print(soma / i)
if __name__ == '__main__': n = int(input()) output = "" for i in range(1, n+1): output = output + str(i) print(output)
if __name__ == '__main__': n = int(input()) output = '' for i in range(1, n + 1): output = output + str(i) print(output)
# # arr1 = [100,100,200,300,300,400,400] # # arr2 = [14,90,100,100,200,200,450,450,0,0,0,0,0,0,0] # # arr1 = [1,3,5] # # arr2 = [2,4,6,0,0,0] # arr1 = [1,1,1,1,1,1] # arr2 = [12,1,1,1,1,1,2,0,0,0,0,0,0] # # arr1_ptr, arr2_ptr = 0,0 # # while arr2_ptr <= len(arr1) - 1: # # if arr2[arr2_ptr] <= arr1[arr1_ptr]: # # ...
def generate_all_subsets(s): res = [] def helper(data, index, slate): if index == len(data): res.append('|'.join(slate)) return for i in range(index + 1, len(data) + 1): curr = string[index, i] slate.append(data[index]) helper(data, index + 1,...
def factorize(x: int): d = 2 while x != 1: if x % d == 0: print('Hello') yield d x //= d else: d += 1 A = factorize(1023) print(A) for x in map(str, A): print('Factor:', x)
def factorize(x: int): d = 2 while x != 1: if x % d == 0: print('Hello') yield d x //= d else: d += 1 a = factorize(1023) print(A) for x in map(str, A): print('Factor:', x)
def insertion_sort(v): for i in range (1, len(v)): x = v[i] j = i-1 while j>=0 and x< v[j]: v[j+1] = v[j] j -= 1 v[j+1] = x print() b = [8,3,9,2,1,10,7,5,4,6] print(b) print() a = insertion_sort(b) print() a = b print(a) print()
def insertion_sort(v): for i in range(1, len(v)): x = v[i] j = i - 1 while j >= 0 and x < v[j]: v[j + 1] = v[j] j -= 1 v[j + 1] = x print() b = [8, 3, 9, 2, 1, 10, 7, 5, 4, 6] print(b) print() a = insertion_sort(b) print() a = b print(a) print()
class User(): def __init__(self , Name , userName , username_type , Game , data_dict): self.index = data_dict.getIndex()+1 self.name = Name self.username = userName self.username_type = username_type self.game = Game self.data = data_dict self.data.AddU...
class User: def __init__(self, Name, userName, username_type, Game, data_dict): self.index = data_dict.getIndex() + 1 self.name = Name self.username = userName self.username_type = username_type self.game = Game self.data = data_dict self.data.AddUser(self) ...
class Time60(object): 'Time60 - track hours and minutes' def __init__(self, hr, min): self.hr = hr self.min = min def __str__(self): return '%d:%d' %(self.hr, self.min) __repr__ = __str__ def __add__(self, other): return self.__class__(self.hr + other.hr, self.min...
class Time60(object): """Time60 - track hours and minutes""" def __init__(self, hr, min): self.hr = hr self.min = min def __str__(self): return '%d:%d' % (self.hr, self.min) __repr__ = __str__ def __add__(self, other): return self.__class__(self.hr + other.hr, self...
# internal flags TRANS_FLIPX = 1 TRANS_FLIPY = 2 TRANS_ROT = 4 # Tiled gid flags GID_TRANS_FLIPX = 1 << 31 GID_TRANS_FLIPY = 1 << 30 GID_TRANS_ROT = 1 << 29
trans_flipx = 1 trans_flipy = 2 trans_rot = 4 gid_trans_flipx = 1 << 31 gid_trans_flipy = 1 << 30 gid_trans_rot = 1 << 29
INSTALLED_APPS += ( "django_mailbox", # "social", 'reversion', # "social_django", 'django_outlook', )
installed_apps += ('django_mailbox', 'reversion', 'django_outlook')
#Cleansing #remove urls, usernames, NA, special charactars, and numbers class TwitterCleanuper: def iterate(self): for cleanup_method in [self.remove_urls, self.remove_usernames, self.remove_na, self.remove_specia...
class Twittercleanuper: def iterate(self): for cleanup_method in [self.remove_urls, self.remove_usernames, self.remove_na, self.remove_special_chars, self.remove_numbers]: yield cleanup_method def remove_by_regex(tweets, regexp): tweets.loc[:, 'text'].replace(regexp, '', inplace=Tr...
def get_right(pat, r=256): right = [-1] * r for i in range(len(pat)): right[ord(pat[i])] = i return right def boyemoore_search(txt, pat): right = get_right(pat) skip = 0 i = 0 while i <= len(txt) - len(pat): skip = 0 j = len(pat) - 1 while j >=...
def get_right(pat, r=256): right = [-1] * r for i in range(len(pat)): right[ord(pat[i])] = i return right def boyemoore_search(txt, pat): right = get_right(pat) skip = 0 i = 0 while i <= len(txt) - len(pat): skip = 0 j = len(pat) - 1 while j >= 0: ...
def validate_empty(field, name=None): if not field: raise ValueError('This field is Required.') if name and not field: raise validate_empty('{} is Required'.format(name))
def validate_empty(field, name=None): if not field: raise value_error('This field is Required.') if name and (not field): raise validate_empty('{} is Required'.format(name))
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'chromium', 'chromium_android', 'recipe_engine/json', 'recipe_engine/properties', ] def RunSteps(api): api.chromium.set_config('chromium...
deps = ['chromium', 'chromium_android', 'recipe_engine/json', 'recipe_engine/properties'] def run_steps(api): api.chromium.set_config('chromium') api.chromium_android.set_config('main_builder') api.chromium_android.run_sharded_perf_tests(config=api.json.input({'steps': {}, 'version': 1}), max_battery_temp=...
# coded in python3 # video : text = input("Enter your text : ") check = True etext = "" for chars in text: if(ord(chars)) <= 90 and ord(chars) <= 65: if((ord(chars) + 13) > 90): x = 64 + ((ord(chars) + 13) - 90) else: x = ord(chars) + 13 elif(ord(chars) <= 122 and o...
text = input('Enter your text : ') check = True etext = '' for chars in text: if ord(chars) <= 90 and ord(chars) <= 65: if ord(chars) + 13 > 90: x = 64 + (ord(chars) + 13 - 90) else: x = ord(chars) + 13 elif ord(chars) <= 122 and ord(chars) >= 97: if ord(chars) + ...
a = [74,-72,94,-53,-59,-3,-66,36,-13,22,73,15,-52,75] def maxSubArraySum(a): current_sequence = 0 best_sequence = a[0] for x in a: current_sequence = max(x,current_sequence+x) best_sequence = max(best_sequence,current_sequence) return best_sequence print("Largest sum con...
a = [74, -72, 94, -53, -59, -3, -66, 36, -13, 22, 73, 15, -52, 75] def max_sub_array_sum(a): current_sequence = 0 best_sequence = a[0] for x in a: current_sequence = max(x, current_sequence + x) best_sequence = max(best_sequence, current_sequence) return best_sequence print('Largest sum...
class Pic16f15356DeviceInformationArea: def __init__(self, address, dia): if len(dia) != 32: raise ValueError('dia', f'PIC16F15356 DIA is 32 words but received {len(dia)} words') self._address = address self._raw = dia.copy() self._device_id = ''.join(['{:04x}'.format(id_byte) for id_byte in dia[0x00:0x09]...
class Pic16F15356Deviceinformationarea: def __init__(self, address, dia): if len(dia) != 32: raise value_error('dia', f'PIC16F15356 DIA is 32 words but received {len(dia)} words') self._address = address self._raw = dia.copy() self._device_id = ''.join(['{:04x}'.format(i...
arduino = Runtime.createAndStart("arduino","Arduino") arduino.setBoardMega() arduino.connect("COM7") arduino1 = Runtime.createAndStart("arduino1","Arduino") arduino1.setBoardNano() #connecting arduino1 to arduino Serial1 instead to a COMX arduino1.connect(arduino,"Serial1") servo = Runtime.createAndStart("servo","Se...
arduino = Runtime.createAndStart('arduino', 'Arduino') arduino.setBoardMega() arduino.connect('COM7') arduino1 = Runtime.createAndStart('arduino1', 'Arduino') arduino1.setBoardNano() arduino1.connect(arduino, 'Serial1') servo = Runtime.createAndStart('servo', 'Servo') servo.attach(arduino1, 5) sleep(1) servo.moveTo(90)
# Copyright (c) 2015 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
class Dashboardapiconfig(object): dashboard_api_version = 'v1' dashboard_call_auth_token = dashboard_api_version + '/api/auth/token' class Gearpumpapiconfig(object): version = 'v1.0' prefix = '/api/' + version prefix_master = prefix + '/master/' call_login = '/login' call_submit = prefix_ma...
##Patterns: W0199 assert (1 == 1, 2 == 2), "no error" ##Warn: W0199 assert (1 == 1, 2 == 2) assert 1 == 1, "no error" assert (1 == 1,), "no error" assert (1 == 1,) assert (1 == 1, 2 == 2, 3 == 5), "no error" assert () ##Warn: W0199 assert (True, 'error msg')
assert (1 == 1, 2 == 2), 'no error' assert (1 == 1, 2 == 2) assert 1 == 1, 'no error' assert (1 == 1,), 'no error' assert (1 == 1,) assert (1 == 1, 2 == 2, 3 == 5), 'no error' assert () assert (True, 'error msg')
class Parameters(object): def __init__(self, *, p, q, g): if isinstance(p, bytes): p = int.from_bytes(p, 'big') self.p = p if isinstance(q, bytes): q = int.from_bytes(q, 'big') self.q = q if isinstance(g, bytes): g = int.from_bytes(g, 'bi...
class Parameters(object): def __init__(self, *, p, q, g): if isinstance(p, bytes): p = int.from_bytes(p, 'big') self.p = p if isinstance(q, bytes): q = int.from_bytes(q, 'big') self.q = q if isinstance(g, bytes): g = int.from_bytes(g, 'big...
############################################## ## CONFIG BLOCK ## ############################################## # @string token - API Token # @string user - This is found in Zendesk under Admin > Channels > API, Commonly your login_email/token # @list user_defined_list - List of emails comm...
token = 'TOKEN' user = 'APIUSER/token' user_defined_list = ['useremail@company.com', 'useremail2@company.com'] admin_email = 'user@email.com' default_days = 7 from_addr = 'user@company.com' smtp_server = 'mail.server.net' email_pass = 'password'
# define the time range we are interested in end_time = datetime(2017, 9, 12, 0) start_time = end_time - timedelta(days=2) # build the query query = ncss.query() query.lonlat_point(-155.1, 19.7) query.time_range(start_time, end_time) query.variables('altimeter_setting', 'temperature', 'dewpoint', 'wind...
end_time = datetime(2017, 9, 12, 0) start_time = end_time - timedelta(days=2) query = ncss.query() query.lonlat_point(-155.1, 19.7) query.time_range(start_time, end_time) query.variables('altimeter_setting', 'temperature', 'dewpoint', 'wind_direction', 'wind_speed') query.accept('csv') data = ncss.get_data(query) df = ...
# -*- coding: utf-8 -*- class Announce: def __init__(self, data=None): self.guild_id: str = "" self.channel_id: str = "" self.message_id: str = "" if data: self.__dict__ = data class CreateAnnounceRequest: def __init__(self, channel_id: str, message_id: str): ...
class Announce: def __init__(self, data=None): self.guild_id: str = '' self.channel_id: str = '' self.message_id: str = '' if data: self.__dict__ = data class Createannouncerequest: def __init__(self, channel_id: str, message_id: str): self.channel_id = cha...
__all__ = ['class_in_class_factory'] def class_in_class_factory(parent_class, name, bases=None, **fields): if not (isinstance(bases, tuple) or bases is None): raise TypeError('`bases` must be tuple.') fields['__module__'] = '{parent_class_module_name}.{parent_class_name}'.format( parent_class...
__all__ = ['class_in_class_factory'] def class_in_class_factory(parent_class, name, bases=None, **fields): if not (isinstance(bases, tuple) or bases is None): raise type_error('`bases` must be tuple.') fields['__module__'] = '{parent_class_module_name}.{parent_class_name}'.format(parent_class_module_na...
class Tree(object): def __init__(self, x): self.value = x self.left = None self.right = None def balancedBinaryTree(root): def get_height(root): if root is None: return 0 return max(get_height(root.left), get_height(root.right)) + 1 if root is None: ...
class Tree(object): def __init__(self, x): self.value = x self.left = None self.right = None def balanced_binary_tree(root): def get_height(root): if root is None: return 0 return max(get_height(root.left), get_height(root.right)) + 1 if root is None: ...
#Project Euler Question 54 #Poker hands poker_file = open(r"C:\Users\Clayton\Documents\Python Other Files\p054_poker.txt") content = poker_file.read() content = content.replace(" ", "") content = content.split("\n") card_values = {"2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "T": 10, "J": 11, "Q": ...
poker_file = open('C:\\Users\\Clayton\\Documents\\Python Other Files\\p054_poker.txt') content = poker_file.read() content = content.replace(' ', '') content = content.split('\n') card_values = {'2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, 'T': 10, 'J': 11, 'Q': 12, 'K': 13, 'A': 14} def royal_flush...
def did_from_credential_definition_id(credential_definition_id: str) -> str: parts = credential_definition_id.split(":") return parts[0]
def did_from_credential_definition_id(credential_definition_id: str) -> str: parts = credential_definition_id.split(':') return parts[0]
def solve_knapsack(profits, weights, capacity): n = len(profits) if capacity <= 0 or n == 0 or len(weights) != n: # basic checks return 0 # We only need one previous row to find the optimal solution, # Overall we need '2' rows, the solution is similar to the previous solution, the only differe...
def solve_knapsack(profits, weights, capacity): n = len(profits) if capacity <= 0 or n == 0 or len(weights) != n: return 0 dp = [[0 for x in range(capacity + 1)] for y in range(2)] for c in range(0, capacity + 1): if weights[0] <= c: dp[0][c] = dp[1][c] = profits[0] for i...
# Parent class 1 class Person: def person_info(self, name, age): print('Inside Person class') print('Name:', name, 'Age:', age) # Parent class 2 class Company: def company_info(self, company_name, location): print('Inside Company class') print('Name:', company_name, 'location:'...
class Person: def person_info(self, name, age): print('Inside Person class') print('Name:', name, 'Age:', age) class Company: def company_info(self, company_name, location): print('Inside Company class') print('Name:', company_name, 'location:', location) class Employee(Perso...
BINDIR = '/usr/local/bin' BLOCK_MESSAGE_KEYS = [] BUILD_TYPE = 'app' BUNDLE_NAME = 'pebble-World-Cup.pbw' DEFINES = ['RELEASE'] LIBDIR = '/usr/local/lib' LIB_DIR = 'node_modules' MESSAGE_KEYS = {} MESSAGE_KEYS_HEADER = '/root/hello-pebblejs/pebble-World-Cup/build/include/message_keys.auto.h' NODE_PATH = '/root/.pebble-...
bindir = '/usr/local/bin' block_message_keys = [] build_type = 'app' bundle_name = 'pebble-World-Cup.pbw' defines = ['RELEASE'] libdir = '/usr/local/lib' lib_dir = 'node_modules' message_keys = {} message_keys_header = '/root/hello-pebblejs/pebble-World-Cup/build/include/message_keys.auto.h' node_path = '/root/.pebble-...
# -*- coding: utf-8 -*- __author__ = 'viruzzz-kun' class OptionsFinish(Exception): pass
__author__ = 'viruzzz-kun' class Optionsfinish(Exception): pass
cube = lambda x: pow(x,3) def fibonacci(n): if n >= 0: lst = [0] if n >= 1: lst.append(1) if n >= 2: for i in range(2,n+1): lst.append(lst[-1]+ lst[-2]) return lst[:n] if __name__ == '__main__': n = int(input()) print(list(map(cube, fibonacci(n))))
cube = lambda x: pow(x, 3) def fibonacci(n): if n >= 0: lst = [0] if n >= 1: lst.append(1) if n >= 2: for i in range(2, n + 1): lst.append(lst[-1] + lst[-2]) return lst[:n] if __name__ == '__main__': n = int(input()) print(list(map(cube, fibonacci(n))))
def wire(data): x, y = (0, 0) for dir, step in [(x[0], int(x[1:])) for x in data.split(",")]: for _ in range(step): x += -1 if dir == "L" else 1 if dir == "R" else 0 y += -1 if dir == "D" else 1 if dir == "U" else 0 yield x, y def aoc(data): wires = [set(wire(li...
def wire(data): (x, y) = (0, 0) for (dir, step) in [(x[0], int(x[1:])) for x in data.split(',')]: for _ in range(step): x += -1 if dir == 'L' else 1 if dir == 'R' else 0 y += -1 if dir == 'D' else 1 if dir == 'U' else 0 yield (x, y) def aoc(data): wires = [set(wi...
def find_tree(row, index): if index > len(row): row = row * ((index // len(row)) + 1) if row[index] == '#': return 1 return 0 if __name__ == '__main__': with open('input.txt') as f: data = [r.strip() for r in f.readlines()] indices = range(0, len(data) * 3, 3) tree_cou...
def find_tree(row, index): if index > len(row): row = row * (index // len(row) + 1) if row[index] == '#': return 1 return 0 if __name__ == '__main__': with open('input.txt') as f: data = [r.strip() for r in f.readlines()] indices = range(0, len(data) * 3, 3) tree_count = ...
class BufferToLines(object): def __init__(self): self._acc_buff = "" self._last_line = "" self._in_middle_of_line = False def add(self, buff): self._acc_buff += buff.decode() self._in_middle_of_line = False if self._acc_buff[-1] == '\n' else True def lines(self): ...
class Buffertolines(object): def __init__(self): self._acc_buff = '' self._last_line = '' self._in_middle_of_line = False def add(self, buff): self._acc_buff += buff.decode() self._in_middle_of_line = False if self._acc_buff[-1] == '\n' else True def lines(self): ...
GET_ACTION_LIST = 'get_action_list' EXECUTE_ACTION = 'execute_action' GET_FIELD_OPTIONS = 'get_field_options' GET_ELEMENT_STATUS = 'get_element_status' message_handlers = {} def add_handler(message_name, func): message_handlers[message_name] = func def get_handler(message_name): return message_handlers.ge...
get_action_list = 'get_action_list' execute_action = 'execute_action' get_field_options = 'get_field_options' get_element_status = 'get_element_status' message_handlers = {} def add_handler(message_name, func): message_handlers[message_name] = func def get_handler(message_name): return message_handlers.get(me...
# Write a program that asks the number of kilometers a car has driven and the number of days it has been hired. # Calculate the price to pay, knowing that the car costs US$ 60 per day and US$ 0.15 per km driven. k = float(input('Enter how many kilometers the car has traveled: ')) d = float(input('Enter how many days t...
k = float(input('Enter how many kilometers the car has traveled: ')) d = float(input('Enter how many days the car has been rented: ')) t = k * 0.15 + d * 60 print('The total rental of the car is {}US${:.2f}{}'.format('\x1b[1;31;40m', t, '\x1b[m'))
class BaseMemory(object): def __init__(self, max_num=20000, key_num=2000, sampling_policy='random', updating_policy='random', ): super(BaseMemory, self).__init__() self.max_num = max_num self.key_num = key_num self.s...
class Basememory(object): def __init__(self, max_num=20000, key_num=2000, sampling_policy='random', updating_policy='random'): super(BaseMemory, self).__init__() self.max_num = max_num self.key_num = key_num self.sampling_policy = sampling_policy self.updating_policy = updat...
commands = input().split(" ") my_list = [] team_a_count = 11 team_b_count = 11 condition = False for i in commands: if i not in my_list: my_list.append(i) if "A" in i: team_a_count -= 1 if "B" in i: team_b_count -= 1 if team_a_count < 7 or team_b_count < 7: ...
commands = input().split(' ') my_list = [] team_a_count = 11 team_b_count = 11 condition = False for i in commands: if i not in my_list: my_list.append(i) if 'A' in i: team_a_count -= 1 if 'B' in i: team_b_count -= 1 if team_a_count < 7 or team_b_count < 7: ...
class ActivePlan(object): def __init__(self, join_observer_list, on_next, on_completed): self.join_observer_list = join_observer_list self.on_next = on_next self.on_completed = on_completed self.join_observers = {} for join_observer in self.join_observer_list: sel...
class Activeplan(object): def __init__(self, join_observer_list, on_next, on_completed): self.join_observer_list = join_observer_list self.on_next = on_next self.on_completed = on_completed self.join_observers = {} for join_observer in self.join_observer_list: se...
COINS = ( (25, 'Quarters'), (10, 'Dimes'), (5, 'Nickels'), (1, 'Pennies') ) def loose_change(cents): change = {'Pennies': 0, 'Nickels': 0, 'Dimes': 0, 'Quarters': 0} cents = int(cents) if cents <= 0: return change for coin_value, coin_name in COINS: q, r = divmod(cents,...
coins = ((25, 'Quarters'), (10, 'Dimes'), (5, 'Nickels'), (1, 'Pennies')) def loose_change(cents): change = {'Pennies': 0, 'Nickels': 0, 'Dimes': 0, 'Quarters': 0} cents = int(cents) if cents <= 0: return change for (coin_value, coin_name) in COINS: (q, r) = divmod(cents, coin_value) ...
'''input 97 89 20000 25899 10 5 8 10 97 89 8634 17266 97 89 8633 8633 100 100 101 200 1 1 1 1 1 1 20000 20000 100 100 20000 20000 12 8 25 48 2 3 8 12 2 2 2 2 ''' # -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem A if __name__ == '__...
"""input 97 89 20000 25899 10 5 8 10 97 89 8634 17266 97 89 8633 8633 100 100 101 200 1 1 1 1 1 1 20000 20000 100 100 20000 20000 12 8 25 48 2 3 8 12 2 2 2 2 """ if __name__ == '__main__': a = int(input()) b = int(input()) n = int(input()) for i in range(n, 30000 + 1): if i % a == 0 a...
def count_largest_group(n: int) -> int: hash_ = {} for i in range(1, n + 1): num = i count = 0 while num >= 10: count += num % 10 num //= 10 count += num if count in hash_: hash_[count] += 1 else: has...
def count_largest_group(n: int) -> int: hash_ = {} for i in range(1, n + 1): num = i count = 0 while num >= 10: count += num % 10 num //= 10 count += num if count in hash_: hash_[count] += 1 else: hash_[count] = 1 ...
#Accept a list of words and return length of longest word. def long_word(word_list): word_len=[] for word in word_list: word_len.append((len(word),word)) word_len.sort() return word_len[-1][0], word_len[-1][1] word=long_word(["hai","everyone","bye"]) print("\nThe longest word is: ",wor...
def long_word(word_list): word_len = [] for word in word_list: word_len.append((len(word), word)) word_len.sort() return (word_len[-1][0], word_len[-1][1]) word = long_word(['hai', 'everyone', 'bye']) print('\nThe longest word is: ', word[1]) print("\nand the length of '", word[1], "' is: ", wor...
# 5-5 Problems print(all([1, 2, abs(-3)-3])) print(chr(ord('a')) == 'a') x = [1, -2, 3, -5, 8, -3] print(list(filter(lambda val: val > 0, x))) x = hex(234) print(int(x, 16)) x = [1, 2, 3, 4] print(list(map(lambda a: a * 3, x))) x = [-8, 2, 7, 5, -3, 5, 0, 1] print(max(x) + min(x)) x = 17 / 3 pri...
print(all([1, 2, abs(-3) - 3])) print(chr(ord('a')) == 'a') x = [1, -2, 3, -5, 8, -3] print(list(filter(lambda val: val > 0, x))) x = hex(234) print(int(x, 16)) x = [1, 2, 3, 4] print(list(map(lambda a: a * 3, x))) x = [-8, 2, 7, 5, -3, 5, 0, 1] print(max(x) + min(x)) x = 17 / 3 print(round(x, 4))
def get_max_profits(stock_prices): if len(stock_prices) < 2: raise ValueError("Getting a profit requires at least two prices") min_price = stock_prices[0] max_profit = stock_prices[1] - stock_prices[0] for current_time in range(1, len(stock_prices)): print(current_time, "currenttime") ...
def get_max_profits(stock_prices): if len(stock_prices) < 2: raise value_error('Getting a profit requires at least two prices') min_price = stock_prices[0] max_profit = stock_prices[1] - stock_prices[0] for current_time in range(1, len(stock_prices)): print(current_time, 'currenttime') ...
# https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher PLAINTEXT = 'ATTACKATDAWN' KEY = 'LEMON' def vigenere_cipher_func(key, message): message = message.lower() key = key.lower() cipher_message = '' key_value = 0 for char in message: if ord(char) >= 97 and ord(char) < 134: mi...
plaintext = 'ATTACKATDAWN' key = 'LEMON' def vigenere_cipher_func(key, message): message = message.lower() key = key.lower() cipher_message = '' key_value = 0 for char in message: if ord(char) >= 97 and ord(char) < 134: mi = ord(char) - 97 ki = ord(key[key_value % le...
# # PySNMP MIB module SVRNTCLU-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SVRNTCLU-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:04:39 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,...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, value_size_constraint, constraints_intersection) ...
def iteritems(dictonary): pass class StringIO(object): pass
def iteritems(dictonary): pass class Stringio(object): pass
r= int(input()) pi= 3.14159 sphere= (4/3)* pi* pow(r,3) print("VOLUME = %.3f" %sphere)
r = int(input()) pi = 3.14159 sphere = 4 / 3 * pi * pow(r, 3) print('VOLUME = %.3f' % sphere)
class CoreConstraintConstants: core_constraint_slots = ( "table", "constraint_name", "constraint_definition", "UNIQUE", "PRIMARY_KEY", "FOREIGN_KEY", "REFERENCES", "CHECK", "DEFAULT", "FOR" ) core_constraint_default_values = { "table": None, "constraint_name": None, ...
class Coreconstraintconstants: core_constraint_slots = ('table', 'constraint_name', 'constraint_definition', 'UNIQUE', 'PRIMARY_KEY', 'FOREIGN_KEY', 'REFERENCES', 'CHECK', 'DEFAULT', 'FOR') core_constraint_default_values = {'table': None, 'constraint_name': None, 'constraint_definition': '', 'UNIQUE': (), 'PRIM...
# -*- coding: utf-8 -*- COMMIT_AUTHOR_NAME = 'Mimiron' COMMIT_AUTHOR_EMAIL = ''
commit_author_name = 'Mimiron' commit_author_email = ''
# # PySNMP MIB module IP-FORWARD-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/IP-FORWARD-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:17:45 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, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) ...
# Declare any variables (as constants) that are or could be used anywhere in the application # TODO: Determine what a good fingerprint length is FINGERPRINT_LENGTH = 40
fingerprint_length = 40
def multi(a,b): return a*b if __name__ == '__main__': print(multi(2,3))
def multi(a, b): return a * b if __name__ == '__main__': print(multi(2, 3))
class LayerShape: def __init__(self, *dims): self.dims = dims if len(dims) == 1: self.channels = dims[0] elif len(dims) == 2: self.channels = dims[0] self.height = dims[1] elif len(dims) == 3: self.channels = dims[0] self.he...
class Layershape: def __init__(self, *dims): self.dims = dims if len(dims) == 1: self.channels = dims[0] elif len(dims) == 2: self.channels = dims[0] self.height = dims[1] elif len(dims) == 3: self.channels = dims[0] self.h...
# Time: O(Log n) We performed a Binary Search # Space: O(1) class Solution: def findMin(self, nums): if len(nums) == 1: return nums[0] left = 0 right = len(nums) - 1 if nums[0] < nums[right]: return nums[0] while left <= right: m...
class Solution: def find_min(self, nums): if len(nums) == 1: return nums[0] left = 0 right = len(nums) - 1 if nums[0] < nums[right]: return nums[0] while left <= right: mid = (right + left) // 2 mid_val = nums[mid] ...
def foo_task(): print('Foo task is running...') print('Foo task completed.') return True def sum_task(arg_1: int, arg_2: int): print('Sum task is running...') result = arg_1 + arg_2 print('Sum task completed.') return result
def foo_task(): print('Foo task is running...') print('Foo task completed.') return True def sum_task(arg_1: int, arg_2: int): print('Sum task is running...') result = arg_1 + arg_2 print('Sum task completed.') return result
#!/usr/bin/env python3 # Tax calculator # This program currently # only works with the hungarian tax def calcTax(cost, country='hungary'): countries = {'hungary' : 27} if country in countries.keys(): tax = (cost / 100) * countries[country] else: return "Country can't be found" retur...
def calc_tax(cost, country='hungary'): countries = {'hungary': 27} if country in countries.keys(): tax = cost / 100 * countries[country] else: return "Country can't be found" return tax def main(): tax = calc_tax(int(input('What was the cost of your purchase? ')), input('Which count...
''' Details about this Python package. ''' __version__ = '1.1.0' __title__ = 'example-python' __author__ = 'Mahathir Almashor' __author_email__ = 'mahathir.almashor@data61.csiro.au' __description__ = 'Example Python repository for Cyber Security Cooperative Research Centre' __url__ = 'https://github.com/ma-al/example-...
""" Details about this Python package. """ __version__ = '1.1.0' __title__ = 'example-python' __author__ = 'Mahathir Almashor' __author_email__ = 'mahathir.almashor@data61.csiro.au' __description__ = 'Example Python repository for Cyber Security Cooperative Research Centre' __url__ = 'https://github.com/ma-al/example-p...
with open("day13.in") as f: lines = f.read().splitlines() dots = set() for i, line in enumerate(lines): if line == "": break x, y = line.split(",") dots.add((int(x), int(y))) # folds for line in lines[i+1:]: _, _, fold = line.split(" ") axis, num = fold.split("=") num = int(num...
with open('day13.in') as f: lines = f.read().splitlines() dots = set() for (i, line) in enumerate(lines): if line == '': break (x, y) = line.split(',') dots.add((int(x), int(y))) for line in lines[i + 1:]: (_, _, fold) = line.split(' ') (axis, num) = fold.split('=') num = int(num) ...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( num ) : series = [ 1 , 3 , 2 , - 1 , - 3 , - 2 ] ; series_index = 0 ; result = 0 ; for i in range (...
def f_gold(num): series = [1, 3, 2, -1, -3, -2] series_index = 0 result = 0 for i in range(len(num) - 1, -1, -1): digit = ord(num[i]) - 48 result += digit * series[series_index] series_index = (series_index + 1) % 6 result %= 7 if result < 0: result = (result ...
VALUE_INITIALIZED = 0 def test_owner_address(box, accounts): # verify that accounts[0] is contract owner assert accounts[0].address == box.owner() def test_value_after_contract_creation(box, accounts): # verify initialized value of box assert VALUE_INITIALIZED == box.retrieve()
value_initialized = 0 def test_owner_address(box, accounts): assert accounts[0].address == box.owner() def test_value_after_contract_creation(box, accounts): assert VALUE_INITIALIZED == box.retrieve()
# This file creates custom rules to make tests can easily run under # certain environment(like inside a docker). # # For example: # # run_under_test( # name = "test_under_docker", # under = "//tools/docker:zookeper", # command = "//sometest", # data = [ # ], # args = [ # "--gtest_filter=abc", # ] # ) ...
def _run_under_impl(ctx): bin_dir = ctx.configuration.bin_dir build_directory = str(bin_dir)[:-len('[derived]')] + '/' under = ctx.executable.under under_args = ctx.attr.under_args command = ctx.executable.command exe = ctx.outputs.executable ctx.file_action(output=exe, content='#!/bin/bash\...
# x = n^2 + an + b; |a| < 1000 and |b| < 1000 # b has to be odd, positive and prime as we are testing consecutive values for n # a has to be negative otherwise the difference between consecutive x's will be huge! def is_prime(num) : if (num <= 1) : return False if (num <= 3) : return True...
def is_prime(num): if num <= 1: return False if num <= 3: return True if num % 2 == 0 or num % 3 == 0: return False i = 5 while i * i <= num: if num % i == 0 or num % (i + 2) == 0: return False i = i + 6 return True def max_prod(max_val_a, max...
if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) nlist = [[i,j,k] for i in range(0, x+1) for j in range(0, y+1) for k in range(0, z+1) if (i+j+k) > n or (i+j+k)< n] print(nlist)
if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) nlist = [[i, j, k] for i in range(0, x + 1) for j in range(0, y + 1) for k in range(0, z + 1) if i + j + k > n or i + j + k < n] print(nlist)
##Collect data: ''' #SMI: 2021/10/30 SAF: 308214 Standard Beamline 12-ID proposal: (CFN, 307961) create proposal: proposal_id( '2021_3', '307961_Dinca' ) #create the proposal id and folder %run -i /home/xf12id/.ipython/profile_collection/startup/users/30-user-Dinca2021C2B.py RE( shopen() ) # to...
""" #SMI: 2021/10/30 SAF: 308214 Standard Beamline 12-ID proposal: (CFN, 307961) create proposal: proposal_id( '2021_3', '307961_Dinca' ) #create the proposal id and folder %run -i /home/xf12id/.ipython/profile_collection/startup/users/30-user-Dinca2021C2B.py RE( shopen() ) # to open the beam and...
class Arithmetic: def __init__(self): self.value1 = 0 self.value2 = 0 def Accept(self, no1, no2): self.value1 = no1 self.value2 = no2 def Addition(self): result = self.value1 + self.value2 print("Addition is = ", result) def Subtraction(sel...
class Arithmetic: def __init__(self): self.value1 = 0 self.value2 = 0 def accept(self, no1, no2): self.value1 = no1 self.value2 = no2 def addition(self): result = self.value1 + self.value2 print('Addition is = ', result) def subtraction(self): ...
class Config(object) : #DETECTRON_URL = 'http://localhost/predictions' DETECTRON_URL = 'https://master-ainized-detectron2-gkswjdzz.endpoint.ainize.ai/predictions' #STANFORDNLP_URL = 'http://localhost:81/analyze' STANFORDNLP_URL = 'https://master-ainized-stanfordnlp-gkswjdzz.endpoint.ainize.ai/analyze'
class Config(object): detectron_url = 'https://master-ainized-detectron2-gkswjdzz.endpoint.ainize.ai/predictions' stanfordnlp_url = 'https://master-ainized-stanfordnlp-gkswjdzz.endpoint.ainize.ai/analyze'
# -*- coding: utf-8 -*- # AtCoder Beginner Contest def main(): n, a, b = list(map(int, input().split())) position = 0 for i in range(n): s, d = list(map(str, input().split())) if int(d) < a: d = a elif int(d) > b: d = b else: d = d ...
def main(): (n, a, b) = list(map(int, input().split())) position = 0 for i in range(n): (s, d) = list(map(str, input().split())) if int(d) < a: d = a elif int(d) > b: d = b else: d = d if s == 'West': d = -1 * int(d) ...
class CFG: # Disease: _TARGET_R0 = 1.4 # before Test and Trace and Isolation DAYS_BEFORE_INFECTIOUS = 4 # t0 DAYS_INFECTIOUS_TO_SYMPTOMS = 2 # t1 DAYS_OF_SYMPTOMS = 5 # t2 PROB_SYMPTOMATIC = 0.6 # pS probability that an infected person develops actionable symptoms ...
class Cfg: _target_r0 = 1.4 days_before_infectious = 4 days_infectious_to_symptoms = 2 days_of_symptoms = 5 prob_symptomatic = 0.6 prob_isolate_if_symptoms = 0.75 prob_isolate_if_traced = 0.3 prob_isolate_if_testpos = 0.3 prob_get_test_if_traced = 0.75 prob_apply_for_test_if_symp...
getMappingUsageMetrics = [ { "names": [ "TotalBandwidth", "TotalHits", "HitRatio" ], "totals": [ "0.0", "0", "0.0" ], "type": "TOTALS" } ]
get_mapping_usage_metrics = [{'names': ['TotalBandwidth', 'TotalHits', 'HitRatio'], 'totals': ['0.0', '0', '0.0'], 'type': 'TOTALS'}]
class Solution: def reverse(self, x: int) -> int: l = 0 val = 0 flag = 1 if x == 0: return x else: if x>0: val = x l = len(str(val)) else: val = -1*x l = len(str(val)) ...
class Solution: def reverse(self, x: int) -> int: l = 0 val = 0 flag = 1 if x == 0: return x else: if x > 0: val = x l = len(str(val)) else: val = -1 * x l = len(str(val)) ...
class Solution: def oddCells(self, n: int, m: int, indices: list) -> int: row_operation = [False] * n col_operation = [False] * m for index in indices: row_id, col_id = index row_operation[row_id] = not row_operation[row_id] col_operation[col_id] = not co...
class Solution: def odd_cells(self, n: int, m: int, indices: list) -> int: row_operation = [False] * n col_operation = [False] * m for index in indices: (row_id, col_id) = index row_operation[row_id] = not row_operation[row_id] col_operation[col_id] = not...
print("Premier programme") nom = input("Donnez votre nom : ") print("Bonjour %s, comment vas-tu? " % nom)
print('Premier programme') nom = input('Donnez votre nom : ') print('Bonjour %s, comment vas-tu? ' % nom)
def read_data(filename="data/input1.data"): with open(filename) as f: return f.read() def rot(l, i): offset = len(l) // 2 pos = (i+offset) % len(l) return l[pos] if l[pos] == l[i] else 0 if __name__ == "__main__": captcha = [int(x) for x in read_data()] captcha.append(captcha[0]) ...
def read_data(filename='data/input1.data'): with open(filename) as f: return f.read() def rot(l, i): offset = len(l) // 2 pos = (i + offset) % len(l) return l[pos] if l[pos] == l[i] else 0 if __name__ == '__main__': captcha = [int(x) for x in read_data()] captcha.append(captcha[0]) ...
#################### version 1 ################################################# a = list(range(10)) # print(a, id(a)) res_1 = list(a) # print(res_1, id(res_1)) for i in a: if i in (3, 5): print(">>>", i, id(i)) res_1 = list(filter(lambda x: x != i, res_1)) # print(type(res_1), id(res_1))...
a = list(range(10)) res_1 = list(a) for i in a: if i in (3, 5): print('>>>', i, id(i)) res_1 = list(filter(lambda x: x != i, res_1)) print(list(res_1)) b = list(range(10)) res_2 = list(b) for i in b: if i in {3, 5}: print('>>>', i, id(i)) res_2 = filter(lambda x: x != i, res_2) ...
def add_native_methods(clazz): def initPbuffer__long__long__boolean__int__int__(a0, a1, a2, a3, a4, a5): raise NotImplementedError() clazz.initPbuffer__long__long__boolean__int__int__ = initPbuffer__long__long__boolean__int__int__
def add_native_methods(clazz): def init_pbuffer__long__long__boolean__int__int__(a0, a1, a2, a3, a4, a5): raise not_implemented_error() clazz.initPbuffer__long__long__boolean__int__int__ = initPbuffer__long__long__boolean__int__int__
class CompressString(object): def compress(self, string): if string is None or not string: return string result = '' prev_char = string[0] count = 0 for char in string: if char == prev_char: count += 1 else: ...
class Compressstring(object): def compress(self, string): if string is None or not string: return string result = '' prev_char = string[0] count = 0 for char in string: if char == prev_char: count += 1 else: ...
def solution(a): answer = 0 left_min = 1000000001 left_zero = [] reverse_a = a[::-1] right_zero = [] right_min = 1000000001 for i in range(len(a)): left_min = min(a[i], left_min) if left_min == a[i]: left_zero.append(1) else: left_zero.append...
def solution(a): answer = 0 left_min = 1000000001 left_zero = [] reverse_a = a[::-1] right_zero = [] right_min = 1000000001 for i in range(len(a)): left_min = min(a[i], left_min) if left_min == a[i]: left_zero.append(1) else: left_zero.append(0...
data = ( ((-0.195090, 0.980785), (0.000000, 1.000000)), ((-0.382683, 0.923880), (-0.195090, 0.980785)), ((-0.555570, 0.831470), (-0.382683, 0.923880)), ((-0.707107, 0.707107), (-0.555570, 0.831470)), ((-0.831470, 0.555570), (-0.707107, 0.707107)), ((-0.923880, 0.382683), (-0.831470, 0.555570)), ((-0.980785, 0.195090), ...
data = (((-0.19509, 0.980785), (0.0, 1.0)), ((-0.382683, 0.92388), (-0.19509, 0.980785)), ((-0.55557, 0.83147), (-0.382683, 0.92388)), ((-0.707107, 0.707107), (-0.55557, 0.83147)), ((-0.83147, 0.55557), (-0.707107, 0.707107)), ((-0.92388, 0.382683), (-0.83147, 0.55557)), ((-0.980785, 0.19509), (-0.92388, 0.382683)), ((...
sum = float(input()) counter_of_coins = 0 sum = int(sum*100) counter_of_coins += sum // 200 sum = sum % 200 counter_of_coins += sum // 100 sum = sum % 100 counter_of_coins += sum // 50 sum = sum % 50 counter_of_coins += sum // 20 sum = sum % 20 counter_of_coins += sum // 10 sum = sum % 10 counter_of_coins += sum // 5 ...
sum = float(input()) counter_of_coins = 0 sum = int(sum * 100) counter_of_coins += sum // 200 sum = sum % 200 counter_of_coins += sum // 100 sum = sum % 100 counter_of_coins += sum // 50 sum = sum % 50 counter_of_coins += sum // 20 sum = sum % 20 counter_of_coins += sum // 10 sum = sum % 10 counter_of_coins += sum // 5...
def validate_string(s): is_alpha_numeric = False is_alpha = False is_digits = False is_lowercase = False is_uppercase = False for letter in s: if letter.isalnum(): is_alpha_numeric = True if letter.isalpha(): is_alpha = True if letter.isdigit():...
def validate_string(s): is_alpha_numeric = False is_alpha = False is_digits = False is_lowercase = False is_uppercase = False for letter in s: if letter.isalnum(): is_alpha_numeric = True if letter.isalpha(): is_alpha = True if letter.isdigit(): ...
class TestScheduleJobFileData: test_job_connection = { "Name": "TestIntegrationConnection", "ConnectorTypeName": "POSTGRESQL", "Host": "localhost", "Port": 5432, "Sid": "", "DatabaseName": "test_pdi_integration", "User": "postgres", "Password": "123456...
class Testschedulejobfiledata: test_job_connection = {'Name': 'TestIntegrationConnection', 'ConnectorTypeName': 'POSTGRESQL', 'Host': 'localhost', 'Port': 5432, 'Sid': '', 'DatabaseName': 'test_pdi_integration', 'User': 'postgres', 'Password': '123456'} test_file_connection = {'Name': 'TestIntegrationConnection...
def func(a, b=5, c=10): print('a equals {}, b equals {}, and c equals {}'.format(a, b, c)) func(3, 7) func(25, c=24) func(c=50, a=100)
def func(a, b=5, c=10): print('a equals {}, b equals {}, and c equals {}'.format(a, b, c)) func(3, 7) func(25, c=24) func(c=50, a=100)
def isPrime(number): if number > 1: for i in range(2, number): if (number % i) == 0: return False else: return True else: return False inputFile = open('test.txt') lines = inputFile.readlines() inputFile.close() pyramid = [] for i in lines: pr...
def is_prime(number): if number > 1: for i in range(2, number): if number % i == 0: return False else: return True else: return False input_file = open('test.txt') lines = inputFile.readlines() inputFile.close() pyramid = [] for i in lines: pri...
def verify(output): scopes = False fail = False for line in output.split('\n'): if scopes: if line.startswith(' '): name,size = [x.strip() for x in line.split('-')] if size != '0': print("unfreed memory in scope",name,":",size) ...
def verify(output): scopes = False fail = False for line in output.split('\n'): if scopes: if line.startswith(' '): (name, size) = [x.strip() for x in line.split('-')] if size != '0': print('unfreed memory in scope', name, ':', size) ...