content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#analysis function for three level game def stat_analysis(c1,c2,c3): #ask question for viewing analysis of game analysis=input('\nDo you want to see your game analysis? (Yes/No) ') if analysis=='Yes': levels=['Level 1','Level 2','Level 3'] #calculating the score of levels l...
def stat_analysis(c1, c2, c3): analysis = input('\nDo you want to see your game analysis? (Yes/No) ') if analysis == 'Yes': levels = ['Level 1', 'Level 2', 'Level 3'] l1_score = c1 * 10 l2_score = c2 * 10 l3_score = c3 * 10 level_score = [l1_score, l2_score, l3_score] ...
#!/usr/bin/env python3 def date_time(time): months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] hour, minute = int(time[11:13]), int(time[14:16]) return f"{int(time[0:2])} {months[int(time[3:5])-1]} {time[6:10]} year {h...
def date_time(time): months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] (hour, minute) = (int(time[11:13]), int(time[14:16])) return f"{int(time[0:2])} {months[int(time[3:5]) - 1]} {time[6:10]} year {hour} hour{('s' if hour != ...
item1='phone' item1_price = 100 item1_quantity = 5 item1_price_total = item1_price * item1_quantity print(type(item1)) # str print(type(item1_price)) # int print(type(item1_quantity)) # int print(type(item1_price_total)) # int # output: # <class 'str'> # <class 'int'> # ...
item1 = 'phone' item1_price = 100 item1_quantity = 5 item1_price_total = item1_price * item1_quantity print(type(item1)) print(type(item1_price)) print(type(item1_quantity)) print(type(item1_price_total))
a = int(input()) while a: for x in range(a-1): out = '*' + ' ' * (a-x-2) + '*' + ' ' * (a-x-2) + '*' print(out.center(2*a-1)) print('*' * (2 * a - 1)) for x in range(a-1): out = '*' + ' ' * x + '*' + ' ' * x + '*' print(out.center(2*a-1)) a = int(input())
a = int(input()) while a: for x in range(a - 1): out = '*' + ' ' * (a - x - 2) + '*' + ' ' * (a - x - 2) + '*' print(out.center(2 * a - 1)) print('*' * (2 * a - 1)) for x in range(a - 1): out = '*' + ' ' * x + '*' + ' ' * x + '*' print(out.center(2 * a - 1)) a = int(input...
class Dataset: _data = None _first_text_col = 'text' _second_text_col = None _label_col = 'label' def __init__(self): self._idx = 0 if self._data is None: raise Exception('Dataset is not loaded') def __iter__(self): return self def __next__(self): ...
class Dataset: _data = None _first_text_col = 'text' _second_text_col = None _label_col = 'label' def __init__(self): self._idx = 0 if self._data is None: raise exception('Dataset is not loaded') def __iter__(self): return self def __next__(self): ...
n=int(input("Enter number ")) fact=1 for i in range(1,n+1): fact=fact*i print("Factorial is ",fact)
n = int(input('Enter number ')) fact = 1 for i in range(1, n + 1): fact = fact * i print('Factorial is ', fact)
# Fractional Knapsack wt = [40,50,30,10,10,40,30] pro = [30,20,20,25,5,35,15] n = len(wt) data = [ (i,pro[i],wt[i]) for i in range(n) ] bag = 100 data.sort(key=lambda x: x[1]/x[2], reverse=True) profit=0 ans=[] i=0 while i<n: if data[i][2]<=bag: bag-=data[i][2] ans.append(data[i...
wt = [40, 50, 30, 10, 10, 40, 30] pro = [30, 20, 20, 25, 5, 35, 15] n = len(wt) data = [(i, pro[i], wt[i]) for i in range(n)] bag = 100 data.sort(key=lambda x: x[1] / x[2], reverse=True) profit = 0 ans = [] i = 0 while i < n: if data[i][2] <= bag: bag -= data[i][2] ans.append(data[i][0]) pro...
class DeviceSettings: def __init__(self, settings): self._id = settings["id"] self._title = settings["title"] self._type = settings["type"]["name"] self._value = settings["value"] @property def id(self): return self._id @property def value(self): ret...
class Devicesettings: def __init__(self, settings): self._id = settings['id'] self._title = settings['title'] self._type = settings['type']['name'] self._value = settings['value'] @property def id(self): return self._id @property def value(self): re...
word = input("Enter a word: ") if word == "a": print("one; any") elif word == "apple": print("familiar, round fleshy fruit") elif word == "rhinoceros": print("large thick-skinned animal with one or two horns on its nose") else: print("That word must not exist. This dictionary is very comprehensive.")
word = input('Enter a word: ') if word == 'a': print('one; any') elif word == 'apple': print('familiar, round fleshy fruit') elif word == 'rhinoceros': print('large thick-skinned animal with one or two horns on its nose') else: print('That word must not exist. This dictionary is very comprehensive.')
cnt = int(input()) num = list(map(int, input())) sum = 0 for i in range(len(num)): sum = sum + num[i] print(sum)
cnt = int(input()) num = list(map(int, input())) sum = 0 for i in range(len(num)): sum = sum + num[i] print(sum)
def test_xrange(judge_command): judge_command( "XRANGE somestream - +", {"command": "XRANGE", "key": "somestream", "stream_id": ["-", "+"]}, ) judge_command( "XRANGE somestream 1526985054069 1526985055069", { "command": "XRANGE", "key": "somestream", ...
def test_xrange(judge_command): judge_command('XRANGE somestream - +', {'command': 'XRANGE', 'key': 'somestream', 'stream_id': ['-', '+']}) judge_command('XRANGE somestream 1526985054069 1526985055069', {'command': 'XRANGE', 'key': 'somestream', 'stream_id': ['1526985054069', '1526985055069']}) judge_comma...
def decode(word1,word2,code): if len(word1)==1: code+=word1+word2 return code else: code+=word1[0]+word2[0] return decode(word1[1:],word2[1:],code) Alice='Ti rga eoe esg o h ore"ermetsCmuainls' Bob='hspormdcdsamsaefrtecus Hraina optcoae"' print(decode(Alice,Bob,''))
def decode(word1, word2, code): if len(word1) == 1: code += word1 + word2 return code else: code += word1[0] + word2[0] return decode(word1[1:], word2[1:], code) alice = 'Ti rga eoe esg o h ore"ermetsCmuainls' bob = 'hspormdcdsamsaefrtecus Hraina optcoae"' print(decode(Alice, Bo...
# constants for configuration parameters of our tensorflow models LABEL = "label" IDS = "ids" # LABEL_PAD_ID is used to pad multi-label training examples. # It should be < 0 to avoid index out of bounds errors by tf.one_hot. LABEL_PAD_ID = -1 HIDDEN_LAYERS_SIZES = "hidden_layers_sizes" SHARE_HIDDEN_LAYERS = "share_hid...
label = 'label' ids = 'ids' label_pad_id = -1 hidden_layers_sizes = 'hidden_layers_sizes' share_hidden_layers = 'share_hidden_layers' transformer_size = 'transformer_size' num_transformer_layers = 'number_of_transformer_layers' num_heads = 'number_of_attention_heads' unidirectional_encoder = 'unidirectional_encoder' ke...
PROTO = { 'spaceone.monitoring.interface.grpc.v1.data_source': ['DataSource'], 'spaceone.monitoring.interface.grpc.v1.metric': ['Metric'], 'spaceone.monitoring.interface.grpc.v1.project_alert_config': ['ProjectAlertConfig'], 'spaceone.monitoring.interface.grpc.v1.escalation_policy': ['EscalationPolicy']...
proto = {'spaceone.monitoring.interface.grpc.v1.data_source': ['DataSource'], 'spaceone.monitoring.interface.grpc.v1.metric': ['Metric'], 'spaceone.monitoring.interface.grpc.v1.project_alert_config': ['ProjectAlertConfig'], 'spaceone.monitoring.interface.grpc.v1.escalation_policy': ['EscalationPolicy'], 'spaceone.monit...
# -*- coding: utf-8 -*- class Config(object): def __init__(self): self.init_scale = 0.1 self.learning_rate = 1.0 self.max_grad_norm = 5 self.num_layers = 2 self.slice_size = 30 self.hidden_size = 200 self.max_epoch = 13 self.keep_prob = 0.8 se...
class Config(object): def __init__(self): self.init_scale = 0.1 self.learning_rate = 1.0 self.max_grad_norm = 5 self.num_layers = 2 self.slice_size = 30 self.hidden_size = 200 self.max_epoch = 13 self.keep_prob = 0.8 self.lr_const_epoch = 4 ...
{ 'targets': [ { # have to specify 'liblib' here since gyp will remove the first one :\ 'target_name': 'mysql_bindings', 'sources': [ 'src/mysql_bindings.cc', 'src/mysql_bindings_connection.cc', 'src/mysql_bindings_result.cc', 'src/mysql_bindings_statement.cc', ...
{'targets': [{'target_name': 'mysql_bindings', 'sources': ['src/mysql_bindings.cc', 'src/mysql_bindings_connection.cc', 'src/mysql_bindings_result.cc', 'src/mysql_bindings_statement.cc'], 'conditions': [['OS=="win"', {}, {'libraries': ['<!@(mysql_config --libs_r)']}], ['OS=="mac"', {'xcode_settings': {'OTHER_CFLAGS': [...
# TODO turn prints into actual error raise, they are print for testing def qSystemInitErrors(init): def newFunction(obj, **kwargs): init(obj, **kwargs) if obj._genericQSys__dimension is None: className = obj.__class__.__name__ print(className + ' requires a dimension') ...
def q_system_init_errors(init): def new_function(obj, **kwargs): init(obj, **kwargs) if obj._genericQSys__dimension is None: class_name = obj.__class__.__name__ print(className + ' requires a dimension') elif obj.frequency is None: class_name = obj.__clas...
def insertion_sort(l): for i in range(1, len(l)): j = i - 1 key = l[i] while (j >= 0) and (l[j] > key): l[j + 1] = l[j] j -= 1 l[j + 1] = key m = int(input().strip()) ar = [int(i) for i in input().strip().split()] insertion_sort(ar) print(" ".join(map(str, a...
def insertion_sort(l): for i in range(1, len(l)): j = i - 1 key = l[i] while j >= 0 and l[j] > key: l[j + 1] = l[j] j -= 1 l[j + 1] = key m = int(input().strip()) ar = [int(i) for i in input().strip().split()] insertion_sort(ar) print(' '.join(map(str, ar)))
def Euler0001(): max = 1000 sum = 0 for i in range(1, max): if i%3 == 0 or i%5 == 0: sum += i print(sum) Euler0001()
def euler0001(): max = 1000 sum = 0 for i in range(1, max): if i % 3 == 0 or i % 5 == 0: sum += i print(sum) euler0001()
class Solution: # @return a string def convertToTitle(self, n: int) -> str: capitals = [chr(x) for x in range(ord('A'), ord('Z')+1)] result = [] while n > 0: result.insert(0, capitals[(n-1)%len(capitals)]) n = (n-1) % len(capitals) # result.reverse() ...
class Solution: def convert_to_title(self, n: int) -> str: capitals = [chr(x) for x in range(ord('A'), ord('Z') + 1)] result = [] while n > 0: result.insert(0, capitals[(n - 1) % len(capitals)]) n = (n - 1) % len(capitals) return ''.join(result)
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ # Intermediate target grouping the android tools needed to run native # unittests and instrumentation test apks. { 'ta...
{'targets': [{'target_name': 'android_tools', 'type': 'none', 'dependencies': ['adb_reboot/adb_reboot.gyp:adb_reboot', 'forwarder2/forwarder.gyp:forwarder2', 'md5sum/md5sum.gyp:md5sum', 'purge_ashmem/purge_ashmem.gyp:purge_ashmem']}, {'target_name': 'memdump', 'type': 'none', 'dependencies': ['memdump/memdump.gyp:memdu...
# Factory-like class for mortgage options class MortgageOptions: def __init__(self,kind,**inputOptions): self.set_default_options() self.set_kind_options(kind = kind) self.set_input_options(**inputOptions) def set_default_options(self): self.optionList = dict() self.optionList['commonDefaul...
class Mortgageoptions: def __init__(self, kind, **inputOptions): self.set_default_options() self.set_kind_options(kind=kind) self.set_input_options(**inputOptions) def set_default_options(self): self.optionList = dict() self.optionList['commonDefaults'] = dict(name=None...
__all__ = ( "Role", ) class Role: def __init__(self, data): self.data = data self._update(data) def _get_json(self): return self.data def __repr__(self): return ( f"<Role id={self.id} name={self.name}>" ) def __str__(self): ...
__all__ = ('Role',) class Role: def __init__(self, data): self.data = data self._update(data) def _get_json(self): return self.data def __repr__(self): return f'<Role id={self.id} name={self.name}>' def __str__(self): return f'{self.name}' def _update(se...
_Msun_kpc3_to_GeV_cm3_factor = 0.3/8.0e6 def Msun_kpc3_to_GeV_cm3(value): return value*_Msun_kpc3_to_GeV_cm3_factor
__msun_kpc3_to__ge_v_cm3_factor = 0.3 / 8000000.0 def msun_kpc3_to__ge_v_cm3(value): return value * _Msun_kpc3_to_GeV_cm3_factor
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, 'linux_link_kerberos%': 0, 'conditions': [ ['chromeos==1 or OS=="android" or OS=="ios"', { ...
{'variables': {'chromium_code': 1, 'linux_link_kerberos%': 0, 'conditions': [['chromeos==1 or OS=="android" or OS=="ios"', {'use_kerberos%': 0}, {'use_kerberos%': 1}], ['OS=="android" and target_arch != "ia32"', {'posix_avoid_mmap%': 1}, {'posix_avoid_mmap%': 0}], ['OS=="ios"', {'enable_websockets%': 0, 'use_v8_in_net%...
#Author Theodosis Paidakis print("Hello World") hello_list = ["Hello World"] print(hello_list[0]) for i in hello_list: print(i)
print('Hello World') hello_list = ['Hello World'] print(hello_list[0]) for i in hello_list: print(i)
print('Digite seu nome completo: ') nome = input().strip().upper() print('Seu nome tem "Silva"?') print('SILVA' in nome)
print('Digite seu nome completo: ') nome = input().strip().upper() print('Seu nome tem "Silva"?') print('SILVA' in nome)
dataset_type = 'STVQADATASET' data_root = '/home/datasets/mix_data/iMIX/' feature_path = 'data/datasets/stvqa/defaults/features/' ocr_feature_path = 'data/datasets/stvqa/defaults/ocr_features/' annotation_path = 'data/datasets/stvqa/defaults/annotations/' vocab_path = 'data/datasets/stvqa/defaults/extras/vocabs/' trai...
dataset_type = 'STVQADATASET' data_root = '/home/datasets/mix_data/iMIX/' feature_path = 'data/datasets/stvqa/defaults/features/' ocr_feature_path = 'data/datasets/stvqa/defaults/ocr_features/' annotation_path = 'data/datasets/stvqa/defaults/annotations/' vocab_path = 'data/datasets/stvqa/defaults/extras/vocabs/' train...
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: I am # # Created: 02/11/2017 # Copyright: (c) I am 2017 # Licence: <your licence> #------------------------------------------------------------------------------- def main(): ...
def main(): pass if __name__ == '__main__': main()
matrix = [list(map(int, input().split())) for _ in range(6)] max_sum = None for i in range(4): for j in range(4): s = sum(matrix[i][j:j+3]) + matrix[i+1][j+1] + sum(matrix[i+2][j:j+3]) if max_sum is None or s > max_sum: max_sum = s print(max_sum)
matrix = [list(map(int, input().split())) for _ in range(6)] max_sum = None for i in range(4): for j in range(4): s = sum(matrix[i][j:j + 3]) + matrix[i + 1][j + 1] + sum(matrix[i + 2][j:j + 3]) if max_sum is None or s > max_sum: max_sum = s print(max_sum)
pessoas = {'nomes': "Rafael","sexo":"macho alfa","idade":19} print(f"o {pessoas['nomes']} que se considera um {pessoas['sexo']} possui {pessoas['idade']}") print(pessoas.keys()) print(pessoas.values()) print(pessoas.items()) for c in pessoas.keys(): print(c) for c in pessoas.values(): print(c) for c, j in pe...
pessoas = {'nomes': 'Rafael', 'sexo': 'macho alfa', 'idade': 19} print(f"o {pessoas['nomes']} que se considera um {pessoas['sexo']} possui {pessoas['idade']}") print(pessoas.keys()) print(pessoas.values()) print(pessoas.items()) for c in pessoas.keys(): print(c) for c in pessoas.values(): print(c) for (c, j) i...
config = { "Luminosity": 1000, "InputDirectory": "results", "Histograms" : { "WtMass" : {}, "etmiss" : {}, "lep_n" : {}, "lep_pt" : {}, "lep_eta" : {}, "lep_E" : {}, "lep_phi" : {"y_margin" : 0.6}, "lep_...
config = {'Luminosity': 1000, 'InputDirectory': 'results', 'Histograms': {'WtMass': {}, 'etmiss': {}, 'lep_n': {}, 'lep_pt': {}, 'lep_eta': {}, 'lep_E': {}, 'lep_phi': {'y_margin': 0.6}, 'lep_charge': {'y_margin': 0.6}, 'lep_type': {'y_margin': 0.5}, 'lep_ptconerel30': {}, 'lep_etconerel20': {}, 'lep_d0': {}, 'lep_z0':...
# Desempacotamento de parametros em funcoes # somando valores de uma tupla def soma(*num): soma = 0 print('Tupla: {}' .format(num)) for i in num: soma += i return soma # Programa principal print('Resultado: {}\n' .format(soma(1, 2))) print('Resultado: {}\n' .format(soma(1, 2, 3, 4, 5, 6, 7, 8,...
def soma(*num): soma = 0 print('Tupla: {}'.format(num)) for i in num: soma += i return soma print('Resultado: {}\n'.format(soma(1, 2))) print('Resultado: {}\n'.format(soma(1, 2, 3, 4, 5, 6, 7, 8, 9)))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def swapNodes(self, head: Optional[ListNode], k: int) -> Optional[ListNode]: temp = head array = [] while temp: a...
class Solution: def swap_nodes(self, head: Optional[ListNode], k: int) -> Optional[ListNode]: temp = head array = [] while temp: array.append(temp.val) temp = temp.next (array[k - 1], array[len(array) - k]) = (array[len(array) - k], array[k - 1]) head...
DATABASE_OPTIONS = { 'database': 'klazor', 'user': 'root', 'password': '', 'charset': 'utf8mb4', } HOSTS = ['127.0.0.1', '67.209.115.211']
database_options = {'database': 'klazor', 'user': 'root', 'password': '', 'charset': 'utf8mb4'} hosts = ['127.0.0.1', '67.209.115.211']
def HAHA(): return 1,2,3 a = HAHA() print(a) print(a[0])
def haha(): return (1, 2, 3) a = haha() print(a) print(a[0])
ser = int(input()) mas = list(map(int, input().split())) mas.sort() print(*mas)
ser = int(input()) mas = list(map(int, input().split())) mas.sort() print(*mas)
backgroundurl = "https://storage.needpix.com/rsynced_images/colored-background.jpg" # <- Need to be a Image URL!!! lang = "en" # <- language code displayset = True # <- Display the Set of the Item raritytext = True # <- Display the Rarity of the Item typeconfig = { "BannerToken": True, "AthenaBackpack":...
backgroundurl = 'https://storage.needpix.com/rsynced_images/colored-background.jpg' lang = 'en' displayset = True raritytext = True typeconfig = {'BannerToken': True, 'AthenaBackpack': True, 'AthenaPetCarrier': True, 'AthenaPet': True, 'AthenaPickaxe': True, 'AthenaCharacter': True, 'AthenaSkyDiveContrail': True, 'Athe...
def cube(number): return number*number*number digit = input(" the cube of which digit do you want >") result = cube(int(digit)) print(result)
def cube(number): return number * number * number digit = input(' the cube of which digit do you want >') result = cube(int(digit)) print(result)
def main(request, response): headers = [("Content-type", "text/html;charset=shift-jis")] # Shift-JIS bytes for katakana TE SU TO ('test') content = chr(0x83) + chr(0x65) + chr(0x83) + chr(0x58) + chr(0x83) + chr(0x67); return headers, content
def main(request, response): headers = [('Content-type', 'text/html;charset=shift-jis')] content = chr(131) + chr(101) + chr(131) + chr(88) + chr(131) + chr(103) return (headers, content)
# Vicfred # https://atcoder.jp/contests/abc132/tasks/abc132_a # implementation S = list(input()) if len(set(S)) == 2: if S.count(S[0]) == 2: print("Yes") quit() print("No")
s = list(input()) if len(set(S)) == 2: if S.count(S[0]) == 2: print('Yes') quit() print('No')
for _ in range(int(input())): x, y = list(map(int, input().split())) flag = 1 for i in range(x, y + 1): n = i * i + i + 41 for j in range(2, n): if j * j > n: break if n % j == 0: flag = 0 break if flag == 0: break if flag: print("OK") else: print("Sorry")
for _ in range(int(input())): (x, y) = list(map(int, input().split())) flag = 1 for i in range(x, y + 1): n = i * i + i + 41 for j in range(2, n): if j * j > n: break if n % j == 0: flag = 0 break if flag == 0: ...
{ 'targets': [ { 'target_name': 'hiredis', 'sources': [ 'src/hiredis.cc' , 'src/reader.cc' ], 'include_dirs': ["<!(node -e \"require('nan')\")"], 'dependencies': [ 'deps/hiredis.gyp:hiredis-c' ], 'defines': [ '_GNU_SOURCE' ], ...
{'targets': [{'target_name': 'hiredis', 'sources': ['src/hiredis.cc', 'src/reader.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'dependencies': ['deps/hiredis.gyp:hiredis-c'], 'defines': ['_GNU_SOURCE'], 'cflags': ['-Wall', '-O3']}]}
# mako/__init__.py # Copyright (C) 2006-2016 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php __version__ = '1.0.9'
__version__ = '1.0.9'
def pick_food(name): if name == "chima": return "chicken" else: return "dry food"
def pick_food(name): if name == 'chima': return 'chicken' else: return 'dry food'
# Creating a elif chain alien_color = 'red' if alien_color == 'green': print('Congratulations! You won 5 points!') elif alien_color == 'yellow': print('Congratulations! You won 10 points!') elif alien_color == 'red': print('Congratulations! You won 15 points!')
alien_color = 'red' if alien_color == 'green': print('Congratulations! You won 5 points!') elif alien_color == 'yellow': print('Congratulations! You won 10 points!') elif alien_color == 'red': print('Congratulations! You won 15 points!')
# https://www.codechef.com/START8C/problems/PENALTY for T in range(int(input())): n=list(map(int,input().split())) a=b=0 for i in range(len(n)): if(n[i]==1): if(i%2==0): a+=1 else: b+=1 if(a>b): print(1) elif(b>a): print(2) else: print(0)
for t in range(int(input())): n = list(map(int, input().split())) a = b = 0 for i in range(len(n)): if n[i] == 1: if i % 2 == 0: a += 1 else: b += 1 if a > b: print(1) elif b > a: print(2) else: print(0)
MATH_BYTECODE = ( "606060405261022e806100126000396000f360606040523615610074576000357c01000000000000" "000000000000000000000000000000000000000000009004806316216f391461007657806361bc22" "1a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d5780" "63dcf537b11461014057610074565b...
math_bytecode = '606060405261022e806100126000396000f360606040523615610074576000357c01000000000000000000000000000000000000000000000000000000009004806316216f391461007657806361bc221a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d578063dcf537b11461014057610074565b005b610083600480505061016c565b604...
def modify(y): return y # returns same reference. No new object is created x = [1, 2, 3] y = modify(x) print("x == y", x == y) print("x == y", x is y)
def modify(y): return y x = [1, 2, 3] y = modify(x) print('x == y', x == y) print('x == y', x is y)
# 1. Create students score dictionary. students_score = {} # 2. Input student's name and check if input is correct. (Alphabet, period, and blank only.) # 2.1 Creat a function that evaluate the validity of name. def check_name(name): # 2.1.1 Remove period and blank and check it if the name is comprised with on...
students_score = {} def check_name(name): list_of_spelling = list(name) while '.' in list_of_spelling: list_of_spelling.remove('.') while ' ' in list_of_spelling: list_of_spelling.remove(' ') list_to_string = '' list_to_string = list_to_string.join(list_of_spelling) return list_...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ee = '\033[1m' green = '\033[32m' yellow = '\033[33m' cyan = '\033[36m' line = cyan+'-' * 0x2D print(ee+line) R,G,B = [float(X) / 0xFF for X in input(f'{yellow}RGB: {green}').split()] K = 1-max(R,G,B) C,M,Y = [round(float((1-X-K)/(1-K) * 0x64),1) for X in [R,G,B]] K = r...
ee = '\x1b[1m' green = '\x1b[32m' yellow = '\x1b[33m' cyan = '\x1b[36m' line = cyan + '-' * 45 print(ee + line) (r, g, b) = [float(X) / 255 for x in input(f'{yellow}RGB: {green}').split()] k = 1 - max(R, G, B) (c, m, y) = [round(float((1 - X - K) / (1 - K) * 100), 1) for x in [R, G, B]] k = round(K * 100, 1) print(f'{y...
def selection_sort(A): # O(n^2) n = len(A) for i in range(n-1): # percorre a lista min = i for j in range(i+1, n): # encontra o menor elemento da lista a partir de i + 1 if A[j] < A[min]: min = j A[i], A[min] = A[min], A[i] # insere o elemento na posicao corre...
def selection_sort(A): n = len(A) for i in range(n - 1): min = i for j in range(i + 1, n): if A[j] < A[min]: min = j (A[i], A[min]) = (A[min], A[i]) return A
tajniBroj = 51 broj = 2 while tajniBroj != broj: broj = int(input("Pogodite tajni broj: ")) if tajniBroj == broj: print("Pogodak!") elif tajniBroj < broj: print("Tajni broj je manji od tog broja.") else: print("Tajni broj je veci od tog broja.") print("Kraj programa")
tajni_broj = 51 broj = 2 while tajniBroj != broj: broj = int(input('Pogodite tajni broj: ')) if tajniBroj == broj: print('Pogodak!') elif tajniBroj < broj: print('Tajni broj je manji od tog broja.') else: print('Tajni broj je veci od tog broja.') print('Kraj programa')
class CoinbaseResponse: bid = 0 ask = 0 product_id = None def set_bid(self, bid): self.bid = float(bid) def get_bid(self): return self.bid def set_ask(self, ask): self.ask = float(ask) def get_ask(self): return self.ask def get_product_id(self): ...
class Coinbaseresponse: bid = 0 ask = 0 product_id = None def set_bid(self, bid): self.bid = float(bid) def get_bid(self): return self.bid def set_ask(self, ask): self.ask = float(ask) def get_ask(self): return self.ask def get_product_id(self): ...
''' Problem description: Given a string, determine whether or not the parentheses are balanced ''' def balanced_parens(str): ''' runtime: O(n) space : O(1) ''' if str is None: return True open_count = 0 for char in str: if char == '(': open_count += 1 ...
""" Problem description: Given a string, determine whether or not the parentheses are balanced """ def balanced_parens(str): """ runtime: O(n) space : O(1) """ if str is None: return True open_count = 0 for char in str: if char == '(': open_count += 1 el...
# 13. Join # it allows to print list a bit better friends = ['Pythobit','boy','Pythoman'] print(f'My friends are {friends}.') # Output - My friends are ['Pythobit', 'boy', 'Pythoman']. # So, the Output needs to be a bit clearer. friends = ['Pythobit','boy','Pythoman'] friend = ', '.join(friends) print(f'My friend...
friends = ['Pythobit', 'boy', 'Pythoman'] print(f'My friends are {friends}.') friends = ['Pythobit', 'boy', 'Pythoman'] friend = ', '.join(friends) print(f'My friends are {friend}')
# settings file for builds. # if you want to have custom builds, copy this file to "localbuildsettings.py" and make changes there. # possible fields: # resourceBaseUrl - optional - the URL base for external resources (all resources embedded in standard IITC) # distUrlBase - optional - the base URL to use for update c...
build_settings = {'randomizax': {'resourceUrlBase': None, 'distUrlBase': 'https://randomizax.github.io/polygon-label'}, 'local8000': {'resourceUrlBase': 'http://0.0.0.0:8000/dist', 'distUrlBase': None}, 'mobile': {'resourceUrlBase': None, 'distUrlBase': None, 'buildMobile': 'debug'}}
class Point3D: def __init__(self,x,y,z): self.x = x self.y = y self.z = z ''' Returns the distance between two 3D points ''' def distance(self, value): return abs(self.x - value.x) + abs(self.y - value.y) + abs(self.z - value.z) def __eq__(self, value): ...
class Point3D: def __init__(self, x, y, z): self.x = x self.y = y self.z = z '\n Returns the distance between two 3D points\n ' def distance(self, value): return abs(self.x - value.x) + abs(self.y - value.y) + abs(self.z - value.z) def __eq__(self, value): ...
# API keys # YF_API_KEY = "YRVHVLiFAt3ANYZf00BXr2LHNfZcgKzdWVmsZ9Xi" # yahoo finance api key TICKER = "TSLA" INTERVAL = "1m" PERIOD = "1d" LOOK_BACK = 30 # hard limit to not reach rate limit of 100 per day
ticker = 'TSLA' interval = '1m' period = '1d' look_back = 30
FILE = r'../src/etc-hosts.txt' hostnames = [] try: with open(FILE, encoding='utf-8') as file: content = file.readlines() except FileNotFoundError: print('File does not exist') except PermissionError: print('Permission denied') for line in content: if line.startswith('#'): continue ...
file = '../src/etc-hosts.txt' hostnames = [] try: with open(FILE, encoding='utf-8') as file: content = file.readlines() except FileNotFoundError: print('File does not exist') except PermissionError: print('Permission denied') for line in content: if line.startswith('#'): continue if ...
def getRoot(config): if not config.parent: return config return getRoot(config.parent) root = getRoot(config) # We only run a small set of tests on Windows for now. # Override the parent directory's "unsupported" decision until we can handle # all of its tests. if root.host_os in ['Windows']: config.unsuppo...
def get_root(config): if not config.parent: return config return get_root(config.parent) root = get_root(config) if root.host_os in ['Windows']: config.unsupported = False else: config.unsupported = True
FACTS = ['espoem multiplied by zero still equals espoem.', 'There is no theory of evolution. Just a list of creatures espoem has allowed to live.', 'espoem does not sleep. He waits.', 'Alexander Graham Bell had three missed calls from espoem when he invented the telephone.', 'espoem ...
facts = ['espoem multiplied by zero still equals espoem.', 'There is no theory of evolution. Just a list of creatures espoem has allowed to live.', 'espoem does not sleep. He waits.', 'Alexander Graham Bell had three missed calls from espoem when he invented the telephone.', 'espoem is the reason why Waldo is hiding.',...
# # LeetCode # # Problem - 106 # URL - https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/ # # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = ri...
class Solution: def build_tree(self, inorder: List[int], postorder: List[int]) -> TreeNode: if not inorder: return None r = postorder.pop() root = tree_node(r) index = inorder.index(r) root.right = self.buildTree(inorder[index + 1:], postorder) root.left ...
# # PySNMP MIB module EXTREME-RTSTATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-BASE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:53:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, M...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
# https://www.acmicpc.net/problem/1260 n, m, v = map(int, input().split()) graph = [[0] * (n+1) for _ in range(n+1)] visit = [False] * (n+1) for _ in range(m): R, C = map(int, input().split()) graph[R][C] = 1 graph[C][R] = 1 def dfs(v): visit[v] = True print(v, end=" ") for i in range(1, n+...
(n, m, v) = map(int, input().split()) graph = [[0] * (n + 1) for _ in range(n + 1)] visit = [False] * (n + 1) for _ in range(m): (r, c) = map(int, input().split()) graph[R][C] = 1 graph[C][R] = 1 def dfs(v): visit[v] = True print(v, end=' ') for i in range(1, n + 1): if not visit[i] and...
class Solution: def modifyString(self, s: str) -> str: s = list(s) for i in range(len(s)): if s[i] == "?": for c in "abc": if (i == 0 or s[i-1] != c) and (i+1 == len(s) or s[i+1] != c): s[i] = c break ...
class Solution: def modify_string(self, s: str) -> str: s = list(s) for i in range(len(s)): if s[i] == '?': for c in 'abc': if (i == 0 or s[i - 1] != c) and (i + 1 == len(s) or s[i + 1] != c): s[i] = c b...
class DynamicObject(object): def __init__(self, name, id_): self.name = name self.id = id_
class Dynamicobject(object): def __init__(self, name, id_): self.name = name self.id = id_
# ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: protocolo.py # # Tests: vistprotocol unit test # # Mark C. Miller, Tue Jan 11 10:19:23 PST 2011 # ---------------------------------------------------------------------------- tapp = visit_bin_path(...
tapp = visit_bin_path('visitprotocol') res = sexe(tapp, ret_output=True) if res['return_code'] == 0: excode = 111 else: excode = 113 exit(excode)
# store information about a pizza being ordered pizza = { 'crust': 'thick', 'toppings': ['mushrooms', 'extra vegan cheese'] } # summarize the order print("You ordered a " + pizza['crust'] + "-crust pizza" + "with the following toppings:") for topping in pizza['toppings']: print("\t" + topping)
pizza = {'crust': 'thick', 'toppings': ['mushrooms', 'extra vegan cheese']} print('You ordered a ' + pizza['crust'] + '-crust pizza' + 'with the following toppings:') for topping in pizza['toppings']: print('\t' + topping)
# Tumblr Setup # Replace the values with your information # OAuth keys can be generated from https://api.tumblr.com/console/calls/user/info consumer_key='ShbOqI5zErQXOL7Qnd5XduXpY9XQUlBgJDpCLeq1OYqnY2KzSt' #replace with your key consumer_secret='ulZradkbJGksjpl2MMlshAfJgEW6TNeSdZucykqeTp8jvwgnhu' #replace with your sec...
consumer_key = 'ShbOqI5zErQXOL7Qnd5XduXpY9XQUlBgJDpCLeq1OYqnY2KzSt' consumer_secret = 'ulZradkbJGksjpl2MMlshAfJgEW6TNeSdZucykqeTp8jvwgnhu' oath_token = 'uUcBuvJx8yhk4HJIZ39sfcYo0W4VoqcvUetR2EwcI5Sn8SLgNt' oath_secret = 'iNJlqQJI6dwhAGmdNbMtD9u7VazmX2Rk5uW0fuIozIEjk97lz4' tumblr_blog = 'soniaetjeremie' tags_for_tumblr =...
df8.cbind(df9) # A B C D A0 B0 C0 D0 # ----- ------ ------ ------ ------ ----- ----- ----- # -0.09 0.944 0.160 0.271 -0.351 1.66 -2.32 -0.86 # -0.95 0.669 0.664 1.535 -0.633 -1.78 0.32 1.27 # 0.17 0.657 0.970 -0.419 -1.413 -0.51 0.64 -1.25 # 0.58 -0.516 -1.598 -1.346 0.71...
df8.cbind(df9)
try: # num = 10 / 0 number = int(input("Enter a number: ")) print(number) # catch specific errors except ZeroDivisionError as err: print(err) except ValueError: print("Invalid input")
try: number = int(input('Enter a number: ')) print(number) except ZeroDivisionError as err: print(err) except ValueError: print('Invalid input')
class Deque: def add_first(self, value): ... def add_last(self, value): ... def delete_first(self): ... def delete_last(self): ... def first(self): ... def last(self): ... def is_empty(self): ... def __len__(self): .....
class Deque: def add_first(self, value): ... def add_last(self, value): ... def delete_first(self): ... def delete_last(self): ... def first(self): ... def last(self): ... def is_empty(self): ... def __len__(self): ....
# A string S consisting of N characters is considered to be properly nested if any of the following conditions is true: # S is empty; # S has the form "(U)" or "[U]" or "{U}" where U is a properly nested string; S has the form "VW" where V and W are properly nested strings. # For example, the string "{[()()]}" is prope...
def solution(s): sets = dict(zip('({[', ')}]')) if not isinstance(s, str): return 'Invalid input' collector = [] for bracket in s: if bracket in sets: collector.append(sets[bracket]) elif bracket not in sets.values(): return 'Invalid input' elif br...
class RedisBackend(object): def __init__(self, settings={}, *args, **kwargs): self.settings = settings @property def connection(self): # cached redis connection if not hasattr(self, '_connection'): self._connection = self.settings.get('redis.connector').get() re...
class Redisbackend(object): def __init__(self, settings={}, *args, **kwargs): self.settings = settings @property def connection(self): if not hasattr(self, '_connection'): self._connection = self.settings.get('redis.connector').get() return self._connection @proper...
# CHECK-TREE: { const <- \x -> \y -> x; y <- const #true #true; z <- const #false #false; #record { const: const, y : y, z: z, }} const = lambda x, y: x y = const(True, True) z = const(False, False)
const = lambda x, y: x y = const(True, True) z = const(False, False)
_base_ = '../faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco.py' model = dict( backbone=dict( num_stages=4, #frozen_stages=4 ), roi_head=dict( bbox_head=dict( num_classes=3 ) ) ) dataset_type = 'COCODataset' classes = ('luchs', 'rotfuchs', 'wolf') data = dict...
_base_ = '../faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco.py' model = dict(backbone=dict(num_stages=4), roi_head=dict(bbox_head=dict(num_classes=3))) dataset_type = 'COCODataset' classes = ('luchs', 'rotfuchs', 'wolf') data = dict(train=dict(img_prefix='raubtierv2a/train/', classes=classes, ann_file='raubtierv2a/trai...
h = int(input()) i = 1 a = 1 b = 1 c = 1 while h >= a: a = 2 ** i i += 1 s = 0 t = True for j in range(1, i-1): c += 2 ** j print(c)
h = int(input()) i = 1 a = 1 b = 1 c = 1 while h >= a: a = 2 ** i i += 1 s = 0 t = True for j in range(1, i - 1): c += 2 ** j print(c)
class ArmorVisitor: def __init__(self, num_pages, first_page_col_start, first_page_row_start, last_page_row_start, last_page_col_end, last_page_row_end, num_col_page=5, num_row_page=3): self.num_pages = num_pages self.first_page_col_start = first_page_col_start self.first_page_row_start = first_page_...
class Armorvisitor: def __init__(self, num_pages, first_page_col_start, first_page_row_start, last_page_row_start, last_page_col_end, last_page_row_end, num_col_page=5, num_row_page=3): self.num_pages = num_pages self.first_page_col_start = first_page_col_start self.first_page_row_start = f...
# # PySNMP MIB module InternetThruway-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/InternetThruway-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:58:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, value_range_constraint, constraints_intersection, single_value_constraint) ...
# 2. Repeat Strings # Write a Program That Reads a list of strings. Each string is repeated N times, where N is the length of the string. Print the concatenated string. strings = input().split() output_string = "" for string in strings: N = len(string) output_string += string * N print(output_string)
strings = input().split() output_string = '' for string in strings: n = len(string) output_string += string * N print(output_string)
def dfs(V): print(V, end=' ') visited[V] = True for n in graph[V]: if not visited[n]: dfs(n) def dfs_s(V): stack = [V] visited[V] = True while stack: now = stack.pop() print(now, end=' ') for n in graph[now]: if not visited[n]: ...
def dfs(V): print(V, end=' ') visited[V] = True for n in graph[V]: if not visited[n]: dfs(n) def dfs_s(V): stack = [V] visited[V] = True while stack: now = stack.pop() print(now, end=' ') for n in graph[now]: if not visited[n]: ...
# Time Complexity - O(n) ; Space Complexity - O(n) class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: carry = 0 out = temp = ListNode() while l1 is not None and l2 is not None: tempsum = l1.val + l2.val tempsum += carry ...
class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: carry = 0 out = temp = list_node() while l1 is not None and l2 is not None: tempsum = l1.val + l2.val tempsum += carry if tempsum > 9: carry = tempsum // 10...
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py' ] model = dict( type='FasterRCNN', # pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requir...
_base_ = ['../_base_/models/faster_rcnn_r50_fpn.py'] model = dict(type='FasterRCNN', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch'), neck=dict(type='FPN', in_channels=[256, 512, 1024, 2048], o...
# Message class Implementation # @author: Gaurav Yeole <gauravyeole@gmail.com> class Message: class Request: def __init__(self, action="", data=None): self.action = action self.data = data class Rsponse: def __init__(self): self.status = False se...
class Message: class Request: def __init__(self, action='', data=None): self.action = action self.data = data class Rsponse: def __init__(self): self.status = False self.data = None def __init__(self): pass def set_request(sel...
# # PySNMP MIB module CISCO-VSI-CONTROLLER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-VSI-CONTROLLER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:03:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ...
class SceneRelation: def __init__(self): self.on_ground = set() self.on_block = {} self.clear = set() def print_relation(self): print(self.on_ground) print(self.on_block) print(self.clear)
class Scenerelation: def __init__(self): self.on_ground = set() self.on_block = {} self.clear = set() def print_relation(self): print(self.on_ground) print(self.on_block) print(self.clear)
def _jpeg_compression(im): assert torch.is_tensor(im) im = ToPILImage()(im) savepath = BytesIO() im.save(savepath, 'JPEG', quality=75) im = Image.open(savepath) im = ToTensor()(im) return im
def _jpeg_compression(im): assert torch.is_tensor(im) im = to_pil_image()(im) savepath = bytes_io() im.save(savepath, 'JPEG', quality=75) im = Image.open(savepath) im = to_tensor()(im) return im
load("@wix_oss_infra//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external") def dependencies(): import_external( name = "org_specs2_specs2_fp_2_12", artifact = "org.specs2:specs2-fp_2.12:4.8.3", artifact_sha256 = "777962ca58054a9ea86e294e025453ecf394c60084c28bd61...
load('@wix_oss_infra//:import_external.bzl', import_external='safe_wix_scala_maven_import_external') def dependencies(): import_external(name='org_specs2_specs2_fp_2_12', artifact='org.specs2:specs2-fp_2.12:4.8.3', artifact_sha256='777962ca58054a9ea86e294e025453ecf394c60084c28bd61956a00d16be31a7', srcjar_sha256='6...
a = int(input()) b = int(input()) c = int(input()) d = int(input()) if a == 0 and b == 0: print("INF") else: if (d - b * c / a) != 0 and (- b / a) == (- b // a): print(- b // a) else: print("NO")
a = int(input()) b = int(input()) c = int(input()) d = int(input()) if a == 0 and b == 0: print('INF') elif d - b * c / a != 0 and -b / a == -b // a: print(-b // a) else: print('NO')
n = int(input()) coelho = rato = sapo = contador = 0 for i in range(0, n): q, t = input().split(' ') t = t.upper() q = int(q) if 1 <= q <= 15: contador += q if t == 'C': coelho += q elif t == 'R': rato += q elif t == 'S': sapo += q po...
n = int(input()) coelho = rato = sapo = contador = 0 for i in range(0, n): (q, t) = input().split(' ') t = t.upper() q = int(q) if 1 <= q <= 15: contador += q if t == 'C': coelho += q elif t == 'R': rato += q elif t == 'S': sapo += q po...
#a2_t1b.py #This program is to convert Celsius to Kelvin def c_to_k(c): k = c + 273.15 #Formula to convert Celsius to Kelvin return k def f_to_c(f): fa = (f-32) * 5/9 #Formula to convert Fareheit to Celsius return fa c = 25.0 f = 100.0 k = c_to_k(c) fa = f_to_c(f) print("Celsius of " + str(c) + " is...
def c_to_k(c): k = c + 273.15 return k def f_to_c(f): fa = (f - 32) * 5 / 9 return fa c = 25.0 f = 100.0 k = c_to_k(c) fa = f_to_c(f) print('Celsius of ' + str(c) + ' is ' + str(k) + ' in Kelvin') print('Farenheit of ' + str(f) + ' is ' + str(fa) + ' in Celsius')
# -*- coding: utf-8 -*- def main(): s, t, u = map(str, input().split()) if len(s) == 5 and len(t) == 7 and len(u) == 5: print('valid') else: print('invalid') if __name__ == '__main__': main()
def main(): (s, t, u) = map(str, input().split()) if len(s) == 5 and len(t) == 7 and (len(u) == 5): print('valid') else: print('invalid') if __name__ == '__main__': main()
def aaa(): # trick sphinx to build link in doc pass # retired ibmqx2_c_to_tars =\ { 0: [1, 2], 1: [2], 2: [], 3: [2, 4], 4: [2] } # 6 edges # retired ibmqx4_c_to_tars =\ { 0: [], 1: [0], 2: [0, 1, 4], 3: [2, 4], 4: [] } # 6 edges # retired ibmq16Rus_c_to_tars = \ { ...
def aaa(): pass ibmqx2_c_to_tars = {0: [1, 2], 1: [2], 2: [], 3: [2, 4], 4: [2]} ibmqx4_c_to_tars = {0: [], 1: [0], 2: [0, 1, 4], 3: [2, 4], 4: []} ibmq16_rus_c_to_tars = {0: [], 1: [0, 2], 2: [3], 3: [4, 14], 4: [], 5: [4], 6: [5, 7, 11], 7: [10], 8: [7], 9: [8, 10], 10: [], 11: [10], 12: [5, 11, 13], 13: [4, 14],...
class Donation_text: # Shown as a message across the top of the page on return from a donation # used in views.py:new_donation() thank_you = ( "Thank you for your donation. " "You may need to refresh this page to see the donation." ) confirmation_email_subject = ( 'Thank y...
class Donation_Text: thank_you = 'Thank you for your donation. You may need to refresh this page to see the donation.' confirmation_email_subject = 'Thank you for donating to the Triple Crown for Heart! ' confirmation_email_opening = 'Thank you for your donation of ' confirmation_email_closing = '.\n\nF...
class Yaratik(object): def move_left(self): print('Moving left...') def move_right(self): print('Moving left...') class Ejderha(Yaratik): def Ates_puskurtme(self): print('ates puskurtum!') class Zombie(Yaratik): def Isirmak(self): print('Isirdim simdi!') enemy =...
class Yaratik(object): def move_left(self): print('Moving left...') def move_right(self): print('Moving left...') class Ejderha(Yaratik): def ates_puskurtme(self): print('ates puskurtum!') class Zombie(Yaratik): def isirmak(self): print('Isirdim simdi!') enemy = yar...
class Solution: def nextGreatestLetter(self, letters: list, target: str) -> str: if target < letters[0] or target >= letters[-1]: return letters[0] left, right = 0, len(letters) - 1 while left < right: mid = left + (right - left) // 2 if letters[mid] > tar...
class Solution: def next_greatest_letter(self, letters: list, target: str) -> str: if target < letters[0] or target >= letters[-1]: return letters[0] (left, right) = (0, len(letters) - 1) while left < right: mid = left + (right - left) // 2 if letters[mid...
my_set = {1, 3, 5} my_dict = {'name': 'Jose', 'age': 90} another_dict = {1: 15, 2: 75, 3: 150} lottery_players = [ { 'name': 'Rolf', 'numbers': (13, 45, 66, 23, 22) }, { 'name': 'John', 'numbers': (14, 56, 80, 23, 22) } ] universities = [ { 'name': 'Oxford',...
my_set = {1, 3, 5} my_dict = {'name': 'Jose', 'age': 90} another_dict = {1: 15, 2: 75, 3: 150} lottery_players = [{'name': 'Rolf', 'numbers': (13, 45, 66, 23, 22)}, {'name': 'John', 'numbers': (14, 56, 80, 23, 22)}] universities = [{'name': 'Oxford', 'location': 'UK'}, {'name': 'MIT', 'location': 'US'}]
class Solution: def XXX(self, x: int) -> int: def solve(x): a = list(map(int,str(x))) p = {} d=0 for ind, val in enumerate(a): p[ind] = val for i, v in p.items(): d += v*(10**i) if (2**31 - 1>= d >= -(2**...
class Solution: def xxx(self, x: int) -> int: def solve(x): a = list(map(int, str(x))) p = {} d = 0 for (ind, val) in enumerate(a): p[ind] = val for (i, v) in p.items(): d += v * 10 ** i if 2 ** 31 - 1 ...
#------ game constants -----# #players WHITE = 0 BLACK = 1 BOTH = 2 #color for onTurnLabel PLAYER_COLOR = ["white", "black"] #figures PAWN = 1 KNIGHT = 2 BISHOP = 3 ROOK = 4 QUEEN = 5 KING = 6 FIGURE_NAME = [ "", "pawn", "knight", "bishop", "rook", "queen", "king" ] #used in move 32bit for prom...
white = 0 black = 1 both = 2 player_color = ['white', 'black'] pawn = 1 knight = 2 bishop = 3 rook = 4 queen = 5 king = 6 figure_name = ['', 'pawn', 'knight', 'bishop', 'rook', 'queen', 'king'] prom_knight = 0 prom_bishop = 1 prom_rook = 2 prom_queen = 3 (a, b, c, d, e, f, g, h) = range(8) (a1, b1, c1, d1, e1, f1, g1, ...