content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
SPARK_SESSION = {"default": {}} """ PySpark session definition Local Session:: SPARK_SESSION = { "default": { "master": "local", "appName": "Word Count", "config": { "spark.some.config.option": "some-value", } } } Cluster:: ...
spark_session = {'default': {}} '\nPySpark session definition\n\nLocal Session::\n\n SPARK_SESSION = {\n "default": {\n "master": "local",\n "appName": "Word Count",\n "config": {\n "spark.some.config.option": "some-value",\n }\n }\n }\n\nCl...
class Db: def __init__(self): self._db = None self._connection = None @property def db(self): return self._db @db.setter def db(self, db): self._db = db async def _make_connection(self): self._connection = await self.db.acquire() async def _close_c...
class Db: def __init__(self): self._db = None self._connection = None @property def db(self): return self._db @db.setter def db(self, db): self._db = db async def _make_connection(self): self._connection = await self.db.acquire() async def _close_...
# -*- coding: utf-8 -*- # 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, softw...
_hw_ns = 'hw:' _cpu_ns = _HW_NS + 'cpu:' _cpu_x86_ns = _CPU_NS + 'x86:' hw_cpu_x86_avx = _CPU_X86_NS + 'avx' hw_cpu_x86_avx2 = _CPU_X86_NS + 'avx2' hw_cpu_x86_clmul = _CPU_X86_NS + 'clmul' hw_cpu_x86_fma3 = _CPU_X86_NS + 'fma3' hw_cpu_x86_fma4 = _CPU_X86_NS + 'fma4' hw_cpu_x86_f16_c = _CPU_X86_NS + 'f16c' hw_cpu_x86_mm...
# # PySNMP MIB module CISCO-MEDIATRACE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-MEDIATRACE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:07:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, constraints_union, single_value_constraint, value_size_constraint) ...
""" module for creating generic constants used by multiple modules """ """ The cloudwatch dashboard grid positioning system will automatically set x and y coordinates of every widget in the list, based on the next available x,y on the dashboard, from left to right, then top to bottom. As long as we specif...
""" module for creating generic constants used by multiple modules """ '\n The cloudwatch dashboard grid positioning system will automatically set x and y coordinates of every widget\n in the list, based on the next available x,y on the dashboard, from left to right, then top to bottom. As long\n as we speci...
# %% [1128. Number of Equivalent Domino Pairs](https://leetcode.com/problems/number-of-equivalent-domino-pairs/) class Solution: def numEquivDominoPairs(self, dominoes: List[List[int]]) -> int: c = collections.Counter(tuple(sorted(i)) for i in dominoes) return sum(n * (n - 1) // 2 for n in c.values(...
class Solution: def num_equiv_domino_pairs(self, dominoes: List[List[int]]) -> int: c = collections.Counter((tuple(sorted(i)) for i in dominoes)) return sum((n * (n - 1) // 2 for n in c.values()))
print("hi\nmyname is : abdullah") print("And in this code we will do ") #Files print("Files") #______________________# with open("information.txt" , "r") as f: print(f.read())
print('hi\nmyname is : abdullah') print('And in this code we will do ') print('Files') with open('information.txt', 'r') as f: print(f.read())
""" DESCRIPTION Gerald Appel developed Moving Average Convergence/Divergence as an indicator of the change in a security's underlying price trend. The theory suggests that when a price is trending, it is expected, from time to time, that speculative forces "test" the trend. MACD shows characteristics of both a trendi...
""" DESCRIPTION Gerald Appel developed Moving Average Convergence/Divergence as an indicator of the change in a security's underlying price trend. The theory suggests that when a price is trending, it is expected, from time to time, that speculative forces "test" the trend. MACD shows characteristics of both a trendi...
def canTransform1(start, end): startX = "".join([c for c in start if c != "X"]) endX = "".join([c for c in end if c != "X"]) if startX != endX: return False startR = [i for i in range(len(start)) if start[i] == "R"] startL = [i for i in range(len(start)) if start[i] == "L"] endR = [i for i...
def can_transform1(start, end): start_x = ''.join([c for c in start if c != 'X']) end_x = ''.join([c for c in end if c != 'X']) if startX != endX: return False start_r = [i for i in range(len(start)) if start[i] == 'R'] start_l = [i for i in range(len(start)) if start[i] == 'L'] end_r = ...
n = int(input()) lst = sorted([int(input()) for i in range(n)]) ans = sorted(set(range(lst[0], lst[len(lst) - 1])).difference(lst)) if lst[0] > 1: for i in range(1, lst[0]): ans.append(i) if (len(ans) != 0): print(*sorted(ans), sep='\n') else: print("good job")
n = int(input()) lst = sorted([int(input()) for i in range(n)]) ans = sorted(set(range(lst[0], lst[len(lst) - 1])).difference(lst)) if lst[0] > 1: for i in range(1, lst[0]): ans.append(i) if len(ans) != 0: print(*sorted(ans), sep='\n') else: print('good job')
# # PySNMP MIB module HH3C-RCR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-RCR-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:29:21 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') (constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ...
# Copyright 2019-2020 The ASReview Authors. All Rights Reserved. # # 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 appl...
def test_get_projects(client): """Test get projects.""" response = client.get('/api/projects') json_data = response.get_json() assert 'result' in json_data assert isinstance(json_data['result'], list)
""" 0 = possible pathway 1 = wall 2 = rat's path """ board = [ [0, 0, 0, 0, 0], [1, 1, 0, 1, 0], [0, 0, 0, 1, 0], [0, 1, 1, 1, 1], [0, 0, 0, 0, 0], ] moves = [(0, 1), (1, 0), (0, -1), (-1, 0)] def main(): if solve(board, 0, 0, 0): print("Solvable") [print(row) for row in board...
""" 0 = possible pathway 1 = wall 2 = rat's path """ board = [[0, 0, 0, 0, 0], [1, 1, 0, 1, 0], [0, 0, 0, 1, 0], [0, 1, 1, 1, 1], [0, 0, 0, 0, 0]] moves = [(0, 1), (1, 0), (0, -1), (-1, 0)] def main(): if solve(board, 0, 0, 0): print('Solvable') [print(row) for row in board] else: print...
DATA_DIR = "/path/your_data_path" IDX_DIR = "/path/your_index_path" FILE_ROOT = "./test" CALIB_FILE = "./imagenet_int8_cache" MODEL_FILE = "./resnet_imagenet.uff"
data_dir = '/path/your_data_path' idx_dir = '/path/your_index_path' file_root = './test' calib_file = './imagenet_int8_cache' model_file = './resnet_imagenet.uff'
APP_DIRECTORY_NAME = "APP" SRC_DIRECTORY_NAME = "src" TEMPLATES_DIRECTORY_NAME = "templates" # Production React Js Template files having Github Repository Links REACTJS_TEMPLATES_URLS_DICT = { "package.json-tpl": "https://raw.githubusercontent.com/Jitensid/django-webpack-dev-server/main/assets/reactjs/package.json...
app_directory_name = 'APP' src_directory_name = 'src' templates_directory_name = 'templates' reactjs_templates_urls_dict = {'package.json-tpl': 'https://raw.githubusercontent.com/Jitensid/django-webpack-dev-server/main/assets/reactjs/package.json-tpl', 'webpack.config.js-tpl': 'https://raw.githubusercontent.com/Jitensi...
# SPDX-License-Identifier: GPL-3.0-only def make_definitions(f, ecpp, bcpp, all_enums, all_bitfields, all_structs_arranged): f.write("// SPDX-License-Identifier: GPL-3.0-only\n\n// This file was auto-generated.\n// If you want to edit this, edit the .json definitions and rerun the generator script, instead.\n\n") ...
def make_definitions(f, ecpp, bcpp, all_enums, all_bitfields, all_structs_arranged): f.write('// SPDX-License-Identifier: GPL-3.0-only\n\n// This file was auto-generated.\n// If you want to edit this, edit the .json definitions and rerun the generator script, instead.\n\n') header_name = 'INVADER__TAG__HEK__CLA...
def run_gbrt(d, r, t, ne=0, lr=0.1, md=3, trs=0, frs=0, mf=7): X_train, X_test, y_train, y_test = train_test_split( np.append(r, d, 1), t, random_state=trs) gbrt = GradientBoostingClassifier( n_estimators=ne, learning_rate=lr, max_depth=md, max_features=mf, random_state=frs) gbrt.fit(X_train...
def run_gbrt(d, r, t, ne=0, lr=0.1, md=3, trs=0, frs=0, mf=7): (x_train, x_test, y_train, y_test) = train_test_split(np.append(r, d, 1), t, random_state=trs) gbrt = gradient_boosting_classifier(n_estimators=ne, learning_rate=lr, max_depth=md, max_features=mf, random_state=frs) gbrt.fit(X_train[:, 1:], y_tra...
class Solution: def buildArray(self, target: List[int], n: int) -> List[str]: res = [] n = min(max(target), n) for i in range(1, n+1): if i in target: res += ["Push"] else: res += ["Push","Pop"] return res
class Solution: def build_array(self, target: List[int], n: int) -> List[str]: res = [] n = min(max(target), n) for i in range(1, n + 1): if i in target: res += ['Push'] else: res += ['Push', 'Pop'] return res
expected_output = { "vrf": { "default": { "source_address": "172.16.10.13", "path": { "172.16.121.10 BRI0": { "neighbor_address": "172.16.121.10", "neighbor_host": "sj1.cisco.com", "distance_preferred_lookup"...
expected_output = {'vrf': {'default': {'source_address': '172.16.10.13', 'path': {'172.16.121.10 BRI0': {'neighbor_address': '172.16.121.10', 'neighbor_host': 'sj1.cisco.com', 'distance_preferred_lookup': True, 'recursion_count': 0, 'interface_name': 'BRI0', 'originated_topology': 'ipv4 unicast base', 'lookup_topology'...
a = True b = False if a == b: print(1) else: print(0)
a = True b = False if a == b: print(1) else: print(0)
#!/usr/bin/env python3 i = 1 for x in range(-10000, 10000): for y in range(-10000, 10000): if (abs(x)+abs(y)) < 100: i += 1 print(i)
i = 1 for x in range(-10000, 10000): for y in range(-10000, 10000): if abs(x) + abs(y) < 100: i += 1 print(i)
class BaseChild: payload = { "patient": { "lastName": "Deeererederepwswdwewwdw", "firstName": "Allakirillohldldwwwlflrereeeded", "middleName": "Ballerffffff", "birthDate": "2011-05-29", "sex": True, "isAutoPhone": True }, ...
class Basechild: payload = {'patient': {'lastName': 'Deeererederepwswdwewwdw', 'firstName': 'Allakirillohldldwwwlflrereeeded', 'middleName': 'Ballerffffff', 'birthDate': '2011-05-29', 'sex': True, 'isAutoPhone': True}, 'linkType': '6'} def __init__(self): pass def post_info(self, payload): ...
ENTRY_POINT = 'smallest_change' #[PROMPT] def smallest_change(arr): """ Given an array arr of integers, find the minimum number of elements that need to be changed to make the array palindromic. A palindromic array is an array that is read the same backwards and forwards. In one change, you can change ...
entry_point = 'smallest_change' def smallest_change(arr): """ Given an array arr of integers, find the minimum number of elements that need to be changed to make the array palindromic. A palindromic array is an array that is read the same backwards and forwards. In one change, you can change one elemen...
# Write a dictionary or list to hdfs best_params = { "Key1": 123, "Key2": "hello" } save_path = "hdfs://nameservice1/user/duc.nguyenv3/projects/01_lgbm_modeling/data/output/best_params.json" sdf = ( spark .sparkContext .parallelize([best_params]) .toDF() .coalesce(1) ...
best_params = {'Key1': 123, 'Key2': 'hello'} save_path = 'hdfs://nameservice1/user/duc.nguyenv3/projects/01_lgbm_modeling/data/output/best_params.json' sdf = spark.sparkContext.parallelize([best_params]).toDF().coalesce(1).write.mode('overwrite').json(save_path) json_df = spark.read.json(save_path)
""" Test module for learning python packaging. """ NAME = "pybinson"
""" Test module for learning python packaging. """ name = 'pybinson'
''' Title : sWAP cASE Subdomain : Strings Domain : Python Author : Kalpak Seal Created : 29 September 2016 ''' __author__ = 'Kalpak Seal' inputString = raw_input() finalString = "" for i in range(0, len(inputString)): currentChar = inputString[i] if currentChar.islower() or currentChar...
""" Title : sWAP cASE Subdomain : Strings Domain : Python Author : Kalpak Seal Created : 29 September 2016 """ __author__ = 'Kalpak Seal' input_string = raw_input() final_string = '' for i in range(0, len(inputString)): current_char = inputString[i] if currentChar.islower() or currentChar.isupper():...
class Singleton(object): def __init__(self, func): self._func = func def Instance(self,*a,**k): try: return self._instance except AttributeError: self._instance = self._func(*a,**k) return self._instance def __call__(self): raise TypeError(...
class Singleton(object): def __init__(self, func): self._func = func def instance(self, *a, **k): try: return self._instance except AttributeError: self._instance = self._func(*a, **k) return self._instance def __call__(self): raise type...
FILE_TEMPLATE = "19C_{0:05d}.xml" header = """<?xml version="1.0" encoding="UTF-8" ?><marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"> """ fo...
file_template = '19C_{0:05d}.xml' header = '<?xml version="1.0" encoding="UTF-8" ?><marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">\n' footer ...
# # PySNMP MIB module BLUECOAT-AV-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BLUECOAT-AV-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:22:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, single_value_constraint, constraints_intersection) ...
class PartialFillHandlingEnum: PARTIAL_FILL_UNSET = 0 PARTIAL_FILL_HANDLING_REDUCE_QUANTITY = 1 PARTIAL_FILL_HANDLING_IMMEDIATE_CANCEL = 2
class Partialfillhandlingenum: partial_fill_unset = 0 partial_fill_handling_reduce_quantity = 1 partial_fill_handling_immediate_cancel = 2
SKILL_SAMPLE_TYPES = ( ("dc", "DC"), ("mod", "Modifier"), )
skill_sample_types = (('dc', 'DC'), ('mod', 'Modifier'))
def emulate(instructions): # did we already run a specific instruction? previous = [False for _ in range(len(instructions))] acc, i = 0, 0 while i < len(instructions): # infinite loop detected if previous[i]: return None previous[i] = True instr, value = instructions[i] ...
def emulate(instructions): previous = [False for _ in range(len(instructions))] (acc, i) = (0, 0) while i < len(instructions): if previous[i]: return None previous[i] = True (instr, value) = instructions[i] if instr == 'acc': acc += value elif ...
flowerpot_price = 4.00 flower_seeds_price = 1.00 soil_price = 5.00 tax_rate = 0.06 number_of_pots = int(input('How many flowerpots? ')) number_of_seeds = int(input('How many packs of seeds? ')) number_of_bags = int(input('How many bags of soil? ')) cost_of_items = (number_of_pots * flowerpot_price) + (number_of_seeds...
flowerpot_price = 4.0 flower_seeds_price = 1.0 soil_price = 5.0 tax_rate = 0.06 number_of_pots = int(input('How many flowerpots? ')) number_of_seeds = int(input('How many packs of seeds? ')) number_of_bags = int(input('How many bags of soil? ')) cost_of_items = number_of_pots * flowerpot_price +(number_of_seeds * flowe...
class Field: cells = () def __init__(self, w, h): print('Game Field Created!')
class Field: cells = () def __init__(self, w, h): print('Game Field Created!')
class Entry(object): def __init__(self, record, value): self.record = record self.value = value def __lt__(self, other): # to make a max-heap return self.value > other.value def to_json(self): return {"record": self.record.to_json(), "value": self.value}
class Entry(object): def __init__(self, record, value): self.record = record self.value = value def __lt__(self, other): return self.value > other.value def to_json(self): return {'record': self.record.to_json(), 'value': self.value}
# # PySNMP MIB module HUAWEI-TASK-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-TASK-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:37:15 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') (constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint, constraints_union) ...
# keyword param for the ProfileHandler KEY_DATASET_OBJECT_ID = 'dataset_object_id' KEY_SAVE_ROW_COUNT = 'save_row_count' KEY_DATASET_IS_DJANGO_FILEFIELD = 'dataset_is_django_filefield' KEY_DATASET_IS_FILEPATH = 'dataset_is_filepath' VAR_TYPE_BOOLEAN = 'Boolean' VAR_TYPE_CATEGORICAL = 'Categorical' VAR_TYPE_NUMERICAL ...
key_dataset_object_id = 'dataset_object_id' key_save_row_count = 'save_row_count' key_dataset_is_django_filefield = 'dataset_is_django_filefield' key_dataset_is_filepath = 'dataset_is_filepath' var_type_boolean = 'Boolean' var_type_categorical = 'Categorical' var_type_numerical = 'Numerical' var_type_integer = 'Integer...
#! /usr/bin/env python3 # check if a word is palindromic without reversing it def isPalindrome(word): end = len(word) start = 0 retval = True while start < end+1: left = word[start] right = word[end-1] if left != right: retval = False break start...
def is_palindrome(word): end = len(word) start = 0 retval = True while start < end + 1: left = word[start] right = word[end - 1] if left != right: retval = False break start += 1 end -= 1 return retval print(is_palindrome('wwaabbaawwz')...
class Solution(object): def setZeroes(self, matrix): """ :type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. """ if len(matrix) == 0 or len(matrix[0]) == 0: return matrix rcnt = len(matrix) ccnt = len...
class Solution(object): def set_zeroes(self, matrix): """ :type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. """ if len(matrix) == 0 or len(matrix[0]) == 0: return matrix rcnt = len(matrix) ccnt = le...
class Pessoa: olhos = 2 def __init__(self, *filhos, nome=None, idade=46): self.idade = idade self.nome = nome self.filhos = list(filhos) def cumprimentar(self): return f'Ola {id(self)}' if __name__ == '__main__': nilton = Pessoa(nome='Nilton') roberto = Pessoa(nil...
class Pessoa: olhos = 2 def __init__(self, *filhos, nome=None, idade=46): self.idade = idade self.nome = nome self.filhos = list(filhos) def cumprimentar(self): return f'Ola {id(self)}' if __name__ == '__main__': nilton = pessoa(nome='Nilton') roberto = pessoa(nilto...
AIRTABLE_EXPORT_JOB_DOWNLOADING_PENDING = "pending" AIRTABLE_EXPORT_JOB_DOWNLOADING_FAILED = "failed" AIRTABLE_EXPORT_JOB_DOWNLOADING_FINISHED = "finished" AIRTABLE_EXPORT_JOB_DOWNLOADING_BASE = "downloading-base" AIRTABLE_EXPORT_JOB_CONVERTING = "converting" AIRTABLE_EXPORT_JOB_DOWNLOADING_FILES = "downloading-files" ...
airtable_export_job_downloading_pending = 'pending' airtable_export_job_downloading_failed = 'failed' airtable_export_job_downloading_finished = 'finished' airtable_export_job_downloading_base = 'downloading-base' airtable_export_job_converting = 'converting' airtable_export_job_downloading_files = 'downloading-files' ...
#!/usr/bin/env python3 """Advent of Code 2020 Day 06 - Custom Customs.""" with open ('inputs/day_06.txt', 'r') as forms: groups = [group_answers.strip() for group_answers in forms.read().split('\n\n')] overall_yes = 0 for group in groups: group_yes = set() for member_yes in group.split('\n'): fo...
"""Advent of Code 2020 Day 06 - Custom Customs.""" with open('inputs/day_06.txt', 'r') as forms: groups = [group_answers.strip() for group_answers in forms.read().split('\n\n')] overall_yes = 0 for group in groups: group_yes = set() for member_yes in group.split('\n'): for char in member_yes: ...
print("Rathinn") print("AM.EN.U4AIE19052") print("AIE") print("Anime Rocks")
print('Rathinn') print('AM.EN.U4AIE19052') print('AIE') print('Anime Rocks')
"""Constants about physical keg shell.""" # Most common shell sizes, from smalles to largest. MINI = "mini" CORNY_25 = "corny-2_5-gal" CORNY_30 = "corny-3-gal" CORNY = "corny" SIXTH_BARREL = "sixth" EURO_30_LITER = "euro-30-liter" EURO_HALF_BARREL = "euro-half" QUARTER_BARREL = "quarter" EURO = "euro" HALF_BARREL = "h...
"""Constants about physical keg shell.""" mini = 'mini' corny_25 = 'corny-2_5-gal' corny_30 = 'corny-3-gal' corny = 'corny' sixth_barrel = 'sixth' euro_30_liter = 'euro-30-liter' euro_half_barrel = 'euro-half' quarter_barrel = 'quarter' euro = 'euro' half_barrel = 'half-barrel' other = 'other' volumes_ml = {MINI: 5000,...
"""Consts used by rpi_camera.""" DOMAIN = "rpi_camera" CONF_HORIZONTAL_FLIP = "horizontal_flip" CONF_IMAGE_HEIGHT = "image_height" CONF_IMAGE_QUALITY = "image_quality" CONF_IMAGE_ROTATION = "image_rotation" CONF_IMAGE_WIDTH = "image_width" CONF_OVERLAY_METADATA = "overlay_metadata" CONF_OVERLAY_TIMESTAMP = "overlay_t...
"""Consts used by rpi_camera.""" domain = 'rpi_camera' conf_horizontal_flip = 'horizontal_flip' conf_image_height = 'image_height' conf_image_quality = 'image_quality' conf_image_rotation = 'image_rotation' conf_image_width = 'image_width' conf_overlay_metadata = 'overlay_metadata' conf_overlay_timestamp = 'overlay_tim...
# Backtracking class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: if not candidates: return candidates.sort() paths = [] results = [] index = 0 cursum = 0 # paths, results,...
class Solution: def combination_sum(self, candidates: List[int], target: int) -> List[List[int]]: if not candidates: return candidates.sort() paths = [] results = [] index = 0 cursum = 0 self.dfs(paths, results, index, candidates, cursum, target) ...
# final def sum_of_args(args): result = 0 for i in args: result += i return result print(sum_of_args(args=[1,2,3,4]))
def sum_of_args(args): result = 0 for i in args: result += i return result print(sum_of_args(args=[1, 2, 3, 4]))
''' https://leetcode.com/contest/weekly-contest-182/problems/find-lucky-integer-in-an-array/ ''' class Solution: def findLucky(self, arr: List[int]) -> int: for a in sorted(arr)[::-1]: if a == arr.count(a): return a return -1
""" https://leetcode.com/contest/weekly-contest-182/problems/find-lucky-integer-in-an-array/ """ class Solution: def find_lucky(self, arr: List[int]) -> int: for a in sorted(arr)[::-1]: if a == arr.count(a): return a return -1
####Use the loop 'while' # input a and b a = int(input()) b = int(input()) if a > b : print('it is not the total') else : i = a total = 0 while i <= b : total += i i += 1 print(total)
a = int(input()) b = int(input()) if a > b: print('it is not the total') else: i = a total = 0 while i <= b: total += i i += 1 print(total)
# Write your solution for 1.3 here! x=0 i=0 while x<10000: i+=1 x+=i print(i)
x = 0 i = 0 while x < 10000: i += 1 x += i print(i)
# This is the Python adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/). # # Copyright 2021 Huawei Technologies Co., Ltd # # 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 ...
""" Define constants""" k_scalar_add = 'ScalarAdd' k_scalar_sub = 'ScalarSub' k_scalar_mul = 'ScalarMul' k_scalar_div = 'ScalarDiv' k_scalar_floordiv = 'ScalarFloordiv' k_scalar_mod = 'ScalarMod' k_scalar_pow = 'ScalarPow' k_scalar_trunc = 'ScalarTrunc' k_scalar_floor = 'ScalarFloor' k_scalar_uadd = 'ScalarUadd' k_scal...
tile_size = 25 # size of tiles in the board screen_width = 400 # width of the screen screen_height = 400 # height of the screen
tile_size = 25 screen_width = 400 screen_height = 400
class Queue: def __init__(self,list = None): if list == None: self.item =[] else : self.item = list def enQueue(self,i): self.item.append(i) def size(self): return len(self.item) def isEmpty(self): return len(self.item)==0 def deQueue...
class Queue: def __init__(self, list=None): if list == None: self.item = [] else: self.item = list def en_queue(self, i): self.item.append(i) def size(self): return len(self.item) def is_empty(self): return len(self.item) == 0 def ...
def test_signup_new_account(app): username = "user1" password = "test" app.james.ensure_user_exists(username, password)
def test_signup_new_account(app): username = 'user1' password = 'test' app.james.ensure_user_exists(username, password)
list_var = [1, 2] dict_var = { "key1": "value1" } setVar = {1, 2, 3}
list_var = [1, 2] dict_var = {'key1': 'value1'} set_var = {1, 2, 3}
n = int(input()) cnt1, cnt2 = {}, {} for i in range(n): x, y = map(int, input().split()) cnt1[x+y] = cnt1.get(x+y, 0) + 1 cnt2[x-y] = cnt2.get(x-y, 0) + 1 ans = 0 for t in cnt1.values(): ans += t*(t-1)//2 for t in cnt2.values(): ans += t*(t-1)//2 print(ans)
n = int(input()) (cnt1, cnt2) = ({}, {}) for i in range(n): (x, y) = map(int, input().split()) cnt1[x + y] = cnt1.get(x + y, 0) + 1 cnt2[x - y] = cnt2.get(x - y, 0) + 1 ans = 0 for t in cnt1.values(): ans += t * (t - 1) // 2 for t in cnt2.values(): ans += t * (t - 1) // 2 print(ans)
def valid_oci_group(parser): add_oci_group(parser) def add_oci_group(parser): oci_group = parser.add_argument_group(title="OCI arguments") oci_group.add_argument("--oci-profile-name", default="") oci_group.add_argument("--oci-profile-compartment-id", default="") # HACK to extract the set provider...
def valid_oci_group(parser): add_oci_group(parser) def add_oci_group(parser): oci_group = parser.add_argument_group(title='OCI arguments') oci_group.add_argument('--oci-profile-name', default='') oci_group.add_argument('--oci-profile-compartment-id', default='') oci_group.add_argument('--oci', acti...
def sievePrimeGen(n): primes = [True] * (n + 1) ans = [] for i in range(2, int(n * (1 / 2) + 1)): if primes[i] == True: for j in range(i * 2, n + 1, i): primes[j] = False for i in range(2, n + 1): if primes[i] == True: ans.appe...
def sieve_prime_gen(n): primes = [True] * (n + 1) ans = [] for i in range(2, int(n * (1 / 2) + 1)): if primes[i] == True: for j in range(i * 2, n + 1, i): primes[j] = False for i in range(2, n + 1): if primes[i] == True: ans.append(i) i += ...
class Card: def __repr__(self): return str((self.name, self.rules, self.value)) class Batman(Card): def __init__(self): self.name = 'Batman' self.value = 1 self.rules = "Guess a player's hand" self.action = 'guess' class Catwoman(Card): def __init__(self): ...
class Card: def __repr__(self): return str((self.name, self.rules, self.value)) class Batman(Card): def __init__(self): self.name = 'Batman' self.value = 1 self.rules = "Guess a player's hand" self.action = 'guess' class Catwoman(Card): def __init__(self): ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def inorderSuccessor(self, root: 'TreeNode', p: 'TreeNode') -> 'TreeNode': ''' in-order traversal ''' sel...
class Solution: def inorder_successor(self, root: 'TreeNode', p: 'TreeNode') -> 'TreeNode': """ in-order traversal """ self.found = False def inorder(node, target): if not node: return if node.left: l = inorder(node.le...
db_host_name="127.0.0.1" db_name="TestDB" db_user="testuser" db_password="test123" db_table_name="brady"
db_host_name = '127.0.0.1' db_name = 'TestDB' db_user = 'testuser' db_password = 'test123' db_table_name = 'brady'
# # This file is part of BDC-DB. # Copyright (C) 2020 INPE. # # BDC-DB is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # """Define mock of flask app that extends BDC-DB.""" SCHEMA = 'myapp'
"""Define mock of flask app that extends BDC-DB.""" schema = 'myapp'
''' Created on 13 Jun 2016 @author: a ''' class InvalidPasswords(): BAD_PASSWORDS = ['1234567890','qwertyuiop','123456789','password1','photoshop', '11111111','12345678','1qaz2wsx','access14','adobe123','baseball', 'bigdaddy','butthead','cocacola','comp...
""" Created on 13 Jun 2016 @author: a """ class Invalidpasswords: bad_passwords = ['1234567890', 'qwertyuiop', '123456789', 'password1', 'photoshop', '11111111', '12345678', '1qaz2wsx', 'access14', 'adobe123', 'baseball', 'bigdaddy', 'butthead', 'cocacola', 'computer', 'corvette', 'danielle', 'dolphins', 'einstei...
# None datatype a = None print(a) # Numeric datatype (int,float,complex,bool) b = 4 print(type(b)) c = 2.5 print(type(c)) d = 4 + 5j print(type(d)) bool = b > c print(type(bool)) e = int(c) print(e) f = complex(e, b) print(f) print(int(True)) # List datatype lst = [1, 2, 3, 4, 5] print(lst) # Set datatype s = {4, 8,...
a = None print(a) b = 4 print(type(b)) c = 2.5 print(type(c)) d = 4 + 5j print(type(d)) bool = b > c print(type(bool)) e = int(c) print(e) f = complex(e, b) print(f) print(int(True)) lst = [1, 2, 3, 4, 5] print(lst) s = {4, 8, 2, 1, 6, 3} print(s) tup = (10, 20, 50, 40, 30) print(tup) str = 'Sunny' print(str) k = list(...
# this menu.py only installs the SetLoop examples. # get script location (necessaary for loading toolsets) dirName = os.path.dirname( os.path.abspath(__file__)).replace('\\', '/') # get node toolbar nodes = nuke.menu('Nodes') # make group entry for examples in toolsets menu group = nodes.addMenu('ToolSets/SetLoop...
dir_name = os.path.dirname(os.path.abspath(__file__)).replace('\\', '/') nodes = nuke.menu('Nodes') group = nodes.addMenu('ToolSets/SetLoop Examples', index=2) def add_example(fileName, toolSetName): group.addCommand('(' + toolSetName + ') ' + fileName, "nuke.loadToolset('" + dirName + '/' + fileName + ".nk')", ic...
_base_ = ["./FlowNet512_1.5AugCosyAAEGray_Flat_Pbr_01_ape.py"] OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_Flat_lmPbr_SO/camera" DATASETS = dict(TRAIN=("lm_pbr_camera_train",), TEST=("lm_real_camera_test",)) # bbnc7 # objects camera Avg(1) # ad_2 26.86 26.86 # ad_5 84.41 84.41 # a...
_base_ = ['./FlowNet512_1.5AugCosyAAEGray_Flat_Pbr_01_ape.py'] output_dir = 'output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_Flat_lmPbr_SO/camera' datasets = dict(TRAIN=('lm_pbr_camera_train',), TEST=('lm_real_camera_test',))
# Function to square every digit of a number. # Eg. 9119 will become 811181, because 9^2 is 81 and 1^2 is 1. def square_each_number(num): result= '' list = [int(d) for d in str(num)] square_list = [i ** 2 for i in list] for i in square_list: result += str(i) return float(result) test.assert...
def square_each_number(num): result = '' list = [int(d) for d in str(num)] square_list = [i ** 2 for i in list] for i in square_list: result += str(i) return float(result) test.assert_equals(square_digits(9119), 811181)
# QUESTION: # # This problem was asked by Google. # # Given the root to a binary tree, implement serialize(root), which serializes # the tree into a string, and deserialize(s), which deserializes the string # back into the tree. # # For example, given the following Node class # # class Node: # def __init__(self, va...
class Node(object): def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right def solution(L): if not L: return None if len(L) < 3: return L for i in range(0, len(L)): if L[i] == 0: return None pro...
def reverseBits(n): head = 15 tail = 0 while head > tail: headBit = (n >> head) & 1 tailBit = (n >> tail) & 1 if headBit != tailBit: bitMask = (1 << head) | (1 << tail) n ^= bitMask head -= 1 tail += 1 return n
def reverse_bits(n): head = 15 tail = 0 while head > tail: head_bit = n >> head & 1 tail_bit = n >> tail & 1 if headBit != tailBit: bit_mask = 1 << head | 1 << tail n ^= bitMask head -= 1 tail += 1 return n
class MolGraphInterface: r"""The `MolGraphInterface` defines the base class interface to handle a molecular graph. The method implementation to generate a mol-instance from smiles etc. can be obtained from different backends like `rdkit`. The mol-instance of a chemical informatics package like `rdkit` is tr...
class Molgraphinterface: """The `MolGraphInterface` defines the base class interface to handle a molecular graph. The method implementation to generate a mol-instance from smiles etc. can be obtained from different backends like `rdkit`. The mol-instance of a chemical informatics package like `rdkit` is tre...
# from Data Structures, Spring 2019 class Graph: """Representation of a simple graph using an adjacency map.""" #------------------------- nested Vertex class ------------------------- class Vertex: """Lightweight vertex structure for a graph.""" # __slots__ = '_element' def __...
class Graph: """Representation of a simple graph using an adjacency map.""" class Vertex: """Lightweight vertex structure for a graph.""" def __init__(self, idx, goal=None, proof_tree=None, proof=None): """Do not call constructor directly. Use Graph's insert_vertex(x).""" ...
""".. Ignore pydocstyle D400. =============== Resolwe Toolkit =============== This module includes general processes, schemas, tools and docker image definitions. """
""".. Ignore pydocstyle D400. =============== Resolwe Toolkit =============== This module includes general processes, schemas, tools and docker image definitions. """
def get(s, register): if s in 'abcdefghijklmnopqrstuvwxyz': return register[s] return int(s) def solveQuestion(inputPath): fileP = open(inputPath, 'r') instVals = [line.split() for line in fileP.read().strip().split("\n")] fileP.close() registers = {} registers[0] = {} ...
def get(s, register): if s in 'abcdefghijklmnopqrstuvwxyz': return register[s] return int(s) def solve_question(inputPath): file_p = open(inputPath, 'r') inst_vals = [line.split() for line in fileP.read().strip().split('\n')] fileP.close() registers = {} registers[0] = {} regist...
class ColumnWidthChangingEventArgs(CancelEventArgs): """ Provides data for the System.Windows.Forms.ListView.ColumnWidthChanging event. ColumnWidthChangingEventArgs(columnIndex: int,newWidth: int,cancel: bool) ColumnWidthChangingEventArgs(columnIndex: int,newWidth: int) """ @staticmethod ...
class Columnwidthchangingeventargs(CancelEventArgs): """ Provides data for the System.Windows.Forms.ListView.ColumnWidthChanging event. ColumnWidthChangingEventArgs(columnIndex: int,newWidth: int,cancel: bool) ColumnWidthChangingEventArgs(columnIndex: int,newWidth: int) """ @staticmethod def __new...
# import standard modules # import third party modules # import third party modules class Layer(object): """ Parent class for all layer classes used for a model. For this framework is does only have one attribute which all layers share, however, it is important to keep things sorted in case of future en...
class Layer(object): """ Parent class for all layer classes used for a model. For this framework is does only have one attribute which all layers share, however, it is important to keep things sorted in case of future enrichment. """ def __init__(self): self.cache = None
""" URL lookup for common views """ common_urls = [ ]
""" URL lookup for common views """ common_urls = []
PRECISION = 100 class PiCalculator(object): def __init__(self, precision): self.precision = precision def divide_one_by(self, b): divider = 1 result = "" for x in range(self.precision): if divider // b == 0: divider *= 10 result += ...
precision = 100 class Picalculator(object): def __init__(self, precision): self.precision = precision def divide_one_by(self, b): divider = 1 result = '' for x in range(self.precision): if divider // b == 0: divider *= 10 result += '...
def area(a, b): return (a * b) / 2 print(area(6, 9)) print(area(5, 8))
def area(a, b): return a * b / 2 print(area(6, 9)) print(area(5, 8))
# returns the classification or None if no classification could be determined def calcClass(arr): sel0 = arr[0] > 0.0 sel1 = arr[1] > 0.0 if sel0 and sel1: # is selection valid? if not then we just ignore the result! n = 2 maxSelVal = float("-inf") maxSelIdx = None for iIdx i...
def calc_class(arr): sel0 = arr[0] > 0.0 sel1 = arr[1] > 0.0 if sel0 and sel1: n = 2 max_sel_val = float('-inf') max_sel_idx = None for i_idx in range(n): if arr[iIdx] > maxSelVal: max_sel_idx = iIdx max_sel_val = arr[iIdx] ...
""" Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge them into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. Otherwis...
""" Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge them into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. Otherwis...
''' Leetcode problem No 301 Remove Invalid Parentheses Solution written by Xuqiang Fang on 5 July, 2018 ''' class Solution(object): def removeInvalidParentheses(self, s): """ :type s: str :rtype: List[str] """ l = 0; r = 0 for c in s: if c == '(': ...
""" Leetcode problem No 301 Remove Invalid Parentheses Solution written by Xuqiang Fang on 5 July, 2018 """ class Solution(object): def remove_invalid_parentheses(self, s): """ :type s: str :rtype: List[str] """ l = 0 r = 0 for c in s: if c == '(...
# -*- coding: utf-8 -*- """Implementation of the ``tcell_crg_report`` step This step collects all of the calls and information gathered for the BIH T cell CRG and generates an Excel report for each patient. .. note:: Status: not implemented yet ========== Step Input ========== The BIH T cell CRG report generat...
"""Implementation of the ``tcell_crg_report`` step This step collects all of the calls and information gathered for the BIH T cell CRG and generates an Excel report for each patient. .. note:: Status: not implemented yet ========== Step Input ========== The BIH T cell CRG report generator uses the following as...
def MAD(data : np.array): """ returns the median absolute deviation of a distribution useful for non-normal distributions, etc. """ return np.median(abs(data - np.median(data)))
def mad(data: np.array): """ returns the median absolute deviation of a distribution useful for non-normal distributions, etc. """ return np.median(abs(data - np.median(data)))
class Solution: def search(self, arr, target) -> int: """O(logn) time | O(1) space""" l, h = 0, len(arr)-1 while l <= h: mid = (l+h)//2 if arr[mid] == target: return mid elif target < arr[mid]: if arr[l] <= target or arr[l] ...
class Solution: def search(self, arr, target) -> int: """O(logn) time | O(1) space""" (l, h) = (0, len(arr) - 1) while l <= h: mid = (l + h) // 2 if arr[mid] == target: return mid elif target < arr[mid]: if arr[l] <= target...
__doc__ = """Just a sketch for now. """ __author__ = "Rui Campos" class Element(dict): def __init__(self, Z): self.__dict__[Z] = 1 self.Z = Z def __mul__(self, other): #usual checks if not (isinstance(other, float) or isinstance(other, int)): ...
__doc__ = 'Just a sketch for now.\n' __author__ = 'Rui Campos' class Element(dict): def __init__(self, Z): self.__dict__[Z] = 1 self.Z = Z def __mul__(self, other): if not (isinstance(other, float) or isinstance(other, int)): return NotImplemented self.__dict__[Z] ...
""" utils.py Copyright 2011 Andres Riancho This file is part of w3af, http://w3af.org/ . w3af is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License. w3af is distributed in the hope that it wi...
""" utils.py Copyright 2011 Andres Riancho This file is part of w3af, http://w3af.org/ . w3af is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License. w3af is distributed in the hope that it wi...
_base_ = './faster_rcnn_obb_r50_fpn_1x_dota2.0.py' # fp16 settings fp16 = dict(loss_scale=512.)
_base_ = './faster_rcnn_obb_r50_fpn_1x_dota2.0.py' fp16 = dict(loss_scale=512.0)
class Digraph: def __init__(self, v): self.v = v self.e = 0 self.adj = [[] for _ in range(v)] def init_from(self, file_name): with open(file_name) as f: self.v = int(f.readline()) self.e = int(f.readline()) self.adj = [[] for _ in range(self...
class Digraph: def __init__(self, v): self.v = v self.e = 0 self.adj = [[] for _ in range(v)] def init_from(self, file_name): with open(file_name) as f: self.v = int(f.readline()) self.e = int(f.readline()) self.adj = [[] for _ in range(self....
# -*- coding: utf-8 -*- try: print('enter a number') num = int (input()) print('enter a denom') denom = int (input()) print(str(num/denom)) #you can raise the exceptions as follows #raise ZeroDivisionError except ZeroDivisionError: #except IOError: print('Canno...
try: print('enter a number') num = int(input()) print('enter a denom') denom = int(input()) print(str(num / denom)) except ZeroDivisionError: print('Cannot divide by zero') print('enter a number') num = int(input()) print('enter a denom') denom = int(input()) print(str(num / ...
class Journal: def __init__(self, article_title, journal_title, year_published, page_start, page_end, volume, issue, doi_or_website): self.article_title = article_title self.journal_title = journal_title self.year_published = year_published self.page_start = page_sta...
class Journal: def __init__(self, article_title, journal_title, year_published, page_start, page_end, volume, issue, doi_or_website): self.article_title = article_title self.journal_title = journal_title self.year_published = year_published self.page_start = page_start self....
#!/usr/bin/env python3 """ Pythonic implementation of Adverse Outcome Pathways """ class AdverseOutcomePathway(object): """Adverse Outcome Pathway---A framework for conceptualizing how toxic exposures result in downstream adverse phenotypic effects, especially in humans. AOPs basically constitute th...
""" Pythonic implementation of Adverse Outcome Pathways """ class Adverseoutcomepathway(object): """Adverse Outcome Pathway---A framework for conceptualizing how toxic exposures result in downstream adverse phenotypic effects, especially in humans. AOPs basically constitute the "pinnacle" of toxicolog...
vogais = ('Aprender', 'Programar', 'Linguagem', 'Python', 'Curso', 'Gratis', 'Estudar', 'Praticar', 'Trabalhar', 'Mercado', 'Programador') for c in range(0, len(vogais)): print(f'\nNa palavra {vogais[c].upper()} temos: ', end=' ') for letra in vogais[c]: if letra.lower() in 'aeiou': print(l...
vogais = ('Aprender', 'Programar', 'Linguagem', 'Python', 'Curso', 'Gratis', 'Estudar', 'Praticar', 'Trabalhar', 'Mercado', 'Programador') for c in range(0, len(vogais)): print(f'\nNa palavra {vogais[c].upper()} temos: ', end=' ') for letra in vogais[c]: if letra.lower() in 'aeiou': print(le...
#!/usr/bin/env python3 def responses(input_text): user_message = str(input_text).lower() if user_message in ("yes","sure","ok"): return "Great! Let's start. First I need to know where you were born." if user_message in ("no","naw","no thanks"): return "That's alright, maybe another t...
def responses(input_text): user_message = str(input_text).lower() if user_message in ('yes', 'sure', 'ok'): return "Great! Let's start. First I need to know where you were born." if user_message in ('no', 'naw', 'no thanks'): return "That's alright, maybe another time." return "I'm Crypt...
''' Este snipet es para crear un generador que me permita contar hasta 100. ''' # Retorna la lsita con todos los valores def count_to(): yield [n for n in range(0,101) if n%2 ==0] if __name__ == '__main__': i = count_to() print(next(i)) # Lista print(next(i)) # Error StopIteration
""" Este snipet es para crear un generador que me permita contar hasta 100. """ def count_to(): yield [n for n in range(0, 101) if n % 2 == 0] if __name__ == '__main__': i = count_to() print(next(i)) print(next(i))
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: low = 0 high = len(numbers)-1 while low < high: s = numbers[low] + numbers[high] if s == target: return [low+1, high+1] if s > target: high -= ...
class Solution: def two_sum(self, numbers: List[int], target: int) -> List[int]: low = 0 high = len(numbers) - 1 while low < high: s = numbers[low] + numbers[high] if s == target: return [low + 1, high + 1] if s > target: h...
#============================================================================== # exceptions.py # exception handler for Exosite HTTP JSON RPC API library (man, alphabet soup) #============================================================================== ## ## Tested with python 2.6 ## ## Copyright (c) 2010, Exosite LL...
class Oneexception(Exception): pass class Oneplatformexception(OneException): pass class Jsonrpcrequestexception(OneException): pass class Jsonrpcresponseexception(OneException): pass class Jsonstringexception(OneException): pass class Provisionexception(OneException): def __init__(self, p...
num1 = int(input('Enter First number: ')) num2 = int(input('Enter Second number ')) add = num1 + num2 dif = num1 - num2 mul = num1 * num2 div = num1 / num2 floor_div = num1 // num2 power = num1 ** num2 modulus = num1 % num2 print('Sum of ',num1 ,'and' ,num2 ,'is :',add) print('Difference of ',num1 ,'and' ,num2 ,'is :',...
num1 = int(input('Enter First number: ')) num2 = int(input('Enter Second number ')) add = num1 + num2 dif = num1 - num2 mul = num1 * num2 div = num1 / num2 floor_div = num1 // num2 power = num1 ** num2 modulus = num1 % num2 print('Sum of ', num1, 'and', num2, 'is :', add) print('Difference of ', num1, 'and', num2, 'is ...
#!/usr/bin/env python3 c = 100 k = int(input()) i = 0 while c<k: c = int(c*1.01) i += 1 print(i)
c = 100 k = int(input()) i = 0 while c < k: c = int(c * 1.01) i += 1 print(i)
def parse(data): kernel, img = data.split("\n\n") i = set() for y, r in enumerate(img.split()): for x, c in enumerate(r): if c == "#": i.add((x, y)) return [c == "#" for c in kernel], i def enhance(kernel, i, inverted): inverting = kernel[0] and not inverted ...
def parse(data): (kernel, img) = data.split('\n\n') i = set() for (y, r) in enumerate(img.split()): for (x, c) in enumerate(r): if c == '#': i.add((x, y)) return ([c == '#' for c in kernel], i) def enhance(kernel, i, inverted): inverting = kernel[0] and (not inve...
print(a) print(b) c = a + b print(c)
print(a) print(b) c = a + b print(c)