content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def test_check_userId1(client): response = client.get('/check?userId=1') assert "True" in response.json def test_check_userId3(client): response = client.get('/check?userId=3') assert "False" in response.json
def test_check_user_id1(client): response = client.get('/check?userId=1') assert 'True' in response.json def test_check_user_id3(client): response = client.get('/check?userId=3') assert 'False' in response.json
# Write your solution for 1.3 here! mysum=0 i=0 while i <= 10000 : i = i+1 mysum = mysum+ i print (mysum)
mysum = 0 i = 0 while i <= 10000: i = i + 1 mysum = mysum + i print(mysum)
config = { "CLIENT_ID": "8", "API_URL": "http://DOMAIN.COM", "PERSONAL_ACCESS_TOKEN": "", "BRIDGE_IP": "192.168.x.x", }
config = {'CLIENT_ID': '8', 'API_URL': 'http://DOMAIN.COM', 'PERSONAL_ACCESS_TOKEN': '', 'BRIDGE_IP': '192.168.x.x'}
load("//bazel/rules/cpp:main.bzl", "cpp_main") load("//bazel/rules/unilang:unilang_to_java.bzl", "unilang_to_java") load("//bazel/rules/code:code_to_java.bzl", "code_to_java") load("//bazel/rules/move_file:move_file.bzl", "move_file") load("//bazel/rules/move_file:move_file_java.bzl", "move_java_file") def transfer_un...
load('//bazel/rules/cpp:main.bzl', 'cpp_main') load('//bazel/rules/unilang:unilang_to_java.bzl', 'unilang_to_java') load('//bazel/rules/code:code_to_java.bzl', 'code_to_java') load('//bazel/rules/move_file:move_file.bzl', 'move_file') load('//bazel/rules/move_file:move_file_java.bzl', 'move_java_file') def transfer_un...
getinput = input() def main(): # import pdb; pdb.set_trace() res = [] split_input = list(str(getinput)) for i, _ in enumerate(split_input): if i == len(split_input) - 1: if split_input[i] == split_input[-1]: res.append(int(split_input[i])) else: i...
getinput = input() def main(): res = [] split_input = list(str(getinput)) for (i, _) in enumerate(split_input): if i == len(split_input) - 1: if split_input[i] == split_input[-1]: res.append(int(split_input[i])) elif split_input[i] == split_input[i + 1]: ...
# # PySNMP MIB module H3C-SUBNET-VLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-SUBNET-VLAN-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:23:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ...
class User: # create the class attributes n_active = 0 users = [] # create the __init__ method def __init__(self, active, user_name): self.active = active self.user_name = user_name
class User: n_active = 0 users = [] def __init__(self, active, user_name): self.active = active self.user_name = user_name
class DatabaseError(Exception): pass class GameError(Exception): pass
class Databaseerror(Exception): pass class Gameerror(Exception): pass
lst = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) def sequential__search(lst_, num): for i in lst_: if i == num: print() print(i) return print() print() print(f"{num} does not exist in the given list") print() return False sequential__search(lst, 10)
lst = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) def sequential__search(lst_, num): for i in lst_: if i == num: print() print(i) return print() print() print(f'{num} does not exist in the given list') print() return False sequential__search(lst, 10)
def is_credit_card_valid(number): length = len(number) if length % 2 == 0: return False new_number = '' rev = number[::-1] for index in range(0,length): if index % 2 == 0: new_number += rev[index] else: new_number += (str)((int)(rev[index]) + (int)(rev[index])) return sum(map(int, list(new_number...
def is_credit_card_valid(number): length = len(number) if length % 2 == 0: return False new_number = '' rev = number[::-1] for index in range(0, length): if index % 2 == 0: new_number += rev[index] else: new_number += str(int(rev[index]) + int(rev[inde...
BNB_BASE_URL = "https://www.bnb.bg/Statistics/StExternalSector/StExchangeRates/StERForeignCurrencies/index.htm?" BNB_DATE_FORMAT = "%d.%m.%Y" BNB_SPLIT_BY_MONTHS = 3 BNB_CSV_HEADER_ROWS = 2 NAP_DIGIT_PRECISION = "0.01" NAP_DATE_FORMAT = "%Y-%m-%d" NAP_DIVIDEND_TAX = "0.05" RECEIVED_DIVIDEND_ACTIVITY_TYPES = ["DIV", ...
bnb_base_url = 'https://www.bnb.bg/Statistics/StExternalSector/StExchangeRates/StERForeignCurrencies/index.htm?' bnb_date_format = '%d.%m.%Y' bnb_split_by_months = 3 bnb_csv_header_rows = 2 nap_digit_precision = '0.01' nap_date_format = '%Y-%m-%d' nap_dividend_tax = '0.05' received_dividend_activity_types = ['DIV', 'DI...
class Matcher: def matches(self, arg): pass class Any(Matcher): def __init__(self, wanted_type=None): self.wanted_type = wanted_type def matches(self, arg): if self.wanted_type: return isinstance(arg, self.wanted_type) else: return True def __repr__(self): re...
class Matcher: def matches(self, arg): pass class Any(Matcher): def __init__(self, wanted_type=None): self.wanted_type = wanted_type def matches(self, arg): if self.wanted_type: return isinstance(arg, self.wanted_type) else: return True def __...
print("The elementary reactions are:") print(" Reaction 1: the birth of susceptible individuals with propensity b") print(" Reaction 2: their death with propensity mu_S*S(t)") print(" Reaction 3: their infection with propensity beta * S(t)*I(t)") print(" Reaction 4: the death of infected individuals with propensity mu_...
print('The elementary reactions are:') print(' Reaction 1: the birth of susceptible individuals with propensity b') print(' Reaction 2: their death with propensity mu_S*S(t)') print(' Reaction 3: their infection with propensity beta * S(t)*I(t)') print(' Reaction 4: the death of infected individuals with propensity mu_...
def baz(x): if x < 0: baz(x) else: baz(x)
def baz(x): if x < 0: baz(x) else: baz(x)
TABLES = {'Network': [['f_name', 'TEXT'], ['scenariodate', 'TEXT'], ['stopthresholdspeed', 'TEXT'], ['growth', 'TEXT'], ['defwidth', 'TEXT'], ['pedspeed', 'TEXT'], ['phf', 'TEXT'], ...
tables = {'Network': [['f_name', 'TEXT'], ['scenariodate', 'TEXT'], ['stopthresholdspeed', 'TEXT'], ['growth', 'TEXT'], ['defwidth', 'TEXT'], ['pedspeed', 'TEXT'], ['phf', 'TEXT'], ['vehlength', 'TEXT'], ['criticalmergegap', 'TEXT'], ['hv', 'TEXT'], ['followuptime', 'TEXT'], ['utdfversion', 'TEXT'], ['dontwalk', 'TEXT'...
class TxInfo: def __init__(self, txid, timestamp, fee, fee_currency, wallet_address, exchange, url): self.txid = txid self.timestamp = timestamp self.fee = fee self.fee_currency = fee_currency self.wallet_address = wallet_address self.exchange = exchange sel...
class Txinfo: def __init__(self, txid, timestamp, fee, fee_currency, wallet_address, exchange, url): self.txid = txid self.timestamp = timestamp self.fee = fee self.fee_currency = fee_currency self.wallet_address = wallet_address self.exchange = exchange self...
'''https://practice.geeksforgeeks.org/problems/multiply-two-linked-lists/1 Multiply two linked lists Easy Accuracy: 38.67% Submissions: 24824 Points: 2 Given elements as nodes of the two linked lists. The task is to multiply these two linked lists, say L1 and L2. Note: The output could be large take modulo 109+7. I...
"""https://practice.geeksforgeeks.org/problems/multiply-two-linked-lists/1 Multiply two linked lists Easy Accuracy: 38.67% Submissions: 24824 Points: 2 Given elements as nodes of the two linked lists. The task is to multiply these two linked lists, say L1 and L2. Note: The output could be large take modulo 109+7. I...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def numComponents(self, head: ListNode, G: List[int]) -> int: ans = 0 G_set = set(G) cur = head while cur: ...
class Solution: def num_components(self, head: ListNode, G: List[int]) -> int: ans = 0 g_set = set(G) cur = head while cur: if cur.val in G_set and (not cur.next or cur.next.val not in G_set): ans += 1 cur = cur.next return ans
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Rock Paper Scissors! #Problem level: 8 kyu def rps(p1, p2): if p1[0]=='r' and p2[0]=='s': return "Player 1 won!" if p1[0]=='s' and p2[0]=='p': return "Player 1 won!" if p1[0]=='p' and p2[0]=='r': return "Player 1 won!" if p2[0]=='r' and p1[0]=...
def rps(p1, p2): if p1[0] == 'r' and p2[0] == 's': return 'Player 1 won!' if p1[0] == 's' and p2[0] == 'p': return 'Player 1 won!' if p1[0] == 'p' and p2[0] == 'r': return 'Player 1 won!' if p2[0] == 'r' and p1[0] == 's': return 'Player 2 won!' if p2[0] == 's' and p1[...
class ArgsTest: def __init__(self, key:str=None, value:str=None, max_age=None, expires=None, path:str=None, domain:str=None, secure:bool=False, httponly:bool=False, sync_expires:bool=True, comment:str=None, version:int=None): pass class Sub(ArgsTest): pass
class Argstest: def __init__(self, key: str=None, value: str=None, max_age=None, expires=None, path: str=None, domain: str=None, secure: bool=False, httponly: bool=False, sync_expires: bool=True, comment: str=None, version: int=None): pass class Sub(ArgsTest): pass
def roll_new(name, gender): pass def describe(character): pass
def roll_new(name, gender): pass def describe(character): pass
# receive a integer than count the number of "1"s in it's binary form #my : def countBits(n): i = 0 while n > 2: if n % 2 == 1: i = i + 1 n = (n-1)/2 else: n = n/2 return (i + 1) if n != 0 else 0
def count_bits(n): i = 0 while n > 2: if n % 2 == 1: i = i + 1 n = (n - 1) / 2 else: n = n / 2 return i + 1 if n != 0 else 0
# -*- coding: utf-8 -*- class ImageSerializerMixin: def build_absolute_image_url(self, url): if not url.startswith('http'): request = self.context.get('request') return request.build_absolute_uri(url) return url
class Imageserializermixin: def build_absolute_image_url(self, url): if not url.startswith('http'): request = self.context.get('request') return request.build_absolute_uri(url) return url
__version__ = "0.1.9" __license__ = "Apache 2.0 license" __website__ = "https://oss.navio.online/navio-gitlab/" __download_url__ = ('https://github.com/navio-online/navio-gitlab/archive' '/{}.tar.gz'.format(__version__)),
__version__ = '0.1.9' __license__ = 'Apache 2.0 license' __website__ = 'https://oss.navio.online/navio-gitlab/' __download_url__ = ('https://github.com/navio-online/navio-gitlab/archive/{}.tar.gz'.format(__version__),)
SPACE_TOKEN = "\u241F" def replace_space(text: str) -> str: return text.replace(" ", SPACE_TOKEN) def revert_space(text: list) -> str: clean = ( " ".join("".join(text).replace(SPACE_TOKEN, " ").split()) .strip() ) return clean
space_token = '␟' def replace_space(text: str) -> str: return text.replace(' ', SPACE_TOKEN) def revert_space(text: list) -> str: clean = ' '.join(''.join(text).replace(SPACE_TOKEN, ' ').split()).strip() return clean
def check(s): (rule, password) = s.split(':') (amount, letter) = rule.split(' ') (lower, upper) = amount.split('-') count = password.count(letter) return count >= int(lower) and count <= int(upper) def solve(in_file): with open(in_file) as f: passwords = f.readlines() return sum(1 ...
def check(s): (rule, password) = s.split(':') (amount, letter) = rule.split(' ') (lower, upper) = amount.split('-') count = password.count(letter) return count >= int(lower) and count <= int(upper) def solve(in_file): with open(in_file) as f: passwords = f.readlines() return sum((1 ...
class DictionaryManipulator: def __init__(self): self.__dict = {} with open("./en_US.dic", 'r') as content_file: count = 0 for line in content_file.readlines(): words = line.split("/") if len(words) > 1: self.__dict[words[0...
class Dictionarymanipulator: def __init__(self): self.__dict = {} with open('./en_US.dic', 'r') as content_file: count = 0 for line in content_file.readlines(): words = line.split('/') if len(words) > 1: self.__dict[words[0...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"load_dcm": "00_io.ipynb", "load_h5": "00_io.ipynb", "crop": "01_manipulate.ipynb", "pad": "01_manipulate.ipynb", "resample": "01_manipulate.ipynb", "resample_by":...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'load_dcm': '00_io.ipynb', 'load_h5': '00_io.ipynb', 'crop': '01_manipulate.ipynb', 'pad': '01_manipulate.ipynb', 'resample': '01_manipulate.ipynb', 'resample_by': '01_manipulate.ipynb'} modules = ['io.py', 'manipulate.py'] doc_url = 'https://pfdama...
# # PySNMP MIB module SNR-ERD-4 (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNR-ERD-4 # Produced by pysmi-0.3.4 at Mon Apr 29 21:00:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
class Subtract: def subtract(initial, remove): if not(remove in initial): return initial index = initial.index(remove) tracker = 0 removed = '' while tracker < len(initial): if not(tracker >= index and tracker < index + len(remove)): removed += initial[tracker:tracker + 1] tracker += 1 return ...
class Subtract: def subtract(initial, remove): if not remove in initial: return initial index = initial.index(remove) tracker = 0 removed = '' while tracker < len(initial): if not (tracker >= index and tracker < index + len(remove)): r...
fr=open('migrating.txt', 'r') caseDict = {} oldList = [ "Ball_LightningSphere1.bmp", "Ball_LightningSphere2.bmp", "Ball_LightningSphere3.bmp", "Ball_Paper.bmp", "Ball_Stone.bmp", "Ball_Wood.bmp", "Brick.bmp", "Button01_deselect.tga", "Button01_select.tga", "Button01_special.tga"...
fr = open('migrating.txt', 'r') case_dict = {} old_list = ['Ball_LightningSphere1.bmp', 'Ball_LightningSphere2.bmp', 'Ball_LightningSphere3.bmp', 'Ball_Paper.bmp', 'Ball_Stone.bmp', 'Ball_Wood.bmp', 'Brick.bmp', 'Button01_deselect.tga', 'Button01_select.tga', 'Button01_special.tga', 'Column_beige.bmp', 'Column_beige_fa...
class Net3(nn.Module): def __init__(self, kernel=None, padding=0, stride=2): super(Net3, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=3, kernel_size=3, padding=padding) # first kernel - leading diagonal kernel_1 = torch.Tensor([[[1, -1, -1], ...
class Net3(nn.Module): def __init__(self, kernel=None, padding=0, stride=2): super(Net3, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=3, kernel_size=3, padding=padding) kernel_1 = torch.Tensor([[[1, -1, -1], [-1, 1, -1], [-1, -1, 1]]]) kernel_2 = torch.Tensor(...
# Fonte https://www.thehuxley.com/problem/2253?locale=pt_BR # TODO: Ordenar saidas de forma alfabetica, seguindo especificacoes do problema tamanho_a, tamanho_b = input().split() tamanho_a = int(tamanho_a) tamanho_b = int(tamanho_b) selecionados_a, selecionados_b = input().split() selecionados_a = int(selecionados_a) ...
(tamanho_a, tamanho_b) = input().split() tamanho_a = int(tamanho_a) tamanho_b = int(tamanho_b) (selecionados_a, selecionados_b) = input().split() selecionados_a = int(selecionados_a) selecionados_b = int(selecionados_b) a = input().split() a = list(map(int, a)) b = input().split() b = list(map(int, b)) a.sort() b.sort(...
# # PySNMP MIB module ASCEND-CALL-LOGGING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-CALL-LOGGING-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:26:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(call_logging_group,) = mibBuilder.importSymbols('ASCEND-MIB', 'callLoggingGroup') (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_ran...
filepath = 'Prometheus_Unbound.txt' with open(filepath) as fp: line = fp.readline() cnt = 1 while line: print("Line {}: {}".format(cnt, line.strip())) line = fp.readline() cnt += 1
filepath = 'Prometheus_Unbound.txt' with open(filepath) as fp: line = fp.readline() cnt = 1 while line: print('Line {}: {}'.format(cnt, line.strip())) line = fp.readline() cnt += 1
sum = 0 for i in range(1000): if i%3==0 or i%5==0: sum+=i print(sum)
sum = 0 for i in range(1000): if i % 3 == 0 or i % 5 == 0: sum += i print(sum)
# https://www.codingame.com/training/easy/lumen def get_neighbors(col, row, room_size): if room_size == 1: return if row > 0: yield col, row - 1 if col > 0: yield col - 1, row - 1 if col < room_size - 1: yield col + 1, row - 1 if row < room_size - 1: yield col, row + 1 ...
def get_neighbors(col, row, room_size): if room_size == 1: return if row > 0: yield (col, row - 1) if col > 0: yield (col - 1, row - 1) if col < room_size - 1: yield (col + 1, row - 1) if row < room_size - 1: yield (col, row + 1) if col...
neighborhoods = [ "Andersonville", "Archer Heights", "Ashburn", "Ashburn Estates", "Austin", "Avaondale", "Belmont Central", "Beverly", "Beverly Woods", "Brainerd", "Bridgeport", "Brighton Park", "Bronceville", "Bucktown", "Burnside", "Calumet Heights", ...
neighborhoods = ['Andersonville', 'Archer Heights', 'Ashburn', 'Ashburn Estates', 'Austin', 'Avaondale', 'Belmont Central', 'Beverly', 'Beverly Woods', 'Brainerd', 'Bridgeport', 'Brighton Park', 'Bronceville', 'Bucktown', 'Burnside', 'Calumet Heights', 'Canaryville', 'Clearing', 'Chatham', 'Chinatown', 'Cottage Grove H...
largura = int(input('digite a largura: ')) altura = int(input('digite a altura: ')) resetalargura = largura contador = largura print((largura) * '#', end='') while altura > 0: while contador < largura and contador > 0: print('#', end='') contador -= 1 print('#') altura -= 1 print((largu...
largura = int(input('digite a largura: ')) altura = int(input('digite a altura: ')) resetalargura = largura contador = largura print(largura * '#', end='') while altura > 0: while contador < largura and contador > 0: print('#', end='') contador -= 1 print('#') altura -= 1 print(largura * '#'...
def task_dis(size,task_list): task_num=len(task_list) task_dis_list=[] for i in range(size): task_dis_list.append([]) #print(str(task_dis_list)) for i in range(len(task_list)): for j in range(size): if i%size==j: task_dis_list[j].append(task_list[i]) #for i in range(size): # print("************"...
def task_dis(size, task_list): task_num = len(task_list) task_dis_list = [] for i in range(size): task_dis_list.append([]) for i in range(len(task_list)): for j in range(size): if i % size == j: task_dis_list[j].append(task_list[i]) return task_dis_list if...
''' By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? ''' p_no = 0 def is_prime(x): if x >= 2: for y in range(2,x): if not( x % y ): #reverse the modulo operation retu...
""" By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? """ p_no = 0 def is_prime(x): if x >= 2: for y in range(2, x): if not x % y: return False else: return False return Tru...
load("//third_party:repos/boost.bzl", "boost_repository") load("//third_party:repos/grpc.bzl", "grpc_rules_repository") load("//third_party:repos/gtest.bzl", "gtest_repository") def dependencies(excludes = []): ignores = native.existing_rules().keys() + excludes if "com_github_nelhage_rules_boost" not in igno...
load('//third_party:repos/boost.bzl', 'boost_repository') load('//third_party:repos/grpc.bzl', 'grpc_rules_repository') load('//third_party:repos/gtest.bzl', 'gtest_repository') def dependencies(excludes=[]): ignores = native.existing_rules().keys() + excludes if 'com_github_nelhage_rules_boost' not in ignores...
class EncodingEnum: BINARY_ENCODING = 0 BINARY_WITH_VARIABLE_LENGTH_STRINGS = 1 JSON_ENCODING = 2 JSON_COMPACT_ENCODING = 3 PROTOCOL_BUFFERS = 4
class Encodingenum: binary_encoding = 0 binary_with_variable_length_strings = 1 json_encoding = 2 json_compact_encoding = 3 protocol_buffers = 4
num = int(input('Digite um numero [999 para parar]: ')) soma = 0 tot = 0 while num != 999: soma += num tot += 1 num = int(input('Digite um numero [999 para parar] : ')) print(f'{soma} e {tot}')
num = int(input('Digite um numero [999 para parar]: ')) soma = 0 tot = 0 while num != 999: soma += num tot += 1 num = int(input('Digite um numero [999 para parar] : ')) print(f'{soma} e {tot}')
_base_ = [ '../../_base_/models/faster_rcnn_r50_fpn.py', '../../_base_/datasets/waymo_detection_1280x1920.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py' ] # model model = dict( rpn_head=dict( anchor_generator=dict( type='AnchorGenerator', ...
_base_ = ['../../_base_/models/faster_rcnn_r50_fpn.py', '../../_base_/datasets/waymo_detection_1280x1920.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py'] model = dict(rpn_head=dict(anchor_generator=dict(type='AnchorGenerator', scales=[3], ratios=[0.5, 1.0, 2.0], strides=[4, 8, 16, 32, 64...
a = 5 b = 6 c = 7.5 result = multiply(a, b, c) print(result)
a = 5 b = 6 c = 7.5 result = multiply(a, b, c) print(result)
ch=input("Enter ch = ") for i in range (0,len(ch)-1,2): if(ch[i].isalpha()): print((ch[i])*int(ch[i+1]),end="") elif(ch[i+1].isalpha()): print((ch[i+1])*int(ch[i]),end="")
ch = input('Enter ch = ') for i in range(0, len(ch) - 1, 2): if ch[i].isalpha(): print(ch[i] * int(ch[i + 1]), end='') elif ch[i + 1].isalpha(): print(ch[i + 1] * int(ch[i]), end='')
class KalmanFilter: def __init__(self, errorMeasurement, errorEstimate, q): self.errorMeasurement = errorMeasurement self.errorEstimate = errorEstimate self.q = q #covariance error self.lastEstimate = 25.0 self.currentEstimate = 25.0 def updateEstimate(se...
class Kalmanfilter: def __init__(self, errorMeasurement, errorEstimate, q): self.errorMeasurement = errorMeasurement self.errorEstimate = errorEstimate self.q = q self.lastEstimate = 25.0 self.currentEstimate = 25.0 def update_estimate(self, measurement): k_gain...
''' Settings for generating synthetic images using code for Cut, Paste, and Learn Paper ''' # Paths BACKGROUND_DIR = '/scratch/jnan1/background/TRAIN' BACKGROUND_GLOB_STRING = '*.png' INVERTED_MASK = False # Set to true if white pixels represent background # Parameters for generator NUMBER_OF_WORKERS = 4 BLENDING_LIS...
""" Settings for generating synthetic images using code for Cut, Paste, and Learn Paper """ background_dir = '/scratch/jnan1/background/TRAIN' background_glob_string = '*.png' inverted_mask = False number_of_workers = 4 blending_list = ['gaussian', 'none', 'box', 'motion'] min_no_of_objects = 1 max_no_of_objects = 3 mi...
# https://adventofcode.com/2019/day/4 def is_valid_password(i: int, version: int = 1) -> bool: i_digits = [int(digit) for digit in str(i)] is_increasing, repeats = True, False for k in range(len(i_digits) - 1): if i_digits[k] > i_digits[k+1]: is_increasing = False elif version ...
def is_valid_password(i: int, version: int=1) -> bool: i_digits = [int(digit) for digit in str(i)] (is_increasing, repeats) = (True, False) for k in range(len(i_digits) - 1): if i_digits[k] > i_digits[k + 1]: is_increasing = False elif version == 1 and i_digits[k] == i_digits[k +...
#Function which finds 45 minutes before current time def alarm_clock(h, m): #Finding total minutes passed total_minutes = h * 60 + m ans = [] #Subtracting 45 minutes if total_minutes >= 45: answer_minutes = total_minutes - 45 else: answer_minutes = total_minutes - 45 + 1440 ...
def alarm_clock(h, m): total_minutes = h * 60 + m ans = [] if total_minutes >= 45: answer_minutes = total_minutes - 45 else: answer_minutes = total_minutes - 45 + 1440 ans += [answer_minutes // 60, answer_minutes % 60] return ans (h, m) = map(int, input().split()) answer_list = [...
class TypeValidator(object): def __init__(self, *types, **options): self.types = types self.exclude = options.get('exclude') def __call__(self, value): if self.exclude is not None and isinstance(value, self.exclude): return False if not isinstance(value, self.types...
class Typevalidator(object): def __init__(self, *types, **options): self.types = types self.exclude = options.get('exclude') def __call__(self, value): if self.exclude is not None and isinstance(value, self.exclude): return False if not isinstance(value, self.types)...
class ImageArea: def __init__(self, width, height): self.width = width self.height = height def get_area(self): area = self.width * self.height return area def __gt__(self, other): return self.get_area() > other.get_area() def __ge__(self, other): retur...
class Imagearea: def __init__(self, width, height): self.width = width self.height = height def get_area(self): area = self.width * self.height return area def __gt__(self, other): return self.get_area() > other.get_area() def __ge__(self, other): retu...
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: found = {} max_length = 0 start_pos = -1 for pos, char in enumerate(s): if char in found and start_pos <= found[char]: start_pos = found[char] else: max_length =...
class Solution: def length_of_longest_substring(self, s: str) -> int: found = {} max_length = 0 start_pos = -1 for (pos, char) in enumerate(s): if char in found and start_pos <= found[char]: start_pos = found[char] else: max_le...
try: raise ArithmeticError except Exception: print("Caught ArithmeticError via Exception") try: raise ArithmeticError except ArithmeticError: print("Caught ArithmeticError") try: raise AssertionError except Exception: print("Caught AssertionError via Exception") try: raise AssertionError ...
try: raise ArithmeticError except Exception: print('Caught ArithmeticError via Exception') try: raise ArithmeticError except ArithmeticError: print('Caught ArithmeticError') try: raise AssertionError except Exception: print('Caught AssertionError via Exception') try: raise AssertionError exc...
# The directory where jobs are stored job_directory = "/fred/oz988/gwcloud/jobs/" # Format submission script for specified scheduler. scheduler = "slurm" # Environment scheduler sources during runtime scheduler_env = "/fred/oz988/gwcloud/gwcloud_job_client/bundles/unpacked/fbc9f7c0815f1a83b0de36f957351c93797b2049/ven...
job_directory = '/fred/oz988/gwcloud/jobs/' scheduler = 'slurm' scheduler_env = '/fred/oz988/gwcloud/gwcloud_job_client/bundles/unpacked/fbc9f7c0815f1a83b0de36f957351c93797b2049/venv/bin/activate'
# Node: Gate G102 (1096088604) # http://www.openstreetmap.org/node/1096088604 assert_has_feature( 16, 10487, 25366, 'pois', { 'id': 1096088604, 'kind': 'aeroway_gate' }) # Node: Gate 1 (2618197593) # http://www.openstreetmap.org/node/2618197593 assert_has_feature( 16, 10309, 22665, 'pois', { 'id': 2618...
assert_has_feature(16, 10487, 25366, 'pois', {'id': 1096088604, 'kind': 'aeroway_gate'}) assert_has_feature(16, 10309, 22665, 'pois', {'id': 2618197593, 'kind': 'gate', 'aeroway': type(None)}) assert_has_feature(16, 13462, 24933, 'pois', {'id': 2122898936, 'kind': 'ski_rental'}) assert_has_feature(16, 10566, 25429, 'la...
# Leo colorizer control file for io mode. # This file is in the public domain. # Properties for io mode. properties = { "commentStart": "*/", "indentCloseBrackets": ")", "indentOpenBrackets": "(", "lineComment": "//", "lineUpClosingBracket": "true", } # Attributes dict for io_main rule...
properties = {'commentStart': '*/', 'indentCloseBrackets': ')', 'indentOpenBrackets': '(', 'lineComment': '//', 'lineUpClosingBracket': 'true'} io_main_attributes_dict = {'default': 'null', 'digit_re': '', 'escape': '\\', 'highlight_digits': 'true', 'ignore_case': 'false', 'no_word_sep': ''} attributes_dict_dict = {'io...
x = int(input()) ar = list(map(int,input().split())) ar = sorted(ar) if(ar[0]<=0): print(False) else: chk = False for i in ar: s = str(i) if (s==s[::-1]): chk = True break print(chk)
x = int(input()) ar = list(map(int, input().split())) ar = sorted(ar) if ar[0] <= 0: print(False) else: chk = False for i in ar: s = str(i) if s == s[::-1]: chk = True break print(chk)
#!/bin/zsh ''' Extending the Multiclipboard Extend the multiclipboard program in this chapter so that it has a delete <keyword> command line argument that will delete a keyword from the shelf. Then add a delete command line argument that will delete all keywords. '''
""" Extending the Multiclipboard Extend the multiclipboard program in this chapter so that it has a delete <keyword> command line argument that will delete a keyword from the shelf. Then add a delete command line argument that will delete all keywords. """
class CityNotFoundError(Exception): pass class ServerError(Exception): pass class OWMApiKeyIsNotCorrectError(ServerError): pass
class Citynotfounderror(Exception): pass class Servererror(Exception): pass class Owmapikeyisnotcorrecterror(ServerError): pass
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: l = 0 r = len(numbers) - 1 while l < r: sum = numbers[l] + numbers[r] if sum == target: return [l + 1, r + 1] if sum < target: l += 1 else: r -= 1
class Solution: def two_sum(self, numbers: List[int], target: int) -> List[int]: l = 0 r = len(numbers) - 1 while l < r: sum = numbers[l] + numbers[r] if sum == target: return [l + 1, r + 1] if sum < target: l += 1 ...
HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' REDEFINED = "\033[0;0m" PROCESS = "\033[1;37;42m" def message_information(text): print(OKBLUE + str(text) + REDEFINED) def message_sucess(text): pri...
header = '\x1b[95m' okblue = '\x1b[94m' okgreen = '\x1b[92m' warning = '\x1b[93m' fail = '\x1b[91m' endc = '\x1b[0m' bold = '\x1b[1m' underline = '\x1b[4m' redefined = '\x1b[0;0m' process = '\x1b[1;37;42m' def message_information(text): print(OKBLUE + str(text) + REDEFINED) def message_sucess(text): print(OKG...
class SensorStatusJob: on = 'ON' off = 'OFF' broken = 'BROKEN' charge_low = 'CHARGE_LOW' discharged = 'DISCHARGED' class SensorStatusSituation: null = 'NULL' stable = 'STABLE' fire = 'FIRE' warning = 'WARNING' class ObjectStatusJob: on = 'ON' off = 'OFF' defect = 'DEF...
class Sensorstatusjob: on = 'ON' off = 'OFF' broken = 'BROKEN' charge_low = 'CHARGE_LOW' discharged = 'DISCHARGED' class Sensorstatussituation: null = 'NULL' stable = 'STABLE' fire = 'FIRE' warning = 'WARNING' class Objectstatusjob: on = 'ON' off = 'OFF' defect = 'DEFEC...
# Misc general coloring tips # Color organization: highlighted, neutral, and low-lighted/background # Red and green in center of screen # Blue, black, white, and yellow in periphery of screen # http://www.awwwards.com/flat-design-an-in-depth-look.html # main actions such as "Submit," "Send," "See More," should have v...
titlefont1 = {'type': ('Segoe UI', 12, 'bold'), 'color': 'black'} titlefont1_contrast = {'type': ('Segoe UI', 12, 'bold'), 'color': 'white'} font1 = {'type': ('Segoe UI', 10), 'color': 'black'} font2 = {'type': ('Segoe UI', 10), 'color': 'Grey42'} color1 = 'Grey69' color2 = 'Grey79' color3 = 'Grey89' color4 = 'Grey99' ...
subprocess.Popen('/bin/ls *', shell=True) #nosec (on the line) subprocess.Popen('/bin/ls *', #nosec (at the start of function call) shell=True) subprocess.Popen('/bin/ls *', shell=True) #nosec (on the specific kwarg line)
subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('/bin/ls *', shell=True)
''' Single point of truth for version information ''' VERSION_NO = '1.1.7' VERSION_DESC = 'VAWS' + VERSION_NO
""" Single point of truth for version information """ version_no = '1.1.7' version_desc = 'VAWS' + VERSION_NO
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: if head is None: return None slow = fast = head meet = None while fast and fas...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def detect_cycle(self, head: ListNode) -> ListNode: if head is None: return None slow = fast = head meet = None while fast and fast.next: slow = slow.ne...
# Create a string variable with your full name name = "Boris Johnson" # Split the string into a list names = name.split(" ") # Print out your surname surname = names[-1] print("Surname:", surname) # Check if your surname contains the letter 'e' pos = surname.find("e") print("Position of 'e':", pos) # or contains th...
name = 'Boris Johnson' names = name.split(' ') surname = names[-1] print('Surname:', surname) pos = surname.find('e') print("Position of 'e':", pos) pos = surname.find('o') print("Position of 'o':", pos)
value = 'some' #modify this line if value == 'Y' or value == 'y': print('yes') elif value == 'N' or value == 'n': print('no') else: print('error')
value = 'some' if value == 'Y' or value == 'y': print('yes') elif value == 'N' or value == 'n': print('no') else: print('error')
class BasicBlock(object): def __init__(self): self.start_addr = 0 self.end_addr = 0 self.instructions = [] self.successors = [] def __str__(self): return "0x%x - 0x%x (%d) -> [%s]" % (self.start_addr, self.end_addr, len(self.instructions), ", ".join(["0x%x" % ref for ...
class Basicblock(object): def __init__(self): self.start_addr = 0 self.end_addr = 0 self.instructions = [] self.successors = [] def __str__(self): return '0x%x - 0x%x (%d) -> [%s]' % (self.start_addr, self.end_addr, len(self.instructions), ', '.join(['0x%x' % ref for re...
events = input().split("|") energy = 100 coins = 100 is_bankrupt = False for event in events: args = event.split("-") name = args[0] value = int(args[1]) if name == "rest": gained_energy = 0 if energy + value < 100: gained_energy = value energy += value ...
events = input().split('|') energy = 100 coins = 100 is_bankrupt = False for event in events: args = event.split('-') name = args[0] value = int(args[1]) if name == 'rest': gained_energy = 0 if energy + value < 100: gained_energy = value energy += value el...
to_name = { "TA": "TA", "D": "dependent", "TC": "tile coding", "RB": "random binary", "R": "random real-valued", "P": "polynomial", "F": "fourier", "RC": "state aggregation", }
to_name = {'TA': 'TA', 'D': 'dependent', 'TC': 'tile coding', 'RB': 'random binary', 'R': 'random real-valued', 'P': 'polynomial', 'F': 'fourier', 'RC': 'state aggregation'}
# -*- coding:utf-8 -*- class Solution: def IsPopOrder(self, pushV, popV): # write code here imi = [pushV.pop(0)] while imi: cur = popV.pop(0) while imi[-1] != cur: if not pushV: return False imi.append(pushV.pop(0)) imi.pop(...
class Solution: def is_pop_order(self, pushV, popV): imi = [pushV.pop(0)] while imi: cur = popV.pop(0) while imi[-1] != cur: if not pushV: return False imi.append(pushV.pop(0)) imi.pop() return True s = ...
colors_file = None try: colors_file = open("colors2.txt", "r") for color in colors_file: print(color.rstrip()) except IOError as exc: print(exc) finally: if colors_file: colors_file.close() # print(dir(colors_file))
colors_file = None try: colors_file = open('colors2.txt', 'r') for color in colors_file: print(color.rstrip()) except IOError as exc: print(exc) finally: if colors_file: colors_file.close()
''' import html2text html = input('') text = html2text.html2text(html) print(text) input() ''' teste = input("Digite:") if teste == "1": print("1") elif teste == "2": print("2") else: print("3")
""" import html2text html = input('') text = html2text.html2text(html) print(text) input() """ teste = input('Digite:') if teste == '1': print('1') elif teste == '2': print('2') else: print('3')
d = {'name':'mari','age':19,'gender':'feminine'} del d['age'] print(d.values()) # .keys() # .items() for k,v in d.items(): print(f'[{k}]:[{v}]') print(d) e = {} br = [] for c in range(0,2): e['uf'] = str(input('estado: ')) e['cidade'] = str(input('cidade: ')) br.append(e.copy()) print(br)
d = {'name': 'mari', 'age': 19, 'gender': 'feminine'} del d['age'] print(d.values()) for (k, v) in d.items(): print(f'[{k}]:[{v}]') print(d) e = {} br = [] for c in range(0, 2): e['uf'] = str(input('estado: ')) e['cidade'] = str(input('cidade: ')) br.append(e.copy()) print(br)
class MultiplesOf3And5: def execute(self, top): result = 0 for multiple in [3, 5]: result += sum(self.get_multiples(multiple, top)) return result def get_multiples(self, multiple, top): value = 0 while value < top: yield value ...
class Multiplesof3And5: def execute(self, top): result = 0 for multiple in [3, 5]: result += sum(self.get_multiples(multiple, top)) return result def get_multiples(self, multiple, top): value = 0 while value < top: yield value value +...
# # PROBLEM INTERPRETATION | MY INTERPRETATION # | # West | West # _______ | ...
def resize(list_, radius, default): for _ in range((size(radius) - len(list_)) // 2): list_.append(safe_copy(default)) list_.insert(0, safe_copy(default)) def safe_copy(element): try: return element.copy() except AttributeError: return element def size(radius): return 2...
# Why does this file exist, and why not put this in `__main__`? # # You might be tempted to import things from __main__ later, # but that will cause problems: the code will get executed twice: # # - When you run `python -m poetry_issue_2369` python will execute # `__main__.py` as a script. That means there won't be a...
def main(args=None): return 1
{ "task": "tabular", "core": { "data": { "bs": 64, #Default "val_bs": null, #Default "device": null, #Default "no_check": false, #Default "num_workers": 16, "validation": { "method": "none", # [spl...
{'task': 'tabular', 'core': {'data': {'bs': 64, 'val_bs': null, 'device': null, 'no_check': false, 'num_workers': 16, 'validation': {'method': 'none', 'rand_pct': {'valid_pct': 0.2, 'seed': null}, 'idx': {'csv_name': null, 'valid_idx': 20}, 'subsets': {'train_size': 0.08, 'valid_size': 0.2, 'seed': null}, 'files': {'va...
class Solution: def containsDuplicate(self, nums: List[int]) -> bool: seen = {} for i in nums: if i in seen: return True seen[i] = 1 return False
class Solution: def contains_duplicate(self, nums: List[int]) -> bool: seen = {} for i in nums: if i in seen: return True seen[i] = 1 return False
d = {"a": 1, "b": 2, "c": 3} sum=0 for i in d: sum+=d.get(i) print(sum)
d = {'a': 1, 'b': 2, 'c': 3} sum = 0 for i in d: sum += d.get(i) print(sum)
def triple_sum(nums): result = [] for i in nums: for j in nums: for k in nums: j_is_unique = j != i and j != k k_is_unique = k != i sum_is_zero = (i + j + k) == 0 if j_is_unique and k_is_unique and sum_is_zero: ...
def triple_sum(nums): result = [] for i in nums: for j in nums: for k in nums: j_is_unique = j != i and j != k k_is_unique = k != i sum_is_zero = i + j + k == 0 if j_is_unique and k_is_unique and sum_is_zero: ...
s=str(input()) n1,n2=[int(e) for e in input().split()] j=0 for i in range(len(s)): if j<n1-1: print(s[j],end="") j+=1 elif j>=n1-1: j=n2 if j>=n1: print(s[j],end="") j-=1 elif j<=k: print(s[j],end="") j+=1 k=n2-1
s = str(input()) (n1, n2) = [int(e) for e in input().split()] j = 0 for i in range(len(s)): if j < n1 - 1: print(s[j], end='') j += 1 elif j >= n1 - 1: j = n2 if j >= n1: print(s[j], end='') j -= 1 elif j <= k: print(s[j], end='') ...
def mapDict(d, mapF): result = {} for key in d: mapped = mapF(key, d[key]) if mapped != None: result[key] = mapped return result withPath = mapDict(houseClosestObj, lambda house, obj: { "target": obj, "path": houseObjPaths[house][obj]}) with open("houseClose...
def map_dict(d, mapF): result = {} for key in d: mapped = map_f(key, d[key]) if mapped != None: result[key] = mapped return result with_path = map_dict(houseClosestObj, lambda house, obj: {'target': obj, 'path': houseObjPaths[house][obj]}) with open('houseClosestObj.json', 'w') a...
# rounds a number to the nearest even number # Author: Isabella Doyle num = float(input("Enter a number: ")) round = round(num) print('{} rounded is {}'.format(num, round))
num = float(input('Enter a number: ')) round = round(num) print('{} rounded is {}'.format(num, round))
def main(): print('This is printed from testfile.py') if __name__=='__main__': main()
def main(): print('This is printed from testfile.py') if __name__ == '__main__': main()
def _get_main(ctx): if ctx.file.main: return ctx.file.main.path main = ctx.label.name + ".py" for src in ctx.files.srcs: if src.basename == main: return src.path fail( "corresponding default '{}' does not appear in srcs. ".format(main) + "Add it or override de...
def _get_main(ctx): if ctx.file.main: return ctx.file.main.path main = ctx.label.name + '.py' for src in ctx.files.srcs: if src.basename == main: return src.path fail("corresponding default '{}' does not appear in srcs. ".format(main) + "Add it or override default file name w...
#---------------------------------------------------------------------------------------------------------- # # AUTOMATICALLY GENERATED FILE TO BE USED BY W_HOTBOX # # NAME: Copy Hue/Sat # #---------------------------------------------------------------------------------------------------------- ns = nuke.selectedNode...
ns = nuke.selectedNodes() for n in ns: n.knob('hue').setValue(1) n.knob('sat').setValue(1) n.knob('lumaMix').setValue(0)
#!/usr/bin/env python temp = 24 Farenheint = temp * 1.8 + 32 print(Farenheint)
temp = 24 farenheint = temp * 1.8 + 32 print(Farenheint)
expected_output = { 'id':{ 101: { 'connection': 0, 'name': 'grpc-tcp', 'state': 'Resolving', 'explanation': 'Resolution request in progress' } } }
expected_output = {'id': {101: {'connection': 0, 'name': 'grpc-tcp', 'state': 'Resolving', 'explanation': 'Resolution request in progress'}}}
dolares = input('Cuantos dolares tienes?: ') dolares = float(dolares) valor_dolar = 0.045 peso = dolares / valor_dolar peso = round(peso,2) peso = str(peso) print('Tienes $' + peso + ' Pesos')
dolares = input('Cuantos dolares tienes?: ') dolares = float(dolares) valor_dolar = 0.045 peso = dolares / valor_dolar peso = round(peso, 2) peso = str(peso) print('Tienes $' + peso + ' Pesos')
load(":collect_export_declaration.bzl", "collect_export_declaration") load(":collect_header_declaration.bzl", "collect_header_declaration") load(":collect_link_declaration.bzl", "collect_link_declaration") load(":collect_umbrella_dir_declaration.bzl", "collect_umbrella_dir_declaration") load(":collection_results.bzl", ...
load(':collect_export_declaration.bzl', 'collect_export_declaration') load(':collect_header_declaration.bzl', 'collect_header_declaration') load(':collect_link_declaration.bzl', 'collect_link_declaration') load(':collect_umbrella_dir_declaration.bzl', 'collect_umbrella_dir_declaration') load(':collection_results.bzl', ...
# GEPPETTO SERVLET MESSAGES class Servlet: LOAD_PROJECT_FROM_URL = 'load_project_from_url' RUN_EXPERIMENT = 'run_experiment' CLIENT_ID = 'client_id' PING = 'ping' class ServletResponse: PROJECT_LOADED = 'project_loaded' GEPPETTO_MODEL_LOADED = 'geppetto_model_loaded' EXPERIMENT_LOADED ...
class Servlet: load_project_from_url = 'load_project_from_url' run_experiment = 'run_experiment' client_id = 'client_id' ping = 'ping' class Servletresponse: project_loaded = 'project_loaded' geppetto_model_loaded = 'geppetto_model_loaded' experiment_loaded = 'experiment_loaded' error_r...
# 2. Using the dictionary created in the previous problem, allow the user to enter a dollar amount # and print out all the products whose price is less than that amount. print('To stop any phase, enter an empty product name.') product_dict = {} while True: product = input('Enter a product name to assign with a pr...
print('To stop any phase, enter an empty product name.') product_dict = {} while True: product = input('Enter a product name to assign with a price: ') if product == '': break price = input('Enter the product price: ') while price == '': print('You must enter a price for the product.') ...
reservation_day = int(input()) reservation_month = int(input()) accommodation_day = int(input()) accommodation_month = int(input()) leaving_day = int(input()) leaving_month = int(input()) discount = 0 price_per_night = 0 discount_days = accommodation_day - 10 days_staying = abs(accommodation_day - leaving_day) if r...
reservation_day = int(input()) reservation_month = int(input()) accommodation_day = int(input()) accommodation_month = int(input()) leaving_day = int(input()) leaving_month = int(input()) discount = 0 price_per_night = 0 discount_days = accommodation_day - 10 days_staying = abs(accommodation_day - leaving_day) if reser...
s, a, A = list(input()), list('abcdefghijklmnopqrstuvwxyz'), 26 s1, s2 = s[0:len(s) // 2], s[len(s) // 2:len(s)] s1_r, s2_r = sum([a.index(i.lower()) for i in s1]), sum([a.index(i.lower()) for i in s2]) for i in range(len(s1)): s1[i] = a[(s1_r + a.index(s1[i].lower())) % A] for i in range(len(s2)): s2[i] = a[(s2...
(s, a, a) = (list(input()), list('abcdefghijklmnopqrstuvwxyz'), 26) (s1, s2) = (s[0:len(s) // 2], s[len(s) // 2:len(s)]) (s1_r, s2_r) = (sum([a.index(i.lower()) for i in s1]), sum([a.index(i.lower()) for i in s2])) for i in range(len(s1)): s1[i] = a[(s1_r + a.index(s1[i].lower())) % A] for i in range(len(s2)): ...
def test(): print('hello world') c = color(1,0.2,0.2, 1) print(c) print(c.r) print(c.g) print(c.b) print(c.a) c.a = 0.5 print(c.a) c.b += 0.1 print(c.b) d = c.darkened( 0.9 ) print(d) test()
def test(): print('hello world') c = color(1, 0.2, 0.2, 1) print(c) print(c.r) print(c.g) print(c.b) print(c.a) c.a = 0.5 print(c.a) c.b += 0.1 print(c.b) d = c.darkened(0.9) print(d) test()
out = [] digits =[ "0000001", "1001111", #1 "0010010", "0000110", #3 "1001100", "0100100", #5 "1100000", "0001111", #7 "0000000", "0001100", #9 ] for i in range(10000): s = "{:04d}".format(i) out += ["{...
out = [] digits = ['0000001', '1001111', '0010010', '0000110', '1001100', '0100100', '1100000', '0001111', '0000000', '0001100'] for i in range(10000): s = '{:04d}'.format(i) out += ['{:21d} 0 0 {} {} {} {}'.format(i, digits[int(s[0])], digits[int(s[1])], digits[int(s[2])], digits[int(s[3])])] f = open('example...