content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Project Euler #21: Amicable numbers def sum_of_divisors(n): sd = 1 # 1 is a divisors1 i = 2 i2 = i * i while i2 <= n: if n % i == 0: sd += i + n // i if i2 == n: sd -= i i += 1 i2 = i * i return sd print(sum_of_divisors(220)) print(s...
def sum_of_divisors(n): sd = 1 i = 2 i2 = i * i while i2 <= n: if n % i == 0: sd += i + n // i if i2 == n: sd -= i i += 1 i2 = i * i return sd print(sum_of_divisors(220)) print(sum_of_divisors(284)) def main(): n = 10000 n = 300 i ...
#!/usr/bin/env python3 #This program will write Hello World ! print("Hello World!")
print('Hello World!')
archivo = open("DDSIVClases/archivo.txt", "r") # imprime cada linea del archivo txt for linea in archivo: print(linea) #linea2 = archivo.readline(2) #print(linea2) lineas = archivo.readline()
archivo = open('DDSIVClases/archivo.txt', 'r') for linea in archivo: print(linea) lineas = archivo.readline()
tree_count = 0 with open("input.txt") as file_handler: for n, line in enumerate(file_handler): if n == 0: continue if len(line.strip()) == 0: continue charPos = n*3 if charPos > len(line.strip()): multiples = int(charPos / len(line.strip())) ...
tree_count = 0 with open('input.txt') as file_handler: for (n, line) in enumerate(file_handler): if n == 0: continue if len(line.strip()) == 0: continue char_pos = n * 3 if charPos > len(line.strip()): multiples = int(charPos / len(line.strip())) ...
#file = open('sample.txt','r') #contents = file.read() #file.close() #print(contents) with open('file_example.txt', 'r') as file: contents = file.read() print(contents)
with open('file_example.txt', 'r') as file: contents = file.read() print(contents)
def buildPalindrome(st): for i in range(len(st)): sub = st[i : len(st)] if sub[::-1] == sub: missing = st[0:i] return st + missing[::-1] return st
def build_palindrome(st): for i in range(len(st)): sub = st[i:len(st)] if sub[::-1] == sub: missing = st[0:i] return st + missing[::-1] return st
n, k = map(int, input().split()) count = 0 for _ in range(n): a = int(input()) if a%k == 0: count +=1 print(count)
(n, k) = map(int, input().split()) count = 0 for _ in range(n): a = int(input()) if a % k == 0: count += 1 print(count)
# Programa em q o usuario possa adicionar valores numericos em uma lista, Caso o numero ja exista ele nao sera adicionado # no final serao exibidos todos os valores unicos em ordem crescente lista = [] resp = '' old = 0 while True: old = int(input('Digite um valor: ')) if old in lista: print('Valor r...
lista = [] resp = '' old = 0 while True: old = int(input('Digite um valor: ')) if old in lista: print('Valor repetido, nao vou adicionar...') else: lista.append(old) print('Valor adicionado com sucesso...') resp = input('Deseja continuar? [S/N] ').strip().upper()[0] while res...
male = [ 'AKIO', 'AKIRA', 'AOI', 'ARATA', 'ASUKA', 'AYUMU', 'DAICHI', 'DAIKI', 'DAISUKE', 'GORO', 'GOROU', 'HACHIRO', 'HACHIROU', 'HARU', 'HARUKA', 'HARUKI', 'HARUTO', 'HAYATE', 'HAYATO', 'HIBIKI', 'HIDEAKI', 'HIDEKI', 'HIDEYOSH...
male = ['AKIO', 'AKIRA', 'AOI', 'ARATA', 'ASUKA', 'AYUMU', 'DAICHI', 'DAIKI', 'DAISUKE', 'GORO', 'GOROU', 'HACHIRO', 'HACHIROU', 'HARU', 'HARUKA', 'HARUKI', 'HARUTO', 'HAYATE', 'HAYATO', 'HIBIKI', 'HIDEAKI', 'HIDEKI', 'HIDEYOSHI', 'HIKARI', 'HIKARU', 'HINATA', 'HIRAKU', 'HIROKI', 'HIROSHI', 'HIROTO', 'ICHIRO', 'ICHIROU...
class Scale: def __init__(self, tonic): if tonic in ["F", "Bb", "Eb", "Ab", "Db", "Gb", "d", "g", "c", "f", "bb", "eb", ]: notes = ["A", "Bb", "B", "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", ] else: notes = ["A", "A#", "B", "C", "C#", "D", ...
class Scale: def __init__(self, tonic): if tonic in ['F', 'Bb', 'Eb', 'Ab', 'Db', 'Gb', 'd', 'g', 'c', 'f', 'bb', 'eb']: notes = ['A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab'] else: notes = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'] ...
# binStrToBytes : Converts a binary string to an array of bytes. # @param bin : The binary string to be converted to byte array. # @return : The byte array representation of the provided binary string. def binStrToBytes(bin): if (not isinstance(bin, str)): raise TypeError("Unexpected type, expected 'str'")...
def bin_str_to_bytes(bin): if not isinstance(bin, str): raise type_error("Unexpected type, expected 'str'") bin = bin.replace(' ', '') size = len(bin) if size % 8 != 0: raise exception('Invalid length, cannot convert to byte array') return bytes([int(bin[i:i + 8], 2) for i in range(0...
# Hidden Street - Ardentmill :: 910001000 # Gere :: Master of Smithing :: 9031003 MINING_SKILL = 92010000 SMITHING_CRAFT_SKILL = 92020000 ACCESSORY_CRAFT_SKILL = 92030000 ALCHEMY_CRAFT_SKILL = 92040000 FEE = [5000, 15000, 25000, 40000, 60000, 85000, 115000, 150000, 190000, 235000] if not sm.hasSkill(SMITHING_CRAFT_SK...
mining_skill = 92010000 smithing_craft_skill = 92020000 accessory_craft_skill = 92030000 alchemy_craft_skill = 92040000 fee = [5000, 15000, 25000, 40000, 60000, 85000, 115000, 150000, 190000, 235000] if not sm.hasSkill(SMITHING_CRAFT_SKILL): selection = sm.sendSay('I am #bGere#k, master Blacksmith. What do you want...
''' Dataset 1 # This cases have displaced or incorrect annotation files # Some maybe be corrected using the map below skipCase = ['LUNG1-034', 'LUNG1-040', 'LUNG1-044', 'LUNG1-068', 'LUNG1-083', 'LUNG1-084', 'LUNG1-094', 'LUNG1-096', ...
""" Dataset 1 # This cases have displaced or incorrect annotation files # Some maybe be corrected using the map below skipCase = ['LUNG1-034', 'LUNG1-040', 'LUNG1-044', 'LUNG1-068', 'LUNG1-083', 'LUNG1-084', 'LUNG1-094', 'LUNG1-096', ...
(5)(3) l = [a, 21, l] l(3) a(20, 21, *n, b=m)
5(3) l = [a, 21, l] l(3) a(20, 21, *n, b=m)
ages = [5, 12, 17, 18, 24, 32] def myFunc(x): if x < 18: return False else: return True adults = filter(myFunc, ages) for x in adults: print(x)
ages = [5, 12, 17, 18, 24, 32] def my_func(x): if x < 18: return False else: return True adults = filter(myFunc, ages) for x in adults: print(x)
def fraction(a, b): try: return "%.1f" % (float(a) / float(b)) except (ValueError, ZeroDivisionError): return "ERR"
def fraction(a, b): try: return '%.1f' % (float(a) / float(b)) except (ValueError, ZeroDivisionError): return 'ERR'
# M-1 x1 = 12 y1 = 5 z1 = x1*y1 print(z1) # M-2 eggs = 12 unit_price = 5 total_price = eggs*unit_price print(total_price) # M-3 a12345 = 12 b12345 = 5 c12345 = a12345*b12345 print(c12345)
x1 = 12 y1 = 5 z1 = x1 * y1 print(z1) eggs = 12 unit_price = 5 total_price = eggs * unit_price print(total_price) a12345 = 12 b12345 = 5 c12345 = a12345 * b12345 print(c12345)
# SAVE PATIENTS n = int(input()) strength = list(map(int, input().split())) patient = list(map(int, input().split())) strength.sort() patient.sort() for i in range(n): if strength[i]<patient[i]: print("No") break else: print("Yes")
n = int(input()) strength = list(map(int, input().split())) patient = list(map(int, input().split())) strength.sort() patient.sort() for i in range(n): if strength[i] < patient[i]: print('No') break else: print('Yes')
# 06 Magic Methods # https://rszalski.github.io/magicmethods/ # Magiv Methods are called automaticly by Python interpreter, depending on how we use our object and class class Point: point_color = "Red" @classmethod def zero(cls): return cls(0, 0, 0) def __init__(self, x, y, z): self...
class Point: point_color = 'Red' @classmethod def zero(cls): return cls(0, 0, 0) def __init__(self, x, y, z): self.x = x self.y = y self.z = z def __str__(self): return f'{self.x}, {self.y}, {self.z}' def draw(self): print(f'Point coordinates (...
# Python vs. C++ Example 4 # Rachel J. Morris, 2013 - RachelJMorris@gmail.com, Moosader.com, github.com/Moosader # MIT License # Generally, these shouldn't be stored in separate lists; we would create # a class to store name & age, but we will do this in a later example. lstStudentNames = [] lstStudentAges = [] doneW...
lst_student_names = [] lst_student_ages = [] done_with_program = False while not doneWithProgram: print('\n') print('What would you like to do?') print('1. Add another student') print('2. End') choice = input('? ') while int(choice) != 1 and int(choice) != 2: choice = input('Invalid choi...
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return an integer def sumNumbers(self, root): if not root: return 0 qu...
class Solution: def sum_numbers(self, root): if not root: return 0 queue = [] values = [] self.dfs(root, queue, values) return sum(values) def dfs(self, root, queue, values): queue.append(root) if not root.left and (not root.right): ...
#!/usr/bin/env python # Copyright Contributors to the Open Shading Language project. # SPDX-License-Identifier: BSD-3-Clause # https://github.com/AcademySoftwareFoundation/OpenShadingLanguage # Simple test on a grid texture command = testshade("-t 1 -groupname Beatles -layer Cake test") command += testshade("-t 1 -g ...
command = testshade('-t 1 -groupname Beatles -layer Cake test') command += testshade('-t 1 -g 2 2 -groupname Beatles -layer Cake test_v_name')
table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" flag = [ord("X") for i in range(0x64)] flag[0] = ord(table[0x1c]) flag[1] = ord(table[0x36]) flag[2] = ord(table[(0x1c + 0x36) >> 2]) flag[10] = flag[2] flag[3] = 0x6a flag[4] = flag[0] + 1 for p in [0xc, 0x16, 0x18]: flag[p] = flag[4] - 1 fl...
table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' flag = [ord('X') for i in range(100)] flag[0] = ord(table[28]) flag[1] = ord(table[54]) flag[2] = ord(table[28 + 54 >> 2]) flag[10] = flag[2] flag[3] = 106 flag[4] = flag[0] + 1 for p in [12, 22, 24]: flag[p] = flag[4] - 1 flag[6] = flag[3] - ...
class Configuration: DB = 'aiohttpdemo_polls' USER = 'aiohttpdemo_user' PASS = 'aiohttpdemo_pass' HOST = 'localhost' PORT = '5432'
class Configuration: db = 'aiohttpdemo_polls' user = 'aiohttpdemo_user' pass = 'aiohttpdemo_pass' host = 'localhost' port = '5432'
class Provider(object): base_url = None def __init__(self, url: str) -> None: self.base_url = url def watch(self): pass
class Provider(object): base_url = None def __init__(self, url: str) -> None: self.base_url = url def watch(self): pass
# # PySNMP MIB module XYLAN-BASE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-BASE-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:44:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ...
pares, impares, positivos, negativos = 0, 0, 0, 0 for i in range(5): num = int(input()) if num % 2 == 0: pares += 1 else: impares += 1 if num > 0: positivos += 1 elif num < 0: negativos += 1 print('{} valor(es) par(es)'.format(pares)) print('{} valor(es) i...
(pares, impares, positivos, negativos) = (0, 0, 0, 0) for i in range(5): num = int(input()) if num % 2 == 0: pares += 1 else: impares += 1 if num > 0: positivos += 1 elif num < 0: negativos += 1 print('{} valor(es) par(es)'.format(pares)) print('{} valor(es) impar(es)...
arquivo = open('argv.py', 'r') for line in arquivo: print(line.rstrip())
arquivo = open('argv.py', 'r') for line in arquivo: print(line.rstrip())
class D(object): pass class E(object): pass class F(object): pass class B(E, D): pass class C(D, F): pass class A(B, C): pass
class D(object): pass class E(object): pass class F(object): pass class B(E, D): pass class C(D, F): pass class A(B, C): pass
def null(X): null_list = X.isnull().sum() return null_list
def null(X): null_list = X.isnull().sum() return null_list
def findDecision(obj): #obj[0]: Driving_to, obj[1]: Passanger, obj[2]: Weather, obj[3]: Temperature, obj[4]: Time, obj[5]: Coupon, obj[6]: Coupon_validity, obj[7]: Gender, obj[8]: Age, obj[9]: Maritalstatus, obj[10]: Children, obj[11]: Education, obj[12]: Occupation, obj[13]: Income, obj[14]: Bar, obj[15]: Coffeehouse,...
def find_decision(obj): if obj[13] <= 6: if obj[5] > 0: if obj[20] <= 2: if obj[15] <= 2.0: if obj[9] <= 2: if obj[1] > 0: if obj[14] > -1.0: if obj[10] <= 0: ...
class Question(object): def __init__(self, id, title, text): self._id = id self._title = title self._text = text self._answers = [] self._chosen_answer = None @property def id(self): return self._id @id.setter def id(self, id): self._id = i...
class Question(object): def __init__(self, id, title, text): self._id = id self._title = title self._text = text self._answers = [] self._chosen_answer = None @property def id(self): return self._id @id.setter def id(self, id): self._id = id...
# -*- coding: utf-8 -*- name = 'usdview' version = '18.11' requires = [ 'pyside-1.2', 'usd-18.11' ] def commands(): env.DEFAULT_USD.set('{root}/bin/DefaultUSD.usda')
name = 'usdview' version = '18.11' requires = ['pyside-1.2', 'usd-18.11'] def commands(): env.DEFAULT_USD.set('{root}/bin/DefaultUSD.usda')
# 7. Write a program that asks the user to enter a word and determines whether the word is a # palindrome or not. A palindrome is a word that reads the same backwards as forwards. s = input('Enter a string: ') new_string = s[::-1] # a negative step reverses the string if s == new_string: print('It is a palindro...
s = input('Enter a string: ') new_string = s[::-1] if s == new_string: print('It is a palindrome.') else: print('It is not a palindrome.')
moveSet1 = 'R1009,D117,L888,D799,L611,U766,L832,U859,L892,D79,R645,U191,L681,D787,R447,D429,L988,U536,L486,D832,R221,D619,R268,D545,L706,U234,L528,D453,R493,D24,L688,U658,L74,D281,R910,D849,L5,U16,R935,D399,L417,U609,R22,D782,L432,D83,L357,D982,L902,U294,L338,U102,R342,D621,R106,U979,L238,U158,R930,D948,L700,D808,R445,...
move_set1 = 'R1009,D117,L888,D799,L611,U766,L832,U859,L892,D79,R645,U191,L681,D787,R447,D429,L988,U536,L486,D832,R221,D619,R268,D545,L706,U234,L528,D453,R493,D24,L688,U658,L74,D281,R910,D849,L5,U16,R935,D399,L417,U609,R22,D782,L432,D83,L357,D982,L902,U294,L338,U102,R342,D621,R106,U979,L238,U158,R930,D948,L700,D808,R445...
## ## ## def exec(conexao): cursor = conexao.cursor() print("RULE 16 - Inicializando",end=' ') update = " UPDATE principal SET " update = update + " r25 = \"50\", " update = update + " r31 = \"50\" " update = update + " WHERE 1=1 " update = update + " AND r1 = \"C170\" " update =...
def exec(conexao): cursor = conexao.cursor() print('RULE 16 - Inicializando', end=' ') update = ' UPDATE principal SET ' update = update + ' r25 = "50", ' update = update + ' r31 = "50" ' update = update + ' WHERE 1=1 ' update = update + ' AND r1 = "C170" ' update = update + ' AND r3 = "...
#!/usr/bin/env python # Import modules # Read settings file settings_file = open('./odin_fix_settings.txt') input_file = settings_file.readline().rstrip() output_file = settings_file.readline().rstrip() parsed_file = open(output_file,'w') parsed_file.write('Date\tTime\tDust\tRH\tTemp\tBatt\n') with open(input_file,'r')...
settings_file = open('./odin_fix_settings.txt') input_file = settings_file.readline().rstrip() output_file = settings_file.readline().rstrip() parsed_file = open(output_file, 'w') parsed_file.write('Date\tTime\tDust\tRH\tTemp\tBatt\n') with open(input_file, 'r') as datafile: for line in datafile: has_header...
t = int(input()) for ___ in range(t): length = int(input()) a = [int(k) for k in input().split(' ')] max_boost = 0 summm = 0 for k in range(length): if k%2 == 0: summm += a[k] for l in range(length-1): if l%2 == 0: vygoda = 0 sum_nech, sum_ch =...
t = int(input()) for ___ in range(t): length = int(input()) a = [int(k) for k in input().split(' ')] max_boost = 0 summm = 0 for k in range(length): if k % 2 == 0: summm += a[k] for l in range(length - 1): if l % 2 == 0: vygoda = 0 (sum_nech, s...
class Solution: def __init__(self) : self.store = { 0 : [], 1 : ["()"] } def AllParenthesis(self,n): if n in self.store : return self.store[n] ans = set() for i in range(n) : if i == 0 : for co...
class Solution: def __init__(self): self.store = {0: [], 1: ['()']} def all_parenthesis(self, n): if n in self.store: return self.store[n] ans = set() for i in range(n): if i == 0: for comb in self.AllParenthesis(n - 1): ...
def translate(value, leftMin, leftMax, rightMin, rightMax): leftSpan = leftMax - leftMin rightSpan = rightMax - rightMin valueScaled = float(value - leftMin) / float(leftSpan) result = rightMin + (valueScaled * rightSpan) return result def reversed_iterator(iter): return reversed(list(iter))
def translate(value, leftMin, leftMax, rightMin, rightMax): left_span = leftMax - leftMin right_span = rightMax - rightMin value_scaled = float(value - leftMin) / float(leftSpan) result = rightMin + valueScaled * rightSpan return result def reversed_iterator(iter): return reversed(list(iter))
t = int(input()) def find_max_level(n: int): sums = [1] i = 1 while max(sums) < n: sums.append(2 * sums[i - 1] + 1) i += 1 return i def create_binomial_matrix(level: int): mat = [[1 if j == i or j == 0 else 0 for j in range(0,level)] for i in range(0,level)] for i in range...
t = int(input()) def find_max_level(n: int): sums = [1] i = 1 while max(sums) < n: sums.append(2 * sums[i - 1] + 1) i += 1 return i def create_binomial_matrix(level: int): mat = [[1 if j == i or j == 0 else 0 for j in range(0, level)] for i in range(0, level)] for i in range(0,...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # Check with 'pylint' command to code rating. ''' A very simple script. ''' def func(): ''' A simple function ''' first = 1 second = 2 print(first) print(second) func()
""" A very simple script. """ def func(): """ A simple function """ first = 1 second = 2 print(first) print(second) func()
_CLASH_ERR = "Cannot have more than one '{}' stanza (Clashing files: {})" _VALID_ERR = "The data in the '{}' stanza from '{}' failed validation rules." class MetaloaderError(RuntimeError): pass class ExclusiveStanzaClashError(MetaloaderError): def __init__(self, key, clashing_files): error_message =...
_clash_err = "Cannot have more than one '{}' stanza (Clashing files: {})" _valid_err = "The data in the '{}' stanza from '{}' failed validation rules." class Metaloadererror(RuntimeError): pass class Exclusivestanzaclasherror(MetaloaderError): def __init__(self, key, clashing_files): error_message = ...
class Solution: def defangIPaddr(self, address: str) -> str: # replace return address.replace('.', '[.]') # def defangIPaddr(self, address: str) -> str: # # split and join # return '[.]'.join(address.split('.')) # def defangIPaddr(self, address: str) -> str: # # repla...
class Solution: def defang_i_paddr(self, address: str) -> str: return address.replace('.', '[.]')
def somadig(n): if n == 0: return 0 else: return (n % 10) + somadig(n // 10) print(somadig(120)) #https://pt.stackoverflow.com/q/349093/101
def somadig(n): if n == 0: return 0 else: return n % 10 + somadig(n // 10) print(somadig(120))
class Node: def __init__(self, data): self.data = data self.next_node = None class LinkedList: def __init__(self): self.head = None self.size = 0 def insert_at_start(self, data): new_node = Node(data) self.size += 1 if not self.head: se...
class Node: def __init__(self, data): self.data = data self.next_node = None class Linkedlist: def __init__(self): self.head = None self.size = 0 def insert_at_start(self, data): new_node = node(data) self.size += 1 if not self.head: se...
# jmespath/_lrtable.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\xb4\x1bXD\x01\x03z\xbb\x19\xfc\rk\xd7x\x00\xa3' _lr_action_items = {'STAR':([0,2,11,23,26,28,29,32,36,39,44,45,46,47,48,49,50,55,63,],[1,14,1,1,51,1,57,1,1,1,-16,-17,1,-18,-19,-1...
_tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '´\x1bXD\x01\x03z»\x19ü\rk×x\x00£' _lr_action_items = {'STAR': ([0, 2, 11, 23, 26, 28, 29, 32, 36, 39, 44, 45, 46, 47, 48, 49, 50, 55, 63], [1, 14, 1, 1, 51, 1, 57, 1, 1, 1, -16, -17, 1, -18, -19, -14, -15, 1, 1]), 'LPAREN': ([10], [23]), 'NUMBER': ([2, 26], [15, ...
# Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 load("@python3//:defs.bzl", "interpreter") def _bitstreams_repo_impl(rctx): rctx.execute( [ rctx.path(rctx.attr.python_interpreter), rct...
load('@python3//:defs.bzl', 'interpreter') def _bitstreams_repo_impl(rctx): rctx.execute([rctx.path(rctx.attr.python_interpreter), rctx.attr._cache_manager, '--build-file=BUILD.bazel', '--bucket-url={}'.format(rctx.attr.bucket_url), '--cache={}'.format(rctx.attr.cache), '--refresh-time={}'.format(rctx.attr.refresh...
# Reading data from file f = open("student.txt", mode="r") data1 = f.read(2) data2 = f.read(2) print(data1) print(data2) f.close() print("complete!!!")
f = open('student.txt', mode='r') data1 = f.read(2) data2 = f.read(2) print(data1) print(data2) f.close() print('complete!!!')
class Solution(object): def removeDuplicates(self, nums): ht = {} insert = 0 for num in nums: if num in ht: ht[num] += 1 else: ht[num] = 1 if ht[num] > 2: continue else: nums[in...
class Solution(object): def remove_duplicates(self, nums): ht = {} insert = 0 for num in nums: if num in ht: ht[num] += 1 else: ht[num] = 1 if ht[num] > 2: continue else: nums[ins...
def module2_1(): a = 2**0.5 print('%.6f' % (a)) def module2_2(): top = 10 bottom = 20 height = 8 area = (top+bottom)*height/2 print('Area of a Trapezoid:%.1f' % area) def module2_3(): prime_number = [1] for i in range(2,1001): prime_flag = True for prime in prime_nu...
def module2_1(): a = 2 ** 0.5 print('%.6f' % a) def module2_2(): top = 10 bottom = 20 height = 8 area = (top + bottom) * height / 2 print('Area of a Trapezoid:%.1f' % area) def module2_3(): prime_number = [1] for i in range(2, 1001): prime_flag = True for prime in p...
# list of file paths to ignore when decrypting # any files that start with these names will not be dumped nodecrypt = [ "data\\BehaviourCreator", "data\\DirectXRedist", "data\\RecommendedBuilds", "data\\ReplayEncoder", "data\\Replays", "data\\Rofl", "data\\Shaders", "data\\Sound\\Music",...
nodecrypt = ['data\\BehaviourCreator', 'data\\DirectXRedist', 'data\\RecommendedBuilds', 'data\\ReplayEncoder', 'data\\Replays', 'data\\Rofl', 'data\\Shaders', 'data\\Sound\\Music', 'data\\VCRedist', 'data\\Video', 'data\\AwesomenautsIcon.bmp']
def feet2inches(feet): return feet * 12 def inches2feet(inches): feet = inches / 12.0 remainder_inches = feet % 12.0 return feet, remainder_inches def inches2meters(inches): return inches * 39.37007874 def meters2inches(meters): return meters / 0.0254 def meters2feet(meters): inches = meters2inches(...
def feet2inches(feet): return feet * 12 def inches2feet(inches): feet = inches / 12.0 remainder_inches = feet % 12.0 return (feet, remainder_inches) def inches2meters(inches): return inches * 39.37007874 def meters2inches(meters): return meters / 0.0254 def meters2feet(meters): inches = ...
#file --pair-- # Jakub Grobelny # 2018 class pair: def __init__(self, first, second): self.first = first self.second = second def get(self, which): if which == 0: return self.first elif which == 1: return self.second else: ...
class Pair: def __init__(self, first, second): self.first = first self.second = second def get(self, which): if which == 0: return self.first elif which == 1: return self.second else: raise exception('Pair access violation!')
# WAP to show the use of for loop cities = ['new york city', 'mountain view', 'chicago', 'los angeles'] for city in cities: #city is the iteration variable, cities is the iterable being looped over print(city) print("Done!")
cities = ['new york city', 'mountain view', 'chicago', 'los angeles'] for city in cities: print(city) print('Done!')
nombre = None edad = None apellido = None def nombre_completo(): return nombre + ' ' + apellido def cumplir_anios(): global edad edad += 1
nombre = None edad = None apellido = None def nombre_completo(): return nombre + ' ' + apellido def cumplir_anios(): global edad edad += 1
class Solution: def maxIncreaseKeepingSkyline(self, grid: List[List[int]]) -> int: n = len(grid) row_high = [0]*n col_high = [0]*n for i in range(n): row_high[i] = max(grid[i]) col_high[i] = 0 for j in range(n): col_hig...
class Solution: def max_increase_keeping_skyline(self, grid: List[List[int]]) -> int: n = len(grid) row_high = [0] * n col_high = [0] * n for i in range(n): row_high[i] = max(grid[i]) col_high[i] = 0 for j in range(n): col_high[i] ...
def obfuscated_id(x): y = x z = y return z a = 42 b = obfuscated_id(a)
def obfuscated_id(x): y = x z = y return z a = 42 b = obfuscated_id(a)
# noinspection PyUnusedLocal # friend_name = unicode string def hello(friend_name): ''' :param Int1: Integer between 0 and 100 inclusive :param Int2: Integer between 0 and 100 inclusive :return: Sum of Int1 and Int2 >>> hello ('Bob') --> 'Hello Bob' >>> sumR1 ('Alice') --> '...
def hello(friend_name): """ :param Int1: Integer between 0 and 100 inclusive :param Int2: Integer between 0 and 100 inclusive :return: Sum of Int1 and Int2 >>> hello ('Bob') --> 'Hello Bob' >>> sumR1 ('Alice') --> 'Hello Alice' """ msg = 'Hello, ' screamer = '!' return ms...
# const N_INPUTS = 2 N_OUTPUTS = 1 # supported values: 1000, 2000, 4000, 8000, 16000 BATCH_SIZE = 1000 # variables N_LAYERS = 3 MAX_ITER = 1000 SEED = 41 N_UNITS = [] for i in range(N_LAYERS): N_UNITS.append(16)
n_inputs = 2 n_outputs = 1 batch_size = 1000 n_layers = 3 max_iter = 1000 seed = 41 n_units = [] for i in range(N_LAYERS): N_UNITS.append(16)
# Irupe Canet # Check if one number divides another p = 8 m = 2 if (p % m) == 0: print(p, "divided by", m, "leaves a reminder of zero.") print("I'll run too if the condition is True.") else: print(p, "divided by", m, "does not leaves a reminder of zero.") print("I'll run no matter what.")
p = 8 m = 2 if p % m == 0: print(p, 'divided by', m, 'leaves a reminder of zero.') print("I'll run too if the condition is True.") else: print(p, 'divided by', m, 'does not leaves a reminder of zero.') print("I'll run no matter what.")
# This file is where you keep secret settings, passwords, and tokens! # If you put them in the code you risk committing that info or sharing it secrets = { 'ssid' : 'home_network', 'password' : 'ssid_password', 'timezone' : "America/New_York", # http://worldtimeapi.org/timezones 'github_token' : 'fawfj...
secrets = {'ssid': 'home_network', 'password': 'ssid_password', 'timezone': 'America/New_York', 'github_token': 'fawfj23rakjnfawiefa', 'hackaday_token': 'h4xx0rs3kret'}
width = int(input()) lenght = int(input()) count = width * lenght while count > 0: line = input() if line == "STOP": break else: new_pieces = int(line) count = count - new_pieces if count > 0: print(f"{count} pieces are left.") else: print(f"No more cake left! You need {ab...
width = int(input()) lenght = int(input()) count = width * lenght while count > 0: line = input() if line == 'STOP': break else: new_pieces = int(line) count = count - new_pieces if count > 0: print(f'{count} pieces are left.') else: print(f'No more cake left! You need {abs(c...
# Program to find GCD of the digits of a number # Recursive function to return gcd of a and b def gcd(a, b): return a if (b == 0) else gcd(b, a % b) def digitGCD(n): ans = 0 while n > 0: ans = gcd(n % 10, ans) # If at any point GCD is 1, return if gcd == 1: return 1 ...
def gcd(a, b): return a if b == 0 else gcd(b, a % b) def digit_gcd(n): ans = 0 while n > 0: ans = gcd(n % 10, ans) if gcd == 1: return 1 n = n // 10 return ans n = int(input('Enter a number: ')) print('GCD of the digits of n is', digit_gcd(n))
class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: dic = collections.defaultdict(list) for s in strs : dic["".join(sorted(s))].append(s) return list(dic.values())
class Solution: def group_anagrams(self, strs: List[str]) -> List[List[str]]: dic = collections.defaultdict(list) for s in strs: dic[''.join(sorted(s))].append(s) return list(dic.values())
#!/usr/bin/env python wc_arr = [0 for x in range(0, 14000/8)] def _iswordchar(ch): return (not ( ch <= 33 or ch == ord(';') or ch == ord('-') or ch == ord('"') or ch == ord('\'') or (ch >= 35 and ch <= 38) or (ch >= 40 and ch <= 44) or (ch >= 46 and ch <= 47) or ch == 58 or (ch >= 60 and ch <= 63) ...
wc_arr = [0 for x in range(0, 14000 / 8)] def _iswordchar(ch): return not (ch <= 33 or ch == ord(';') or ch == ord('-') or (ch == ord('"')) or (ch == ord("'")) or (ch >= 35 and ch <= 38) or (ch >= 40 and ch <= 44) or (ch >= 46 and ch <= 47) or (ch == 58) or (ch >= 60 and ch <= 63) or (ch >= 91 and ch <= 94) or (ch...
# The main module for the plugin. # Note: In ALL plugins there must be a python file called [name-of-plugin].py in a folder called [name-of-plugin]! def init(page, config): # This code runs when the generate command is called. print("Example plugin initialized!") def site(page): # This code run whenever a new Dars...
def init(page, config): print('Example plugin initialized!') def site(page): print('Site created.') print('Site title: ' + page.title) def closesite(page): print('Site closed: ' + page.title)
def belongs_to_file(word, filename): with open(filename) as f: l = f.readlines() for w in l: if w.strip() == word: return True return False print(belongs_to_file("renard", "words.txt")) print(belongs_to_file("abbots", "words.txt"))
def belongs_to_file(word, filename): with open(filename) as f: l = f.readlines() for w in l: if w.strip() == word: return True return False print(belongs_to_file('renard', 'words.txt')) print(belongs_to_file('abbots', 'words.txt'))
class LampTextureSlot: color_factor = None object = None shadow_factor = None texture_coords = None use_map_color = None use_map_shadow = None
class Lamptextureslot: color_factor = None object = None shadow_factor = None texture_coords = None use_map_color = None use_map_shadow = None
''' Created on Feb 24, 2018 @author: danie '''
""" Created on Feb 24, 2018 @author: danie """
# Task 05. Faro Shuffle def faro_shuffle(arr_input): left_half = deck[:len(arr_input) // 2] right_half = deck[len(arr_input) // 2:] new_list = [] for ind in range(len(left_half)): new_list.append(right_half[ind]) new_list.append(left_half[ind]) return new_list deck = input().split...
def faro_shuffle(arr_input): left_half = deck[:len(arr_input) // 2] right_half = deck[len(arr_input) // 2:] new_list = [] for ind in range(len(left_half)): new_list.append(right_half[ind]) new_list.append(left_half[ind]) return new_list deck = input().split() count = int(input()) fir...
class AccountInfo(object): _LABELS = ('section', 'organization', 'account-group-code', 'account-code', 'account-group-name', 'account-name', 'amount') def __init__(self): self.section = None self.organizat...
class Accountinfo(object): _labels = ('section', 'organization', 'account-group-code', 'account-code', 'account-group-name', 'account-name', 'amount') def __init__(self): self.section = None self.organization = None self.account_group_code = None self.account_code = None ...
class WitEmulator(object): def __init__(self): self.name='wit' def normalise_request_json(self,data): _data = {} _data["text"]=data['q'][0] return _data def normalise_response_json(self,data): print('plain response {0}'.format(data)) return [ { ...
class Witemulator(object): def __init__(self): self.name = 'wit' def normalise_request_json(self, data): _data = {} _data['text'] = data['q'][0] return _data def normalise_response_json(self, data): print('plain response {0}'.format(data)) return [{'_text':...
def gcd(a, b): if b == 0: return a return gcd(b, a % b) def bgcd(a, b): if b == 0: return a if a == 0: return b if a & 1: if b & 1: return bgcd((a - b) >> 1, b) else: return bgcd(a, b >> 1) else: if b & 1: retu...
def gcd(a, b): if b == 0: return a return gcd(b, a % b) def bgcd(a, b): if b == 0: return a if a == 0: return b if a & 1: if b & 1: return bgcd(a - b >> 1, b) else: return bgcd(a, b >> 1) elif b & 1: return bgcd(a >> 1, b) ...
# Copyright 2013-2021 Aerospike, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
class Lookupdict: lookup_mode = 0 prefix_mode = 1 suffix_mode = 2 def __init__(self, mode=None): self._kv = {} if mode == None: mode = self.LOOKUP_MODE self.mode = mode def __setitem__(self, key, value): return self.add(key, value) def __getitem__(s...
''' Doc Header ''' def test_this1(): assert 1 == 1, "This should never fail"
""" Doc Header """ def test_this1(): assert 1 == 1, 'This should never fail'
name = 'stackdandelion' aliases = ['stackdandelions', 'fixdandelionstacking'] fix_dandelion_stacking_fixed = False async def run(message): 'Fixes dandelion stacking.' global fix_dandelion_stacking_fixed if not fix_dandelion_stacking_fixed: await message.send('Dandelion stacking has been fixed.') else: await ...
name = 'stackdandelion' aliases = ['stackdandelions', 'fixdandelionstacking'] fix_dandelion_stacking_fixed = False async def run(message): """Fixes dandelion stacking.""" global fix_dandelion_stacking_fixed if not fix_dandelion_stacking_fixed: await message.send('Dandelion stacking has been fixed.'...
# Solution for the problem "Constructing a Number" # https://www.hackerrank.com/contests/hourrank-25/challenges/constructing-a-number/problem # Number of test cases t = int(input()) for x in range(t): # Number of items. We are not actually using this in our approach n = int(input()) # We are replacing all...
t = int(input()) for x in range(t): n = int(input()) num = int(input().replace(' ', '')) print('Yes' if num % 3 == 0 else 'No')
name_score = 0 def cal_name_score(n, list_a): global name_score name_s = 0 for i in list_a[n]: name_s += ord(i.lower()) - 96 name_score += name_s * (n+1) return name_score if __name__ == '__main__': with open('p022_names.txt') as f: name_list = f.readlines() clear_list = ...
name_score = 0 def cal_name_score(n, list_a): global name_score name_s = 0 for i in list_a[n]: name_s += ord(i.lower()) - 96 name_score += name_s * (n + 1) return name_score if __name__ == '__main__': with open('p022_names.txt') as f: name_list = f.readlines() clear_list = n...
# Nested For Loop # User input for number of rows rows = int(input("Enter the rows:")) # Outer loop will print number of rows for i in range(0, rows+1): # Inner loop will print number of Astrisk for j in range(i): print("*",end = '') print() # Program to print number pyramid rows = int(inp...
rows = int(input('Enter the rows:')) for i in range(0, rows + 1): for j in range(i): print('*', end='') print() rows = int(input('Enter the rows')) for i in range(0, rows + 1): for j in range(i): print(i, end='') print() i = 2 while i < 20: j = 2 while j <= i / j: if not ...
class Automovel: cor = "" marca = "" qtdegasolina = 45 def __init__(self, c, m): self.cor = c self.marca = m def abastecerCarro(qtdeLitros): qtdegasolina = qtdegasolina + qtdeLitros uno = Automovel("Verde","Fiat") print(uno) hondafit = Automovel("Preta", "Honda") prin...
class Automovel: cor = '' marca = '' qtdegasolina = 45 def __init__(self, c, m): self.cor = c self.marca = m def abastecer_carro(qtdeLitros): qtdegasolina = qtdegasolina + qtdeLitros uno = automovel('Verde', 'Fiat') print(uno) hondafit = automovel('Preta', 'Honda') print(ho...
class Solution: def decodeString(self, s: str) -> str: def dfs(s, i): res, multi = "", 0 while i < len(s): if '0' <= s[i] <= '9': multi = multi * 10 + int(s[i]) elif s[i] == '[': i, tmp = dfs(s, i + 1) ...
class Solution: def decode_string(self, s: str) -> str: def dfs(s, i): (res, multi) = ('', 0) while i < len(s): if '0' <= s[i] <= '9': multi = multi * 10 + int(s[i]) elif s[i] == '[': (i, tmp) = dfs(s, i + 1) ...
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/test_nbdev_define_in_subfolder/01 define in multiple_nbs 1.ipynb (unless otherwise specified). __all__ = ['defined_in_multiple_nbs', 'defined_in_multiple_nbs'] # Cell def defined_in_multiple_nbs(): print("This function was defined on notebook 01") # Cell def defi...
__all__ = ['defined_in_multiple_nbs', 'defined_in_multiple_nbs'] def defined_in_multiple_nbs(): print('This function was defined on notebook 01') def defined_in_multiple_nbs(): print('This function was defined on notebook 02')
#!/usr/bin/env python def part_one() -> None: buffer = [0] idx = 0 for i in range(1, 2018): idx = step(buffer, idx) buffer.insert(idx + 1, i) idx += 1 print('Part 1: ', buffer[buffer.index(2017) + 1]) def step(buffer: list, start: int) -> int: steps = 359 return (step...
def part_one() -> None: buffer = [0] idx = 0 for i in range(1, 2018): idx = step(buffer, idx) buffer.insert(idx + 1, i) idx += 1 print('Part 1: ', buffer[buffer.index(2017) + 1]) def step(buffer: list, start: int) -> int: steps = 359 return (steps + start) % len(buffer) ...
#page contains functions that locates data about things on the webpage #add locators def body_element_locator(browser): return browser.find_element_by_tag_name('body') def get_tweets(browser): return browser.find_elements_by_class_name('tweet-text')
def body_element_locator(browser): return browser.find_element_by_tag_name('body') def get_tweets(browser): return browser.find_elements_by_class_name('tweet-text')
class WorkflowException(Exception): pass class UnsupportedRequirement(WorkflowException): pass
class Workflowexception(Exception): pass class Unsupportedrequirement(WorkflowException): pass
# zop = Zen of python zop = '''Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality be...
zop = "Beautiful is better than ugly.\nExplicit is better than implicit.\nSimple is better than complex.\nComplex is better than complicated.\nFlat is better than nested.\nSparse is better than dense.\nReadability counts.\nSpecial cases aren't special enough to break the rules.\nAlthough practicality beats purity.\nErr...
img_width = 48 img_height = 48 img_depth = 1 batch_size = 32 epochs = 500
img_width = 48 img_height = 48 img_depth = 1 batch_size = 32 epochs = 500
t = int(input().strip()) for a0 in range(t): n = int(input().strip()) a = list(map(int, input().strip().split(' '))) occur = {} count = 0 for i in a: if i in occur: count += occur[i] * 2 occur[i] += 1 else: occur[i] = 1 print(count)
t = int(input().strip()) for a0 in range(t): n = int(input().strip()) a = list(map(int, input().strip().split(' '))) occur = {} count = 0 for i in a: if i in occur: count += occur[i] * 2 occur[i] += 1 else: occur[i] = 1 print(count)
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- _ER...
_error_page_blob_size_alignment = 'Invalid page blob size: {0}. ' + 'The size must be aligned to a 512-byte boundary.' _error_page_blob_start_alignment = 'start_range must align with 512 page size' _error_page_blob_end_alignment = 'end_range must align with 512 page size' _error_invalid_block_id = 'All blocks in block ...
img_norm_cfg = dict( mean=[127.5, 127.5, 127.5], std=[127.5, 127.5, 127.5], to_rgb=False) crop_size = (288, 960) # KITTI config kitti_train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', sparse=True), dict( type='ColorJitter', asymmetric_prob=0.0, bri...
img_norm_cfg = dict(mean=[127.5, 127.5, 127.5], std=[127.5, 127.5, 127.5], to_rgb=False) crop_size = (288, 960) kitti_train_pipeline = [dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', sparse=True), dict(type='ColorJitter', asymmetric_prob=0.0, brightness=0.4, contrast=0.4, saturation=0.4, hue=0.5 / 3.14), ...
maxdepth = 0 def depth(elem, level): global maxdepth # your code goes her # print(elem," :::") # print(level," [[[]]]") if (level == maxdepth): maxdepth += 1 # print(elem) for child in elem: # print(child) depth(child, level + 1)
maxdepth = 0 def depth(elem, level): global maxdepth if level == maxdepth: maxdepth += 1 for child in elem: depth(child, level + 1)
class InvalidKeyType(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class KeyValueStoreDumpException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs)
class Invalidkeytype(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class Keyvaluestoredumpexception(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs)
# This file is automatically generated during the generation of setup.py # Copyright 2020, Caer author = 'Jason Dsouza <jasmcaus@gmail.com>' version = '1.7.8' full_version = '1.7.8' release = True contributors = ['Jason Dsouza <jasmcaus@gmail.com>']
author = 'Jason Dsouza <jasmcaus@gmail.com>' version = '1.7.8' full_version = '1.7.8' release = True contributors = ['Jason Dsouza <jasmcaus@gmail.com>']
# My solution def merge_lists(a, b): res = [] a_cur = 0 b_cur = 0 a_min = a[a_cur] b_min = b[b_cur] a_done = False b_done = False for i in range(len(a) + len(b)): if (a_min <= b_min or b_done) and (a_cur < len(a)): res.append(a_min) a_cur += 1 if (a_cur < len(a)): a_min = a...
def merge_lists(a, b): res = [] a_cur = 0 b_cur = 0 a_min = a[a_cur] b_min = b[b_cur] a_done = False b_done = False for i in range(len(a) + len(b)): if (a_min <= b_min or b_done) and a_cur < len(a): res.append(a_min) a_cur += 1 if a_cur < len(a...
YOLO = dict() # Datasets Parameter YOLO['classes'] = ["aeroplane", "bicycle", "bird", "boat", "bottle"] YOLO['datasets_path'] = '/home/tshzzz/disk_m2/jinnan_round2/datasets/round1_train/' YOLO['anno_path'] = '/home/tshzzz/disk_m2/jinnan_round2/datasets/round1_train/jinnan_round1_train.json' YOLO['val_path'] = '/home/...
yolo = dict() YOLO['classes'] = ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle'] YOLO['datasets_path'] = '/home/tshzzz/disk_m2/jinnan_round2/datasets/round1_train/' YOLO['anno_path'] = '/home/tshzzz/disk_m2/jinnan_round2/datasets/round1_train/jinnan_round1_train.json' YOLO['val_path'] = '/home/tshzzz/disk_m2/jinnan_r...
''' Manages the ingestion rollback File: rollback.py Contains: Singleton - metaclass for the Singleton pattern implementation Rollback - a class storing and executing rollback commands @author: livia ''' class Singleton(type): '''Metaclass to create Singleton classes _instances - s...
""" Manages the ingestion rollback File: rollback.py Contains: Singleton - metaclass for the Singleton pattern implementation Rollback - a class storing and executing rollback commands @author: livia """ class Singleton(type): """Metaclass to create Singleton classes _instances - s...
#!/usr/bin/env python3 file_contents = open('in.idf').read().upper() if 'HVACTEMPLATE' in file_contents: open('expanded.idf', 'w').write('HI') open('BasementGHTIn.idf', 'w').write('HI') open('GHTIn.idf', 'w').write('HI') open('EPObjects.TXT', 'w').write('HI') open('RunINPUT.TXT', 'w').write('HI') ...
file_contents = open('in.idf').read().upper() if 'HVACTEMPLATE' in file_contents: open('expanded.idf', 'w').write('HI') open('BasementGHTIn.idf', 'w').write('HI') open('GHTIn.idf', 'w').write('HI') open('EPObjects.TXT', 'w').write('HI') open('RunINPUT.TXT', 'w').write('HI') open('RunDEBUGOUT.TXT...
BID_VALUE = 'BID_VALUE' PASS = "PASS" MIN_BID_VALUE = "MIN_BID_VALUE" FIRST_ROUND_HONORS_MIN= "FIRST_ROUND_HONORS_MIN" SECOND_ROUND_HONORS_MIN="SECOND_ROUND_HONORS_MIN" TRUMP_CARD_ABBREVIATION= "CARD_ABBREVIATION"
bid_value = 'BID_VALUE' pass = 'PASS' min_bid_value = 'MIN_BID_VALUE' first_round_honors_min = 'FIRST_ROUND_HONORS_MIN' second_round_honors_min = 'SECOND_ROUND_HONORS_MIN' trump_card_abbreviation = 'CARD_ABBREVIATION'
def quick_sort(ARRAY): ARRAY_LENGTH = len(ARRAY) if( ARRAY_LENGTH <= 1): return ARRAY else: PIVOT = ARRAY[0] GREATER = [ element for element in ARRAY[1:] if element > PIVOT ] LESSER = [ element for element in ARRAY[1:] if element <= PIVOT ] return quick_sort(LESSER) +...
def quick_sort(ARRAY): array_length = len(ARRAY) if ARRAY_LENGTH <= 1: return ARRAY else: pivot = ARRAY[0] greater = [element for element in ARRAY[1:] if element > PIVOT] lesser = [element for element in ARRAY[1:] if element <= PIVOT] return quick_sort(LESSER) + [PIVO...