content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# this should accept a command as a string, and raturn a string detailing the issue
# if <command> is not a valid vanilla minecraft command. None otherwise.
def check(command):
return None
| def check(command):
return None |
print("One")
print("Two")
print("Three")
| print('One')
print('Two')
print('Three') |
'''
Created on Jul 19, 2012
@author: Chris
'''
class Command(object):
def validate(self, game):
pass
def execute(self, game):
pass | """
Created on Jul 19, 2012
@author: Chris
"""
class Command(object):
def validate(self, game):
pass
def execute(self, game):
pass |
# menu_text.py
#
# simple python menu
# https://stackoverflow.com/questions/19964603/creating-a-menu-in-python
#
city_menu = { '1': 'Chicago',
'2': 'New York',
'3': 'Washington',
'x': 'Exit'}
month_menu = {'0': 'All',
'1': 'January',
'2': 'February... | city_menu = {'1': 'Chicago', '2': 'New York', '3': 'Washington', 'x': 'Exit'}
month_menu = {'0': 'All', '1': 'January', '2': 'February', '3': 'March', '4': 'April', '5': 'May', '6': 'June', 'x': 'Exit'}
weekday_menu = {'0': 'All', '1': 'Monday', '2': 'Tuesday', '3': 'Wednesday', '4': 'Thursday', '5': 'Friday', '6': 'Sa... |
hex_strings = [
"FF 81 BD A5 A5 BD 81 FF",
"AA 55 AA 55 AA 55 AA 55",
"3E 7F FC F8 F8 FC 7F 3E",
"93 93 93 F3 F3 93 93 93",
]
def hex_data_to_image(hex_data):
for hex_pair in hex_data:
for divisor in reversed(range(len(hex_data))):
print("X" if (int(hex_pair, 16) >> divisor & 1) == 1 else " ", end=... | hex_strings = ['FF 81 BD A5 A5 BD 81 FF', 'AA 55 AA 55 AA 55 AA 55', '3E 7F FC F8 F8 FC 7F 3E', '93 93 93 F3 F3 93 93 93']
def hex_data_to_image(hex_data):
for hex_pair in hex_data:
for divisor in reversed(range(len(hex_data))):
print('X' if int(hex_pair, 16) >> divisor & 1 == 1 else ' ', end='... |
# -*- coding: utf-8 -*-
# Copy this file and renamed it settings.py and change the values for your own project
# The csv file containing the information about the member.
# There is three columns: The name, the email and the member type: 0 regular, 1 life time
CSV_FILE = "path to csv file"
# The svg file for regular... | csv_file = 'path to csv file'
svg_file_regular = 'path to svg regular member file'
svg_file_life_time = 'path to svg life time member file'
dest_generated_folder = 'path to folder that will contain the generated files'
msg_file = '/Users/pierre/Documents/LPA/CA/carte_membre_msg'
smpt_host = 'myserver.com'
smpt_port = 5... |
i = 0
while (i<119):
print(i)
i+=10
| i = 0
while i < 119:
print(i)
i += 10 |
# The shape of the numbers for the dice
dice = { 1: [[None, None, None], [None, "", None], [None, None, None]],
2: [["", None, None], [None, None, None], [None, None, ""]],
3: [["", None, None], [None, "", None], [None, None, ""]],
4: [["", None, ""], [None, None, None], ["", None, ""]],
... | dice = {1: [[None, None, None], [None, '', None], [None, None, None]], 2: [['', None, None], [None, None, None], [None, None, '']], 3: [['', None, None], [None, '', None], [None, None, '']], 4: [['', None, ''], [None, None, None], ['', None, '']], 5: [['', None, ''], [None, '', None], ['', None, '']], 6: [['', None, ''... |
__author__ = "Music"
# MNIST For ML Beginners
# https://www.tensorflow.org/versions/r0.9/tutorials/mnist/beginners/index.html
| __author__ = 'Music' |
# -*- coding: utf-8 -*-
CHECKLIST_MAPPING = {
'checklist_retrieve': {
'resource': '/checklists/{id}',
'docs': (
'https://developers.trello.com/v1.0/reference'
'#checklistsid'
),
'methods': ['GET'],
},
'checklist_field_retrieve': {
'resource': ... | checklist_mapping = {'checklist_retrieve': {'resource': '/checklists/{id}', 'docs': 'https://developers.trello.com/v1.0/reference#checklistsid', 'methods': ['GET']}, 'checklist_field_retrieve': {'resource': '/checklists/{id}/{field}', 'docs': 'https://developers.trello.com/v1.0/reference#checklistsidfield', 'methods': ... |
days = int(input())
sladkar = int(input())
cake = int(input())
gofreta = int(input())
pancake = int(input())
cake_price = cake*45
gofreta_price = gofreta*5.8
pancake_price = pancake*3.2
day_price = (cake_price + gofreta_price + pancake_price)*sladkar
total_price = days*day_price
campaign = total_price - (total_price/8)... | days = int(input())
sladkar = int(input())
cake = int(input())
gofreta = int(input())
pancake = int(input())
cake_price = cake * 45
gofreta_price = gofreta * 5.8
pancake_price = pancake * 3.2
day_price = (cake_price + gofreta_price + pancake_price) * sladkar
total_price = days * day_price
campaign = total_price - total... |
n = int(input())
lst = list(map(int, input().split()))
def sort1(arr):
l = len(arr)
for i in range(1, n):
cur = arr[i]
pos = i
check = False
while pos > 0:
if arr[pos - 1] > cur:
check = True
arr[pos] = arr[pos - 1]
e... | n = int(input())
lst = list(map(int, input().split()))
def sort1(arr):
l = len(arr)
for i in range(1, n):
cur = arr[i]
pos = i
check = False
while pos > 0:
if arr[pos - 1] > cur:
check = True
arr[pos] = arr[pos - 1]
else:
... |
radiobutton_style = '''
QRadioButton:disabled {
background: transparent;
}
QRadioButton::indicator {
background: palette(dark);
width: 8px;
height: 8px;
border: 3px solid palette(dark);
border-radius: 7px;
}
QRadioButton::indicator:checked {
background: palette(highlight);
}
QRadioButton:... | radiobutton_style = '\nQRadioButton:disabled {\n background: transparent;\n}\n\nQRadioButton::indicator {\n background: palette(dark);\n width: 8px;\n height: 8px;\n border: 3px solid palette(dark);\n border-radius: 7px;\n}\n\nQRadioButton::indicator:checked {\n background: palette(highlight);\n}\n... |
#
# PySNMP MIB module ERI-DNX-STS1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ERI-DNX-STS1-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:51:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
expected_output = {
"location": {
"R0 R1": {
"auto_abort_timer": "inactive",
"pkg_state": {
1: {
"filename_version": "17.08.01.0.149429",
"state": "U",
"type": "IMG",
}
},
... | expected_output = {'location': {'R0 R1': {'auto_abort_timer': 'inactive', 'pkg_state': {1: {'filename_version': '17.08.01.0.149429', 'state': 'U', 'type': 'IMG'}}}}} |
def selection_sort(my_list):
for i in range(len(my_list)):
min_index=i
for j in range(i+1 , len(my_list)):
if my_list[min_index]>my_list[j]:
min_index= j
my_list[i],my_list[min_index]= my_list[min_index] ,my_list[i]
print(my_list)
cus_list=[8,4,23,42,16,... | def selection_sort(my_list):
for i in range(len(my_list)):
min_index = i
for j in range(i + 1, len(my_list)):
if my_list[min_index] > my_list[j]:
min_index = j
(my_list[i], my_list[min_index]) = (my_list[min_index], my_list[i])
print(my_list)
cus_list = [8, 4,... |
class Person:
number_of_people = 0
def __init__(self, name):
print("__init__ initiated")
self.name = name
print("calling add_person()")
Person.add_person()
@classmethod
def num_of_people(cls):
print("initiating num_of_person()")
return cls.number_of_peo... | class Person:
number_of_people = 0
def __init__(self, name):
print('__init__ initiated')
self.name = name
print('calling add_person()')
Person.add_person()
@classmethod
def num_of_people(cls):
print('initiating num_of_person()')
return cls.number_of_peop... |
SEPARATOR: list = [':', ',', '*', ';', '#', '|', '+', '%', '>', '?', '&', '=', '!']
def word_splitter(string: str) -> list:
for i in string:
if i in SEPARATOR:
string = string.replace(i, ' ')
return string.split()
| separator: list = [':', ',', '*', ';', '#', '|', '+', '%', '>', '?', '&', '=', '!']
def word_splitter(string: str) -> list:
for i in string:
if i in SEPARATOR:
string = string.replace(i, ' ')
return string.split() |
# POKEMING - GON'NA CATCH 'EM ALL
# -- A simple hack 'n slash game in console
# -- This class is handles all utility related things
class Utility:
# This allows to see important message of the game
def pause(message):
print(message)
input('Press any key to continue.') | class Utility:
def pause(message):
print(message)
input('Press any key to continue.') |
str1 = "Python"
str2 = "Python"
print("\nMemory location of str1 =", hex(id(str1)))
print("Memory location of str2 =", hex(id(str2)))
print() | str1 = 'Python'
str2 = 'Python'
print('\nMemory location of str1 =', hex(id(str1)))
print('Memory location of str2 =', hex(id(str2)))
print() |
config = dict()
config['fixed_cpu_frequency'] = "@ 3700 MHz"
config['frequency'] = 3.7e9
config['maxflops_sisd'] = 2
config['maxflops_sisd_fma'] = 4
config['maxflops_simd'] = 16
config['maxflops_simd_fma'] = 32
config['roofline_beta'] = 64 # According to WikiChip (Skylake)
config['figure_size'] = (20,9)
config... | config = dict()
config['fixed_cpu_frequency'] = '@ 3700 MHz'
config['frequency'] = 3700000000.0
config['maxflops_sisd'] = 2
config['maxflops_sisd_fma'] = 4
config['maxflops_simd'] = 16
config['maxflops_simd_fma'] = 32
config['roofline_beta'] = 64
config['figure_size'] = (20, 9)
config['save_folder'] = '../all_plots/' |
class Location:
def __init__(self, location_id, borough, zone, lat, lng):
self.location_id = location_id
self.borough = borough
self.zone = zone
self.lat = lat
self.lng = lng
@property
def json(self):
return {
"location_id": self.location_id,
... | class Location:
def __init__(self, location_id, borough, zone, lat, lng):
self.location_id = location_id
self.borough = borough
self.zone = zone
self.lat = lat
self.lng = lng
@property
def json(self):
return {'location_id': self.location_id, 'borough': self.... |
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
#
# What is the 10 001st prime number?
primes = []
for i in range(2, 100):
if len(primes) == 10001:
break
x = list(map(lambda y: i % y == 0, range(2,i)))
if sum(x) == False:
primes.a... | primes = []
for i in range(2, 100):
if len(primes) == 10001:
break
x = list(map(lambda y: i % y == 0, range(2, i)))
if sum(x) == False:
primes.append(i)
print(i)
print(primes[-1], 'Len: ', len(primes)) |
# Converts a given temperature from Celsius to Fahrenheit
# Prompt user for Celsius temperature
degreesCelsius = float(input('\nEnter the temperature in Celsius: '))
# Calculate and display the converted
# temperature in Fahrenheit
degreesFahrenheit = ((9.0 / 5.0) * degreesCelsius) + 32
print('Fahrenheit equivalent:... | degrees_celsius = float(input('\nEnter the temperature in Celsius: '))
degrees_fahrenheit = 9.0 / 5.0 * degreesCelsius + 32
print('Fahrenheit equivalent: ', format(degreesFahrenheit, ',.1f'), '\n', sep='') |
class Solution:
def subtractProductAndSum(self, n: int) -> int:
x = n
add = 0
mul = 1
while x > 0 :
add += x%10
mul *= x%10
x = x//10
return mul - add
| class Solution:
def subtract_product_and_sum(self, n: int) -> int:
x = n
add = 0
mul = 1
while x > 0:
add += x % 10
mul *= x % 10
x = x // 10
return mul - add |
# Implementation of Shell Sort algorithm in Python
def shellSort(arr):
interval = 1
# Initializes interval
while (interval < (len(arr) // 3)):
interval = (interval * 3) + 1
while (interval > 0):
for i in range(interval, len(arr)):
# Select val to be inserted
... | def shell_sort(arr):
interval = 1
while interval < len(arr) // 3:
interval = interval * 3 + 1
while interval > 0:
for i in range(interval, len(arr)):
val = arr[i]
j = i
while j > interval - 1 and arr[j - interval] >= val:
arr[j] = arr[j - i... |
TASK_STATUS = [
('TD', 'To Do'),
('IP', 'In Progress'),
('QA', 'Testing'),
('DO', 'Done'),
]
TASK_PRIORITY = [
('ME', 'Medium'),
('HI', 'Highest'),
('HG', 'High'),
('LO', 'Lowest'),
]
| task_status = [('TD', 'To Do'), ('IP', 'In Progress'), ('QA', 'Testing'), ('DO', 'Done')]
task_priority = [('ME', 'Medium'), ('HI', 'Highest'), ('HG', 'High'), ('LO', 'Lowest')] |
def main():
total = 0
for i in range(0, 1000):
if i % 3 == 0:
total += i
elif i % 5 == 0:
total += i
print(total)
if __name__ == '__main__':
main()
| def main():
total = 0
for i in range(0, 1000):
if i % 3 == 0:
total += i
elif i % 5 == 0:
total += i
print(total)
if __name__ == '__main__':
main() |
class BaseTransform:
def transform_s(self, s, training=True):
return s
def transform_batch(self, batch, training=True):
return batch
def write_logs(self, logger):
pass
| class Basetransform:
def transform_s(self, s, training=True):
return s
def transform_batch(self, batch, training=True):
return batch
def write_logs(self, logger):
pass |
elements = {
'em': '',
'blockquote': '<br/>'
}
| elements = {'em': '', 'blockquote': '<br/>'} |
def rate_diff_percentage(previous_rate, current_rate, percentage=False):
diff_percentage = (current_rate - previous_rate) / previous_rate
if percentage:
return diff_percentage * 100
return diff_percentage | def rate_diff_percentage(previous_rate, current_rate, percentage=False):
diff_percentage = (current_rate - previous_rate) / previous_rate
if percentage:
return diff_percentage * 100
return diff_percentage |
# Assume that we execute the following assignment statements
# width = 17
# height = 12.0
width = 17
height = 12.0
value_1 = width // 2
value_2 = width / 2.0
value_3 = height / 3
value_4 = 1 + 2 * 5
print(f"value_1 is {value_1} and it's type is {type(value_1)}")
print(f"value_2 is {value_2} and it's type is {type(va... | width = 17
height = 12.0
value_1 = width // 2
value_2 = width / 2.0
value_3 = height / 3
value_4 = 1 + 2 * 5
print(f"value_1 is {value_1} and it's type is {type(value_1)}")
print(f"value_2 is {value_2} and it's type is {type(value_2)}")
print(f"value_3 is {value_3} and it's type is {type(value_3)}")
print(f"value_4 is ... |
class Solution:
def mostVisited(self, n: int, rounds: List[int]) -> List[int]:
start, end = rounds[0], rounds[-1]
if end >= start:
return list(range(start, end + 1))
else:
return list(range(1, end + 1)) + list(range(start, n + 1))
| class Solution:
def most_visited(self, n: int, rounds: List[int]) -> List[int]:
(start, end) = (rounds[0], rounds[-1])
if end >= start:
return list(range(start, end + 1))
else:
return list(range(1, end + 1)) + list(range(start, n + 1)) |
__author__ = 'Evan Cordell'
__copyright__ = 'Copyright 2012-2015 Localmed, Inc.'
__version__ = "0.1.6"
__version_info__ = tuple(__version__.split('.'))
__short_version__ = __version__
| __author__ = 'Evan Cordell'
__copyright__ = 'Copyright 2012-2015 Localmed, Inc.'
__version__ = '0.1.6'
__version_info__ = tuple(__version__.split('.'))
__short_version__ = __version__ |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Australian Government, Department of the Environment
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without... | """
base 64 encoded gif images for the GUI buttons
"""
class App_Img:
format = 'gif'
data = 'R0lGODlhEAAQAOeRACcLIiAbCSAjCjMdMzsfMjUkGUcmRjwwJ0YqRj4xJVwoUFguRkU2MS0/LzQ8\n PC8/LzM+QTJCMDJCQTpCQCxIME1CIXQyYW48KTpLO1REPEpKSktKS01KSkpLSkxLTE1LS0VNUDtS\n PD9PT0tMTExMTE1MTUxNTU1NTU5NTUFUQFFOTk... |
def is_true(a,b,c,d,e,f,g):
if a>10:
print(10) | def is_true(a, b, c, d, e, f, g):
if a > 10:
print(10) |
#~ Copyright 2014 Wieger Wesselink.
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
def read_text(filename):
with open(filename, 'r') as f:
return f.read()
def write_text(filename, text):
with open(filenam... | def read_text(filename):
with open(filename, 'r') as f:
return f.read()
def write_text(filename, text):
with open(filename, 'w') as f:
f.write(text) |
_base_ = "./resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_01_02MasterChefCan.py"
OUTPUT_DIR = (
"output/gdrn/ycbvPbrSO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO/09_10PottedMeatCan"
)
DATASETS = dict(TRAIN=("ycbv_010_potted_meat_can_train_pbr",))
| _base_ = './resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_01_02MasterChefCan.py'
output_dir = 'output/gdrn/ycbvPbrSO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO/09_10PottedMeatCan'
datasets = dict(TRAIN=('ycbv_010_potted_meat_can_train_pbr',)) |
# -*- coding: utf-8 -*-
# __author__= "Ruda"
# Date: 2018/10/16
'''
import os
from rongcloud import RongCloud
app_key = os.environ['APP_KEY']
app_secret = os.environ['APP_SECRET']
rcloud = RongCloud(app_key, app_secret)
r = rcloud.User.getToken(userId='userid1', name='username', portraitUri='http://www.rongcloud.c... | """
import os
from rongcloud import RongCloud
app_key = os.environ['APP_KEY']
app_secret = os.environ['APP_SECRET']
rcloud = RongCloud(app_key, app_secret)
r = rcloud.User.getToken(userId='userid1', name='username', portraitUri='http://www.rongcloud.cn/images/logo.png')
print(r)
{'token': 'P9YNVZ2cMQwwaADiNDVrtRZK... |
'''
If the child is currently on the nth step,
then there are three possibilites as to how
it reached there:
1. Reached (n-3)th step and hopped 3 steps in one time
2. Reached (n-2)th step and hopped 2 steps in one time
3. Reached (n-1)th step and hopped 2 steps in one time
The total number of possibilities is the sum... | """
If the child is currently on the nth step,
then there are three possibilites as to how
it reached there:
1. Reached (n-3)th step and hopped 3 steps in one time
2. Reached (n-2)th step and hopped 2 steps in one time
3. Reached (n-1)th step and hopped 2 steps in one time
The total number of possibilities is the sum... |
class Solution:
def runningSum(self, nums: List[int]) -> List[int]:
for index in range(1, len(nums)):
nums[index] = nums[index - 1] + nums[index]
return nums
| class Solution:
def running_sum(self, nums: List[int]) -> List[int]:
for index in range(1, len(nums)):
nums[index] = nums[index - 1] + nums[index]
return nums |
class PrefabError(Exception):
pass
class HashAlgorithmNotFound(PrefabError):
pass
class ImageAccessError(PrefabError):
pass
class ImageBuildError(PrefabError):
pass
class ImageNotFoundError(PrefabError):
pass
class ImagePushError(PrefabError):
pass
class ImageValidationError(PrefabEr... | class Prefaberror(Exception):
pass
class Hashalgorithmnotfound(PrefabError):
pass
class Imageaccesserror(PrefabError):
pass
class Imagebuilderror(PrefabError):
pass
class Imagenotfounderror(PrefabError):
pass
class Imagepusherror(PrefabError):
pass
class Imagevalidationerror(PrefabError):
... |
class Opt:
def __init__(self):
self.dataset = "fashion200k"
self.dataset_path = "./dataset/Fashion200k"
self.batch_size = 32
self.embed_dim = 512
self.hashing = False
self.retrieve_by_random = True | class Opt:
def __init__(self):
self.dataset = 'fashion200k'
self.dataset_path = './dataset/Fashion200k'
self.batch_size = 32
self.embed_dim = 512
self.hashing = False
self.retrieve_by_random = True |
# Two children, Lily and Ron, want to share a chocolate bar. Each of the squares has an integer on it.
# Lily decides to share a contiguous segment of the bar selected such that:
# The length of the segment matches Ron's birth month, and,
# The sum of the integers on the squares is equal to his birth day.
# Determine... | def birthday(s, d, m):
number_diveded = 0
number_iteration = len(s) - (m - 1)
if numberIteration == 0:
number_iteration = 1
for k in range(0, numberIteration):
new_array = s[k:k + m]
sum_array = sum(newArray)
if sumArray == d:
number_diveded += 1
return nu... |
N = int(input())
entry = [input().split() for _ in range(N)]
phoneBook = {name: number for name, number in entry}
while True:
try:
name = input()
if name in phoneBook:
print(f"{name}={phoneBook[name]}")
else:
print("Not found")
except:
break
| n = int(input())
entry = [input().split() for _ in range(N)]
phone_book = {name: number for (name, number) in entry}
while True:
try:
name = input()
if name in phoneBook:
print(f'{name}={phoneBook[name]}')
else:
print('Not found')
except:
break |
pet = {
"name":"Doggo",
"animal":"dog",
"species":"labrador",
"age":"5"
}
class Pet(object):
def __init__(self, name, age, animal):
self.name = name
self.age = age
self.animal = animal
self.hungry = False
self.mood= "happy"
def eat(self):
print("> %s is eating.... | pet = {'name': 'Doggo', 'animal': 'dog', 'species': 'labrador', 'age': '5'}
class Pet(object):
def __init__(self, name, age, animal):
self.name = name
self.age = age
self.animal = animal
self.hungry = False
self.mood = 'happy'
def eat(self):
print('> %s is eati... |
# Definition for binary tree with next pointer.
class TreeLinkNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
self.next = None
class Solution:
# @param root, a tree link node
# @return nothing
def connect(self, root):
node = root
... | class Treelinknode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
self.next = None
class Solution:
def connect(self, root):
node = root
current = None
candidate = None
next_start = None
if node is None:
... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"get_device": "00_basics.ipynb",
"settings_template": "00_basics.ipynb",
"read_settings": "00_basics.ipynb",
"DEVICE": "00_basics.ipynb",
"settings": "00_basics.ipynb",
... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'get_device': '00_basics.ipynb', 'settings_template': '00_basics.ipynb', 'read_settings': '00_basics.ipynb', 'DEVICE': '00_basics.ipynb', 'settings': '00_basics.ipynb', 'DATA_STORE': '00_basics.ipynb', 'LOG_STORE': '00_basics.ipynb', 'MODEL_STORE': ... |
# Define a procedure, fibonacci, that takes a natural number as its input, and
# returns the value of that fibonacci number.
# Two Base Cases:
# fibonacci(0) => 0
# fibonacci(1) => 1
# Recursive Case:
# n > 1 : fibonacci(n) => fibonacci(n-1) + fibonacci(n-2)
def fibonacci(n):
return n if n ==... | def fibonacci(n):
return n if n == 0 or n == 1 else fibonacci(n - 1) + fibonacci(n - 2)
print(fibonacci(0))
print(fibonacci(1))
print(fibonacci(15)) |
errorFound = False
def hasError():
global errorFound
return errorFound
def clearError():
global errorFound
errorFound = False
def error(message, lineNo = 0):
report(lineNo, "", message)
def report(lineNo, where, message):
global errorFound
errorFound = True
if lineNo == 0:
... | error_found = False
def has_error():
global errorFound
return errorFound
def clear_error():
global errorFound
error_found = False
def error(message, lineNo=0):
report(lineNo, '', message)
def report(lineNo, where, message):
global errorFound
error_found = True
if lineNo == 0:
... |
class AnythingType(set):
def __contains__(self, other):
return True
def intersection(self, other):
return other
def union(self, other):
return self
def __str__(self):
return '*'
def __repr__(self):
return "Anything"
Anything = AnythingType()
| class Anythingtype(set):
def __contains__(self, other):
return True
def intersection(self, other):
return other
def union(self, other):
return self
def __str__(self):
return '*'
def __repr__(self):
return 'Anything'
anything = anything_type() |
allct_dat = {
"TYR": { "HB2":{'torsion': 300.0, 'tree': 'E', 'NC': 4, 'NB': 6, 'NA': 8, 'I': 9, 'angle': 109.5, 'blen': 1.09, 'charge': 0.038, 'type': 'HC'},
"HB3":{'torsion': 60.0, 'tree': 'E', 'NC': 4, 'NB': 6, 'NA': 8, 'I': 10, 'angle': 109.5, 'blen': 1.09, 'charge': 0.038, 'type': 'HC'},
"impropTors":[['-M', 'CA'... | allct_dat = {'TYR': {'HB2': {'torsion': 300.0, 'tree': 'E', 'NC': 4, 'NB': 6, 'NA': 8, 'I': 9, 'angle': 109.5, 'blen': 1.09, 'charge': 0.038, 'type': 'HC'}, 'HB3': {'torsion': 60.0, 'tree': 'E', 'NC': 4, 'NB': 6, 'NA': 8, 'I': 10, 'angle': 109.5, 'blen': 1.09, 'charge': 0.038, 'type': 'HC'}, 'impropTors': [['-M', 'CA',... |
def kelime_sayisi(string):
counter = 1
for i in range(0,len(string)):
if string[i] == ' ':
counter += 1
return counter
cumle = input("Cumlenizi giriniz : ")
print("Cumlenizdeki kelime sayisi = {}".format(kelime_sayisi(cumle))) | def kelime_sayisi(string):
counter = 1
for i in range(0, len(string)):
if string[i] == ' ':
counter += 1
return counter
cumle = input('Cumlenizi giriniz : ')
print('Cumlenizdeki kelime sayisi = {}'.format(kelime_sayisi(cumle))) |
class Solution:
def paintHouse(self, cost:list, houses:int, colors:int)->int:
if houses == 0: # no houses to paint
return 0
if colors == 0: # no colors to paint houses
return 0
dp = [[0]*colors for _ in range(houses)]
dp[0] = cost[0]... | class Solution:
def paint_house(self, cost: list, houses: int, colors: int) -> int:
if houses == 0:
return 0
if colors == 0:
return 0
dp = [[0] * colors for _ in range(houses)]
dp[0] = cost[0]
for i in range(1, houses):
mincost = 100000000... |
'''
Created on Dec 21, 2014
@author: Ben
'''
def create_new_default(directory: str, dest: dict, param: dict):
'''
Creates new default parameter file based on parameter settings
'''
with open(directory, 'w') as new_default:
new_default.write(
'''TARGET DESTINATION = {}
SAVE DESTINATION = {}... | """
Created on Dec 21, 2014
@author: Ben
"""
def create_new_default(directory: str, dest: dict, param: dict):
"""
Creates new default parameter file based on parameter settings
"""
with open(directory, 'w') as new_default:
new_default.write('TARGET DESTINATION = {} \nSAVE DESTINATION = {}\nS... |
def grayscale(image):
for row in range(image.shape[0]):
for col in range(image.shape[1]):
avg = sum(image[row][col][i] for i in range(3)) // 3
image[row][col] = [avg for _ in range(3)]
| def grayscale(image):
for row in range(image.shape[0]):
for col in range(image.shape[1]):
avg = sum((image[row][col][i] for i in range(3))) // 3
image[row][col] = [avg for _ in range(3)] |
def get_cross_sum(n):
start = 1
total = 1
for i in range(1, n):
step = i * 2
start = start + step
total += start * 4 + step * 6
start = start + step * 3
return total
print(get_cross_sum(501)) | def get_cross_sum(n):
start = 1
total = 1
for i in range(1, n):
step = i * 2
start = start + step
total += start * 4 + step * 6
start = start + step * 3
return total
print(get_cross_sum(501)) |
class Analyser:
def __init__(self, callbacks, notifiers, state):
self.cbs = callbacks
self.state = state
self.notifiers = notifiers
def on_begin_analyse(self, timestamp):
pass
def on_end_analyse(self, timestamp):
pass
def analyse(self, event):
event_nam... | class Analyser:
def __init__(self, callbacks, notifiers, state):
self.cbs = callbacks
self.state = state
self.notifiers = notifiers
def on_begin_analyse(self, timestamp):
pass
def on_end_analyse(self, timestamp):
pass
def analyse(self, event):
event_na... |
GOV_AIRPORTS = {
"Antananarivo/Ivato": "big",
"Antsiranana/Diego": "small",
"Fianarantsoa": "small",
"Tolagnaro/Ft. Dauphin": "small",
"Mahajanga": "medium",
"Mananjary": "small",
"Nosy Be": "medium",
"Morondava": "small",
"Sainte Marie": "small",
"Sambava": "small",
"Toamasi... | gov_airports = {'Antananarivo/Ivato': 'big', 'Antsiranana/Diego': 'small', 'Fianarantsoa': 'small', 'Tolagnaro/Ft. Dauphin': 'small', 'Mahajanga': 'medium', 'Mananjary': 'small', 'Nosy Be': 'medium', 'Morondava': 'small', 'Sainte Marie': 'small', 'Sambava': 'small', 'Toamasina': 'small', 'Toliary': 'small'} |
def fibonacci(n):
fibonacci = np.zeros(10, dtype=np.int32)
fibonacci_pow = np.zeros(10, dtype=np.int32)
fibonacci[0] = 0
fibonacci[1] = 1
for i in np.arange(2, 10):
fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2]
fibonacci[i] = int(fibonacci[i])
print(fibonacci)
for i in np.arange(10):
fibonacci_pow[i] ... | def fibonacci(n):
fibonacci = np.zeros(10, dtype=np.int32)
fibonacci_pow = np.zeros(10, dtype=np.int32)
fibonacci[0] = 0
fibonacci[1] = 1
for i in np.arange(2, 10):
fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2]
fibonacci[i] = int(fibonacci[i])
print(fibonacci)
for i in n... |
def split_in_three(data_real, data_fake):
min_v = min(data_fake.min(), data_real.min())
max_v = max(data_fake.max(), data_real.max())
tercio = (max_v - min_v) / 3
# Calculate 1/3
th_one = min_v + tercio
# Calculate 2/3
th_two = max_v - tercio
first_f, second_f, third_f = split_data(th_... | def split_in_three(data_real, data_fake):
min_v = min(data_fake.min(), data_real.min())
max_v = max(data_fake.max(), data_real.max())
tercio = (max_v - min_v) / 3
th_one = min_v + tercio
th_two = max_v - tercio
(first_f, second_f, third_f) = split_data(th_one, th_two, data_fake)
(first_r, se... |
data = (
'Mie ', # 0x00
'Xu ', # 0x01
'Mang ', # 0x02
'Chi ', # 0x03
'Ge ', # 0x04
'Xuan ', # 0x05
'Yao ', # 0x06
'Zi ', # 0x07
'He ', # 0x08
'Ji ', # 0x09
'Diao ', # 0x0a
'Cun ', # 0x0b
'Tong ', # 0x0c
'Ming ', # 0x0d
'Hou ', # 0x0e
'Li ', # 0x0f
'Tu ', # 0x10
'Xiang ... | data = ('Mie ', 'Xu ', 'Mang ', 'Chi ', 'Ge ', 'Xuan ', 'Yao ', 'Zi ', 'He ', 'Ji ', 'Diao ', 'Cun ', 'Tong ', 'Ming ', 'Hou ', 'Li ', 'Tu ', 'Xiang ', 'Zha ', 'Xia ', 'Ye ', 'Lu ', 'A ', 'Ma ', 'Ou ', 'Xue ', 'Yi ', 'Jun ', 'Chou ', 'Lin ', 'Tun ', 'Yin ', 'Fei ', 'Bi ', 'Qin ', 'Qin ', 'Jie ', 'Bu ', 'Fou ', 'Ba ', '... |
divisor = int(input())
bound = int(input())
for num in range(bound, 0, -1):
if num % divisor == 0:
print(num)
break
| divisor = int(input())
bound = int(input())
for num in range(bound, 0, -1):
if num % divisor == 0:
print(num)
break |
cities = [
'Budapest',
'Debrecen',
'Miskolc',
'Szeged',
'Pecs',
'Zuglo',
'Gyor',
'Nyiregyhaza',
'Kecskemet',
'Szekesfehervar',
'Szombathely',
'Jozsefvaros',
'Paradsasvar',
'Szolnok',
'Tatabanya',
'Kaposvar',
'Bekescsaba',
'Erd',
'Veszprem',
... | cities = ['Budapest', 'Debrecen', 'Miskolc', 'Szeged', 'Pecs', 'Zuglo', 'Gyor', 'Nyiregyhaza', 'Kecskemet', 'Szekesfehervar', 'Szombathely', 'Jozsefvaros', 'Paradsasvar', 'Szolnok', 'Tatabanya', 'Kaposvar', 'Bekescsaba', 'Erd', 'Veszprem', 'Erzsebetvaros', 'Zalaegerszeg', 'Kispest', 'Sopron', 'Eger', 'Nagykanizsa', 'Du... |
def read_file(test = True):
if test:
filename = '../tests/day1.txt'
else:
filename = '../input/day1.txt'
with open(filename) as file:
temp = list()
for line in file:
temp.append(line.strip())
return temp
def puzzle1():
temp = read_file(False)[0]
floo... | def read_file(test=True):
if test:
filename = '../tests/day1.txt'
else:
filename = '../input/day1.txt'
with open(filename) as file:
temp = list()
for line in file:
temp.append(line.strip())
return temp
def puzzle1():
temp = read_file(False)[0]
floor =... |
def firstDuplicate(a):
number_frequencies, number_indices, duplicate_index = {}, {}, {}
# Iterate through list and increment frequency count
# if number not in dict. Also, note the index asscoiated
# with the value
for i in range(len(a)):
if a[i] not in number_frequencies:
numbe... | def first_duplicate(a):
(number_frequencies, number_indices, duplicate_index) = ({}, {}, {})
for i in range(len(a)):
if a[i] not in number_frequencies:
number_frequencies[a[i]] = 1
number_indices[a[i]] = i
elif a[i] in number_frequencies:
if number_frequencies... |
#
# PySNMP MIB module IANA-MALLOC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IANA-MALLOC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:50:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ... |
class File:
@staticmethod
def tail(self, file_path, lines=10):
with open(file_path, 'rb') as f:
total_lines_wanted = lines
block_size = 1024
f.seek(0, 2)
block_end_byte = f.tell()
lines_to_go = total_lines_wanted
block_number = -1
... | class File:
@staticmethod
def tail(self, file_path, lines=10):
with open(file_path, 'rb') as f:
total_lines_wanted = lines
block_size = 1024
f.seek(0, 2)
block_end_byte = f.tell()
lines_to_go = total_lines_wanted
block_number = -1
... |
class Solution:
def isStrobogrammatic(self, num: str) -> bool:
strobogrammatic = {
'1': '1',
'0': '0',
'6': '9',
'9': '6',
'8': '8'
}
for idx, digit in enumerate(num):
if digit not in strobogrammatic or strobogrammatic[... | class Solution:
def is_strobogrammatic(self, num: str) -> bool:
strobogrammatic = {'1': '1', '0': '0', '6': '9', '9': '6', '8': '8'}
for (idx, digit) in enumerate(num):
if digit not in strobogrammatic or strobogrammatic[digit] != num[len(num) - idx - 1]:
return False
... |
def check_candidate(a, candidate, callback_when_different, *args, **kwargs):
control_result = None
candidate_result = None
control_exception = None
candidate_exception = None
reason = None
try:
control_result = a(*args, **kwargs)
except BaseException as e:
control_exception ... | def check_candidate(a, candidate, callback_when_different, *args, **kwargs):
control_result = None
candidate_result = None
control_exception = None
candidate_exception = None
reason = None
try:
control_result = a(*args, **kwargs)
except BaseException as e:
control_exception =... |
n = int(input()) % 8
if n == 0:
print(2)
elif n <= 5:
print(n)
else:
print(10 - n)
| n = int(input()) % 8
if n == 0:
print(2)
elif n <= 5:
print(n)
else:
print(10 - n) |
def arg_to_step(arg):
if isinstance(arg, str):
return {'run': arg}
else:
return dict(zip(['run', 'parameters', 'cache'], arg))
def steps(*args):
return [arg_to_step(arg) for arg in args]
| def arg_to_step(arg):
if isinstance(arg, str):
return {'run': arg}
else:
return dict(zip(['run', 'parameters', 'cache'], arg))
def steps(*args):
return [arg_to_step(arg) for arg in args] |
#inputFile = 'sand.407'
inputFile = 'sand.407'
outputFile= 'sand.out'
def joinLine():
pass
with open(inputFile) as OF:
lines = OF.readlines()
print(lines[0:3])
| input_file = 'sand.407'
output_file = 'sand.out'
def join_line():
pass
with open(inputFile) as of:
lines = OF.readlines()
print(lines[0:3]) |
class MergeSort:
def __init__(self, lst):
self.lst = lst
def mergeSort(self, a):
midPoint = len(a) // 2
if a[len(a) - 1] < a[0]:
left = self.mergeSort(a[:midPoint])
right = self.mergeSort(a[midPoint:])
return self.merge(left, right)
else:
... | class Mergesort:
def __init__(self, lst):
self.lst = lst
def merge_sort(self, a):
mid_point = len(a) // 2
if a[len(a) - 1] < a[0]:
left = self.mergeSort(a[:midPoint])
right = self.mergeSort(a[midPoint:])
return self.merge(left, right)
else:
... |
'''
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
You may assume nums1 and nums2 cannot be both empty.
'''
### Nature: the meaning of MEDIAN, is that, the number of elements less than it,
##... | """
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
You may assume nums1 and nums2 cannot be both empty.
"""
def find_median_sorted_arrays(nums1, nums2):
(m, n) = (len(nums1), len(nums2))
... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def hasPathSum(self, root: 'TreeNode', sum: 'int') -> 'bool':
if not root:
return False
def helper(node,val):... | class Solution:
def has_path_sum(self, root: 'TreeNode', sum: 'int') -> 'bool':
if not root:
return False
def helper(node, val):
if not node:
return False
val -= node.val
if node.left is None and node.right is None:
re... |
class Solution:
def maxArea(self, ls):
n = len(ls) - 1
v, left, right = [], 0, n
while 0 <= left < right <= n:
h = min(ls[left], ls[right])
v += [h * (right - left)]
while ls[left] <= h and left < right:
left += 1
while ls[right... | class Solution:
def max_area(self, ls):
n = len(ls) - 1
(v, left, right) = ([], 0, n)
while 0 <= left < right <= n:
h = min(ls[left], ls[right])
v += [h * (right - left)]
while ls[left] <= h and left < right:
left += 1
while ls... |
def _check_stamping_format(f):
if f.startswith("{") and f.endswith("}"):
return True
return False
def _resolve_stamp(ctx, string, output):
stamps = [ctx.info_file, ctx.version_file]
args = ctx.actions.args()
args.add_all(stamps, format_each = "--stamp-info-file=%s")
args.add(string, for... | def _check_stamping_format(f):
if f.startswith('{') and f.endswith('}'):
return True
return False
def _resolve_stamp(ctx, string, output):
stamps = [ctx.info_file, ctx.version_file]
args = ctx.actions.args()
args.add_all(stamps, format_each='--stamp-info-file=%s')
args.add(string, forma... |
def extract_stack_from_seat_line(seat_line: str) -> float or None:
# Seat 3: PokerPete24 (40518.00)
if 'will be allowed to play after the button' in seat_line:
return None
return float(seat_line.split(' (')[1].split(')')[0])
| def extract_stack_from_seat_line(seat_line: str) -> float or None:
if 'will be allowed to play after the button' in seat_line:
return None
return float(seat_line.split(' (')[1].split(')')[0]) |
class Table:
# Constructor
# Defauls row and col to 0 if less than 0
def __init__(self, col_count, row_count, headers = [], border_size = 0):
self.col_count = col_count if col_count >= 0 else 0
self.row_count = row_count if row_count >= 0 else 0
self.border_size = border_size if ... | class Table:
def __init__(self, col_count, row_count, headers=[], border_size=0):
self.col_count = col_count if col_count >= 0 else 0
self.row_count = row_count if row_count >= 0 else 0
self.border_size = border_size if border_size > 0 else 0
self.headers = headers
def get_row_... |
class cluster(object):
def __init__(self,members=[]):
self.s=set(members)
def merge(self, other):
self.s.union(other.s)
return self
class clusterManager(object):
def __init__(self,clusters={}):
self.c=clusters
def merge(self, i, j):
self.c[i]=self.c[j]=self.c[i... | class Cluster(object):
def __init__(self, members=[]):
self.s = set(members)
def merge(self, other):
self.s.union(other.s)
return self
class Clustermanager(object):
def __init__(self, clusters={}):
self.c = clusters
def merge(self, i, j):
self.c[i] = self.c[j... |
#backslash and new line ignored
print("one\
two\
three")
| print('one two three') |
jogador = dict()
partidas = list()
jogador['nome'] = str(input('Nome do jogador: '))
tot = int(input(f'Quantas partidas {jogador["nome"]} jogou? '))
for c in range(0, tot):
partidas.append(int(input(f' Quantos gols na partida {c}? ')))
jogador['gols'] = partidas[:]
jogador['total'] = sum(partidas)
print(30*'-=')... | jogador = dict()
partidas = list()
jogador['nome'] = str(input('Nome do jogador: '))
tot = int(input(f"Quantas partidas {jogador['nome']} jogou? "))
for c in range(0, tot):
partidas.append(int(input(f' Quantos gols na partida {c}? ')))
jogador['gols'] = partidas[:]
jogador['total'] = sum(partidas)
print(30 * '-=... |
#skip.runas import Image; im = Image.open("Scribus.gif"); image_list = list(im.getdata()); cols, rows = im.size; res = range(len(image_list)); sobelFilter(image_list, res, cols, rows)
#runas cols = 100; rows = 100 ;image_list=[x%10+y%20 for x in xrange(cols) for y in xrange(rows)]; sobelFilter(image_list, cols, rows)
#... | def sobel_filter(original_image, cols, rows):
edge_image = range(len(original_image))
for i in xrange(rows):
edge_image[i * cols] = 255
edge_image[(i + 1) * cols - 1] = 255
for i in xrange(1, cols - 1):
edge_image[i] = 255
edge_image[i + (rows - 1) * cols] = 255
for iy in... |
def sum_digit(n):
total = 0
while n != 0:
total += n % 10
n /= 10
return total
def factorial(n):
if n <= 0:
return 1
return n * factorial(n - 1)
| def sum_digit(n):
total = 0
while n != 0:
total += n % 10
n /= 10
return total
def factorial(n):
if n <= 0:
return 1
return n * factorial(n - 1) |
class Global:
sand_box = True
app_key = None
# your secret
secret = None
callback_url = None
server_url = None
log = None
def __init__(self, config):
Global.sand_box = config.get_env()
Global.app_key = config.get_app_key()
Global.secret = config.get_secret()... | class Global:
sand_box = True
app_key = None
secret = None
callback_url = None
server_url = None
log = None
def __init__(self, config):
Global.sand_box = config.get_env()
Global.app_key = config.get_app_key()
Global.secret = config.get_secret()
Global.callbac... |
DEFAULT_KUBE_VERSION=1.14
KUBE_VERSION="kubeVersion"
USER_ID="userId"
DEFAULT_USER_ID=1
CLUSTER_NAME="clusterName"
CLUSTER_MASTER_IP="masterHostIP"
CLUSTER_WORKER_IP_LIST="workerIPList"
FRAMEWORK_TYPE= "frameworkType"
FRAMEWORK_VERSION="frameworkVersion"
FRAMEWORK_RESOURCES="frameworkResources"
FRAMEWORK_VOLUME_SIZE= ... | default_kube_version = 1.14
kube_version = 'kubeVersion'
user_id = 'userId'
default_user_id = 1
cluster_name = 'clusterName'
cluster_master_ip = 'masterHostIP'
cluster_worker_ip_list = 'workerIPList'
framework_type = 'frameworkType'
framework_version = 'frameworkVersion'
framework_resources = 'frameworkResources'
frame... |
# Python3
def makeArrayConsecutive2(statues):
return (max(statues) - min(statues) + 1) - len(statues)
| def make_array_consecutive2(statues):
return max(statues) - min(statues) + 1 - len(statues) |
'''
>List of functions
1. contain(value,limit) - contains a value between 0 to limit
'''
def contain(value,limit):
if value<0:
return value+limit
elif value>=limit:
return value-limit
else:
return value | """
>List of functions
1. contain(value,limit) - contains a value between 0 to limit
"""
def contain(value, limit):
if value < 0:
return value + limit
elif value >= limit:
return value - limit
else:
return value |
class URLShortener:
def __init__(self):
self.id_counter = 0
self.links = {}
def getURL(self, short_id):
return self.links.get(short_id)
def shorten(self, url):
short_id = self.getNextId()
self.links.update({short_id: url})
return short_id
def getNextId... | class Urlshortener:
def __init__(self):
self.id_counter = 0
self.links = {}
def get_url(self, short_id):
return self.links.get(short_id)
def shorten(self, url):
short_id = self.getNextId()
self.links.update({short_id: url})
return short_id
def get_next... |
print ('hello world')
print ('hey i did something')
print ('what happens if i do a ;');
print ('apparently nothing')
| print('hello world')
print('hey i did something')
print('what happens if i do a ;')
print('apparently nothing') |
class Bank:
def __init__(self):
self.__agencies = [1111, 2222, 3333]
self.__costumers = []
self.__accounts = []
def insert_costumers(self, costumer):
self.__costumers.append(costumer)
def insert_accounts(self, account):
self.__accounts.append(account)
def authe... | class Bank:
def __init__(self):
self.__agencies = [1111, 2222, 3333]
self.__costumers = []
self.__accounts = []
def insert_costumers(self, costumer):
self.__costumers.append(costumer)
def insert_accounts(self, account):
self.__accounts.append(account)
def auth... |
'''
Python program to determine which triples sum to zero from a given list of lists.
Input: [[1343532, -2920635, 332], [-27, 18, 9], [4, 0, -4], [2, 2, 2], [-20, 16, 4]]
Output:
[False, True, True, False, True]
Input: [[1, 2, -3], [-4, 0, 4], [0, 1, -5], [1, 1, 1], [-2, 4, -1]]
Output:
[True, True, False, False, False... | """
Python program to determine which triples sum to zero from a given list of lists.
Input: [[1343532, -2920635, 332], [-27, 18, 9], [4, 0, -4], [2, 2, 2], [-20, 16, 4]]
Output:
[False, True, True, False, True]
Input: [[1, 2, -3], [-4, 0, 4], [0, 1, -5], [1, 1, 1], [-2, 4, -1]]
Output:
[True, True, False, False, False... |
class AliasNotFound(Exception):
def __init__(self, alias):
self.alias = alias
class AliasAlreadyExists(Exception):
def __init__(self, alias):
self.alias = alias
class UnexpectedServerResponse(Exception):
def __init__(self, response):
self.response = response
| class Aliasnotfound(Exception):
def __init__(self, alias):
self.alias = alias
class Aliasalreadyexists(Exception):
def __init__(self, alias):
self.alias = alias
class Unexpectedserverresponse(Exception):
def __init__(self, response):
self.response = response |
def differentiate(fxn: str) -> str:
if fxn == "x":
return "1"
dividedFxn = getFirstLevel(fxn)
coeffOrTrig: str = dividedFxn[0]
exponent: str = dividedFxn[2]
insideParentheses: str = dividedFxn[1]
if coeffOrTrig.isalpha():
ans = computeTrig(coeffOrTrig, insideParentheses)
... | def differentiate(fxn: str) -> str:
if fxn == 'x':
return '1'
divided_fxn = get_first_level(fxn)
coeff_or_trig: str = dividedFxn[0]
exponent: str = dividedFxn[2]
inside_parentheses: str = dividedFxn[1]
if coeffOrTrig.isalpha():
ans = compute_trig(coeffOrTrig, insideParentheses)
... |
class register:
plugin_dict = {}
plugin_name = []
@classmethod
def register(cls, plugin_name):
def wrapper(plugin):
cls.plugin_dict[plugin_name] = plugin
return plugin
return wrapper | class Register:
plugin_dict = {}
plugin_name = []
@classmethod
def register(cls, plugin_name):
def wrapper(plugin):
cls.plugin_dict[plugin_name] = plugin
return plugin
return wrapper |
#B
def average(As :list) -> float:
return float(sum(As)/len(As))
def main():
# input
As = list(map(int, input().split()))
# compute
# output
print(average(As))
if __name__ == '__main__':
main()
| def average(As: list) -> float:
return float(sum(As) / len(As))
def main():
as = list(map(int, input().split()))
print(average(As))
if __name__ == '__main__':
main() |
if __name__ == '__main__':
pass
RESULT = 1
# DO NOT REMOVE NEXT LINE - KEEP IT INTENTIONALLY LAST
assert RESULT == 1, ''
| if __name__ == '__main__':
pass
result = 1
assert RESULT == 1, '' |
class ToolNameAPI:
thing = 'thing'
toolname_tool = 'example'
tln = ToolNameAPI()
the_repo = "reponame"
author = "authorname"
profile = "authorprofile" | class Toolnameapi:
thing = 'thing'
toolname_tool = 'example'
tln = tool_name_api()
the_repo = 'reponame'
author = 'authorname'
profile = 'authorprofile' |
class BaseFunction:
def __init__(self, name, n_calls, internal_ns):
self._name = name
self._n_calls = n_calls
self._internal_ns = internal_ns
@property
def name(self):
return self._name
@property
def n_calls(self):
return self._n_calls
@property
def... | class Basefunction:
def __init__(self, name, n_calls, internal_ns):
self._name = name
self._n_calls = n_calls
self._internal_ns = internal_ns
@property
def name(self):
return self._name
@property
def n_calls(self):
return self._n_calls
@property
de... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.