content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
x=int(input("Enter a value for x: ")) y=int(input("Enter a value for y: ")) z=int(input("Enter a value for z: ")) if x<y<z: print("branch 1", end =' ') elif x>y>z: print("branch 2", end =' ') else: print("branch 3", end =' ') print("is the branch")
x = int(input('Enter a value for x: ')) y = int(input('Enter a value for y: ')) z = int(input('Enter a value for z: ')) if x < y < z: print('branch 1', end=' ') elif x > y > z: print('branch 2', end=' ') else: print('branch 3', end=' ') print('is the branch')
"""Pyvista specific errors.""" class MissingDataError(ValueError): """Exception when data is missing, e.g. no active scalars can be set.""" class AmbiguousDataError(ValueError): """Exception when data is ambiguous, e.g. multiple active scalars can be set."""
"""Pyvista specific errors.""" class Missingdataerror(ValueError): """Exception when data is missing, e.g. no active scalars can be set.""" class Ambiguousdataerror(ValueError): """Exception when data is ambiguous, e.g. multiple active scalars can be set."""
PORT=5050 HEADER=128 FORMAT='utf-8' HEADER=64 DISCONNECT_MESSAGE='bye_0x8x0_eyb' PING_MSG='I____NAME____I' CHANGE_BIT='I_____I'
port = 5050 header = 128 format = 'utf-8' header = 64 disconnect_message = 'bye_0x8x0_eyb' ping_msg = 'I____NAME____I' change_bit = 'I_____I'
""" @author: Andrea Domenico Giuliano @contact: andreadomenico.giuliano@studenti.unipd.it @organization: University of Padua """ #File contenente la funzione che ritorna quante volte compare un item tra le impression di una settimana # e la funzione che ritorna la lista degli items di un impressions def c_i(...
""" @author: Andrea Domenico Giuliano @contact: andreadomenico.giuliano@studenti.unipd.it @organization: University of Padua """ def c_i(c, item_id, imp_id): c.execute('select count(item_id.%s) from imp_items where (imp_id = %s)' % (item_id, imp_id)) for r in c: n_i = int(r[0]) return n_i def l_i(...
def comp_surface_opening(self, Ndisc=200): """Compute the Slot opening surface (by numerical computation). Caution, the bottom of the Slot is an Arc Parameters ---------- self : Slot A Slot object Ndisc : int Number of point to discretize the lines Returns ------- S...
def comp_surface_opening(self, Ndisc=200): """Compute the Slot opening surface (by numerical computation). Caution, the bottom of the Slot is an Arc Parameters ---------- self : Slot A Slot object Ndisc : int Number of point to discretize the lines Returns ------- S...
#!/usr/bin/env python3 syscall_table = [ "ni_syscall", "console_putc", "console_puts", "process_create", "process_exit", "thread_create", "thread_exit", "vmo_create", "vmo_write", "vmo_read", "vmo_map", "register_server", "register_named_server", "register_client...
syscall_table = ['ni_syscall', 'console_putc', 'console_puts', 'process_create', 'process_exit', 'thread_create', 'thread_exit', 'vmo_create', 'vmo_write', 'vmo_read', 'vmo_map', 'register_server', 'register_named_server', 'register_client', 'register_client_by_name', 'ipc_call', 'ipc_return', 'nanosleep', 'clock_get',...
class CaesarEncryption: def __init__(self,input_message,shift): self.input_message = input_message self.shift=shift def get_shifted_message(self): alphabet_list_sequence = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] e...
class Caesarencryption: def __init__(self, input_message, shift): self.input_message = input_message self.shift = shift def get_shifted_message(self): alphabet_list_sequence = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',...
class InvalidRequest(Exception): def __init__(self, message='', status_code=403): super(InvalidRequest, self).__init__() self.message = message self.status_code = status_code @property def as_dict(self): return { 'error': 'Invalid Request', 'message'...
class Invalidrequest(Exception): def __init__(self, message='', status_code=403): super(InvalidRequest, self).__init__() self.message = message self.status_code = status_code @property def as_dict(self): return {'error': 'Invalid Request', 'message': self.message}
#!/usr/bin/env python # coding: utf-8 # # BATCH 7 DAY 3 ASSIGNMENT # Question 1 # In[ ]: for altitude in range(1000,10000): altitude=int(input('enter altitude')) if altitude ==1000: print('plane is safe to land') elif altitude > 1000 and altitude < 5000: print('bring the plane down to 1...
for altitude in range(1000, 10000): altitude = int(input('enter altitude')) if altitude == 1000: print('plane is safe to land') elif altitude > 1000 and altitude < 5000: print('bring the plane down to 1000 ft') else: print('turn around and try later') num1 = 0 num2 = 200 for n in...
def merge_dicts(dict1, dict2): res = {**dict1, **dict2} return res def pairwise(iterable): itr = iter(iterable) a = next(itr, None) for b in itr: yield a, b a = b
def merge_dicts(dict1, dict2): res = {**dict1, **dict2} return res def pairwise(iterable): itr = iter(iterable) a = next(itr, None) for b in itr: yield (a, b) a = b
class Token: def __init__(self): self.content = [] def add_content(self, content): self.content.append(content) def close(self): if len(self.content) == 0: raise Exception("Content for token '" + self.token_name() + "' is missing")
class Token: def __init__(self): self.content = [] def add_content(self, content): self.content.append(content) def close(self): if len(self.content) == 0: raise exception("Content for token '" + self.token_name() + "' is missing")
########################################################################## # Author: Samuca # # brief: returns if a str has "silva" # # this is a list exercise available on youtube: # https://www.youtube.com/playlist?list=PLHz_AreHm4dm6wYOIW20Nyg12TAjmMGT- ############################################################...
name = str(input('write down your full name: ')).strip() print('Is there Silva in the name? {}'.format('SILVA' in name.upper()))
""" This API can be used to interact with and modify Motorola S-Record files. .. moduleauthor:: Yves-Noel Weweler <y.weweler@gmail.com> """ __author__ = 'Yves-Noel Weweler <y.weweler@gmail.com>' __status__ = 'Development' __version__ = '0.0.1' __all__ = ('SRECError', 'SRecordParsingError', 'NotSRecFileError') class...
""" This API can be used to interact with and modify Motorola S-Record files. .. moduleauthor:: Yves-Noel Weweler <y.weweler@gmail.com> """ __author__ = 'Yves-Noel Weweler <y.weweler@gmail.com>' __status__ = 'Development' __version__ = '0.0.1' __all__ = ('SRECError', 'SRecordParsingError', 'NotSRecFileError') class S...
class Menu: def __init__(self): self.divMenu = '=' * 40 self.infoBot = 'CriptoBot / Versao: 1.1.2' self.desenvolvedor = 'Guilherme Malaquias' def inicial_menu(self) -> str: return f'{self.divMenu}\n0 - Consultar Moeda\n1 - Consultar Moeda Por Intervalo\n\n2 - Para sair\n{self.d...
class Menu: def __init__(self): self.divMenu = '=' * 40 self.infoBot = 'CriptoBot / Versao: 1.1.2' self.desenvolvedor = 'Guilherme Malaquias' def inicial_menu(self) -> str: return f'{self.divMenu}\n0 - Consultar Moeda\n1 - Consultar Moeda Por Intervalo\n\n2 - Para sair\n{self.d...
async def call1(callback): await callback()
async def call1(callback): await callback()
""" Session: 7 Topic: Homework - simple calculator """ # function adds two numbers def add(x, y): return x + y # function subtracts two numbers def subtract(x, y): return x - y # function multiplies two numbers def multiply(x, y): return x * y # function divides two numbers def divide(x, y): return ...
""" Session: 7 Topic: Homework - simple calculator """ def add(x, y): return x + y def subtract(x, y): return x - y def multiply(x, y): return x * y def divide(x, y): return x / y def calculate(num1, num2, choice): if choice == '1': val = add(num1, num2) print('num1 + num2 = {}'...
#Unique Nickname while True: online = input("Online now: ") nickname = input("Nickname: ") online_list = online.split(" ") if nickname not in online_list: print("Welcome, {}!".format(nickname)) else: print("Sorry, that nickname is taken.")
while True: online = input('Online now: ') nickname = input('Nickname: ') online_list = online.split(' ') if nickname not in online_list: print('Welcome, {}!'.format(nickname)) else: print('Sorry, that nickname is taken.')
class Code: SUCCESS = 0 NO_PARAM = 1 ERROR =-1 msg = { SUCCESS: "success", NO_PARAM: "param error", ERROR:"error" }
class Code: success = 0 no_param = 1 error = -1 msg = {SUCCESS: 'success', NO_PARAM: 'param error', ERROR: 'error'}
# DROP TABLES songplay_table_drop = "DROP TABLE IF EXISTS f_songplays;" user_table_drop = "DROP TABLE IF EXISTS d_users;" song_table_drop = "DROP TABLE IF EXISTS d_songs;" artist_table_drop = "DROP TABLE IF EXISTS d_artists;" time_table_drop = "DROP TABLE IF EXISTS d_times;" # CREATE TABLES user_table_create = ("CRE...
songplay_table_drop = 'DROP TABLE IF EXISTS f_songplays;' user_table_drop = 'DROP TABLE IF EXISTS d_users;' song_table_drop = 'DROP TABLE IF EXISTS d_songs;' artist_table_drop = 'DROP TABLE IF EXISTS d_artists;' time_table_drop = 'DROP TABLE IF EXISTS d_times;' user_table_create = 'CREATE TABLE IF NOT EXISTS d_users ...
class Help(object): """Help View""" def __init__(self, ui): self.ui = ui self.tab = ui.contents.help # connect signals self.ui.menu.btnHelp.clicked.connect(self.tab_handler) def tab_handler(self): self.ui.contents.showTab(self.ui.contents.HELP)
class Help(object): """Help View""" def __init__(self, ui): self.ui = ui self.tab = ui.contents.help self.ui.menu.btnHelp.clicked.connect(self.tab_handler) def tab_handler(self): self.ui.contents.showTab(self.ui.contents.HELP)
DOCUMENT_MAPPING = [ { 'name': 'title', 'pattern': '<{}> dc:title|rdfs:label ?title .', 'type': 'string' }, { 'name': 'journalTitle', 'pattern': """?journal vivo:publicationVenueFor <{}> ; rdfs:label ?journalTitle .""", 'type':...
document_mapping = [{'name': 'title', 'pattern': '<{}> dc:title|rdfs:label ?title .', 'type': 'string'}, {'name': 'journalTitle', 'pattern': '?journal vivo:publicationVenueFor <{}> ;\n rdfs:label ?journalTitle .', 'type': 'string'}, {'name': 'doi', 'pattern': '<{}> bibo:doi ?doi .', 'typ...
""" Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Notice that the solution set must not contain duplicate quadruplets. Example 1: Input: nums = [1,0,-1,...
""" Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Notice that the solution set must not contain duplicate quadruplets. Example 1: Input: nums = [1,0,-1,...
def insert_sort(unsorted): sorted = [] while unsorted: x = unsorted.pop() len_sorted = len(sorted) for i in range(len_sorted): if sorted[i] >= x: sorted.insert(i, x) break if len_sorted == len(sorted): sorted.append(x) ...
def insert_sort(unsorted): sorted = [] while unsorted: x = unsorted.pop() len_sorted = len(sorted) for i in range(len_sorted): if sorted[i] >= x: sorted.insert(i, x) break if len_sorted == len(sorted): sorted.append(x) r...
""" This module holds all the UP API routes used in the SDK. https://jawbone.com/up/developer/endpoints """ DOMAIN = 'https://jawbone.com' """ OAuth Endpoints """ AUTH_PATH = '{}/auth/oauth2'.format(DOMAIN) AUTH = '{}/auth'.format(AUTH_PATH) TOKEN = '{}/token'.format(AUTH_PATH) """ Resource Endpoints """ VERSION = 'v...
""" This module holds all the UP API routes used in the SDK. https://jawbone.com/up/developer/endpoints """ domain = 'https://jawbone.com' '\nOAuth Endpoints\n' auth_path = '{}/auth/oauth2'.format(DOMAIN) auth = '{}/auth'.format(AUTH_PATH) token = '{}/token'.format(AUTH_PATH) '\nResource Endpoints\n' version = 'v.1.1' ...
words = {} first_line = input().split() iterations = int(first_line[0]) for i in range(int(first_line[1])): line = input().split() words[int(line[0])] = line[1] for n in range(1, iterations+1): o = "" for i, word in words.items(): if n % i == 0: o += word print(o if o else n)
words = {} first_line = input().split() iterations = int(first_line[0]) for i in range(int(first_line[1])): line = input().split() words[int(line[0])] = line[1] for n in range(1, iterations + 1): o = '' for (i, word) in words.items(): if n % i == 0: o += word print(o if o else n)
class BackendError(Exception): pass class ThreadStoppedError(Exception): pass
class Backenderror(Exception): pass class Threadstoppederror(Exception): pass
class Solution: def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool: s1 = "".join(word1) s2 = "".join(word2) return s1 == s2
class Solution: def array_strings_are_equal(self, word1: List[str], word2: List[str]) -> bool: s1 = ''.join(word1) s2 = ''.join(word2) return s1 == s2
def matrix_sum(matrix): total_sum = 0 for row in matrix: total_sum += sum(row) return total_sum rows_count, columns_count = [int(x) for x in input().split(', ')] matrix = [] for _ in range(rows_count): row = [int(x) for x in input().split(', ')] matrix.append(row) print(matrix_sum(matrix...
def matrix_sum(matrix): total_sum = 0 for row in matrix: total_sum += sum(row) return total_sum (rows_count, columns_count) = [int(x) for x in input().split(', ')] matrix = [] for _ in range(rows_count): row = [int(x) for x in input().split(', ')] matrix.append(row) print(matrix_sum(matrix))...
# -*- encoding: utf-8 -*- """ Copyright (c) 2019 - present AppSeed.us License: https://github.com/app-generator/license-eula """ class COMMON: NULL = None # not set NA = -1 # not set OK = 0 # all ok ERR = 1 # not ok NOT_FOUND = 2 # file or directory no...
""" Copyright (c) 2019 - present AppSeed.us License: https://github.com/app-generator/license-eula """ class Common: null = None na = -1 ok = 0 err = 1 not_found = 2 input_err = 3 def errorinfo(aErrorCode): if COMMON.NA == aErrorCode: return 'Not Set' if COMMON.ERR == aErrorCod...
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2020/soni_f110_ws/src/f110-skeletons-spring2020/system/vesc/vesc_driver/include".split(';') if "/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2...
catkin_package_prefix = '' project_pkg_config_include_dirs = '/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2020/soni_f110_ws/src/f110-skeletons-spring2020/system/vesc/vesc_driver/include'.split(';') if '/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2020/soni_f110_ws/src/f110-skeletons-spring2020/system/ves...
#!/usr/bin/python3 def multiple_returns(sentence): "returns a tuple with the length of a string and its first character" "if the sentence is empty, the first character should be equal to None" if sentence == "": return (0, None) return (len(sentence), sentence[0])
def multiple_returns(sentence): """returns a tuple with the length of a string and its first character""" 'if the sentence is empty, the first character should be equal to None' if sentence == '': return (0, None) return (len(sentence), sentence[0])
#!/usr/bin/python # -*- coding: utf-8 -*- # vi: ts=4 sw=4 ################################################################################ # Short-term settings (specific to a particular user/experiment) can # be placed in this file. You may instead wish to make a copy of this file in # the user's data directory, ...
if False: m = 1000.0 cm = 10.0 mm = 1.0 um = 0.001 nm = 1e-06 inch = 25.4 pixel = 0.172 deg = 1.0 rad = np.degrees(1.0) mrad = np.degrees(0.001) urad = np.degrees(1e-06) def get_default_stage(): return stg class Sampletsaxs(SampleTSAXS_Generic): def __init__(self, ...
class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """ Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first f...
class Snakegame: def __init__(self, width: int, height: int, food: List[List[int]]): """ Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first f...
# -*- coding: utf-8 -*- n = 0 a = 0 g = 0 d = 0 while n!=4: n = int(input()) if n==1: a += 1 if n==2: g += 1 if n==3: d += 1 print('''MUITO OBRIGADO Alcool: {} Gasolina: {} Diesel: {}'''.format(a, g, d))
n = 0 a = 0 g = 0 d = 0 while n != 4: n = int(input()) if n == 1: a += 1 if n == 2: g += 1 if n == 3: d += 1 print('MUITO OBRIGADO\nAlcool: {}\nGasolina: {}\nDiesel: {}'.format(a, g, d))
class TableNotFoundException(Exception): def __init__(self, database, table): self.database = database self.table = table Exception.__init__(self, "table not find %s.%s" % (database, table))
class Tablenotfoundexception(Exception): def __init__(self, database, table): self.database = database self.table = table Exception.__init__(self, 'table not find %s.%s' % (database, table))
""" https://www.codechef.com/SEPT20B/problems/TREE2/ https://www.codechef.com/users/aditi124jha """ def main(): t=int(input()) for i in range(t): n=int(input()) h=list(map(int, input().split()[:n])) s=set(h) s.discard(0) print(len(s)) return 0 main()
""" https://www.codechef.com/SEPT20B/problems/TREE2/ https://www.codechef.com/users/aditi124jha """ def main(): t = int(input()) for i in range(t): n = int(input()) h = list(map(int, input().split()[:n])) s = set(h) s.discard(0) print(len(s)) return 0 main()
# CALCULATE CANADIAN SALES TAX # If the province is Alberta or Nunavut charge 5% # If the province is Ontario charge 13% # If only one of the conditions will ever occur you can use a single if statement with elif province = input("What province do you live in? ") tax = 0 if province == 'Alberta': tax = 0.05 elif...
province = input('What province do you live in? ') tax = 0 if province == 'Alberta': tax = 0.05 elif province == 'Nunavut': tax = 0.05 elif province == 'Ontario': tax = 0.13 print(tax) province = input('What province do you live in? ') tax = 0 if province == 'Alberta': tax = 0.05 elif province == 'Nunav...
# Time: O(m + n), m is the length of source # , n is the length of target # Space: O(m) # greedy solution class Solution(object): def shortestWay(self, source, target): """ :type source: str :type target: str :rtype: int """ lookup = [[None for _ in r...
class Solution(object): def shortest_way(self, source, target): """ :type source: str :type target: str :rtype: int """ lookup = [[None for _ in range(26)] for _ in range(len(source) + 1)] find_char_next_pos = [None] * 26 for i in reversed(range(len(s...
#!/usr/bin/env python #coding=utf-8 __author__ = 'vzer' class Base_Config(object): #app config SECRET_KEY="" POST_PRE_PAGE=6 REGISTERCODE="" DEBUG = True #mysql config MYSQL_DB = "" MYSQL_USER = "" MYSQL_PASS = "" MYSQL_HOST = "" MYSQL_PORT =0 SQLALCHEMY_DATABASE_URI =...
__author__ = 'vzer' class Base_Config(object): secret_key = '' post_pre_page = 6 registercode = '' debug = True mysql_db = '' mysql_user = '' mysql_pass = '' mysql_host = '' mysql_port = 0 sqlalchemy_database_uri = 'mysql://%s:%s@%s:%s/%s' % (MYSQL_USER, MYSQL_PASS, MYSQL_HOST, ...
#!/usr/bin/env python # Copyright 2011 Google Inc. All Rights Reserved. """Protobufs used by GRR."""
"""Protobufs used by GRR."""
# V1 # V2 # Time: O(n^2) # Space: O(1) class Solution(object): def triangleNumber(self, nums): """ :type nums: List[int] :rtype: int """ result = 0 nums.sort() for i in range(len(nums)-2): if nums[i] == 0: continue ...
class Solution(object): def triangle_number(self, nums): """ :type nums: List[int] :rtype: int """ result = 0 nums.sort() for i in range(len(nums) - 2): if nums[i] == 0: continue k = i + 2 for j in range(i +...
def is_prime(n): """Returns True is n is prime, False if not""" for i in range(2,n-1): if n%i == 0: return False return True def all_primes(n): primes = [] for number in range(1,n): if is_prime(number): primes.append(number) return primes
def is_prime(n): """Returns True is n is prime, False if not""" for i in range(2, n - 1): if n % i == 0: return False return True def all_primes(n): primes = [] for number in range(1, n): if is_prime(number): primes.append(number) return primes
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-upheno_ontology' ES_DOC_TYPE = 'phenotype' API_PREFIX = 'upheno_ontology' API_VERSION = ''
es_host = 'localhost:9200' es_index = 'pending-upheno_ontology' es_doc_type = 'phenotype' api_prefix = 'upheno_ontology' api_version = ''
servo_a_pw = [[-90.0, 2463] [-86.4, 2423] [-72.0, 2263] [-56.6, 2093] [-43.2, 2013] [-28.8, 1793] [-14.4, 1646] [0.0, 1436] [14.4, 1276] [28.8, 1096] [43.2, 916] [56....
servo_a_pw = [[-90.0, 2463][-86.4, 2423][-72.0, 2263][-56.6, 2093][-43.2, 2013][-28.8, 1793][-14.4, 1646][0.0, 1436][14.4, 1276][28.8, 1096][43.2, 916][56.6, 746][72.0, 586][72.0, 590][90.0, 390]]
#!/usr/bin/python3 #https://practice.geeksforgeeks.org/problems/a-simple-fraction/0 def sol(n, d): res = [] r = {} i = int(n/d) rem = n%d res.append(i) if rem: res.append(".") r[rem] = 0 p = 1 while rem: div = rem*10 q = div//d rem = div%d ...
def sol(n, d): res = [] r = {} i = int(n / d) rem = n % d res.append(i) if rem: res.append('.') r[rem] = 0 p = 1 while rem: div = rem * 10 q = div // d rem = div % d res.append(q) if rem in r: res.append(')') ...
class Solution: def validMountainArray(self, arr: List[int]) -> bool: if len(arr) < 3: return False if arr[1] < arr[0]: return False n = len(arr) i = 1 while i < n and arr[i] > arr[i-1]: i += 1 if i >= n: return False ...
class Solution: def valid_mountain_array(self, arr: List[int]) -> bool: if len(arr) < 3: return False if arr[1] < arr[0]: return False n = len(arr) i = 1 while i < n and arr[i] > arr[i - 1]: i += 1 if i >= n: return Fal...
''' Create the Control class: Deal with hazards Forwarding Branch handling ''' class Control(object): def __init__(self, ForwardStatus): self.DataHazardFlag=False self.ControlHazardFlag=False self.forwardFlag=ForwardStatus ''' Forward keys: 0: Inactive 1: Execution forward ...
""" Create the Control class: Deal with hazards Forwarding Branch handling """ class Control(object): def __init__(self, ForwardStatus): self.DataHazardFlag = False self.ControlHazardFlag = False self.forwardFlag = ForwardStatus '\n Forward keys:\n 0: Inactive\n 1: Execution f...
l = ["he", "hi", "hello", "hi"] r = [k for k in l if 'gene' in k or 'dis' in k] print(r) with open('project2_test.txt', 'r') as f: prefix = 'gene' for line in f: r = filter(lambda x: x.startswith(prefix), list(line.split())) print(list(r))
l = ['he', 'hi', 'hello', 'hi'] r = [k for k in l if 'gene' in k or 'dis' in k] print(r) with open('project2_test.txt', 'r') as f: prefix = 'gene' for line in f: r = filter(lambda x: x.startswith(prefix), list(line.split())) print(list(r))
# Author: Asif Ali Mehmuda # Email: asif.mehmuda9@gmail.com # This file exposes some of the common mathematical functions def add_nums(num1, num2): return num1 + num2 # Subtract two numbers def sub_nums(num1, num2): return num1 - num2 # Subtract two numbers such that the smaller number is always subtracted...
def add_nums(num1, num2): return num1 + num2 def sub_nums(num1, num2): return num1 - num2 def abs_diff(num1, num2): if num1 < num2: (num1, num2) = (num2, num1) return num1 - num2
count = 1 while True: a = input() if a == '0': break if count > 1: print() numbers = input() print("Instancia", count) if a in numbers: print("verdadeira") else: print("falsa") count += 1
count = 1 while True: a = input() if a == '0': break if count > 1: print() numbers = input() print('Instancia', count) if a in numbers: print('verdadeira') else: print('falsa') count += 1
string = "Janet Asimov" pattern = re.compile(r"(?<!Isaac )Asimov") # Will match any Asimov except Isaac, and only keep "Asimov" result = re.search(pattern, string) if result is not None: print("Substring '{0}' was found in the range {1}".format(result.group(), result.span()))
string = 'Janet Asimov' pattern = re.compile('(?<!Isaac )Asimov') result = re.search(pattern, string) if result is not None: print("Substring '{0}' was found in the range {1}".format(result.group(), result.span()))
# # PySNMP MIB module RM2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RM2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:49:40 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:15)...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ...
""" Michael Persico Sept.29, 2021 Ones and Zeros https://www.codewars.com/kata/578553c3a1b8d5c40300037c """ def binary_array_to_number(arr): return int("0b" + "".join([str(digit) for digit in arr]), 2) if __name__ == "__main__": print(binary_array_to_number([0,0,0,1])) # 1 print(binary_array_to_number([0,...
""" Michael Persico Sept.29, 2021 Ones and Zeros https://www.codewars.com/kata/578553c3a1b8d5c40300037c """ def binary_array_to_number(arr): return int('0b' + ''.join([str(digit) for digit in arr]), 2) if __name__ == '__main__': print(binary_array_to_number([0, 0, 0, 1])) print(binary_array_to_number([0, 0...
nk=list(map(int,input().split())) n=nk[0] k=nk[1] l=list(map(int,input().split())) f=0 for i in range(len(l)-1): if(l[i]+l[i+1]==k): print('yes') f=1 break if(f==0): print('no')
nk = list(map(int, input().split())) n = nk[0] k = nk[1] l = list(map(int, input().split())) f = 0 for i in range(len(l) - 1): if l[i] + l[i + 1] == k: print('yes') f = 1 break if f == 0: print('no')
class Point(): def __init__(self, x, y): self.x = x self.y = y def __repr__(self): return f"({self.x}, {self.y})" class Edge(): def __init__(self, v1, v2): self.v1 = v1 self.v2 = v2 def __repr__(self): return f"{self.v1}-{self.v2}" def ...
class Point: def __init__(self, x, y): self.x = x self.y = y def __repr__(self): return f'({self.x}, {self.y})' class Edge: def __init__(self, v1, v2): self.v1 = v1 self.v2 = v2 def __repr__(self): return f'{self.v1}-{self.v2}' def point_x(point): ...
# -*- coding: utf-8 -*- class Route(object): def __init__(self, base_url=None): self.base_url = base_url self.handlers = [] def __call__(self, url, **kwds): name = kwds.pop('name', None) if self.base_url: url = '/' + self.base_url.strip('/') + '/' + url.lstrip('/')...
class Route(object): def __init__(self, base_url=None): self.base_url = base_url self.handlers = [] def __call__(self, url, **kwds): name = kwds.pop('name', None) if self.base_url: url = '/' + self.base_url.strip('/') + '/' + url.lstrip('/') def _(cls): ...
class Solution: def groupThePeople(self, groupSizes): match = {} for idx, groupSize in enumerate(groupSizes): if groupSize in match: match[groupSize].append(idx) else: match[groupSize] = [idx] ans = [] for groupSize, m in match...
class Solution: def group_the_people(self, groupSizes): match = {} for (idx, group_size) in enumerate(groupSizes): if groupSize in match: match[groupSize].append(idx) else: match[groupSize] = [idx] ans = [] for (group_size, m) ...
def to_postfix(infix): priority = {'*': 1, '/': 1, '^': 1, '+': 0, '-': 0, '(': 0 } res = '' stack = [] for x in infix: if x.isdigit(): res += x elif x == '(': stack.a...
def to_postfix(infix): priority = {'*': 1, '/': 1, '^': 1, '+': 0, '-': 0, '(': 0} res = '' stack = [] for x in infix: if x.isdigit(): res += x elif x == '(': stack.append(x) elif x in '*/^+-': if not stack or stack[-1] == '(': ...
if __name__ == '__main__': # pragma: no cover data = """ /com,*********** Create Remote Point "Internal Remote Point 39" *********** ! -------- Remote Point Used by "Fixed - Line Body To EndCap 14054021-1 d" -------- *set,_npilot,803315 _npilot474=_npilot et,332,170 type,332 real,332 mat,332 keyo,332,2,1 ...
if __name__ == '__main__': data = '\n/com,*********** Create Remote Point "Internal Remote Point 39" ***********\n! -------- Remote Point Used by "Fixed - Line Body To EndCap 14054021-1 d" --------\n*set,_npilot,803315\n_npilot474=_npilot\net,332,170\ntype,332\nreal,332\nmat,332\nkeyo,332,2,1 ! don\'t ...
# A list is symmetric if the first row is the same as the first column, # the second row is the same as the second column and so on. Write a # procedure, symmetric, which takes a list as input, and returns the # boolean True if the list is symmetric and False if it is not. def symmetric(base_list): list_length = l...
def symmetric(base_list): list_length = len(base_list) for row in base_list: if len(row) != list_length: return False for i in range(list_length): for j in range(list_length): if base_list[i][j] != base_list[j][i]: return False return True print(sy...
def is_self_evaluating(exp): """number, string, booleans """ return \ isinstance(exp, int) or isinstance(exp, float) \ or (isinstance(exp, str) and len(exp) >= 2 and exp[0] == '"' and exp[-1] == '"') \ or exp == 'true' or exp == 'false' def text_of_quotation(exp): pass
def is_self_evaluating(exp): """number, string, booleans """ return isinstance(exp, int) or isinstance(exp, float) or (isinstance(exp, str) and len(exp) >= 2 and (exp[0] == '"') and (exp[-1] == '"')) or (exp == 'true') or (exp == 'false') def text_of_quotation(exp): pass
f = open("C:/Users/Username/Documents/2020_aoc/03.txt", "r") l = f.read().split("\n") grid = [] for line in l: grid.append(line*200) def slope_change(right_inc, down_inc): hor = ver = found = 0 while ver + down_inc < len(grid): hor += right_inc ver += down_inc if gr...
f = open('C:/Users/Username/Documents/2020_aoc/03.txt', 'r') l = f.read().split('\n') grid = [] for line in l: grid.append(line * 200) def slope_change(right_inc, down_inc): hor = ver = found = 0 while ver + down_inc < len(grid): hor += right_inc ver += down_inc if grid[ver][hor] ==...
def ensure_column_exists(df, col_name, col_alt = False): """Checks if a particular name is among the column names of a dataframe. Alternative names can be given, which when found will be changed to the desired name. The DataFrame will be changed in place. If no matching name is found an AttributeError is...
def ensure_column_exists(df, col_name, col_alt=False): """Checks if a particular name is among the column names of a dataframe. Alternative names can be given, which when found will be changed to the desired name. The DataFrame will be changed in place. If no matching name is found an AttributeError is rais...
class BaseIOException(Exception): pass class InvalidFitFile(BaseIOException): pass
class Baseioexception(Exception): pass class Invalidfitfile(BaseIOException): pass
#Lucia Saura 25/03/2018 # euler 5 # source https://www.youtube.com/watch?v=EMTcsNMFS_g def euler5 (ni): #first create a function for i in range (11,21): #loop trough the numbers from 11 to 21 (if it is divisible by 11 to 20 is also from 1 to 10) if ni % i ==0: #if the number is divisible by the number in ...
def euler5(ni): for i in range(11, 21): if ni % i == 0: continue else: return False return True x = 2520 while not euler5(x): x += 2520 print(x)
def divisors(integer): integer = abs(integer) divisor = [] for candidate in range(integer//2): if integer % (candidate+1) == 0: divisor.append(candidate+1) return divisor alist = divisors(10) print(alist)
def divisors(integer): integer = abs(integer) divisor = [] for candidate in range(integer // 2): if integer % (candidate + 1) == 0: divisor.append(candidate + 1) return divisor alist = divisors(10) print(alist)
class GenericTurbine(object): def __init__(self, loc, RD, W): self.loc = loc # Location in Space self.RD = RD # Rotor Diameter self.W = W # Width of influence
class Genericturbine(object): def __init__(self, loc, RD, W): self.loc = loc self.RD = RD self.W = W
""" * @file linear_search.py * @author Vladimir Mijic * @date 26/03/2021 """ def linearSearch(array, x): n = len(array) for i in range(0, n): if array[i] == x: return True return False if __name__ == '__main__': arr = [75, 41, 92, 60, 2, 0, 39, 23, 10, 68] print("Bef...
""" * @file linear_search.py * @author Vladimir Mijic * @date 26/03/2021 """ def linear_search(array, x): n = len(array) for i in range(0, n): if array[i] == x: return True return False if __name__ == '__main__': arr = [75, 41, 92, 60, 2, 0, 39, 23, 10, 68] print('Before:...
# # PySNMP MIB module IBM-OSA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBM-OSA-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:51:11 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, 0...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ...
def diff_strings_rec(source, target, dp={}): dp_key = (source, target) if dp_key in dp: return dp[dp_key] if not source and not target: result = [] dp[dp_key] = (0, result) return dp[dp_key] if not source: result = ["+" + ch for ch in target] dp[dp_key] = ...
def diff_strings_rec(source, target, dp={}): dp_key = (source, target) if dp_key in dp: return dp[dp_key] if not source and (not target): result = [] dp[dp_key] = (0, result) return dp[dp_key] if not source: result = ['+' + ch for ch in target] dp[dp_key] ...
""" Title: 0026 - Remove Duplicates from Sorted Array Tags: Array Time: O(n) Space: O(1) Source: https://leetcode.com/problems/remove-duplicates-from-sorted-array/ Difficulty: Easy """ class Solution: def removeDuplicates(self, nums: List[int]) -> int: if not nums: return 0 last = 0 ...
""" Title: 0026 - Remove Duplicates from Sorted Array Tags: Array Time: O(n) Space: O(1) Source: https://leetcode.com/problems/remove-duplicates-from-sorted-array/ Difficulty: Easy """ class Solution: def remove_duplicates(self, nums: List[int]) -> int: if not nums: return 0 last = 0 ...
# Using list to print hello world my_list = ["H", "e", "l", "l", "o", " ", "W", "o", "r", "l", "d"] s = "" for i in my_list: s = s + i print(s)
my_list = ['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'] s = '' for i in my_list: s = s + i print(s)
# EASY # Two pointer # --> if < tar # <-- if > tar # Time O(N) Space O(1) class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: left,right = 0, len(numbers)-1 while left < right: if numbers[left] + numbers[right] == target: return [...
class Solution: def two_sum(self, numbers: List[int], target: int) -> List[int]: (left, right) = (0, len(numbers) - 1) while left < right: if numbers[left] + numbers[right] == target: return [left + 1, right + 1] elif numbers[left] + numbers[right] < target: ...
#Polimorfismo # #Es la capacidad que tienen los objetos en # #diferentes clases para usar un comportamiento # #o atributo del mismo nombre pero con diferente valor # # # Por ejemplo #class Auto: # rueda = 4 # def desplazamiento(self): # print("el auto se esta desplazando sobre 4 ruegas") # #class Moto: # ...
class Animales: def __init__(self, nombre): self.nombre = nombre def tipo_animal(self): pass class Leon(Animales): def tipo_animal(self): print('animal salvaje') class Perro(Animales): def tipo_animal(self): print('animal domestico') nuevo_animal = leon('Simba') nue...
rows_total = 0 rows_masked = 0 ret = 0 profileret = 0
rows_total = 0 rows_masked = 0 ret = 0 profileret = 0
# coding=utf-8 # Author: Jianghan LI # Question: 617.Merge_Two_Binary_Trees # Complexity: O(N) # Date: 2017-06-12 10:52 - 10:54, 0 wrong try # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class ...
class Solution(object): def merge_trees(self, t1, t2): """ :type t1: TreeNode :type t2: TreeNode :rtype: TreeNode """ if not t1: return t2 if not t2: return t1 t1.val += t2.val t1.left = self.mergeTrees(t1.left, t2.left...
class Dicotomia(): def __init__(self, tabla) -> None: self.fin = len(tabla) - 1 self.tabla = tabla self.tablaordenada =[] def bubbleSort(self): for i in range(0, self.fin): for j in range(0, self.fin - i): if self.tabla[j] > self.tabla[j + 1]: ...
class Dicotomia: def __init__(self, tabla) -> None: self.fin = len(tabla) - 1 self.tabla = tabla self.tablaordenada = [] def bubble_sort(self): for i in range(0, self.fin): for j in range(0, self.fin - i): if self.tabla[j] > self.tabla[j + 1]: ...
s = "12010000000000111100000000" for _ in range(int(input())): ans = 0 k = input() for i in k: if i != " ": ans += int(s[ord(i) - 65]) print(ans)
s = '12010000000000111100000000' for _ in range(int(input())): ans = 0 k = input() for i in k: if i != ' ': ans += int(s[ord(i) - 65]) print(ans)
# -*- coding: utf-8 -*- """ Test the api preprocess module for biolink. .. moduleauthor:: Jiwen Xin <kevinxin@scripps.edu> """
""" Test the api preprocess module for biolink. .. moduleauthor:: Jiwen Xin <kevinxin@scripps.edu> """
def init_dashboard(bot): @bot.dashboard.route async def get_stats(data): channels_list = [] for guild in bot.guilds: for channel in guild.channels: channels_list.append(channel) return { "status": "200", "message": "all is ok", ...
def init_dashboard(bot): @bot.dashboard.route async def get_stats(data): channels_list = [] for guild in bot.guilds: for channel in guild.channels: channels_list.append(channel) return {'status': '200', 'message': 'all is ok', 'guilds': str(len(bot.guilds)), ...
n = int(input().strip()) scores = [int(scores_temp) for scores_temp in input().strip().split(' ')] m = int(input().strip()) alice = [int(alice_temp) for alice_temp in input().strip().split(' ')] ranking = [scores[0]] for itm in scores: if itm != ranking[-1]: ranking.append(itm) inx = len(ranking) - 1 fo...
n = int(input().strip()) scores = [int(scores_temp) for scores_temp in input().strip().split(' ')] m = int(input().strip()) alice = [int(alice_temp) for alice_temp in input().strip().split(' ')] ranking = [scores[0]] for itm in scores: if itm != ranking[-1]: ranking.append(itm) inx = len(ranking) - 1 for it...
class DockerService(): """Class that abstracts docker service info """ def __init__(self, data: str) -> None: info = data.split('\t') self.container_id = info[0].split('@')[-1] self.name = info[1].split('@')[-1] self.status = info[2].split('@')[-1] self.ports = info...
class Dockerservice: """Class that abstracts docker service info """ def __init__(self, data: str) -> None: info = data.split('\t') self.container_id = info[0].split('@')[-1] self.name = info[1].split('@')[-1] self.status = info[2].split('@')[-1] self.ports = info[3]...
def RemovesNthDupicate(array, n): hashTable = {} i = 0 while i < len(array): if array[i] in hashTable: hashTable[array[i]] += 1 if hashTable[array[i]] == n: hashTable[array[i]] = 1 array.pop(i) else: ...
def removes_nth_dupicate(array, n): hash_table = {} i = 0 while i < len(array): if array[i] in hashTable: hashTable[array[i]] += 1 if hashTable[array[i]] == n: hashTable[array[i]] = 1 array.pop(i) else: hashTable[array[i]] =...
""" Constants associated with the NEOCERA. """ # Index in the arrays of the heater output HEATER_INDEX = 0 # Index in the arrays of the analog output ANALOG_INDEX = 1 # Minimum allowed output control type for the output index (see self.control) CONTROL_TYPE_MIN = [0, 3] # Maximum allowed output control type for the...
""" Constants associated with the NEOCERA. """ heater_index = 0 analog_index = 1 control_type_min = [0, 3] control_type_max = [5, 6]
def create_request_url(url: str, params: dict = None): """ Adds query params to the given url :param url: the url to extend :param params: query params as a keyed dictionary :return: the url including the given query params """ if params: first_param = True for k, v in sort...
def create_request_url(url: str, params: dict=None): """ Adds query params to the given url :param url: the url to extend :param params: query params as a keyed dictionary :return: the url including the given query params """ if params: first_param = True for (k, v) in sorte...
class Solution(object): def alertNames(self, keyName, keyTime): """ :type keyName: List[str] :type keyTime: List[str] :rtype: List[str] """ mapp = {} for i in range(len(keyName)): name = keyName[i] if(name not in mapp): ...
class Solution(object): def alert_names(self, keyName, keyTime): """ :type keyName: List[str] :type keyTime: List[str] :rtype: List[str] """ mapp = {} for i in range(len(keyName)): name = keyName[i] if name not in mapp: ...
"""crafting_system.py This class represents a simple crafting system. All recipe-related data is stored externally in a JSON file. """ class CraftingSystem: def __init__(self, event_queue, **kwargs): self.event_queue = event_queue self.event_queue.register_system(self) self.__dict__.updat...
"""crafting_system.py This class represents a simple crafting system. All recipe-related data is stored externally in a JSON file. """ class Craftingsystem: def __init__(self, event_queue, **kwargs): self.event_queue = event_queue self.event_queue.register_system(self) self.__dict__.updat...
# Limbs LEG_UPPER_RIGHT = (24,26) LEG_LOWER_RIGHT = (26,28) UPPER_BODY_RIGHT = (12,24) ARM_UPPER_RIGHT = (12,14) ARM_LOWER_RIGHT = (14,16) FOOT_RIGHT = (28,32) LIMBS_ALL = [LEG_UPPER_RIGHT,UPPER_BODY_RIGHT,ARM_UPPER_RIGHT,ARM_LOWER_RIGHT,FOOT_RIGHT] # Joints ANKLE_RIGHT = (26,28,32) ELBOW_RIGHT = (12,14,16) SHOULDER...
leg_upper_right = (24, 26) leg_lower_right = (26, 28) upper_body_right = (12, 24) arm_upper_right = (12, 14) arm_lower_right = (14, 16) foot_right = (28, 32) limbs_all = [LEG_UPPER_RIGHT, UPPER_BODY_RIGHT, ARM_UPPER_RIGHT, ARM_LOWER_RIGHT, FOOT_RIGHT] ankle_right = (26, 28, 32) elbow_right = (12, 14, 16) shoulder_right...
# # PySNMP MIB module CISCO-SYS-INFO-LOG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SYS-INFO-LOG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:57:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection) ...
# # PySNMP MIB module HUAWEI-SERVER-IBMC-MIB (http://pysnmp.sf.net) # ASN.1 source file:///home/jhzhang/test/snmp/HUAWEI-SERVER-iBMC-MIB.txt # Produced by pysmi-0.0.7 at Mon Apr 3 12:24:09 2017 # On host localhost.localdomain platform Linux version 3.10.0-123.el7.x86_64 by user root # Using Python version 2.7.5 (defau...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ...
n,m = list(map(int,input().split())) cost = list(map(int,input().split())) ans=0 for i in range(m): f,s = list(map(int,input().split())) ans += min(cost[f-1],cost[s-1]) print(ans)
(n, m) = list(map(int, input().split())) cost = list(map(int, input().split())) ans = 0 for i in range(m): (f, s) = list(map(int, input().split())) ans += min(cost[f - 1], cost[s - 1]) print(ans)
''' | Write a program to show if the entered character is uppercase or lowercase. | |---------------------------------------------------------------------------------------------| | Usage of isalpha(), islower() and isupper() | ''' n = input("Enter charac...
""" | Write a program to show if the entered character is uppercase or lowercase. | |---------------------------------------------------------------------------------------------| | Usage of isalpha(), islower() and isupper() | """ n = input('Enter charact...
""" Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0,...
""" Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0,...
# Program 8 : multiply two matrices # take a 3x3 matrix A = [[12, 7, 3], [4, 5, 6], [7, 8, 9]] # take a 3x4 matrix B = [[5, 8, 1, 2], [6, 7, 3, 0], [4, 5, 9, 1]] result = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] # iterating by row of A for i in range(len(A)): # iterating by coloum by B for j in rang...
a = [[12, 7, 3], [4, 5, 6], [7, 8, 9]] b = [[5, 8, 1, 2], [6, 7, 3, 0], [4, 5, 9, 1]] result = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] for i in range(len(A)): for j in range(len(B[0])): for k in range(len(B)): result[i][j] += A[i][k] * B[k][j] for r in result: print(r)
API_SECRET = 'fluffernutterpie' # google reCAPTCHA sign-up # https://www.google.com/recaptcha/admin RECAPTCHA_KEY = '6LedVBUUAAAAANb2vWVUSByvl66ob3k9r-zSruCu' RECAPTCHA_PRIVATE_KEY = '6LedVBUUAAAAALWe4MQ2VJQhI9rKi6GJTukS6Hrl'
api_secret = 'fluffernutterpie' recaptcha_key = '6LedVBUUAAAAANb2vWVUSByvl66ob3k9r-zSruCu' recaptcha_private_key = '6LedVBUUAAAAALWe4MQ2VJQhI9rKi6GJTukS6Hrl'
list1 = [12,3,5,-5,-6,-1] for i in list1: if i >= 0: print (i) list2 = [12,4,-95,3] for num in list2: if num >= 0: print (" [ ",num," ] ")
list1 = [12, 3, 5, -5, -6, -1] for i in list1: if i >= 0: print(i) list2 = [12, 4, -95, 3] for num in list2: if num >= 0: print(' [ ', num, ' ] ')
class Point: def __init__(self, x, y): self.x = float(x) self.y = float(y) def collinear(self, p, q): if p.x - self.x == 0 and q.x - self.x == 0: return True if p.x - self.x == 0 or q.x - self.x == 0: return False m1 = (p.y-self.y)/(p.x-self.x) m2 = (q.y-self.y)/(q.x-self.x) return m1 == m2 ...
class Point: def __init__(self, x, y): self.x = float(x) self.y = float(y) def collinear(self, p, q): if p.x - self.x == 0 and q.x - self.x == 0: return True if p.x - self.x == 0 or q.x - self.x == 0: return False m1 = (p.y - self.y) / (p.x - sel...
bash(''' echo "hello" ''') bash(''' for i in $(seq 1 10); do echo $i sleep 2 done ''')
bash('\n\n\necho "hello"\n\n') bash('\nfor i in $(seq 1 10);\ndo\n echo $i\n sleep 2\ndone\n')
# This script generates a theorem for them Z3 SAT solver. The output of this program # is designed to be the input for http://rise4fun.com/z3 # The output of z3 is the coordinates of the queens for a solution to the N Queen problem :) #Prints an assert statement def zassert(x): print("( assert ( {} ) )".format(x)...
def zassert(x): print('( assert ( {} ) )'.format(x)) def zdeclare(x, type='Int'): print('( declare-const {} {} )'.format(x, type)) def generate(N, G): zdeclare('N') zdeclare('G') zassert('= N {}'.format(N)) zassert('= G {}'.format(G)) queens_x = ['P{}_x'.format(n) for n in range(0, N)] ...
# cook your dish here try: t = int(input()) for _ in range(t): r, c, k = map(int, input().rstrip().split(' ')) if r <= k: start_row = 1 else: start_row = r-k if c <= k: start_col = 1 else: start_col = c-k if r+k >= 8...
try: t = int(input()) for _ in range(t): (r, c, k) = map(int, input().rstrip().split(' ')) if r <= k: start_row = 1 else: start_row = r - k if c <= k: start_col = 1 else: start_col = c - k if r + k >= 8: ...