content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# encoding: utf-8 class PygarmeApiError(Exception): pass class PygarmeTransactionApiError(Exception): pass class PygarmeTransactionError(Exception): pass class NotPaidException(PygarmeTransactionError): pass
class Pygarmeapierror(Exception): pass class Pygarmetransactionapierror(Exception): pass class Pygarmetransactionerror(Exception): pass class Notpaidexception(PygarmeTransactionError): pass
BASE_URL = 'https://www.instagram.com/' LOGIN_URL = BASE_URL + 'accounts/login/ajax/' LOGOUT_URL = BASE_URL + 'accounts/logout/' CHROME_WIN_UA = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36' USER_URL = BASE_URL + '{0}/?__a=1' USER_INFO = 'https://i.insta...
base_url = 'https://www.instagram.com/' login_url = BASE_URL + 'accounts/login/ajax/' logout_url = BASE_URL + 'accounts/logout/' chrome_win_ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36' user_url = BASE_URL + '{0}/?__a=1' user_info = 'https://i.insta...
X_reduced = PCA(n_components = 30).fit_transform(X) model = TSNE(learning_rate = 10, n_components = 2, random_state = 123, perplexity = 30) tsne = model.fit_transform(X_reduced) plt.scatter(tsne[:, 0], tsne[:, 1], c = Y, cmap = 'rainbow', s = 2, marker='x') plt.title('tSNE on PCA', fontsize = 20) plt.xlabel("tSNE1", f...
x_reduced = pca(n_components=30).fit_transform(X) model = tsne(learning_rate=10, n_components=2, random_state=123, perplexity=30) tsne = model.fit_transform(X_reduced) plt.scatter(tsne[:, 0], tsne[:, 1], c=Y, cmap='rainbow', s=2, marker='x') plt.title('tSNE on PCA', fontsize=20) plt.xlabel('tSNE1', fontsize=20) plt.yla...
# -*- coding: utf-8 -*- class DBTriggerException(Exception): pass class ConfigError(DBTriggerException): pass class UnavailableDialect(DBTriggerException): pass
class Dbtriggerexception(Exception): pass class Configerror(DBTriggerException): pass class Unavailabledialect(DBTriggerException): pass
def QuestLog_OnLoad(frame): frame.RegisterEvent("QUEST_LOG_UPDATE") def QuestLog_OnEvent(frame, args): QuestLog_Update() def QuestLog_Update(): QuestLogMoneyFrame.Hide() maxNumDisplayQuests = 6 startIndex = 1 numQuests, numEntries = GetNumQuestLogEntries() # Build the list at the top ...
def quest_log__on_load(frame): frame.RegisterEvent('QUEST_LOG_UPDATE') def quest_log__on_event(frame, args): quest_log__update() def quest_log__update(): QuestLogMoneyFrame.Hide() max_num_display_quests = 6 start_index = 1 (num_quests, num_entries) = get_num_quest_log_entries() QuestLogHig...
#!/usr/bin/env python #coding: utf-8 class Solution: # @param triangle, a list of lists of integers # @return an integer def minimumTotal(self, triangle): lt = len(triangle) d = [0 for i in range(lt)] for i in range(lt): for j in range(i, -1, -1): if j =...
class Solution: def minimum_total(self, triangle): lt = len(triangle) d = [0 for i in range(lt)] for i in range(lt): for j in range(i, -1, -1): if j == 0: d[j] = d[j] + triangle[i][j] elif j == i: d[j] = d[j...
''' Created on Aug 9, 2017 URLify: Write a method to replace all spaces in a string with '%20'. You may assume that the string has sufficient space at the end to hold additional characters, and that you are given the true length of the string. EXAMPLE: input: "Mr John Smith ", 13 output: "Mr%20John%20Smith" I am...
""" Created on Aug 9, 2017 URLify: Write a method to replace all spaces in a string with '%20'. You may assume that the string has sufficient space at the end to hold additional characters, and that you are given the true length of the string. EXAMPLE: input: "Mr John Smith ", 13 output: "Mr%20John%20Smith" I am...
''' @file: __init__.py.py @author: qxLiu @time: 2019/12/11 9:43 '''
""" @file: __init__.py.py @author: qxLiu @time: 2019/12/11 9:43 """
pkgname = "gtkmm" pkgver = "4.6.1" pkgrel = 0 build_style = "meson" make_check_wrapper = ["xvfb-run"] hostmakedepends = ["meson", "pkgconf", "glib-devel"] makedepends = [ "gtk4-devel", "cairomm-devel", "pangomm-devel", "gdk-pixbuf-devel", "libepoxy-devel" ] checkdepends = ["xserver-xorg-xvfb"] pkgdesc = "C++ bi...
pkgname = 'gtkmm' pkgver = '4.6.1' pkgrel = 0 build_style = 'meson' make_check_wrapper = ['xvfb-run'] hostmakedepends = ['meson', 'pkgconf', 'glib-devel'] makedepends = ['gtk4-devel', 'cairomm-devel', 'pangomm-devel', 'gdk-pixbuf-devel', 'libepoxy-devel'] checkdepends = ['xserver-xorg-xvfb'] pkgdesc = 'C++ bindings for...
# You must make a copy this file and create private.py in order for these settings to take effect. # Do NOT share or publish your private.py file! Make sure it is included in your .gitignore file. # # To take advantage of failure notifications via email you must have a working Mailgun.com SMTP server. # You can obtain...
mailgun_smtp_login = "Enter your 'Default SMTP Login' From Mailgun Dashboard here" mailgun_default_password = "Enter the 'Default Password' from your Mailgun Dashboard here" notification_address = 'digital@grinnell.edu' passwords = {'digital.grinnell.edu': 'putPasswordHere', 'libweb.grinnell.edu': 'putPasswordHere'}
f=open("input.txt") Input = list(map(int, f.read().split("\n"))) f.close() for a in Input: for b in Input: for c in Input: if(a + b + c == 2020): print(a * b * c)
f = open('input.txt') input = list(map(int, f.read().split('\n'))) f.close() for a in Input: for b in Input: for c in Input: if a + b + c == 2020: print(a * b * c)
class Solution: def findUnsortedSubarray(self, nums: List[int]) -> int: if not nums or len(nums) < 2: return 0 unsorted_min = float('inf') unsorted_max = float('-inf') for i in range(len(nums)): if self.is_unsorted(i, nums): unsorted_min = mi...
class Solution: def find_unsorted_subarray(self, nums: List[int]) -> int: if not nums or len(nums) < 2: return 0 unsorted_min = float('inf') unsorted_max = float('-inf') for i in range(len(nums)): if self.is_unsorted(i, nums): unsorted_min = m...
n_queries = int(input()) for query in range(n_queries): input_ = [int(element) for element in input().split(" ")] a = input_[0] b = input_[1] c = input_[2] # print("\n") # print("a: {} b: {} c: {}".format(a, b, c)) curr_pos = 0 n_jumps = 0 if a == b and c % 2 == 0: curr_po...
n_queries = int(input()) for query in range(n_queries): input_ = [int(element) for element in input().split(' ')] a = input_[0] b = input_[1] c = input_[2] curr_pos = 0 n_jumps = 0 if a == b and c % 2 == 0: curr_pos = 0 elif c % 2 == 0: curr_pos = c // 2 * a - c // 2 * b ...
with open("teste.txt", "w") as arquivo: arquivo.write("Nunca foi tao facil criar um arquivo.") with open("teste.txt", "a") as arquivo: arquivo.write("Teste do A no open, para ver se o append funciona.")
with open('teste.txt', 'w') as arquivo: arquivo.write('Nunca foi tao facil criar um arquivo.') with open('teste.txt', 'a') as arquivo: arquivo.write('Teste do A no open, para ver se o append funciona.')
class ImageList: def __init__(self, images = []): self.images = images print("images list") @property def data(self): return self.images
class Imagelist: def __init__(self, images=[]): self.images = images print('images list') @property def data(self): return self.images
# # PySNMP MIB module H3C-VODIALCONTROL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-VODIALCONTROL-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:24:21 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_size_constraint, value_range_constraint, constraints_intersection) ...
# Manul - Windows utils # ------------------------------------- # Maksim Shudrak <mshudrak@salesforce.com> <mxmssh@gmail.com> # # Copyright 2019 Salesforce.com, inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with...
status_control_c_exit = 3221225786 exception_first_critical_code = 3221225472 exception_last_critical_code = 3225026585
#if we have the list of 5 values we use 3 to fetch the value at 3 #sometimes its better to have a key value pair #we specify 2 things key(immutable,unique) , key data={1:'navin',2:'kiran',4:'harsh'} #when we want to fetch a particular value print(data[4]) #o/p=harsh data.get(1) 'navin' print(data.get(3)) #o/p...
data = {1: 'navin', 2: 'kiran', 4: 'harsh'} print(data[4]) data.get(1) 'navin' print(data.get(3)) data.get(3, 'not found') keys = ['navin', 'kiran', 'harsh'] values = ['python', 'java', 'c++'] data1 = dict(zip(keys, values)) print(data1) data1['monika'] = 'cs' del data['harsh'] prog = {'js': 'atom', 'cs': 'vs', 'python...
if __name__ == "__main__": my_list = [1, 2, 3] your_list = [4, 5, 6, 7] my_list.extend(your_list) print(my_list) print(your_list)
if __name__ == '__main__': my_list = [1, 2, 3] your_list = [4, 5, 6, 7] my_list.extend(your_list) print(my_list) print(your_list)
n = 5 k = 3 max_k = (n * (n - 1)) // 2 if k > max_k: print('Error') exit(1) num_inv = [[0 for _ in range(k)] for _ in range(n)] for k in range(n): num_inv[k][0] = 1 for i in range(1, n): for j in range(k): num_inv[i][j] = sum(num_inv[i - 1][x] for x in range(j))
n = 5 k = 3 max_k = n * (n - 1) // 2 if k > max_k: print('Error') exit(1) num_inv = [[0 for _ in range(k)] for _ in range(n)] for k in range(n): num_inv[k][0] = 1 for i in range(1, n): for j in range(k): num_inv[i][j] = sum((num_inv[i - 1][x] for x in range(j)))
def distance(strand_a, strand_b): if len(strand_a) != len(strand_b): raise ValueError("The strands must be the same length") else: return len([i for i in range(0, len(strand_a)) if strand_a[i] != strand_b[i]])
def distance(strand_a, strand_b): if len(strand_a) != len(strand_b): raise value_error('The strands must be the same length') else: return len([i for i in range(0, len(strand_a)) if strand_a[i] != strand_b[i]])
class Instruction: OP_MIN = 0 OP_MAX = 3 op = None args = [] def __init__(self, encoded): self.instr_encoded = encoded def __repr__(self): strs = [str(x) for x in self.args] return "{} {}".format(self.op, " ".join(strs))
class Instruction: op_min = 0 op_max = 3 op = None args = [] def __init__(self, encoded): self.instr_encoded = encoded def __repr__(self): strs = [str(x) for x in self.args] return '{} {}'.format(self.op, ' '.join(strs))
words = [line.strip().lower() for line in open('words.txt')] def crack1(): print("testing") crack1()
words = [line.strip().lower() for line in open('words.txt')] def crack1(): print('testing') crack1()
n = int(input()) for i in range(n): x, y = [int(x) for x in input().split()] if x > y: x, y = y, x s = 0 for j in range(x+1, y): if j % 2 != 0: s += j print(s)
n = int(input()) for i in range(n): (x, y) = [int(x) for x in input().split()] if x > y: (x, y) = (y, x) s = 0 for j in range(x + 1, y): if j % 2 != 0: s += j print(s)
# # PySNMP MIB module CISCO-WAN-TRAP-VARS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-TRAP-VARS-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:20:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint) ...
# https://leetcode.com/problems/longest-increasing-subsequence/ # Given an integer array nums, return the length of the longest strictly # increasing subsequence. # A subsequence is a sequence that can be derived from an array by deleting some # or no elements without changing the order of the remaining elements. For...
class Solution: def length_of_lis(self, nums: List[int]) -> int: if len(nums) == 1: return 1 n = len(nums) dp = [1] * n for i in range(1, n): for j in range(i): if nums[j] < nums[i]: dp[i] = max(dp[i], dp[j] + 1) re...
# read input values = [] with open('2020/input6.txt') as f: values = f.read().splitlines() sample = ["abc", "", "a", "b", "c", "", "ab", "ac", "", "a", "a", "a", "a", "", "b", ""] #### ALGO #### def parseTable(lines): result = 0 currentSet = set() for line in lines: if line == "": ...
values = [] with open('2020/input6.txt') as f: values = f.read().splitlines() sample = ['abc', '', 'a', 'b', 'c', '', 'ab', 'ac', '', 'a', 'a', 'a', 'a', '', 'b', ''] def parse_table(lines): result = 0 current_set = set() for line in lines: if line == '': result += len(currentSet) ...
NAME = 'debug.py' ORIGINAL_AUTHORS = [ 'Abdur-Rahmaan Janhangeer, pythonmembers.club' ] ABOUT = ''' prints all parameters passed to bot ''' COMMANDS = ''' >>> .debug prints some parameters ''' WEBSITE = ''
name = 'debug.py' original_authors = ['Abdur-Rahmaan Janhangeer, pythonmembers.club'] about = '\nprints all parameters passed to bot\n' commands = '\n>>> .debug\nprints some parameters\n' website = ''
#!/usr/bin/python3.4 ''' A change to `local_bad_scope.py` avoiding any error by passing a parameter ''' def main(): x = 3 f(x) def f(whatever): print(whatever) # error: f doesn't know about the x defined in main main()
""" A change to `local_bad_scope.py` avoiding any error by passing a parameter """ def main(): x = 3 f(x) def f(whatever): print(whatever) main()
#! /usr/bin/env python3 # Manuel Ruvalcaba # Theory of Operating Systems # Shell lab # This lab is a mini-shell that is supposed to mimic bash shell def hasPipes(args): if '|' in args: return True return False def splitCommand(args): # Splits the commands at the pipe and returns it l...
def has_pipes(args): if '|' in args: return True return False def split_command(args): left_arg = [] right_arg = [] for i in range(len(args)): if args[i] == '|': left_arg = args[:i] right_arg = args[i + 1:] break return (leftArg, rightArg) de...
a = int(input()) b = int(input()) sum = 0 j = 0 for i in range(a, b+1): if i % 3 == 0: sum += i j += 1 print(sum/j)
a = int(input()) b = int(input()) sum = 0 j = 0 for i in range(a, b + 1): if i % 3 == 0: sum += i j += 1 print(sum / j)
class PaymentException(Exception): def __init__(self, message): self.message = message class PaymentFailedException(PaymentException): pass
class Paymentexception(Exception): def __init__(self, message): self.message = message class Paymentfailedexception(PaymentException): pass
class Utils(): def __init__(self): self._gc = GlobalContext(); self.c = PyV8.JSContext(self._gc); self.c.enter(); self.c.eval(xlsjscode); self._utils = self.c.locals['XLS'].utils; def csvify(self, sheet): return self._utils.sheet_to_csv(sheet.ws if isinstance(sheet, XLSSheet) else sheet);
class Utils: def __init__(self): self._gc = global_context() self.c = PyV8.JSContext(self._gc) self.c.enter() self.c.eval(xlsjscode) self._utils = self.c.locals['XLS'].utils def csvify(self, sheet): return self._utils.sheet_to_csv(sheet.ws if isinstance(sheet, X...
print('something') # After you changed something, your code can produce an error down-the-line, # which you did not anticipate. To avoid these kind of errors, you do unit-testing # unit testing is to check if you code still works for the entire # input variable range. a = 1 assert type(a) == int # not yet unit...
print('something') a = 1 assert type(a) == int def sum(a, b): assert type(a) == int, 'b is not an int' assert type(b) == int, 'b is not an int' return a + b sum(4, '5') def awesome_function(): print('Do some heavy calculation') return 42
QUICK_DRAWING_NAMES = [ "aircraft carrier", "airplane", "alarm clock", "ambulance", "angel", "animal migration", "ant", "anvil", "apple", "arm", "asparagus", "axe", "backpack", "banana", "bandage", "barn", "baseball bat", "baseball", "basket", ...
quick_drawing_names = ['aircraft carrier', 'airplane', 'alarm clock', 'ambulance', 'angel', 'animal migration', 'ant', 'anvil', 'apple', 'arm', 'asparagus', 'axe', 'backpack', 'banana', 'bandage', 'barn', 'baseball bat', 'baseball', 'basket', 'basketball', 'bat', 'bathtub', 'beach', 'bear', 'beard', 'bed', 'bee', 'belt...
j = Job(application=DaVinci(version='v41r2')) j.backend = Dirac() j.name = 'First ganga job' j.inputdata = j.application.readInputData(( 'data/' 'MC_2012_27163003_Beam4000GeV2012MagDownNu2.5' 'Pythia8_Sim08e_Digi13_' 'Trig0x409f0045_Reco14a_Stripping20NoPrescalingFlagged_' 'ALLSTREAMS.DST.py' )) j.a...
j = job(application=da_vinci(version='v41r2')) j.backend = dirac() j.name = 'First ganga job' j.inputdata = j.application.readInputData('data/MC_2012_27163003_Beam4000GeV2012MagDownNu2.5Pythia8_Sim08e_Digi13_Trig0x409f0045_Reco14a_Stripping20NoPrescalingFlagged_ALLSTREAMS.DST.py') j.application.optsfile = 'code/11-davi...
fabonacci_cache = {0: 0, 1: 1} def fabonacci(value: int) -> int: if value <= 1: return fabonacci_cache[value] else: # f(2) = f(1) + f(0) // 1 + 0 = 1 # f(3) = f(2) + f(1) // 1 + 1 = 2 # f(4) = f(3) + f(2) // 2 + 1 = 3 for i in range(2, value + 1): try: ...
fabonacci_cache = {0: 0, 1: 1} def fabonacci(value: int) -> int: if value <= 1: return fabonacci_cache[value] else: for i in range(2, value + 1): try: fabonacci_cache[i] except KeyError: new_value = fabonacci(i - 1) + fabonacci(i - 2) ...
# Jika file berada pada direktori # yang sama dengan program myfile = open('myfile.txt') # Jika file berada pada direktori yang # berbeda dengan program myfile = open('D:/Python/myfile.txt')
myfile = open('myfile.txt') myfile = open('D:/Python/myfile.txt')
class BaseEvent(object): def __init__(self, fields, event_name="Event", key_fields=(), recguid=None): self.recguid = recguid self.name = event_name self.fields = list(fields) self.field2content = {f: None for f in fields} self.nonempty_count = 0 self.nonempty_ratio = ...
class Baseevent(object): def __init__(self, fields, event_name='Event', key_fields=(), recguid=None): self.recguid = recguid self.name = event_name self.fields = list(fields) self.field2content = {f: None for f in fields} self.nonempty_count = 0 self.nonempty_ratio =...
# -*- coding: utf-8 -*- keymap_keyword = '(?:LAYOUT)' layout_editor_json = { 'default': 'keyboards/lily58/layout_editor/default.json', } ascii_art = { 'default': ''' /* ,-----------------------------------------. ,-----------------------------------------. * |{ }|{ }|{ }|{ }|{ }...
keymap_keyword = '(?:LAYOUT)' layout_editor_json = {'default': 'keyboards/lily58/layout_editor/default.json'} ascii_art = {'default': "\n/* ,-----------------------------------------. ,-----------------------------------------.\n * |{ }|{ }|{ }|{ }|{ }|{ }| |{ ...
# BUILD FILE SYNTAX: SKYLARK SE_VERSION = '3.14.0'
se_version = '3.14.0'
# Copyright 2010-2014, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and ...
{'variables': {'relative_dir': 'android', 'adt_gen_dir': 'gen_for_adt', 'adt_protobuf_gen_dir': 'protobuf/gen_for_adt', 'sdk_gen_dir': 'gen', 'sdk_protobuf_gen_dir': 'protobuf/gen', 'wrapper_path': '<(DEPTH)/build_tools/protoc_wrapper.py', 'protoc_command': 'protoc<(EXECUTABLE_SUFFIX)', 'additional_inputs': ['<(PRODUCT...
SUCCES_GIF = [ "https://media.tenor.com/images/f39f775227250c05070baa7d6151e8dc/tenor.gif", "https://media.tenor.com/images/baa1b555e5c312ea6917c4187a91a44f/tenor.gif" ] FAIL_GIF = [ "https://media.giphy.com/media/PtHRRJQsr0HaU/giphy.gif", "https://media.giphy.com/media/10KJjcguH0t7ji/giphy.gif", "...
succes_gif = ['https://media.tenor.com/images/f39f775227250c05070baa7d6151e8dc/tenor.gif', 'https://media.tenor.com/images/baa1b555e5c312ea6917c4187a91a44f/tenor.gif'] fail_gif = ['https://media.giphy.com/media/PtHRRJQsr0HaU/giphy.gif', 'https://media.giphy.com/media/10KJjcguH0t7ji/giphy.gif', 'https://media.giphy.com/...
a=int(input()) b=int(input()) m=int(input()) s=a**b print(int(s)) print(int(s%m))
a = int(input()) b = int(input()) m = int(input()) s = a ** b print(int(s)) print(int(s % m))
def _is_staging(job): job_desc = native.existing_rule(job + "-staging") job_subs = job_desc["substitutions"] is_bazel = "PROJECT_NAME" in job_subs is_gerrit = "GERRIT_PROJECT" in job_subs and job_subs["GERRIT_PROJECT"] != "" # Take job with Gerrit review, or jobs that are not bazel jovbs is_gerrit_or_not_ba...
def _is_staging(job): job_desc = native.existing_rule(job + '-staging') job_subs = job_desc['substitutions'] is_bazel = 'PROJECT_NAME' in job_subs is_gerrit = 'GERRIT_PROJECT' in job_subs and job_subs['GERRIT_PROJECT'] != '' is_gerrit_or_not_bazel = is_gerrit or not is_bazel is_gold = job in ['T...
# Copyright (c) 2018, WSO2 Inc. (http://wso2.com) 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 ap...
zip_file_extension = '.zip' carbon_name = 'carbon.zip' value_tag = '{http://maven.apache.org/POM/4.0.0}value' surface_plugin_artifact_id = 'maven-surefire-plugin' datasource_paths = {'product-apim': ['repository/conf/datasources/master-datasources.xml', 'repository/conf/datasources/metrics-datasources.xml'], 'product-i...
def process_load(npyImage, objSettings): objCommon['fltFocal'] = 1024 / 2.0 objCommon['fltBaseline'] = 40.0 objCommon['intWidth'] = npyImage.shape[1] objCommon['intHeight'] = npyImage.shape[0] tenImage = torch.FloatTensor(numpy.ascontiguousarray(npyImage.transpose(2, 0, 1)[None, :, :, :].astype(numpy.float32) * (...
def process_load(npyImage, objSettings): objCommon['fltFocal'] = 1024 / 2.0 objCommon['fltBaseline'] = 40.0 objCommon['intWidth'] = npyImage.shape[1] objCommon['intHeight'] = npyImage.shape[0] ten_image = torch.FloatTensor(numpy.ascontiguousarray(npyImage.transpose(2, 0, 1)[None, :, :, :].astype(num...
class User: def __init__(self, discord_id): self.discord_id = discord_id self.session = None
class User: def __init__(self, discord_id): self.discord_id = discord_id self.session = None
# Compute mean of noise-corrupted data X_noisy_mean = np.mean(X_noisy, 0) # Project onto the original basis vectors projX_noisy = np.matmul(X_noisy - X_noisy_mean, evectors) # Reconstruct the data using the top 50 components X_reconstructed = reconstruct_data(projX_noisy, evectors, X_noisy_mean, 50) # Visualize wit...
x_noisy_mean = np.mean(X_noisy, 0) proj_x_noisy = np.matmul(X_noisy - X_noisy_mean, evectors) x_reconstructed = reconstruct_data(projX_noisy, evectors, X_noisy_mean, 50) with plt.xkcd(): plot_mnist_reconstruction(X_noisy, X_reconstructed)
x = [0.0, 3.0, 5.0, 2.5, 3.7] print(type(x)) #remove third element x.pop(2) print(x) #remove the element equal to 2.5 x.remove(2.5) print(x) #add an element to the end x.append(1.2) print(x) #add a copy y=x.copy() print(y) #how many elements are 0.0 print(y.count(0.0)) #print index with value 3.7 print(y.index...
x = [0.0, 3.0, 5.0, 2.5, 3.7] print(type(x)) x.pop(2) print(x) x.remove(2.5) print(x) x.append(1.2) print(x) y = x.copy() print(y) print(y.count(0.0)) print(y.index(3.7)) y.sort() print(y) y.reverse() print(y) y.clear() print(y)
name = input("Choose you name: " ) print("Welcome", name, "I was waiting for you... let's start!!!") ans = None questions = {"Everyone can open it, but no one can close it what's that?": [ "egg", "Well done you find the first solution... Let's move to the next one...", ], "Is huge, massive and dark wh...
name = input('Choose you name: ') print('Welcome', name, "I was waiting for you... let's start!!!") ans = None questions = {"Everyone can open it, but no one can close it what's that?": ['egg', "Well done you find the first solution... Let's move to the next one..."], "Is huge, massive and dark what's that?": ['univers...
# Copyright (c) 2014 University of California, Davis # # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify,...
rcc5 = {} rcc5['disjoint'] = 1 << 0 rcc5['is_included_in'] = 1 << 1 rcc5['equals'] = 1 << 2 rcc5['includes'] = 1 << 3 rcc5['overlaps'] = 1 << 4 rcc5['"!"'] = 1 << 0 rcc5['"<"'] = 1 << 1 rcc5['"="'] = 1 << 2 rcc5['">"'] = 1 << 3 rcc5['"><"'] = 1 << 4 rcc5['!'] = 1 << 0 rcc5['<'] = 1 << 1 rcc5['='] = 1 << 2 rcc5['>'] = 1...
expected_output = { "vrf": { "VRF1": { "interface": { "GigabitEthernet2": { "query_max_response_time": 16, "enable": True, "query_interval": 366, "querier": "FE80::5054:FF:FEDD:BB49", ...
expected_output = {'vrf': {'VRF1': {'interface': {'GigabitEthernet2': {'query_max_response_time': 16, 'enable': True, 'query_interval': 366, 'querier': 'FE80::5054:FF:FEDD:BB49', 'interface_status': 'up', 'query_this_system': True, 'version': 2, 'interface_adress': 'FE80::5054:FF:FEDD:BB49/10', 'active_groups': 0, 'que...
def get_common_ports(c1, c2): if c1 == c2: return c1 elif c1[0] == c2[0] or c1[0] == c2[1]: return c1[0] elif c1[1] == c2[0] or c1[1] == c2[1]: return c1[1] else: return None with open("day24_input") as infile: components = [[int(x) for x in line.split('/')] for line...
def get_common_ports(c1, c2): if c1 == c2: return c1 elif c1[0] == c2[0] or c1[0] == c2[1]: return c1[0] elif c1[1] == c2[0] or c1[1] == c2[1]: return c1[1] else: return None with open('day24_input') as infile: components = [[int(x) for x in line.split('/')] for line ...
# function for removing common characters # with their respective occurrences def remove_match_char(list1, list2): for i in range(len(list1)) : for j in range(len(list2)) : # if common character is found # then remove that character # and return list of concatenated # list with Ture F...
def remove_match_char(list1, list2): for i in range(len(list1)): for j in range(len(list2)): if list1[i] == list2[j]: c = list1[i] list1.remove(c) list2.remove(c) list3 = list1 + ['*'] + list2 return [list3, True] ...
''' Engine enumerations exposed to Python, along with a base enum class that adds a reverse mapping (value-to-name) API. ''' class EnumMeta(type): '''Used by Enum class''' def __new__(metaclass, name, bases, dct): # Create an inverse mapping of values to name - note that in the case of multiple names m...
""" Engine enumerations exposed to Python, along with a base enum class that adds a reverse mapping (value-to-name) API. """ class Enummeta(type): """Used by Enum class""" def __new__(metaclass, name, bases, dct): inverse = {} for (k, v) in dct.items(): if type(v) is int: ...
class Progression: def __init__(self, start=0): self._current = start def _advance(self): self._current += 1 def __next__(self): if self._current is None: raise StopIteration() else: answer = self._current self._advance() ret...
class Progression: def __init__(self, start=0): self._current = start def _advance(self): self._current += 1 def __next__(self): if self._current is None: raise stop_iteration() else: answer = self._current self._advance() re...
def input_matrix(stop_word): matrix = [] while True: row = input() if row == stop_word: break matrix.append([int(x) for x in row.split()]) return matrix def matrix_to_str(matrix): s = '' for row in matrix: for elem in row: s += (str(elem) + ...
def input_matrix(stop_word): matrix = [] while True: row = input() if row == stop_word: break matrix.append([int(x) for x in row.split()]) return matrix def matrix_to_str(matrix): s = '' for row in matrix: for elem in row: s += str(elem) + ' '...
def prefill(n, v=None): try: return [v] * int(n) except (TypeError, ValueError): raise TypeError('{} is invalid'.format(n))
def prefill(n, v=None): try: return [v] * int(n) except (TypeError, ValueError): raise type_error('{} is invalid'.format(n))
Scale.default = Scale.minor Root.default = 0 Clock.bpm = 110 print(Scale.names()) print(SynthDefs) print(Player.get_attributes()) print(Pattern.get_methods()) print(BufferManager()) print(Clock.playing) var.chords = [0,5,0,3,0,5,0,4] ~s1 >> zap(var.chords, dur=8, sus=12, oct=(2,3), amp=1, room=1, mix=.5, coarse=4).sp...
Scale.default = Scale.minor Root.default = 0 Clock.bpm = 110 print(Scale.names()) print(SynthDefs) print(Player.get_attributes()) print(Pattern.get_methods()) print(buffer_manager()) print(Clock.playing) var.chords = [0, 5, 0, 3, 0, 5, 0, 4] ~s1 >> zap(var.chords, dur=8, sus=12, oct=(2, 3), amp=1, room=1, mix=0.5, coar...
class Solution: def minSkips(self, dist: List[int], speed: int, hoursBefore: int) -> int: kInf = 10**7 kEps = 1e-9 n = len(dist) # dp[i][j] := min time w/ prev i-th road and j skips dp = [[kInf] * (n + 1) for _ in range(n + 1)] dp[0][0] = 0 for i, d in enumerate(dist, 1): dp[i][0] =...
class Solution: def min_skips(self, dist: List[int], speed: int, hoursBefore: int) -> int: k_inf = 10 ** 7 k_eps = 1e-09 n = len(dist) dp = [[kInf] * (n + 1) for _ in range(n + 1)] dp[0][0] = 0 for (i, d) in enumerate(dist, 1): dp[i][0] = ceil(dp[i - 1][0...
#!/usr/bin/env python3 def initlog(*args): pass # Remember to implement this! class MyEmptyClass: pass if __name__ == "__main__": # This will cause a busy wait # while True: # pass pass
def initlog(*args): pass class Myemptyclass: pass if __name__ == '__main__': pass
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # @author jsbxyyx # @since 1.0 class SQLRecognizer(object): def get_sql_type(self): raise NotImplemented("need subclass implemented") def get_table_alias(self): raise NotImplemented("need subclass implemented") def get_table_name(self): ...
class Sqlrecognizer(object): def get_sql_type(self): raise not_implemented('need subclass implemented') def get_table_alias(self): raise not_implemented('need subclass implemented') def get_table_name(self): raise not_implemented('need subclass implemented') def get_original_...
# generated from nem_mosaics.py.mako # do not edit manually! mosaics = [ { "name": "NEM", "ticker": " XEM", "namespace": "nem", "mosaic": "xem", "divisibility": 6, }, { "name": "DIMCOIN", "ticker": " DIM", "namespace": "dim", "mosaic":...
mosaics = [{'name': 'NEM', 'ticker': ' XEM', 'namespace': 'nem', 'mosaic': 'xem', 'divisibility': 6}, {'name': 'DIMCOIN', 'ticker': ' DIM', 'namespace': 'dim', 'mosaic': 'coin', 'divisibility': 6, 'levy': 'MosaicLevy_Percentile', 'fee': 10, 'levy_namespace': 'dim', 'levy_mosaic': 'coin', 'networks': [104]}, {'name': 'D...
#!/usr/bin/python3 class LogLevel(object): CRITICAL = 'critical' ERROR = 'error' WARNING = 'warning' INFO = 'info' DEBUG = 'debug'
class Loglevel(object): critical = 'critical' error = 'error' warning = 'warning' info = 'info' debug = 'debug'
l1 = [1, 2, 3, 4, 5, 6, 11, 12, 13] l2 = [6, 7, 8, 9, 0] l3 = zip(l1, l2) l3 = list(l3) print(l3) temp = max(len(l1), len(l2)) print(temp) for r in range(len(l3), temp): print(r) l3.append(('', l1[r])) print(l3)
l1 = [1, 2, 3, 4, 5, 6, 11, 12, 13] l2 = [6, 7, 8, 9, 0] l3 = zip(l1, l2) l3 = list(l3) print(l3) temp = max(len(l1), len(l2)) print(temp) for r in range(len(l3), temp): print(r) l3.append(('', l1[r])) print(l3)
expected_output = { 'lisp_id': { 0: { 'prefix_list_name': { 'site1': { 'number_of_entries': 4, 'users': [{ 'itr_map_resolver': '100.100.100.100' }, { 'itr_map_resolver': '4...
expected_output = {'lisp_id': {0: {'prefix_list_name': {'site1': {'number_of_entries': 4, 'users': [{'itr_map_resolver': '100.100.100.100'}, {'itr_map_resolver': '44.44.44.44'}, {'etr_map_server': '100.100.100.100'}, {'etr_map_server': '44.44.44.44'}, {'itr_map_resolver': '100.100.100.100'}, {'itr_map_resolver': '44.44...
num = 1 num2 = 3 num5 = 154641233121
num = 1 num2 = 3 num5 = 154641233121
class Group: def __init__(self, request, id): self.groupId = id self._requests = request.request def getGroup(self): url = f'https://groups.roblox.com/v1/groups/{self.groupId}' results = json.loads(self._request(url=url, method='GET')) return results def getGroupRo...
class Group: def __init__(self, request, id): self.groupId = id self._requests = request.request def get_group(self): url = f'https://groups.roblox.com/v1/groups/{self.groupId}' results = json.loads(self._request(url=url, method='GET')) return results def get_group...
class Manager: def __init__(self): self.showcase = dict() def register(self, name, proto): self.showcase[name] = proto def create(self, proto_name): p = self.showcase.get(proto_name) return p.create_clone()
class Manager: def __init__(self): self.showcase = dict() def register(self, name, proto): self.showcase[name] = proto def create(self, proto_name): p = self.showcase.get(proto_name) return p.create_clone()
coefficients = [ 0.363445176, 0.988622465, 4.777114035, -0.114037667, -8.50208e-4, - 2.0716198e-2, 6.87678e-4, 2.74954e-4, 0 ]
coefficients = [0.363445176, 0.988622465, 4.777114035, -0.114037667, -0.000850208, -0.020716198, 0.000687678, 0.000274954, 0]
#table of 2 n=10 for i in range(n): print((i+1)*2 ,"," , end="") #-9 # n = 10 for i in range(n): print((i + 1) * (-9), ",", end="") #table of -10 n = 10 for i in range(n): print((i+1)*(.2),",", end="") n=10 for i in range(n): print((i+1)*(-9), ",", end="")
n = 10 for i in range(n): print((i + 1) * 2, ',', end='') for i in range(n): print((i + 1) * -9, ',', end='') n = 10 for i in range(n): print((i + 1) * 0.2, ',', end='') n = 10 for i in range(n): print((i + 1) * -9, ',', end='')
speed=50 is_birthday=True if is_birthday: if speed < 5* 31: print("no ticket") elif speed > 5* 30: print("small ticket")
speed = 50 is_birthday = True if is_birthday: if speed < 5 * 31: print('no ticket') elif speed > 5 * 30: print('small ticket')
def create_sequence(n): if n == 0: print(0) seq = [0 , 1] for i in range(2 , n + 1): seq.append(seq[i - 2] + seq[i - 1]) print(' '.join(str(x) for x in seq)) def locate(number): x, y = 0, 1 while x < number: x , y = y , x + y if x == number: print('Number fo...
def create_sequence(n): if n == 0: print(0) seq = [0, 1] for i in range(2, n + 1): seq.append(seq[i - 2] + seq[i - 1]) print(' '.join((str(x) for x in seq))) def locate(number): (x, y) = (0, 1) while x < number: (x, y) = (y, x + y) if x == number: print('Numb...
def real(valor): return f'R$ {valor:.2f}'.replace('.',',')
def real(valor): return f'R$ {valor:.2f}'.replace('.', ',')
num=int(input("Enter a number :")) i=1 fact=1 while i<=num: fact=fact*i i+=1 print ("Factorial of ", num ,"is ", fact) # second method using range # fact =1 # for i in range(1,num+1): # fact=fact*i # i+=1 # print (fact)
num = int(input('Enter a number :')) i = 1 fact = 1 while i <= num: fact = fact * i i += 1 print('Factorial of ', num, 'is ', fact)
# ADDRESS = 'ws://127.0.0.1:8080/ws' ADDRESS = 'wss://api.bounder.io/ws' # PIXHAWK_ADDRESS = "127.0.0.1:14550" PIXHAWK_ADDRESS = "192.168.1.137:14550" SEND_DELAY = 0.3
address = 'wss://api.bounder.io/ws' pixhawk_address = '192.168.1.137:14550' send_delay = 0.3
rank1 = '23456789TJQKA' rank2 = 'A23456789TJQK' def flush(a, b, c, d, e): # a, b, c, d, e = input().split() # they are not same suit if not (a[1] == b[1] and b[1] == c[1] and c[1] == d[1] and \ d[1] == e[1]): return 'NO' lst = [] lst.append(a[0]) lst.append(b[0]) lst.appe...
rank1 = '23456789TJQKA' rank2 = 'A23456789TJQK' def flush(a, b, c, d, e): if not (a[1] == b[1] and b[1] == c[1] and (c[1] == d[1]) and (d[1] == e[1])): return 'NO' lst = [] lst.append(a[0]) lst.append(b[0]) lst.append(c[0]) lst.append(d[0]) lst.append(e[0]) has_a = False if ...
def create_segment_tree(input): size = next_power_of_2(len(input)); segment_tree = [0 for x in range(2*size - 1)] construct_tree(segment_tree, input, 0, len(input) - 1, 0) return segment_tree def construct_tree(segment_tree, input, low, high, pos): if low == high: segment_tree[pos] = input[...
def create_segment_tree(input): size = next_power_of_2(len(input)) segment_tree = [0 for x in range(2 * size - 1)] construct_tree(segment_tree, input, 0, len(input) - 1, 0) return segment_tree def construct_tree(segment_tree, input, low, high, pos): if low == high: segment_tree[pos] = input...
STATE_DICT_DELIMETER = '.' FLAMBE_SOURCE_KEY = '_flambe_source' FLAMBE_CLASS_KEY = '_flambe_class' FLAMBE_CONFIG_KEY = '_flambe_config' FLAMBE_DIRECTORIES_KEY = '_flambe_directories' FLAMBE_STASH_KEY = '_flambe_stash' KEEP_VARS_KEY = 'keep_vars' VERSION_KEY = '_flambe_version' HIGHEST_SERIALIZATION_PROTOCOL_VERSION = 1...
state_dict_delimeter = '.' flambe_source_key = '_flambe_source' flambe_class_key = '_flambe_class' flambe_config_key = '_flambe_config' flambe_directories_key = '_flambe_directories' flambe_stash_key = '_flambe_stash' keep_vars_key = 'keep_vars' version_key = '_flambe_version' highest_serialization_protocol_version = 1...
def test_address_on_home_page(app): # we will do the test for one contact so we write index 0 = [0] contact_from_home_page = app.contact.get_contact_list()[0] # now we will get contact info from edit page with index 0 as well contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0) as...
def test_address_on_home_page(app): contact_from_home_page = app.contact.get_contact_list()[0] contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0) assert contact_from_home_page.address == contact_from_edit_page.address def test_lastname_on_home_page(app): contact_from_home_page = ap...
## SAIAPR # Here I go via the original feature file. I only use this to get # at the filenames and the region numbers.. featmat = scipy.io.loadmat('../Data/Images/SAIAPR/saiapr_features.mat') X = featmat['X'] # get all the bounding boxes for SAIAPR regions checked = {} outrows = [] this_corpus = icorpus_code['saiapr...
featmat = scipy.io.loadmat('../Data/Images/SAIAPR/saiapr_features.mat') x = featmat['X'] checked = {} outrows = [] this_corpus = icorpus_code['saiapr'] for (n, row) in tqdm(enumerate(X)): this_image_id = int(row[0]) this_region_id = int(row[1]) this_category = int(row[-1]) if checked.get(this_image_id) ...
# 18. Write a program to find the sum of the even and # odd digits of the number which is given as input. # (e.g 5624 evenPlaceSum=5+2=7 oddPlaceSum = 6+4=10) number = int(input("Enter a number:")) print("Number is", number) digit_array = list(map(int, list(str(number)))) print("Digits are", digit_array) even_digit...
number = int(input('Enter a number:')) print('Number is', number) digit_array = list(map(int, list(str(number)))) print('Digits are', digit_array) even_digit = digit_array[0::2] odd_digit = digit_array[1::2] print('Even Place Digits are', even_digit) print('Odd Place Digits are', odd_digit) print('Even place sum=', sum...
# Here you can get some practice creating and naming lists and dictionaries. These are very important and you will use them often in any language. # https://www.w3schools.com/python/python_lists.asp here is the link to the W3 wchools list page. It will help # Example of a list game_consoles_list = ['Xbox', 'Playatatio...
nums_list = [1, 2, 3, 4, 5, 67, 8, 89, 4, 343434, 56] cars_list = ['Volvo', 'Porsche', 'BMW', 'Pagani', 'Chrysler', 'Dodge', 'Jeep']
class BasePageObject(object): def __init__(self, browser, logger): self.browser = browser self.logger = logger
class Basepageobject(object): def __init__(self, browser, logger): self.browser = browser self.logger = logger
#!/usr/bin/env python3 # Day 26: Contiguous Array # # Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. # This is the same problem as April Challenge Day 13 class Solution: def findMaxLength(self, nums: [int]) -> int: counts = {0: -1} longest = 0 ...
class Solution: def find_max_length(self, nums: [int]) -> int: counts = {0: -1} longest = 0 count = 0 for i in range(len(nums)): count += -1 if nums[i] == 0 else 1 if count not in counts: counts[count] = i else: lon...
class Solution: def solveNQueens(self, n): res = [] def dfs(i, l, r, m, arr): if i == n: res.append(arr) else: l = l[1:] + [0] r = [0] + r[:-1] for j in range(n): if m[j] == l[j] == r[j] == 0:...
class Solution: def solve_n_queens(self, n): res = [] def dfs(i, l, r, m, arr): if i == n: res.append(arr) else: l = l[1:] + [0] r = [0] + r[:-1] for j in range(n): if m[j] == l[j] == r[j] =...
def inputNumber(prompt): while True: try: number = float(input(prompt)) break except ValueError: print('Please, provide a correct input value') pass return number
def input_number(prompt): while True: try: number = float(input(prompt)) break except ValueError: print('Please, provide a correct input value') pass return number
def no_return(): print("I am about to raise an exception") raise Exception("This is always raised") print("This line will never execute") return "I won't be returned" def call_exceptor(): print("call_exceptor starts here...") no_return() print("an exception was raised...") print("...so...
def no_return(): print('I am about to raise an exception') raise exception('This is always raised') print('This line will never execute') return "I won't be returned" def call_exceptor(): print('call_exceptor starts here...') no_return() print('an exception was raised...') print("...so ...
class Constants: PAD = "<pad>" START = "<s>" END = "</s>" UNK = "<unk>" PAD_I = 0 START_I = 1 END_I = 2 UNK_I = 3
class Constants: pad = '<pad>' start = '<s>' end = '</s>' unk = '<unk>' pad_i = 0 start_i = 1 end_i = 2 unk_i = 3
user_to_add = [ ("user1@gmail.com", "user1", "user1", 10), ("oscar@gmail.com", "oscar", "oscar", 40), ("oscar@gmail.com", "oscar", "oscar", 50), ("user2@gmail.com", "user2", "user2", 20), ("user3@gmail.com", "user3", "user3", 30), ] WEB = [ {"url":"page1.htm", "desc":"this page con...
user_to_add = [('user1@gmail.com', 'user1', 'user1', 10), ('oscar@gmail.com', 'oscar', 'oscar', 40), ('oscar@gmail.com', 'oscar', 'oscar', 50), ('user2@gmail.com', 'user2', 'user2', 20), ('user3@gmail.com', 'user3', 'user3', 30)] web = [{'url': 'page1.htm', 'desc': 'this page contains data about math'}, {'url': 'page2....
class Grader: @staticmethod def grade_item(grade): if(grade < 60 ): return "F" elif(grade > 59 and grade < 70 ): return "D" elif(grade > 69 and grade < 80 ): return "C" elif(grade > 79 and grade < 90 ): return "B" elif(grade...
class Grader: @staticmethod def grade_item(grade): if grade < 60: return 'F' elif grade > 59 and grade < 70: return 'D' elif grade > 69 and grade < 80: return 'C' elif grade > 79 and grade < 90: return 'B' elif grade > 89: ...
description = 'Selector Tower Movement' group = 'lowlevel' tango_base = 'tango://sans1hw.sans1.frm2:10000/sans1/' devices = dict( selector_ng_ax = device('nicos.devices.generic.Axis', description = 'selector neutron guide axis', motor = 'selector_ng_mot', coder = 'selector_ng_enc', ...
description = 'Selector Tower Movement' group = 'lowlevel' tango_base = 'tango://sans1hw.sans1.frm2:10000/sans1/' devices = dict(selector_ng_ax=device('nicos.devices.generic.Axis', description='selector neutron guide axis', motor='selector_ng_mot', coder='selector_ng_enc', precision=0.1, fmtstr='%.2f', maxage=120, poll...
''' Language: Python ID: 10163 QLink: https://quera.org/problemset/10163/ Author: AmirZoyber ''' abc = list(map(int,input().split())) sf = list(map(int,input().split())) sn = list(map(int,input().split())) sd = list(map(int,input().split())) arr=[] for i in (sf[0],sn[0],sd[0]): # False = means in <-- ar...
""" Language: Python ID: 10163 QLink: https://quera.org/problemset/10163/ Author: AmirZoyber """ abc = list(map(int, input().split())) sf = list(map(int, input().split())) sn = list(map(int, input().split())) sd = list(map(int, input().split())) arr = [] for i in (sf[0], sn[0], sd[0]): arr.append((i, False)) for i ...
# this is for historical pickle deserilaization, it is not used otherwise def _get_thnn_function_backend(): pass
def _get_thnn_function_backend(): pass
class Solution: def convertToTitle(self, num): ls = [] while num: num, i = divmod(num, 26) if i == 0 and num > 0: num -= 1 i = 26 ls.append(chr(ord("A") - 1 + i)) return "".join(reversed(ls))
class Solution: def convert_to_title(self, num): ls = [] while num: (num, i) = divmod(num, 26) if i == 0 and num > 0: num -= 1 i = 26 ls.append(chr(ord('A') - 1 + i)) return ''.join(reversed(ls))
# This algorithm search the minimum path from one node to another # # Input: nodes & init & distances. # Nodes is basically the graph, init is the node you are using as the initial point and the distances are all the # values between nodes. # # Output: visited, distances # visited is the nodes you visited with th...
def dijkstra(nodes, init, distances): unvisited = {node: None for node in nodes} visited = {} current = init current_distance = 0 unvisited[current] = currentDistance while True: for (neighbour, distance) in distances[current].items(): if neighbour not in unvisited: ...
# pylint: skip-file # flake8: noqa # pylint: disable=too-many-arguments class OCConfigMap(OpenShiftCLI): ''' Openshift ConfigMap Class ConfigMaps are a way to store data inside of objects ''' def __init__(self, name, from_file, from_literal, ...
class Occonfigmap(OpenShiftCLI): """ Openshift ConfigMap Class ConfigMaps are a way to store data inside of objects """ def __init__(self, name, from_file, from_literal, state, namespace, kubeconfig='/etc/origin/master/admin.kubeconfig', verbose=False): """ Constructor for OpenshiftOC """ ...
def numbers(): mylist = [] for i in range(1,30): if i % 3 == 0: mylist.append("Fizz") elif i % 5 == 0: mylist.append("Bizz") else: mylist.append(i) return mylist print(numbers())
def numbers(): mylist = [] for i in range(1, 30): if i % 3 == 0: mylist.append('Fizz') elif i % 5 == 0: mylist.append('Bizz') else: mylist.append(i) return mylist print(numbers())
# Write your code here n = int(input()) l = list(map(int,input().split())) odd = [] even = [] for i in range(n) : if(l[i] % 2 == 0) : even.append(l[i]) else : odd.append(l[i]) odd.sort() even.sort() for i in even : print(i,end = " ") print(sum(even),end = " ") for i in odd : print(i,...
n = int(input()) l = list(map(int, input().split())) odd = [] even = [] for i in range(n): if l[i] % 2 == 0: even.append(l[i]) else: odd.append(l[i]) odd.sort() even.sort() for i in even: print(i, end=' ') print(sum(even), end=' ') for i in odd: print(i, end=' ') print(sum(odd), end=' ')