content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Piece:
def __init__(self, x, y, n):
self.x = x
self.y = y
self.n = n
def show(self):
if self.n == 'W':
fill(230)
elif self.n == 'O':
fill(255,165,0)
elif self.n == 'G':
fill(124,252,0)
elif ... | class Piece:
def __init__(self, x, y, n):
self.x = x
self.y = y
self.n = n
def show(self):
if self.n == 'W':
fill(230)
elif self.n == 'O':
fill(255, 165, 0)
elif self.n == 'G':
fill(124, 252, 0)
elif self.n == 'R':
... |
def prime_test(number):
for i in range(2, int(number**.5) + 1):
if number % i == 0:
return False
return True
prime_list = [2]
number = 2
while prime_list[-1] < 2000000:
number += 1
if prime_test(number):
prime_list.append(number)
del prime_list[-1]
print(sum(prime_list)) ... | def prime_test(number):
for i in range(2, int(number ** 0.5) + 1):
if number % i == 0:
return False
return True
prime_list = [2]
number = 2
while prime_list[-1] < 2000000:
number += 1
if prime_test(number):
prime_list.append(number)
del prime_list[-1]
print(sum(prime_list)) |
# Bubble sort in python
def bubblesort(arr):
n = len(arr)
for i in range(n-1):
for j in range(0, n-i-1):
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
arr=[12,24,45,15,32,99,202]
bubblesort(arr)
print('sorted array : ', arr)
| def bubblesort(arr):
n = len(arr)
for i in range(n - 1):
for j in range(0, n - i - 1):
if arr[j] > arr[j + 1]:
(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
arr = [12, 24, 45, 15, 32, 99, 202]
bubblesort(arr)
print('sorted array : ', arr) |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: lib.coginvasion.npc.NPCGlobals
NPC_DNA = {'Flippy': '00/01/04/17/01/17/01/17/03/03/09/09/09/04/00',
'Tutorial Tom': '00/01/05/07/01/... | npc_dna = {'Flippy': '00/01/04/17/01/17/01/17/03/03/09/09/09/04/00', 'Tutorial Tom': '00/01/05/07/01/07/01/07/02/02/03/14/14/08/00', 'Lil Oldman': '00/03/02/21/02/21/01/21/01/01/01/13/13/18/00', 'Coach Zucchini': '00/08/01/10/02/10/01/10/00/00/01/22/22/08/00', 'Coach': '00/06/02/15/00/15/00/15/23/23/17/00/00/00/00', 'L... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class Queue:
def __init__(self):
self.head = None
self.tail = None
def enqueue(self, value):
if self.is_empty():
new_node = Node(value)
self.tail = new_node
... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Queue:
def __init__(self):
self.head = None
self.tail = None
def enqueue(self, value):
if self.is_empty():
new_node = node(value)
self.tail = new_node
... |
name = "eric johnson"
print(name.lower())
print(name.upper())
print(name.title())
| name = 'eric johnson'
print(name.lower())
print(name.upper())
print(name.title()) |
class Rectangle:
def __init__(self, length, width):
self.length = length
self.width = width
def area(self):
return self.length * self.width
def perimeter(self):
return 2 * self.length + 2 * self.width
# Here we declare that the Square class inherits from the Rectangle clas... | class Rectangle:
def __init__(self, length, width):
self.length = length
self.width = width
def area(self):
return self.length * self.width
def perimeter(self):
return 2 * self.length + 2 * self.width
class Square(Rectangle):
def __init__(self, length):
super... |
'''
Given the array candies and the integer extraCandies, where candies[i] represents the number of candies that the ith kid has.
For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the greatest number of
candies among them. Notice that multiple kids can have th... | """
Given the array candies and the integer extraCandies, where candies[i] represents the number of candies that the ith kid has.
For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the greatest number of
candies among them. Notice that multiple kids can have th... |
"A collection of evil objects that crash on introspection"
class Q:
def __get__(self, *args) -> None:
raise RuntimeError("BOOM!")
class W:
R = Q()
class Z:
@property
def __class__(self) -> type:
raise RuntimeError("BOOM!")
@property
def __module__(self) -> type:
ra... | """A collection of evil objects that crash on introspection"""
class Q:
def __get__(self, *args) -> None:
raise runtime_error('BOOM!')
class W:
r = q()
class Z:
@property
def __class__(self) -> type:
raise runtime_error('BOOM!')
@property
def __module__(self) -> type:
... |
Calibration.CustomView = ['X-ray Scope Trigger', 'Ps Laser Osc. Delay', 'Ps Laser Trigger', 'Ns Laser Q-Switch Trigger', 'Ns Laser Flash Lamp Trigger', 'Laser Scope Trigger', 'Heatload Chopper Phase', 'Heatload Chop. Act. Phase', 'ChemMat Chopper Phase', 'ChemMat Chop. Act. Phase', 'X-ray Shutter Delay']
Calibration.vi... | Calibration.CustomView = ['X-ray Scope Trigger', 'Ps Laser Osc. Delay', 'Ps Laser Trigger', 'Ns Laser Q-Switch Trigger', 'Ns Laser Flash Lamp Trigger', 'Laser Scope Trigger', 'Heatload Chopper Phase', 'Heatload Chop. Act. Phase', 'ChemMat Chopper Phase', 'ChemMat Chop. Act. Phase', 'X-ray Shutter Delay']
Calibration.vi... |
class InvalidDate(Exception):
def __init__(self, day, month, year):
message = "Date with year set to {year}, month set to {month}, and day set to {day} is invalid"\
.format(
year=year,
month=month,
day=day,
)
super().__init__(me... | class Invaliddate(Exception):
def __init__(self, day, month, year):
message = 'Date with year set to {year}, month set to {month}, and day set to {day} is invalid'.format(year=year, month=month, day=day)
super().__init__(message)
class Invalidseason(Exception):
def __init__(self, season_end_y... |
fruit = input()
set_type = input()
set_count = int(input())
price = 0
if set_type == "small":
if fruit == "Watermelon":
price = set_count * 2 * 56
elif fruit == "Mango":
price = set_count * 2 * 36.66
elif fruit == "Pineapple":
price = set_count * 2 * 42.10
elif fruit == "Raspber... | fruit = input()
set_type = input()
set_count = int(input())
price = 0
if set_type == 'small':
if fruit == 'Watermelon':
price = set_count * 2 * 56
elif fruit == 'Mango':
price = set_count * 2 * 36.66
elif fruit == 'Pineapple':
price = set_count * 2 * 42.1
elif fruit == 'Raspberry... |
def favourite_book(book):
print(f"Your favourite book is {book} ")
book = input("What's your favourite book? ")
favourite_book(book) | def favourite_book(book):
print(f'Your favourite book is {book} ')
book = input("What's your favourite book? ")
favourite_book(book) |
max_score = 1000000
MOD = 1000000009
s_history = [0] * (max_score + 1)
s_history[2] = 1
s_history[3] = 1
for score in range(4, max_score + 1):
s_history[score] = (s_history[score - 2] + s_history[score - 3]) % MOD
for _ in range(int(input())):
print(s_history[int(input())])
| max_score = 1000000
mod = 1000000009
s_history = [0] * (max_score + 1)
s_history[2] = 1
s_history[3] = 1
for score in range(4, max_score + 1):
s_history[score] = (s_history[score - 2] + s_history[score - 3]) % MOD
for _ in range(int(input())):
print(s_history[int(input())]) |
#
# PySNMP MIB module PROPLANE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PROPLANE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:33:29 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,... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint) ... |
# Prints a bar
def print_split():
print("\n--------------------------------------------------\n")
def write_element(el, max_length, tmp = ''):
length = max_length - len(el)
padding_left = length//2
padding_right = length - padding_left
new_element = ' '*padding_left + el + ' '*padding_right
p... | def print_split():
print('\n--------------------------------------------------\n')
def write_element(el, max_length, tmp=''):
length = max_length - len(el)
padding_left = length // 2
padding_right = length - padding_left
new_element = ' ' * padding_left + el + ' ' * padding_right
print(new_elem... |
class ModuleChain:
def __init__(self):
self.id = None
self.modules = []
self.files = []
| class Modulechain:
def __init__(self):
self.id = None
self.modules = []
self.files = [] |
def A(string):
if string.islower():
return list(string) == list(reversed(string))
else:
return ""
def B(phrase):
phrase = phrase.lower()
alphabet = "abcdefghijklmnopqrstuvwxyz"
new_phrase = ""
for char in phrase:
if char in alphabet:
new_phr... | def a(string):
if string.islower():
return list(string) == list(reversed(string))
else:
return ''
def b(phrase):
phrase = phrase.lower()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
new_phrase = ''
for char in phrase:
if char in alphabet:
new_phrase += char
re... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
return self.helper(root,p,q)
... | class Solution:
def lowest_common_ancestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
return self.helper(root, p, q)
def helper(self, root, p, q):
if not root:
return
if p == root or q == root:
return root
if root.val < p.val an... |
def get_x():
return x
mylookup = {
'bar': 'BAR'
}
class Foo:
def __init__(self, x,y):
global x,y
x = x
y = y
def __getitem__(self, attr_name):
print('trying to get some attr named:', attr_name)
if attr_name == 'get_x':
return get_x
elif attr_name == 'x':
return x
elif attr_name == 'y':
ret... | def get_x():
return x
mylookup = {'bar': 'BAR'}
class Foo:
def __init__(self, x, y):
global x, y
x = x
y = y
def __getitem__(self, attr_name):
print('trying to get some attr named:', attr_name)
if attr_name == 'get_x':
return get_x
elif attr_nam... |
'''
Created on 1.12.2016
@author: Darren
''''''
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999."
'''
| """
Created on 1.12.2016
@author: Darren
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999."
""" |
# 047 - CONTAGEM DE PARES
# TODOS OS NUMEROS PARES Q ESTAO NO INTERVALO ENTRE 1 E 50
for c in range(1, 51):
if c % 2 == 0:
print(f'{c}', end=' ') | for c in range(1, 51):
if c % 2 == 0:
print(f'{c}', end=' ') |
img = 0
def setup():
global img
background(100)
smooth()
size(800, 800)
img = loadImage('winx-stella.png')
def draw():
background(100)
image(img, mouseX, mouseY)
| img = 0
def setup():
global img
background(100)
smooth()
size(800, 800)
img = load_image('winx-stella.png')
def draw():
background(100)
image(img, mouseX, mouseY) |
class Solution:
def findDiagonalOrder(self, nums: List[List[int]]) -> List[int]:
elements = []
for row in range(len(nums)):
for col in range(len(nums[row])):
elements.append((row + col, row * -1, nums[row][col]))
elements.sort()
return [x[2] for x in eleme... | class Solution:
def find_diagonal_order(self, nums: List[List[int]]) -> List[int]:
elements = []
for row in range(len(nums)):
for col in range(len(nums[row])):
elements.append((row + col, row * -1, nums[row][col]))
elements.sort()
return [x[2] for x in el... |
def hide_cursor():
pass
def show_cursor():
pass
def get_idle_time():
return 0
| def hide_cursor():
pass
def show_cursor():
pass
def get_idle_time():
return 0 |
def unicode_block(ch):
'''Return the Unicode block name for ch, or None if ch has no block.'''
cp = ord(ch)
# binary search for the correct block
be, en = 0, len(_unicode_blocks)-1
while be <= en:
mid = (be+en) >> 1
name, start, end = _unicode_blocks[mid]
if start <= cp <= en... | def unicode_block(ch):
"""Return the Unicode block name for ch, or None if ch has no block."""
cp = ord(ch)
(be, en) = (0, len(_unicode_blocks) - 1)
while be <= en:
mid = be + en >> 1
(name, start, end) = _unicode_blocks[mid]
if start <= cp <= end:
return name
... |
#
# PySNMP MIB module ChrComPmAtmATM-CELL-Current-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ChrComPmAtmATM-CELL-Current-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:35:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pytho... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint, constraints_union) ... |
producto = input('Ingrese el nombre del producto: ')
cu = int(input('Ingrese el costo unitario del producto: '))
pvp = int(input('Ingrese el precio de venta unitario del producto: '))
cantidad = int(input('Ingrese las unidades disponibles del producto: '))
ganancia = (pvp * cantidad) - (cu * cantidad)
print('Prod... | producto = input('Ingrese el nombre del producto: ')
cu = int(input('Ingrese el costo unitario del producto: '))
pvp = int(input('Ingrese el precio de venta unitario del producto: '))
cantidad = int(input('Ingrese las unidades disponibles del producto: '))
ganancia = pvp * cantidad - cu * cantidad
print('Producto: ' + ... |
n = int(input('input a int: '))
def generator(n):
for x in range(0,n+1):
if x%2==0:
yield x
print(','.join([str(x) for x in generator(n)])) | n = int(input('input a int: '))
def generator(n):
for x in range(0, n + 1):
if x % 2 == 0:
yield x
print(','.join([str(x) for x in generator(n)])) |
def eh_par_menos_dois(n):
if n == 0:
return 0
elif n < 0:
return -1
if n % 2 != 0:
n -= 1
return n - 2 + eh_par_menos_dois(n - 2)
print(eh_par_menos_dois(int(input())))
| def eh_par_menos_dois(n):
if n == 0:
return 0
elif n < 0:
return -1
if n % 2 != 0:
n -= 1
return n - 2 + eh_par_menos_dois(n - 2)
print(eh_par_menos_dois(int(input()))) |
num=input("what number?")
num=int(num)
count=1
while(count<=10):
print(num*count)
count=count+1
| num = input('what number?')
num = int(num)
count = 1
while count <= 10:
print(num * count)
count = count + 1 |
def append(list):
list.append(7)
return
numbers=[1,3,5]
print ("List before passing: ", numbers)
append(numbers)
print ("List after function call: ", numbers) | def append(list):
list.append(7)
return
numbers = [1, 3, 5]
print('List before passing: ', numbers)
append(numbers)
print('List after function call: ', numbers) |
def process_cmd(player, cmd):
commands = {
"take": player.take_item,
"get": player.take_item,
"drop": player.drop_item,
"toss": player.drop_item,
"throw": player.drop_item,
"leave": not_implemented,
"eat": not_implemented,
"drink": not_implemented,
"search": player.search_room,
... | def process_cmd(player, cmd):
commands = {'take': player.take_item, 'get': player.take_item, 'drop': player.drop_item, 'toss': player.drop_item, 'throw': player.drop_item, 'leave': not_implemented, 'eat': not_implemented, 'drink': not_implemented, 'search': player.search_room, 'move': player.change_room, 'open door... |
# Read a given string, change the character at a given index and then print the modified string.
# The first line contains:
# string sequence: the string to change
# The second line contains:
# int position: the index to insert the character at
# string character: the character to insert... | sequence = input()
(idx, char) = input().split()
new_sequence = sequence[:int(idx)] + char + sequence[int(idx) + 1:]
print(newSequence) |
# polymorphism
# it is one of the main principle of oop programming.
# sometimes a object comes in many types and forms.
# so we can create a method, that will access all types of that object
# and do the same thing regardless what type of the object it is.
# the idea is called polymorphism.
# it means there will be ... | class Parent:
name = 'Father'
def num(self):
print(1)
class Child(Parent):
name = 'Son'
def num(self):
print(0)
object_p = parent()
print(object_P.name)
object_P.num()
object_h = child()
print(object_H.name)
object_H.num()
class Human:
def hello(self, country=None):
if c... |
quantity = int(input())
days_until_xmas = int(input())
ORNAMENT_SET = 2
TREE_SKIRT = 5
TREE_GARLAND = 3
TREE_LIGHTS = 15
xmas_spirit = 0
total_cost = 0
for day in range(1, days_until_xmas + 1):
if day % 11 == 0:
quantity += 2
if day % 2 == 0:
total_cost += ORNAMENT_SET * quanti... | quantity = int(input())
days_until_xmas = int(input())
ornament_set = 2
tree_skirt = 5
tree_garland = 3
tree_lights = 15
xmas_spirit = 0
total_cost = 0
for day in range(1, days_until_xmas + 1):
if day % 11 == 0:
quantity += 2
if day % 2 == 0:
total_cost += ORNAMENT_SET * quantity
xmas_sp... |
def execute_algo(dict_function):
for i, f in dict_function.items():
print('{0} -> {1}'.format(i, f.__class__.__name__))
user_in = str(input('Function -> '))
if user_in in dict_function.keys():
dict_function[user_in].execute()
else:
print('Not available...')
| def execute_algo(dict_function):
for (i, f) in dict_function.items():
print('{0} -> {1}'.format(i, f.__class__.__name__))
user_in = str(input('Function -> '))
if user_in in dict_function.keys():
dict_function[user_in].execute()
else:
print('Not available...') |
# Copyright (c) 2019 Platform9 Systems 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 ... | class Aggregatenotfound(Exception):
def __init__(self, aggregate):
message = 'Aggregate %s not found' % aggregate
super(AggregateNotFound, self).__init__(message)
class Clusterexists(Exception):
def __init__(self, cluster):
message = 'Cluster %s exists' % cluster
super(Cluster... |
arr = [1, 9, 90, 15, 29, 2, 8, 4, 70, 23, 3, 10]
def bubblesortof(arr):
swaps = True
next = len(arr)-1
while next > 0 and swaps:
swaps = False
for i in range(next):
if arr[i] > arr[i + 1]:
swaps = True
temp = arr[i]
arr[i] = arr[i ... | arr = [1, 9, 90, 15, 29, 2, 8, 4, 70, 23, 3, 10]
def bubblesortof(arr):
swaps = True
next = len(arr) - 1
while next > 0 and swaps:
swaps = False
for i in range(next):
if arr[i] > arr[i + 1]:
swaps = True
temp = arr[i]
arr[i] = arr[... |
class Solution:
# Test All Pairs (Accepted), O(n^2) time, O(n) space
def isAdditiveNumber(self, num: str) -> bool:
def is_additive(a, b, s):
if s == '':
return True
target = str(int(a) + int(b))
n = len(target)
if s[:n] == target:
... | class Solution:
def is_additive_number(self, num: str) -> bool:
def is_additive(a, b, s):
if s == '':
return True
target = str(int(a) + int(b))
n = len(target)
if s[:n] == target:
return is_additive(b, target, s[n:])
f... |
#
# PySNMP MIB module CISCO-CCM-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CCM-CAPABILITY
# Produced by pysmi-0.3.4 at Wed May 1 11:52:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ... |
print("NY,CA,TX,FL")
print("Enter State Abbreviation From the List Above: ")
states = {
"NY": "New York",
"CA": "California",
"TX": "Texas",
"FL": "Florida",
"UT": "Utah",
"YM": "Your Mom"
}
print()
#print(states)
| print('NY,CA,TX,FL')
print('Enter State Abbreviation From the List Above: ')
states = {'NY': 'New York', 'CA': 'California', 'TX': 'Texas', 'FL': 'Florida', 'UT': 'Utah', 'YM': 'Your Mom'}
print() |
class moving_obj:
def __init__(self, starting_box):
self.boxes = [starting_box]
def add_box(self, box):
self.boxes.append(box)
def last_coords(self):
return self.boxes[-1].coords
def age(self, curr_time):
last_time = self.boxes[-1].time
return curr_time - last_... | class Moving_Obj:
def __init__(self, starting_box):
self.boxes = [starting_box]
def add_box(self, box):
self.boxes.append(box)
def last_coords(self):
return self.boxes[-1].coords
def age(self, curr_time):
last_time = self.boxes[-1].time
return curr_time - last... |
#splits entire string and returns list
def split_times(times_str):
comma_index = times_str.find(',')
list_output= []
while(comma_index != -1):
day_time = times_str[0:comma_index]
list_output.append(split_day_time(day_time))
times_str = times_str[comma_index+1:len(times_str)]
... | def split_times(times_str):
comma_index = times_str.find(',')
list_output = []
while comma_index != -1:
day_time = times_str[0:comma_index]
list_output.append(split_day_time(day_time))
times_str = times_str[comma_index + 1:len(times_str)]
comma_index = times_str.find(',')
... |
# GENERATED VERSION FILE
# TIME: Fri Jul 3 10:58:01 2020
__version__ = '1.0rc1+fb983fe'
short_version = '1.0rc1'
| __version__ = '1.0rc1+fb983fe'
short_version = '1.0rc1' |
print((1, 2, *(3, 4), 5))
print([1, 2, *[3, 4]])
print([*(1, 2), 3])
xs1 = 1, *f(), 3, 4
xs2 = [1, 2, *f(), *f(), 5]
xs3 = 1, 2, *(3, 4)
print({**{1: 2}, 3: 4})
print({1: 2, **{3: 4}, 5: 6})
print({**f()})
print({**f(), 3: 4})
print({1: 2, **f()})
print({**f(), **f()})
print({1, 2, *(3, 4)})
print({*(1, 2), 3})
print({... | print((1, 2, *(3, 4), 5))
print([1, 2, *[3, 4]])
print([*(1, 2), 3])
xs1 = (1, *f(), 3, 4)
xs2 = [1, 2, *f(), *f(), 5]
xs3 = (1, 2, *(3, 4))
print({**{1: 2}, 3: 4})
print({1: 2, **{3: 4}, 5: 6})
print({**f()})
print({**f(), 3: 4})
print({1: 2, **f()})
print({**f(), **f()})
print({1, 2, *(3, 4)})
print({*(1, 2), 3})
pri... |
class Solution:
def maxIncreaseKeepingSkyline(self, grid):
row_max_list = [0 for _ in range(len(grid))]
column_max_list = [0 for _ in range(len(grid))]
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j] > row_max_list[i]:
row_max_list[i] = grid[i][j]
if grid[i][j] > column_max... | class Solution:
def max_increase_keeping_skyline(self, grid):
row_max_list = [0 for _ in range(len(grid))]
column_max_list = [0 for _ in range(len(grid))]
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j] > row_max_list[i]:
... |
#!/usr/bin/python3
c = list(map(int, '614752839'))
for i in range(10, 10**6 + 1):
c.append(i)
neighbor = dict()
for i in range(len(c)):
j = (i + 1) % len(c)
neighbor[c[i]] = c[j]
def move(val):
cached = val
first = neighbor[val]
second = neighbor[first]
third = neighbor[second]
neighb... | c = list(map(int, '614752839'))
for i in range(10, 10 ** 6 + 1):
c.append(i)
neighbor = dict()
for i in range(len(c)):
j = (i + 1) % len(c)
neighbor[c[i]] = c[j]
def move(val):
cached = val
first = neighbor[val]
second = neighbor[first]
third = neighbor[second]
neighbor[val] = neighbor[... |
# ruleid:overusing-args
def function(args):
args.updates = 1
return args
# ok: overusing-args
def func(*args, **kwargs):
acceptable = 1
return acceptable
# ok: overusing-args
def func(*args):
return 1
| def function(args):
args.updates = 1
return args
def func(*args, **kwargs):
acceptable = 1
return acceptable
def func(*args):
return 1 |
# yacctab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.8'
_lr_method = 'LALR'
_lr_signature = '5B6B33CB64AC0388290E0F1204699060'
_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,26,27,28,30,32,33,34,36,37,38,39,40,41,43,44,45,46,47,49,50,51,56,57,58,5... | _tabversion = '3.8'
_lr_method = 'LALR'
_lr_signature = '5B6B33CB64AC0388290E0F1204699060'
_lr_action_items = {'VOID': ([0, 1, 2, 3, 5, 6, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 21, 22, 23, 24, 26, 27, 28, 30, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 49, 50, 51, 56, 57, 58, 59, 61, 62, 63, 64, 65, 68, 80... |
MS_TODO_CLIENT_ID = "27f3e5af-2d84-4073-91fa-9390208d1527"
MS_TODO_CLIENT_SECRET = " Un-v8gLyJ7:4b=1SkCKKZH@LiSDXSs8E"
MS_TODO_AUTHORITY = "https://login.microsoftonline.com/common"
MS_TODO_AUTH_ROOT = "https://login.microsoftonline.com/common/oauth2/v2.0"
MS_TODO_SCOPE = ["User.Read", "Tasks.ReadWrite", "Tasks.ReadW... | ms_todo_client_id = '27f3e5af-2d84-4073-91fa-9390208d1527'
ms_todo_client_secret = ' Un-v8gLyJ7:4b=1SkCKKZH@LiSDXSs8E'
ms_todo_authority = 'https://login.microsoftonline.com/common'
ms_todo_auth_root = 'https://login.microsoftonline.com/common/oauth2/v2.0'
ms_todo_scope = ['User.Read', 'Tasks.ReadWrite', 'Tasks.ReadWri... |
characterMapMelina = {
"melina_base_001": "melina_base_001", # Auto: Edited
"melina_base_002": "melina_base_002", # Auto: Edited
"melina_base_full_001": "melina_base_full_001", # Auto: Edited
... | character_map_melina = {'melina_base_001': 'melina_base_001', 'melina_base_002': 'melina_base_002', 'melina_base_full_001': 'melina_base_full_001', 'melina_base_full_002': 'melina_base_full_002', 'melina_base_full_gym_001': 'melina_base_full_gym_001', 'melina_base_full_gym_002': 'melina_base_full_gym_002', 'melina_base... |
rows=0
while(rows<5):
cols=0
while(cols<rows):
print("*")
cols+=1
print("\n")
rows+=1 | rows = 0
while rows < 5:
cols = 0
while cols < rows:
print('*')
cols += 1
print('\n')
rows += 1 |
BLACK = (0, 0, 0)
GREENISH = (29, 158, 94)
WHITE = (255, 255, 255)
YELLOW = (255, 255, 55)
RED = (255, 0, 0) | black = (0, 0, 0)
greenish = (29, 158, 94)
white = (255, 255, 255)
yellow = (255, 255, 55)
red = (255, 0, 0) |
# Translation table for Unicode symbols to LaTeX math commands
# for use with the translate() method of unicode objects.
# Includes commands from: standard LaTeX, amssymb, amsmath
uni2tex_table = {
160: u'~',
163: u'\\pounds ',
165: u'\\yen ',
172: u'\\neg ',
174: u'\\circledR ',
177: u'\\pm ',
215: u'\\times ',
240:... | uni2tex_table = {160: u'~', 163: u'\\pounds ', 165: u'\\yen ', 172: u'\\neg ', 174: u'\\circledR ', 177: u'\\pm ', 215: u'\\times ', 240: u'\\eth ', 247: u'\\div ', 305: u'\\imath ', 567: u'\\jmath ', 915: u'\\Gamma ', 916: u'\\Delta ', 920: u'\\Theta ', 923: u'\\Lambda ', 926: u'\\Xi ', 928: u'\\Pi ', 931: u'\\Sigma '... |
class HdmiConnectable:
def connect_via_hdmi(self, device):
pass
class RcaConnectable:
def connect_via_rca(self, device):
pass
class EthernetConnectable:
def connect_via_ethernet(self, device):
pass
class PowerOutletConnectable:
def connect_to_power_outlet(self, device):
... | class Hdmiconnectable:
def connect_via_hdmi(self, device):
pass
class Rcaconnectable:
def connect_via_rca(self, device):
pass
class Ethernetconnectable:
def connect_via_ethernet(self, device):
pass
class Poweroutletconnectable:
def connect_to_power_outlet(self, device):
... |
#!/usr/bin/python3
def Results(parent):
return {
"html": parent.include_file("index.html"),
"jinja": True,
"open_links_in_browser": True
} | def results(parent):
return {'html': parent.include_file('index.html'), 'jinja': True, 'open_links_in_browser': True} |
# with open('data/day22_test.txt') as f:
with open('data/day22.txt') as f:
data = f.read().splitlines()
# Part 1
# =================================
# After shuffling your factory order deck of 10007 cards,
# what is the position of card 2019?
N = 10007
cards = list(range(N))
def shuffle(cards):
N = len(cards... | with open('data/day22.txt') as f:
data = f.read().splitlines()
n = 10007
cards = list(range(N))
def shuffle(cards):
n = len(cards)
for l in data:
if 'deal into new stack' in l:
cards = cards[::-1]
elif 'cut' in l:
(_, n) = l.split(' ')
n = int(n)
... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
class LoginStrategy(object):
pass | class Loginstrategy(object):
pass |
class Solution:
def findDiagonalOrder(self, nums: List[List[int]]) -> List[int]:
diags = defaultdict(deque)
for i in range(len(nums)):
for j in range(len(nums[i])):
diags[i+j].appendleft(nums[i][j])
ans = []
for key in sorted(diags.keys()... | class Solution:
def find_diagonal_order(self, nums: List[List[int]]) -> List[int]:
diags = defaultdict(deque)
for i in range(len(nums)):
for j in range(len(nums[i])):
diags[i + j].appendleft(nums[i][j])
ans = []
for key in sorted(diags.keys()):
... |
def searchMatrix(self, matrix, target):
if matrix!=[]:
m = len(matrix[0])
n = len(matrix)
for i in matrix:
if i!=[]:
if target<=i[-1]:
for j in i:
if target==j:
return True
... | def search_matrix(self, matrix, target):
if matrix != []:
m = len(matrix[0])
n = len(matrix)
for i in matrix:
if i != []:
if target <= i[-1]:
for j in i:
if target == j:
return True
... |
# Default spans in minutes for Simple Moving Averages
SMA_SPANS = [3, 5, 7, 10, 15, 30, 45, 60, 90, 120]
# Default spans in minutes for Exp Weighted Moving Averages
EWMA_SPANS = [3, 5, 7, 10, 15, 30, 45, 60, 90, 120]
| sma_spans = [3, 5, 7, 10, 15, 30, 45, 60, 90, 120]
ewma_spans = [3, 5, 7, 10, 15, 30, 45, 60, 90, 120] |
class Solution:
def repeatedSubstringPattern(self, s: str) -> bool:
n = len(s)
def prime_check(x):
for i in range(2,int(sqrt(x)+1)):
if x%i==0:
return False
return True
for i in range(2,n+1):
if prime_check(i... | class Solution:
def repeated_substring_pattern(self, s: str) -> bool:
n = len(s)
def prime_check(x):
for i in range(2, int(sqrt(x) + 1)):
if x % i == 0:
return False
return True
for i in range(2, n + 1):
if prime_check... |
## Removed the private variables, because while I would like to use them, I belive that they were makeing the code more clutterend and in the end harder to read.
class Node:
def __init__(self, value = None, next_node = None):
self.value = value
self.next = next_node
def __str__(self):
return str(self... | class Node:
def __init__(self, value=None, next_node=None):
self.value = value
self.next = next_node
def __str__(self):
return str(self.value)
@staticmethod
def is_node(value, next_node=None):
if not isinstance(value, Node):
return node(value, next_node)
... |
class SGD:
def __init__(self, tensors, lr):
self.tensors = tensors
self.lr = lr
def step(self):
for t in self.tensors:
t.data -= self.lr * t.grad
| class Sgd:
def __init__(self, tensors, lr):
self.tensors = tensors
self.lr = lr
def step(self):
for t in self.tensors:
t.data -= self.lr * t.grad |
# Declare and initialize variables
even_count=0
odd_count=0
even_sum=0
odd_sum=0
# Main loop
while True:
Int_input = input("Input an integer (Enter '0' to End Entry) --> ")
Int = int(Int_input)
# check for 0 and exit loop
if Int == 0:
print("Ending Input")
break
# Check for negativ... | even_count = 0
odd_count = 0
even_sum = 0
odd_sum = 0
while True:
int_input = input("Input an integer (Enter '0' to End Entry) --> ")
int = int(Int_input)
if Int == 0:
print('Ending Input')
break
elif Int < 0:
print('No negative integers')
elif Int % 2 == 0:
print("Th... |
class RabbitMQ:
QUEUE = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'messages': {'type': 'integer'},
'consumers': {'type': 'integer'},
},
'required': ['name', 'messages', 'consumers'],
}
SCHEMA = {'type': 'array', 'item... | class Rabbitmq:
queue = {'type': 'object', 'properties': {'name': {'type': 'string'}, 'messages': {'type': 'integer'}, 'consumers': {'type': 'integer'}}, 'required': ['name', 'messages', 'consumers']}
schema = {'type': 'array', 'items': QUEUE}
__all__ = ['RabbitMQ'] |
n = int(input())
mis, chris = 0, 0
for _ in range(n):
m, c = list(map(int, input().split()))
if m > c:
mis +=1
elif c > m:
chris +=1
if mis > chris :
print("Mishka")
elif chris > mis:
print("Chris")
else:
print("Friendship is magic!^^")
| n = int(input())
(mis, chris) = (0, 0)
for _ in range(n):
(m, c) = list(map(int, input().split()))
if m > c:
mis += 1
elif c > m:
chris += 1
if mis > chris:
print('Mishka')
elif chris > mis:
print('Chris')
else:
print('Friendship is magic!^^') |
inv = ['2','3','4','5','6','7','8','9']
def to_decimal(data: str):
print("Binary value:",data)
decimal = 0
for digit in data:
if digit in inv:
raise ValueError("Non-binary number entered!")
try:
decimal = decimal*2 + int(digit)
except ValueError:
r... | inv = ['2', '3', '4', '5', '6', '7', '8', '9']
def to_decimal(data: str):
print('Binary value:', data)
decimal = 0
for digit in data:
if digit in inv:
raise value_error('Non-binary number entered!')
try:
decimal = decimal * 2 + int(digit)
except ValueError:
... |
n = int(input())
names = []
for cntN in range(n):
names.append(input().strip())
profits = {name:0 for name in names}
for cntN in range(n):
a = input().strip()
am, k = [int(x) for x in input().split()]
if k == 0:
continue
pr = am // k
profits[a] -= pr * k
# friends = []
for cntK i... | n = int(input())
names = []
for cnt_n in range(n):
names.append(input().strip())
profits = {name: 0 for name in names}
for cnt_n in range(n):
a = input().strip()
(am, k) = [int(x) for x in input().split()]
if k == 0:
continue
pr = am // k
profits[a] -= pr * k
for cnt_k in range(k):
... |
# def change_values(i,j, matrix):
# for col in range(len(matrix[0])):
# if matrix[i][col]!=0:
# matrix[i][col]=None
# for rows in range(len(matrix)):
# if matrix[rows][j]!=0:
# matrix[rows][j]=None
# return matrix
def setZeroes(matrix):
#brute force method... | def set_zeroes(matrix):
zero_inrow = False
zero_incol = False
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if matrix[i][j] == 0:
if i == 0:
zero_inrow = True
if j == 0:
zero_incol = True
... |
#
# @lc app=leetcode.cn id=657 lang=python3
#
# [657] robot-return-to-origin
#
None
# @lc code=end | None |
def get(obj,path):
x = path.split('/')[1:]
for key in x:
obj = obj.get(key)
if not obj:
return obj
return obj
RED = 'red'
GREEN = 'green'
YELLOW = 'yellow'
CIRCLE = ''
CROSS = '-cross'
csq_damaging = [
'transcript_ablation',
'splice_acceptor_variant',
'splice_don... | def get(obj, path):
x = path.split('/')[1:]
for key in x:
obj = obj.get(key)
if not obj:
return obj
return obj
red = 'red'
green = 'green'
yellow = 'yellow'
circle = ''
cross = '-cross'
csq_damaging = ['transcript_ablation', 'splice_acceptor_variant', 'splice_donor_variant', 'sto... |
___assertIs(bool(10), True)
___assertIs(bool(1), True)
___assertIs(bool(-1), True)
___assertIs(bool(0), False)
___assertIs(bool("hello"), True)
___assertIs(bool(""), False)
___assertIs(bool(), False)
| ___assert_is(bool(10), True)
___assert_is(bool(1), True)
___assert_is(bool(-1), True)
___assert_is(bool(0), False)
___assert_is(bool('hello'), True)
___assert_is(bool(''), False)
___assert_is(bool(), False) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
DATA = '''\
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />\n<meta http-equiv="Content-... | data = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />\n<meta http-equiv="Content-Script-Type" content="text/javascript" />\n<meta ht... |
class Hours:
def __init__(self, uid, checkin_times=None, checkout_times=None, **kwargs):
if checkin_times is None:
checkin_times = []
if checkout_times is None:
checkout_times = []
self.uid = uid
self.checkin_times = checkin_times
self.checkout_times ... | class Hours:
def __init__(self, uid, checkin_times=None, checkout_times=None, **kwargs):
if checkin_times is None:
checkin_times = []
if checkout_times is None:
checkout_times = []
self.uid = uid
self.checkin_times = checkin_times
self.checkout_times ... |
class HuffmanTree():
''' This class is used for creating Huffman Trees from a hash table input. In this case,
a Python library dict is used for use as a hash table. '''
class Node:
def __init__(self,weight,char=None,left=None,right=None):
self.weight = weight # weight of the node. W... | class Huffmantree:
""" This class is used for creating Huffman Trees from a hash table input. In this case,
a Python library dict is used for use as a hash table. """
class Node:
def __init__(self, weight, char=None, left=None, right=None):
self.weight = weight
self.char = ... |
def find_missing_letter(testing):
for char in range(len(testing)-1):
if ord(testing[char+1])-ord(testing[char])>=2:
return (chr(ord(testing[char])+1))
| def find_missing_letter(testing):
for char in range(len(testing) - 1):
if ord(testing[char + 1]) - ord(testing[char]) >= 2:
return chr(ord(testing[char]) + 1) |
# -*- coding: utf8 -*-
jabber = {
'username': '',
'password': '',
}
mail = {
'username': '',
'password': '',
'server': '',
}
| jabber = {'username': '', 'password': ''}
mail = {'username': '', 'password': '', 'server': ''} |
# Time: O (NlogN) | Space: O(1) - sort inplace
def nonConstructibleChange(coins):
# sort input coins array
coins.sort()
currentChangeCreated = 0
for coin in coins:
if coin > currentChangeCreated + 1:
return currentChangeCreated + 1
currentChangeCreated += coin
return ... | def non_constructible_change(coins):
coins.sort()
current_change_created = 0
for coin in coins:
if coin > currentChangeCreated + 1:
return currentChangeCreated + 1
current_change_created += coin
return currentChangeCreated + 1 |
class WSClock(object):
def __init__(self, pages):
self.pages = pages
self.current = None
| class Wsclock(object):
def __init__(self, pages):
self.pages = pages
self.current = None |
# Constants
# Colors
# Grayscale
WHITE = 255, 255, 255
BLACK = 0, 0, 0
GREY = 128, 128, 128
# Primary
RED = 255, 0, 0
GREEN = 0, 255, 0
BLUE = 0, 0, 255
# Secondary
YELLOW = 255, 255, 0
PURPLE = 255, 0, 255
CYAN = 0, 255, 255
# Tertiary
# Quaternary
# Quinary
# Sen... | white = (255, 255, 255)
black = (0, 0, 0)
grey = (128, 128, 128)
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
yellow = (255, 255, 0)
purple = (255, 0, 255)
cyan = (0, 255, 255) |
class Tree:
def __init__(self, value, parent=None, l_branch=None, r_branch=None, is_leaf=False):
self.value = value
self.l_branch = l_branch
self.r_branch = r_branch
self.is_leaf = is_leaf
self.parent = parent
| class Tree:
def __init__(self, value, parent=None, l_branch=None, r_branch=None, is_leaf=False):
self.value = value
self.l_branch = l_branch
self.r_branch = r_branch
self.is_leaf = is_leaf
self.parent = parent |
def optimal_sequence(n):
T = [0]*(n+1)
T[1] = [1]
for i in range(2,n+1):
if i % 3 == 0:
s = [*T[i//3], i]
if T[i] == 0:
T[i] = s
elif len(s)<len(T[i]):
T[i] = s
if i % 2 == 0:
s = [*T[i//2], i]
if T[i... | def optimal_sequence(n):
t = [0] * (n + 1)
T[1] = [1]
for i in range(2, n + 1):
if i % 3 == 0:
s = [*T[i // 3], i]
if T[i] == 0:
T[i] = s
elif len(s) < len(T[i]):
T[i] = s
if i % 2 == 0:
s = [*T[i // 2], i]
... |
seq = ['a', 'b', 'c', 'd', 'e']
n=1
print(seq[0:n])
#def first(seq, n=1):
#return seq[0:n] | seq = ['a', 'b', 'c', 'd', 'e']
n = 1
print(seq[0:n]) |
#!/usr/bin/python
#-*- coding: utf-8 -*-
class NamingConventionError(Exception):
pass
| class Namingconventionerror(Exception):
pass |
def equal_binary(answer: bytes, output: bytes) -> bool:
if answer == output:
return True
return False
| def equal_binary(answer: bytes, output: bytes) -> bool:
if answer == output:
return True
return False |
#!usr/bin/env python3
def coroutine_decorator(func):
def wrapper_func(*args, **kwargs):
cr = func(*args, **kwargs)
cr.__next__()
return cr
return wrapper_func
@coroutine_decorator
def counter(input_string):
count = 0
try:
while True:
item = yield
... | def coroutine_decorator(func):
def wrapper_func(*args, **kwargs):
cr = func(*args, **kwargs)
cr.__next__()
return cr
return wrapper_func
@coroutine_decorator
def counter(input_string):
count = 0
try:
while True:
item = (yield)
if isinstance(item,... |
class Solution:
def subarraysDivByK(self, nums: List[int], k: int) -> int:
cur = 0
res = 0
dicu = {0:1}
for n in nums :
cur += n
diff = cur % k
res += dicu.get(diff,0)
dicu[diff] = 1 + dicu.get(diff,0)
return res
| class Solution:
def subarrays_div_by_k(self, nums: List[int], k: int) -> int:
cur = 0
res = 0
dicu = {0: 1}
for n in nums:
cur += n
diff = cur % k
res += dicu.get(diff, 0)
dicu[diff] = 1 + dicu.get(diff, 0)
return res |
def xadrez (x,y,m,n):
if x==m or y==n:
return 1
elif abs(x-m) == abs(y-n):
return 1
else:
return 2
x1=0
x2=0
y1=0
y2=0
while x1<1 or x1>8:
x1=int(input("Insira a coordenada X da primeira casa: "))
while y1<1 or y1>8:
y1=int(input("Insira a coordenada Y da primeira casa: "))
... | def xadrez(x, y, m, n):
if x == m or y == n:
return 1
elif abs(x - m) == abs(y - n):
return 1
else:
return 2
x1 = 0
x2 = 0
y1 = 0
y2 = 0
while x1 < 1 or x1 > 8:
x1 = int(input('Insira a coordenada X da primeira casa: '))
while y1 < 1 or y1 > 8:
y1 = int(input('Insira a coorde... |
coordinates_E0E1E1 = ((123, 109),
(123, 111), (123, 112), (123, 113), (123, 114), (123, 115), (123, 116), (123, 117), (123, 118), (123, 119), (123, 120), (123, 122), (124, 109), (124, 122), (125, 109), (125, 111), (125, 112), (125, 113), (125, 114), (125, 115), (125, 116), (125, 117), (125, 118), (125, 119), (125, 12... | coordinates_e0_e1_e1 = ((123, 109), (123, 111), (123, 112), (123, 113), (123, 114), (123, 115), (123, 116), (123, 117), (123, 118), (123, 119), (123, 120), (123, 122), (124, 109), (124, 122), (125, 109), (125, 111), (125, 112), (125, 113), (125, 114), (125, 115), (125, 116), (125, 117), (125, 118), (125, 119), (125, 12... |
N = int(input(''))
Numbers = []
for i in range(N):
X = int(input(''))
Numbers.insert(i, X)
tin = 0
tout = 0
for i in Numbers:
if i >= 10 and i <= 20:
tin += 1
else:
tout += 1
print(tin, 'in')
print(tout, 'out')
| n = int(input(''))
numbers = []
for i in range(N):
x = int(input(''))
Numbers.insert(i, X)
tin = 0
tout = 0
for i in Numbers:
if i >= 10 and i <= 20:
tin += 1
else:
tout += 1
print(tin, 'in')
print(tout, 'out') |
class Node:
def __init__(self, val):
self.right = None
self.data = val
self.left = None
class Tree:
def create_node(self, data):
return Node(data)
def insert(self, node, data, ch):
if node is None:
return self.create_node(data)
if (ch == 'L'):
... | class Node:
def __init__(self, val):
self.right = None
self.data = val
self.left = None
class Tree:
def create_node(self, data):
return node(data)
def insert(self, node, data, ch):
if node is None:
return self.create_node(data)
if ch == 'L':
... |
class CutoffError(Exception):
pass
class FilterTypeError(Exception):
pass
class InputVariableError(Exception):
pass
class WordLengthError(Exception):
pass
class InvalidBins(Exception):
pass
class DataLabelMismatchError(Exception):
pass
class SplitMethodError(Exception):
pass
| class Cutofferror(Exception):
pass
class Filtertypeerror(Exception):
pass
class Inputvariableerror(Exception):
pass
class Wordlengtherror(Exception):
pass
class Invalidbins(Exception):
pass
class Datalabelmismatcherror(Exception):
pass
class Splitmethoderror(Exception):
pass |
if __name__ == '__main__':
N = int(input())
li =[]
actions ={'insert': li.insert,
'remove': li.remove,
'append': li.append,
'sort': li.sort,
'pop': li.pop,
'reverse': li.reverse,
}
for _ in range(N):
order, *args ... | if __name__ == '__main__':
n = int(input())
li = []
actions = {'insert': li.insert, 'remove': li.remove, 'append': li.append, 'sort': li.sort, 'pop': li.pop, 'reverse': li.reverse}
for _ in range(N):
(order, *args) = input().split()
if order == 'print':
print(li)
else... |
VOC_CLASSES = ( # always index 0
'aeroplane', 'bicycle', 'bird', 'boat',
'bottle', 'bus', 'car', 'cat', 'chair',
'cow', 'diningtable', 'dog', 'horse',
'motorbike', 'person', 'pottedplant',
'sheep', 'sofa', 'train', 'tvmonitor')
VOC_IMG_MEAN = (123, 117, 104) # RGB
COLORS = [[0, 0, 0],
... | voc_classes = ('aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor')
voc_img_mean = (123, 117, 104)
colors = [[0, 0, 0], [128, 0, 0], [0, 128, 0], [128, 128, 0], [0, 0, 128], [128... |
class Product:
payment = ['Visa','Master','American Express']# class variable shared by all instances
def __init__(self, name):
self.name = name | class Product:
payment = ['Visa', 'Master', 'American Express']
def __init__(self, name):
self.name = name |
# File: agari_view.py
#
# Copyright (c) Agari, 2021
#
# This unpublished material is proprietary to Agari.
# All rights reserved. The methods and
# techniques described herein are considered trade secrets
# and/or confidential. Reproduction or distribution, in whole
# or in part, is forbidden except by express written ... | def _get_ctx_result(result, provides):
ctx_result = {}
param = result.get_param()
summary = result.get_summary()
data = result.get_data()
ctx_result['param'] = param
ctx_result['action_name'] = provides
if summary:
ctx_result['summary'] = summary
if not data:
ctx_result['... |
#Printing stars in 'Z' shape!
'''
*****
*
*
*
*****
'''
i=1
j=3
for row in range(5):
for col in range(5):
if(row==0)or(row==4):
print('*',end='')
elif (row==i and col==j):
print('*', end='')
i+=1
j-=1
else:
print(end=' ')
... | """
*****
*
*
*
*****
"""
i = 1
j = 3
for row in range(5):
for col in range(5):
if row == 0 or row == 4:
print('*', end='')
elif row == i and col == j:
print('*', end='')
i += 1
j -= 1
else:
print(end=' ')
print() |
{
"components": {
"responses": {
"200": {"description": "OK"},
"201": {"description": "Created"},
"202": {"description": "No Content (accepted)"},
"204": {"description": "No Content (success)"},
"302": {"description": "Found"},
"400": {... | {'components': {'responses': {'200': {'description': 'OK'}, '201': {'description': 'Created'}, '202': {'description': 'No Content (accepted)'}, '204': {'description': 'No Content (success)'}, '302': {'description': 'Found'}, '400': {'content': {'application/json': {'example': {'code': 400, 'description': {'_errors': ['... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.