content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
pm = sm.getChr().getPotentialMan()
pm.addPotential(pm.generateRandomPotential(1))
sm.completeQuestNoRewards(12394)
sm.dispose()
| pm = sm.getChr().getPotentialMan()
pm.addPotential(pm.generateRandomPotential(1))
sm.completeQuestNoRewards(12394)
sm.dispose() |
class UpdateIpExclusionObject:
def __init__(self, filterIp, ipFilterId):
self.filterIp = filterIp
self.ipFilterId = ipFilterId
self.memo = None | class Updateipexclusionobject:
def __init__(self, filterIp, ipFilterId):
self.filterIp = filterIp
self.ipFilterId = ipFilterId
self.memo = None |
class PsKeyCode:
def __init__(self):
pass
def keycode_in_alpha_upper(self, code):
return 65 <= code <= 90
def keycode_in_alpha_lower(self, code):
return 97 <= code <= 122
def keycode_in_alpha(self, code):
return self.keycode_in_alpha_lower(
code
) o... | class Pskeycode:
def __init__(self):
pass
def keycode_in_alpha_upper(self, code):
return 65 <= code <= 90
def keycode_in_alpha_lower(self, code):
return 97 <= code <= 122
def keycode_in_alpha(self, code):
return self.keycode_in_alpha_lower(code) or self.keycode_in_alp... |
def get_grandma(clause_atom, api):
"""Return a wayyiqtol/yiqtol/imperative from a clause tree.
Recursively climbs up a clause's ancestorial tree.
Stops upon identifying either wayyiqtol
or a yiqtol|impv grand(mother).
Returns:
a string of the ancestor's tense, or None.
"""
F, E, L... | def get_grandma(clause_atom, api):
"""Return a wayyiqtol/yiqtol/imperative from a clause tree.
Recursively climbs up a clause's ancestorial tree.
Stops upon identifying either wayyiqtol
or a yiqtol|impv grand(mother).
Returns:
a string of the ancestor's tense, or None.
"""
(f, e, l... |
class AnalysisElement:
def __init__(self, validationResult, validationMessage):
self.validation_result = validationResult
self.validation_message = validationMessage
class AnalysisResult:
def __init__(self):
self.elements = []
def add_element(self, element: AnalysisElement):
... | class Analysiselement:
def __init__(self, validationResult, validationMessage):
self.validation_result = validationResult
self.validation_message = validationMessage
class Analysisresult:
def __init__(self):
self.elements = []
def add_element(self, element: AnalysisElement):
... |
lim = 10000000
num = [True for _ in range(lim)]
for i in range(4, lim, 2):
num[i] = False
for i in range(3, lim, 2):
if num[i]:
for j in range(i * i, lim, i):
num[j] = False
oa = 0
ob = 0
mnp = 0
size = 1000
for a in range(-size + 1, size):
for b in range(1, size, 2):
np =... | lim = 10000000
num = [True for _ in range(lim)]
for i in range(4, lim, 2):
num[i] = False
for i in range(3, lim, 2):
if num[i]:
for j in range(i * i, lim, i):
num[j] = False
oa = 0
ob = 0
mnp = 0
size = 1000
for a in range(-size + 1, size):
for b in range(1, size, 2):
np = 0
... |
# -*- coding: utf-8 -*-
"""Tests package for Script Venv."""
__author__ = """Struan Lyall Judd"""
__email__ = 'sv@scifi.geek.nz'
| """Tests package for Script Venv."""
__author__ = 'Struan Lyall Judd'
__email__ = 'sv@scifi.geek.nz' |
# coding=utf-8
"""
Package init file
"""
__all__ = ["catch_event_type", "end_event_type", "event_type", "intermediate_catch_event_type",
"intermediate_throw_event_type", "start_event_type", "throw_event_type"]
| """
Package init file
"""
__all__ = ['catch_event_type', 'end_event_type', 'event_type', 'intermediate_catch_event_type', 'intermediate_throw_event_type', 'start_event_type', 'throw_event_type'] |
STATS = [
{
"num_node_expansions": 0,
"search_time": 0.0260686,
"total_time": 0.161712,
"plan_length": 64,
"plan_cost": 64,
"objects_used": 261,
"objects_total": 379,
"neural_net_time": 0.10646533966064453,
"num_replanning_steps": 3,
"w... | stats = [{'num_node_expansions': 0, 'search_time': 0.0260686, 'total_time': 0.161712, 'plan_length': 64, 'plan_cost': 64, 'objects_used': 261, 'objects_total': 379, 'neural_net_time': 0.10646533966064453, 'num_replanning_steps': 3, 'wall_time': 2.435692071914673}, {'num_node_expansions': 0, 'search_time': 0.0279492, 't... |
# Numbers are not stored in the written representation, so they can't be
# treated like strings.
a = 123
print(a[1])
| a = 123
print(a[1]) |
def get_reversed_string(word):
return word[::-1]
while True:
string = input()
if string == 'end':
break
rev_str = get_reversed_string(string)
print(f'{string} = {rev_str}')
| def get_reversed_string(word):
return word[::-1]
while True:
string = input()
if string == 'end':
break
rev_str = get_reversed_string(string)
print(f'{string} = {rev_str}') |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def levelOrderBottom(self, root: 'TreeNode') -> 'List[List[int]]':
if not root:
return
stack = [(ro... | class Solution:
def level_order_bottom(self, root: 'TreeNode') -> 'List[List[int]]':
if not root:
return
stack = [(root, 0)]
rst = []
while stack:
(n, level) = stack.pop(0)
if len(rst) < level + 1:
rst.insert(0, [])
rst... |
# def function_name_print(a,b,c,d):
#
# print(a,b,c,d)
def funargs(normal,*args, **kwargs):
print(normal)
for item in args:
print(item)
print("\nNow I would like to introduce some of our heroes")
for key,value in kwargs.items():
print(f"{key} is a {value}")
# As a tu... | def funargs(normal, *args, **kwargs):
print(normal)
for item in args:
print(item)
print('\nNow I would like to introduce some of our heroes')
for (key, value) in kwargs.items():
print(f'{key} is a {value}')
list = ['Jiggu', 'g', 'f', 'dd']
normal = 'Yhis is normal'
kw = {'Rohan': 'Monito... |
"""
This is template on how to configurate your setup for the weedlings model.
You may create a copy of this script and name it "_conf.py" so it will be not be tracked by the ".gitignore"
and is stored only locally.
The "_conf.py" than can be used in other scripts.
"""
PATH = "/home/yourname/projects/weedlings/" # ove... | """
This is template on how to configurate your setup for the weedlings model.
You may create a copy of this script and name it "_conf.py" so it will be not be tracked by the ".gitignore"
and is stored only locally.
The "_conf.py" than can be used in other scripts.
"""
path = '/home/yourname/projects/weedlings/'
data_p... |
class MonoDevelopSvnPackage (Package):
def __init__ (self):
Package.__init__ (self, 'monodevelop', 'trunk')
def svn_co_or_up (self):
self.cd ('..')
if os.path.isdir ('svn'):
self.cd ('svn')
self.sh ('svn up')
else:
self.sh ('svn co http://anonsvn.mono-project.com/source/trunk/monodevelop svn')
se... | class Monodevelopsvnpackage(Package):
def __init__(self):
Package.__init__(self, 'monodevelop', 'trunk')
def svn_co_or_up(self):
self.cd('..')
if os.path.isdir('svn'):
self.cd('svn')
self.sh('svn up')
else:
self.sh('svn co http://anonsvn.mono... |
class MBTA_Exception(Exception):
"""Superclass for all Exceptions raised in mbta package. """
pass
class MBTA_NotFound(MBTA_Exception):
""" Raised when search returns 404 (Not Found). """
def __init__(self, response, query_val):
parameter = response['errors'][0]['source']['parameter']
... | class Mbta_Exception(Exception):
"""Superclass for all Exceptions raised in mbta package. """
pass
class Mbta_Notfound(MBTA_Exception):
""" Raised when search returns 404 (Not Found). """
def __init__(self, response, query_val):
parameter = response['errors'][0]['source']['parameter']
... |
#
# PySNMP MIB module CISCOSB-UDP (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-UDP
# Produced by pysmi-0.3.4 at Wed May 1 12:24:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint, constraints_union) ... |
def entry_id(entry):
for field in ['id', 'link']:
ret = getattr(entry, field, None)
if ret:
return ret
raise Exception('no id field found in entry: {}'.format(entry))
| def entry_id(entry):
for field in ['id', 'link']:
ret = getattr(entry, field, None)
if ret:
return ret
raise exception('no id field found in entry: {}'.format(entry)) |
print("~" * 60)
print("Tower of Hanoi")
def hanoi(n, src, dst, tmp):
if n > 0:
hanoi(n - 1, src, tmp, dst)
print(f"Move disk {n} from {src} to {dst}")
hanoi(n - 1, tmp, dst, src)
hanoi(4, "A", "B", "C")
print("~" * 60)
print("8 Queens Problem")
queen = [0 for _ in range(8)]
rfree = [Tr... | print('~' * 60)
print('Tower of Hanoi')
def hanoi(n, src, dst, tmp):
if n > 0:
hanoi(n - 1, src, tmp, dst)
print(f'Move disk {n} from {src} to {dst}')
hanoi(n - 1, tmp, dst, src)
hanoi(4, 'A', 'B', 'C')
print('~' * 60)
print('8 Queens Problem')
queen = [0 for _ in range(8)]
rfree = [True fo... |
class Function:
def __init__(self, name, param_types, return_type, line=0):
self.name = name
self.param_types = param_types
self.return_type = return_type
self.line = line
def __str__(self):
return Function.__qualname__
def getattr(self, name):
raise Attrib... | class Function:
def __init__(self, name, param_types, return_type, line=0):
self.name = name
self.param_types = param_types
self.return_type = return_type
self.line = line
def __str__(self):
return Function.__qualname__
def getattr(self, name):
raise attrib... |
class Solution:
def minStartValue(self, nums: List[int]) -> int:
total = minSum = 0
for num in nums:
total += num
minSum = min(minSum, total)
return 1 - minSum
| class Solution:
def min_start_value(self, nums: List[int]) -> int:
total = min_sum = 0
for num in nums:
total += num
min_sum = min(minSum, total)
return 1 - minSum |
def conduit_login(driver):
driver.find_element_by_xpath('//a[@href="#/login"]').click()
driver.find_element_by_xpath('//input[@placeholder="Email"]').send_keys("testmail61@test.hu")
driver.find_element_by_xpath('//input[@placeholder="Password"]').send_keys("Testpass1")
driver.find_element_by_xpath('//*[... | def conduit_login(driver):
driver.find_element_by_xpath('//a[@href="#/login"]').click()
driver.find_element_by_xpath('//input[@placeholder="Email"]').send_keys('testmail61@test.hu')
driver.find_element_by_xpath('//input[@placeholder="Password"]').send_keys('Testpass1')
driver.find_element_by_xpath('//*[... |
class Node():
def __init__(self, val):
self.val = val
self.adjacent_nodes = []
self.visited = False
# O(E^d) where d is depth
def word_transform(w1, w2, dictionary):
# make dictionary into linked list
start_node = Node(w1)
end_node = Node(w2)
nodes = [start_node, end_node]
... | class Node:
def __init__(self, val):
self.val = val
self.adjacent_nodes = []
self.visited = False
def word_transform(w1, w2, dictionary):
start_node = node(w1)
end_node = node(w2)
nodes = [start_node, end_node]
nodes_dict = {start_node.val: start_node, end_node.val: end_nod... |
# leetcode
class Solution:
def mincostTickets(self, days: List[int], costs: List[int]) -> int:
num = 366
one, seven, thirty = costs
dp = [0] * num
idx = 0
for i in range(1, num):
dp[i] = dp[i-1]
if i == days[idx]:
... | class Solution:
def mincost_tickets(self, days: List[int], costs: List[int]) -> int:
num = 366
(one, seven, thirty) = costs
dp = [0] * num
idx = 0
for i in range(1, num):
dp[i] = dp[i - 1]
if i == days[idx]:
dp[i] = min(one + dp[i - 1 ... |
'''
The Python repository "AA" contains the scripts, data,
figures, and text for nudged Arctic Amplification (AA) and
Upper-troposphere Tropical Warming (UTW). The model is SC-WACCM4.
We are interested in the large-scale atmospheric response to
Arctic sea ice loss in AA simulations compared to sea-ice forcing.
See Pe... | """
The Python repository "AA" contains the scripts, data,
figures, and text for nudged Arctic Amplification (AA) and
Upper-troposphere Tropical Warming (UTW). The model is SC-WACCM4.
We are interested in the large-scale atmospheric response to
Arctic sea ice loss in AA simulations compared to sea-ice forcing.
See Pe... |
# employees = {'marge': 3, 'mag': 2}
# employees['phil'] = '5'
# print(employees.values())
# new_list = list(iter(employees))
# for key, value in employees.iteritems():
# print(key,value)
# print(new_list)
# t = ('a', 'b', 'c', 'd')
# print(t.index('c'))
# print(1 > 2)
# myfile = open('test_file.txt')
# read =... | f = open('second_file.txt')
lines = f.read()
print(lines) |
sample_pos_100_circle = {
(0, 12, 14, 28, 61, 76) : (0.6606687940575429, 0.12955294286970329, 0.1392231402857147),
(0, 14, 26, 28, 61, 76) : (0.6775622847685568, 0.0898623709846611, 0.14956067316950022),
(0, 11, 12, 14, 23, 28, 42, 44, 76, 79, 89) : (0.6065886283561139, 0.20320288122581232, 0.140052078713... | sample_pos_100_circle = {(0, 12, 14, 28, 61, 76): (0.6606687940575429, 0.12955294286970329, 0.1392231402857147), (0, 14, 26, 28, 61, 76): (0.6775622847685568, 0.0898623709846611, 0.14956067316950022), (0, 11, 12, 14, 23, 28, 42, 44, 76, 79, 89): (0.6065886283561139, 0.20320288122581232, 0.14005207871339437), (0, 11, 12... |
# -*- coding: utf-8 -*-
'''Top-level package for lico.'''
__author__ = '''Sjoerd Kerkstra'''
__email__ = 'w.s.kerkstra@example.com'
__version__ = '0.1.1'
| """Top-level package for lico."""
__author__ = 'Sjoerd Kerkstra'
__email__ = 'w.s.kerkstra@example.com'
__version__ = '0.1.1' |
"""Stub implementation containing j2kt_provider helpers."""
def _to_j2kt_jvm_name(name):
"""Convert a label name used in j2cl to be used in j2kt jvm"""
if name.endswith("-j2cl"):
name = name[:-5]
return "%s-j2kt-jvm" % name
def _to_j2kt_native_name(name):
"""Convert a label name used in j2cl t... | """Stub implementation containing j2kt_provider helpers."""
def _to_j2kt_jvm_name(name):
"""Convert a label name used in j2cl to be used in j2kt jvm"""
if name.endswith('-j2cl'):
name = name[:-5]
return '%s-j2kt-jvm' % name
def _to_j2kt_native_name(name):
"""Convert a label name used in j2cl t... |
# Author: zhao-zh10
# -----------
# User Instructions:
#
# Modify the the search function so that it becomes
# an A* search algorithm as defined in the previous
# lectures.
#
# Your function should return the expanded grid
# which shows, for each element, the count when
# it was expanded or -1 if the element was never ... | grid = [[0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0]]
heuristic = [[9, 8, 7, 6, 5, 4], [8, 7, 6, 5, 4, 3], [7, 6, 5, 4, 3, 2], [6, 5, 4, 3, 2, 1], [5, 4, 3, 2, 1, 0]]
init = [0, 0]
goal = [len(grid) - 1, len(grid[0]) - 1]
cost = 1
delta = [[-1, 0], [0, -1], [1, 0], ... |
class Solution:
"""
@param nums: A list of integers
@return: A list of integers includes the index of the first number and the index of the last number
"""
def subarraySum(self, nums):
d = {}
d[0] = -1
L = len(nums)
index = 0
count = 0
while index < L ... | class Solution:
"""
@param nums: A list of integers
@return: A list of integers includes the index of the first number and the index of the last number
"""
def subarray_sum(self, nums):
d = {}
d[0] = -1
l = len(nums)
index = 0
count = 0
while index < ... |
# python3
class HeapBuilder:
def __init__(self):
self._swaps = []
self._data = []
def ReadData(self):
global n
n = int(input())
self._data = [int(s) for s in input().split()]
assert n == len(self._data)
def WriteResponse(self):
print(len(self._swaps))
for swap in self._... | class Heapbuilder:
def __init__(self):
self._swaps = []
self._data = []
def read_data(self):
global n
n = int(input())
self._data = [int(s) for s in input().split()]
assert n == len(self._data)
def write_response(self):
print(len(self._swaps))
... |
# python dict of naming overrides
GENE_NAME_OVERRIDE = {
# pmmo Genes
'EQU24_RS19315':'pmoC',
'EQU24_RS19310':'pmoA',
'EQU24_RS19305':'pmoB',
# smmo Genes
'EQU24_RS05930':'mmoR',
'EQU24_RS05925':'mmoG',
'EQU24_RS05910':'mmoC',
'EQU24_RS05900':'mmoZ',
'EQU24_RS05895':'mmoB',
'EQU24_RS05890':'mmoY',
'EQU24... | gene_name_override = {'EQU24_RS19315': 'pmoC', 'EQU24_RS19310': 'pmoA', 'EQU24_RS19305': 'pmoB', 'EQU24_RS05930': 'mmoR', 'EQU24_RS05925': 'mmoG', 'EQU24_RS05910': 'mmoC', 'EQU24_RS05900': 'mmoZ', 'EQU24_RS05895': 'mmoB', 'EQU24_RS05890': 'mmoY', 'EQU24_RS05885': 'mmoX', 'EQU24_RS17825': 'groS', 'EQU24_RS08650': 'groS'... |
"""
107. Word Break
https://www.lintcode.com/problem/word-break/description?_from=ladder&&fromId=160
Memoization
"""
class Solution:
"""
@param: s: A string
@param: dict: A dictionary of words dict
@return: A boolean
"""
def wordBreak(self, s, dict):
# write your code here
if dic... | """
107. Word Break
https://www.lintcode.com/problem/word-break/description?_from=ladder&&fromId=160
Memoization
"""
class Solution:
"""
@param: s: A string
@param: dict: A dictionary of words dict
@return: A boolean
"""
def word_break(self, s, dict):
if dict:
max_dict_word... |
class Coordinate:
coordX = 0
coordY = 0
def __init__(self, coordX=0, coordY=0):
self.coordX = coordX
self.coordY = coordY
pass
def set(self, coordX, coordY):
self.coordX = coordX
self.coordY = coordY
return coordX, coordY
if __name__ == '_... | class Coordinate:
coord_x = 0
coord_y = 0
def __init__(self, coordX=0, coordY=0):
self.coordX = coordX
self.coordY = coordY
pass
def set(self, coordX, coordY):
self.coordX = coordX
self.coordY = coordY
return (coordX, coordY)
if __name__ == '__main__':
... |
apiAttachAvailable = u'API Kullanilabilir'
apiAttachNotAvailable = u'Kullanilamiyor'
apiAttachPendingAuthorization = u'Yetkilendirme Bekliyor'
apiAttachRefused = u'Reddedildi'
apiAttachSuccess = u'Basarili oldu'
apiAttachUnknown = u'Bilinmiyor'
budDeletedFriend = u'Arkadas Listesinden Silindi'
budFriend = u'Arkadas'
bu... | api_attach_available = u'API Kullanilabilir'
api_attach_not_available = u'Kullanilamiyor'
api_attach_pending_authorization = u'Yetkilendirme Bekliyor'
api_attach_refused = u'Reddedildi'
api_attach_success = u'Basarili oldu'
api_attach_unknown = u'Bilinmiyor'
bud_deleted_friend = u'Arkadas Listesinden Silindi'
bud_frien... |
# Copyright (C) 2015-2016 Ammon Smith and Bradley Cai
# Available for use under the terms of the MIT License.
__all__ = [
'print_success',
'print_failure',
]
def print_success(target, usecolor, elapsed):
if usecolor:
start_color = '\033[32;4m'
end_color = '\033[0m'
else:
start... | __all__ = ['print_success', 'print_failure']
def print_success(target, usecolor, elapsed):
if usecolor:
start_color = '\x1b[32;4m'
end_color = '\x1b[0m'
else:
start_color = ''
end_color = ''
print("%sTarget '%s' ran successfully in %.4f seconds.%s" % (start_color, target, el... |
#
# PySNMP MIB module IANA-GMPLS-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IANA-GMPLS-TC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:19:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, constraints_intersection, value_range_constraint) ... |
letters = ["a", "e", "t", "o", "u"]
word = "CreepyNuts"
if (word[1] in letters) and (word[6] in letters):
print(0)
elif (word[1] in letters) or (word[6] in letters):
print(1)
else:
print(2)
| letters = ['a', 'e', 't', 'o', 'u']
word = 'CreepyNuts'
if word[1] in letters and word[6] in letters:
print(0)
elif word[1] in letters or word[6] in letters:
print(1)
else:
print(2) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 - hongzhi.wang <hongzhi.wang@moji.com>
'''
Author: hongzhi.wang
Create Date: 2019-09-04
Modify Date: 2019-09-04
'''
| """
Author: hongzhi.wang
Create Date: 2019-09-04
Modify Date: 2019-09-04
""" |
def parse_input(file):
return [[int(h) for h in l] for l in open(file).read().splitlines()]
input = parse_input('./day 09/Xavier - Python/input.txt')
example = parse_input('./day 09/Xavier - Python/example.txt')
def get_neighbours(map,i,j):
neighbours = []
if i > 0:
neighbours.append((i-1,j))
... | def parse_input(file):
return [[int(h) for h in l] for l in open(file).read().splitlines()]
input = parse_input('./day 09/Xavier - Python/input.txt')
example = parse_input('./day 09/Xavier - Python/example.txt')
def get_neighbours(map, i, j):
neighbours = []
if i > 0:
neighbours.append((i - 1, j))
... |
_base_ = ['./mask_rcnn_r50_8x2_1x.py']
model = dict(roi_head=dict(type='BTRoIHead',
bbox_head=dict(type='Shared2FCCBBoxHeadBT',
loss_cls=dict(type="EQLv2"),
loss_opl=dict(
... | _base_ = ['./mask_rcnn_r50_8x2_1x.py']
model = dict(roi_head=dict(type='BTRoIHead', bbox_head=dict(type='Shared2FCCBBoxHeadBT', loss_cls=dict(type='EQLv2'), loss_opl=dict(type='OrthogonalProjectionLoss', loss_weight=0.0), loss_bt=dict(type='BarlowTwinLoss', loss_weight=1.0))))
data = dict(train=dict(oversample_thr=0.00... |
# -*- coding: utf-8 -*-
# System
SYSTEM_LANGUAGE_KEY = 'System/Language'
SYSTEM_THEME_KEY = 'System/Theme'
SYSTEM_THEME_DEFAULT = 'System'
# File
FILE_SAVE_TO_DIR_KEY = 'File/SaveToDir'
FILE_SAVE_TO_DIR_DEFAULT = ''
FILE_FILENAME_PREFIX_FORMAT_KEY = 'File/FilenamePrefixFormat'
FILE_FILENAME_PREFIX_FORMAT_DEFAULT = ... | system_language_key = 'System/Language'
system_theme_key = 'System/Theme'
system_theme_default = 'System'
file_save_to_dir_key = 'File/SaveToDir'
file_save_to_dir_default = ''
file_filename_prefix_format_key = 'File/FilenamePrefixFormat'
file_filename_prefix_format_default = '{id}_{year}_{author}_{title}'
file_overwrit... |
#Get roll numbers, name & marks of the students of a class(get from user) and store these details in a file- marks.txt
count = int(input("How many students are there in class? "))
fileObj = open('marks.txt',"w")
for i in range(count):
print("Enter details for student",(i+1),"below:")
rollNo = int(input("Rolln... | count = int(input('How many students are there in class? '))
file_obj = open('marks.txt', 'w')
for i in range(count):
print('Enter details for student', i + 1, 'below:')
roll_no = int(input('Rollno: '))
name = input('Name: ')
marks = float(input('Marks: '))
records = str(rollNo) + ',' + name + ',' +... |
# -*- coding: utf-8 -*-
"""Untitled1.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1W2P2nxzaV_t_ePeJDnZMmbLkhvRxqZaF
"""
#used for quick sort algo
#pivot is taken as last element
def lomutoPartition(arr,l,h):
pivot=arr[h]
i=l-1
for j in r... | """Untitled1.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1W2P2nxzaV_t_ePeJDnZMmbLkhvRxqZaF
"""
def lomuto_partition(arr, l, h):
pivot = arr[h]
i = l - 1
for j in range(l, h):
if arr[j] < pivot:
i = i + 1
... |
# id: 640;Stairs
# title:"Schody",
# about:"",
# robotCol:3,
# robotRow:10,
# robotDir:3,
# subs:[3,3,0,0,0],
# allowedCommands:0,
# board:" ggggggggGG gggggggGGg ggggggGGgg gggggGGggg ggggGGgggg gggGGggggg ggGGgggggg gGGggggggg GGgggggggg gggggggggg ... | class Problem:
def __init__(self, parse_str):
gen = self.__lineGenerator(parse_str)
self.id = next(gen)
self.title = next(gen)
self.about = next(gen)
self.robotCol = int(next(gen))
self.robotRow = int(next(gen))
self.robotDir = int(next(gen))
self.sub... |
class DSU:
def __init__(self, N):
self.par = list(range(N))
def find(self, U):
if self.par[U] != U:
self.par[U] = self.find(self.par[U])
return self.par[U]
def union(self, U, V):
X, Y = self.find(U), self.find(V)
self.par[X] = Y
class Solution:
def... | class Dsu:
def __init__(self, N):
self.par = list(range(N))
def find(self, U):
if self.par[U] != U:
self.par[U] = self.find(self.par[U])
return self.par[U]
def union(self, U, V):
(x, y) = (self.find(U), self.find(V))
self.par[X] = Y
class Solution:
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 29 09:58:39 2018
@author: nsde
"""
#%%
#%%
def tf_mahalanobisTransformer(X, scope='mahalanobis_transformer'):
""" Creates a transformer function that for an given input matrix X,
calculates the linear transformation L*X_i """
with t... | """
Created on Tue May 29 09:58:39 2018
@author: nsde
"""
def tf_mahalanobis_transformer(X, scope='mahalanobis_transformer'):
""" Creates a transformer function that for an given input matrix X,
calculates the linear transformation L*X_i """
with tf.variable_scope(scope, reuse=tf.AUTO_REUSE, values=[... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# simple dictionary
mybasket = {'apple':2.99,'orange':1.99,'milk':5.8}
print(mybasket['apple'])
# dictionary with list inside
mynestedbasket = {'apple':2.99,'orange':1.99,'milk':['chocolate','stawbery']}
print(mynestedbasket['milk'][1].upper())
# append more key
myba... | mybasket = {'apple': 2.99, 'orange': 1.99, 'milk': 5.8}
print(mybasket['apple'])
mynestedbasket = {'apple': 2.99, 'orange': 1.99, 'milk': ['chocolate', 'stawbery']}
print(mynestedbasket['milk'][1].upper())
mybasket['pizza'] = 4.5
print(mybasket)
print(mybasket.keys())
print(mybasket.values())
print(mybasket.items()) |
class Solution:
def islandPerimeter(self, grid: List[List[int]]) -> int:
if not grid or not grid[0]:
return 0
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j]:
return self.dfs(grid, i, j)
return 0
def dfs... | class Solution:
def island_perimeter(self, grid: List[List[int]]) -> int:
if not grid or not grid[0]:
return 0
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j]:
return self.dfs(grid, i, j)
return 0
def df... |
class Solution:
def addBinary(self, a, b):
res, carry = '', 0
i, j = len(a) - 1, len(b) - 1
while i >= 0 or j >= 0 or carry:
curval = (i >= 0 and a[i] == '1') + (j >= 0 and b[j] == '1')
carry, rem = divmod(curval + carry, 2)
res = str(rem) + res
... | class Solution:
def add_binary(self, a, b):
(res, carry) = ('', 0)
(i, j) = (len(a) - 1, len(b) - 1)
while i >= 0 or j >= 0 or carry:
curval = (i >= 0 and a[i] == '1') + (j >= 0 and b[j] == '1')
(carry, rem) = divmod(curval + carry, 2)
res = str(rem) + re... |
#this function would write data in the database
def write_data(name, phone, pincode, city, resources):
#here we will connect to database
#and write to it
f = open('/Users/mukesht/Mukesh/Github/covid_resource/resource_item.text', 'a')
f.write(name + ', ' + phone + ', ' + pincode + ', ' + city + ', [' + resource... | def write_data(name, phone, pincode, city, resources):
f = open('/Users/mukesht/Mukesh/Github/covid_resource/resource_item.text', 'a')
f.write(name + ', ' + phone + ', ' + pincode + ', ' + city + ', [' + resources + ']\n')
f.close()
write_data('Hello World', '657254762', '232101', 'Mughalsarai', '[ Oxygen, ... |
def validate(n):
string = str(n)
mod = 0 if len(string) % 2 == 0 else 1 # 0 for even, 1 for odd
total = 0
for i, a in enumerate(string):
current = int(a)
if i % 2 == mod:
double = current * 2
if double > 9:
total += double - 9
else:
... | def validate(n):
string = str(n)
mod = 0 if len(string) % 2 == 0 else 1
total = 0
for (i, a) in enumerate(string):
current = int(a)
if i % 2 == mod:
double = current * 2
if double > 9:
total += double - 9
else:
total += ... |
expected_output = {
"interfaces": {
"Port-channel1": {
"name": "Port-channel1",
"protocol": "lacp",
"members": {
"GigabitEthernet0/0/1": {
"activity": "Active",
"age": 18,
"aggregatable": True,
... | expected_output = {'interfaces': {'Port-channel1': {'name': 'Port-channel1', 'protocol': 'lacp', 'members': {'GigabitEthernet0/0/1': {'activity': 'Active', 'age': 18, 'aggregatable': True, 'collecting': True, 'defaulted': False, 'distributing': True, 'expired': False, 'flags': 'FA', 'interface': 'GigabitEthernet0/0/1',... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
inputs = [
"LLLRLLULLDDLDUDRDDURLDDRDLRDDRUULRULLLDLUURUUUDLUUDLRUDLDUDURRLDRRRUULUURLUDRURULRLRLRRUULRUUUDRRDDRLLLDDLLUDDDLLRLLULULRRURRRLDRLDLLRURDULLDULRUURLRUDRURLRRDLLDDURLDDLUDLRLUURDRDRDDUURDDLDDDRUDULDLRDRDDURDLUDDDRUDLUDLULULRUURLRUUUDDRLDULLLUDLULDUUDLDLRRLLLRLDUDRUU... | inputs = ['LLLRLLULLDDLDUDRDDURLDDRDLRDDRUULRULLLDLUURUUUDLUUDLRUDLDUDURRLDRRRUULUURLUDRURULRLRLRRUULRUUUDRRDDRLLLDDLLUDDDLLRLLULULRRURRRLDRLDLLRURDULLDULRUURLRUDRURLRRDLLDDURLDDLUDLRLUURDRDRDDUURDDLDDDRUDULDLRDRDDURDLUDDDRUDLUDLULULRUURLRUUUDDRLDULLLUDLULDUUDLDLRRLLLRLDUDRUULDLDRDLRRDLDLULUUDRRUDDDRDLRLDLRDUDRULDRDURR... |
#!/usr/bin/env python3
def num_sol(n):
if n==1:
return 1
if n==2:
return 2
solu=num_sol(n-1)+num_sol(n-2)
return solu
# def unrank(n, pos, sorting_criterion="loves_long_tiles"):
# return "(" + unrank(n_in_A, (pos-count) // num_B) + ")" + unrank(n - n_in_A -1, (pos-count) % num... | def num_sol(n):
if n == 1:
return 1
if n == 2:
return 2
solu = num_sol(n - 1) + num_sol(n - 2)
return solu
def unrank(n):
if num_sol(n) == 1:
return ['[]']
if num_sol(n) == 2:
return ['[][]', '[--]']
solu1 = []
solu2 = []
for i in range(num_sol(n - 1)... |
def check_geneassessment(result, payload, previous_assessment_id=None):
assert result["gene_id"] == payload["gene_id"]
assert result["evaluation"] == payload["evaluation"]
assert result["analysis_id"] == payload.get("analysis_id")
assert result["genepanel_name"] == payload["genepanel_name"]
assert r... | def check_geneassessment(result, payload, previous_assessment_id=None):
assert result['gene_id'] == payload['gene_id']
assert result['evaluation'] == payload['evaluation']
assert result['analysis_id'] == payload.get('analysis_id')
assert result['genepanel_name'] == payload['genepanel_name']
assert r... |
def run(m):
sites = m.qualify(["""
SELECT ?equip ?sensor ?setpoint ?sensor_uuid ?setpoint_uuid WHERE {
?setpoint rdf:type/rdfs:subClassOf* brick:Air_Flow_Setpoint .
?sensor rdf:type/rdfs:subClassOf* brick:Air_Flow_Sensor .
?setpoint bf:isPointOf ?equip .
?sensor b... | def run(m):
sites = m.qualify(['\n SELECT ?equip ?sensor ?setpoint ?sensor_uuid ?setpoint_uuid WHERE {\n ?setpoint rdf:type/rdfs:subClassOf* brick:Air_Flow_Setpoint .\n ?sensor rdf:type/rdfs:subClassOf* brick:Air_Flow_Sensor .\n ?setpoint bf:isPointOf ?equip .\n ?sensor ... |
class Edge:
def __init__(self, start, end):
self.start = start
self.end = end
def __str__(self):
return "<" + str(self.start) + " " + str(self.end) + ">"
| class Edge:
def __init__(self, start, end):
self.start = start
self.end = end
def __str__(self):
return '<' + str(self.start) + ' ' + str(self.end) + '>' |
class Solution:
def minOperations(self, boxes: str) -> List[int]:
ans = [0]*len(boxes)
lc = 0
lcost = 0
rc = 0
rcost = 0
for i in range(1,len(boxes)):
if boxes[i-1]=="1": lc+=1
lcost += lc
ans[i] = lcost
for i in range(len(... | class Solution:
def min_operations(self, boxes: str) -> List[int]:
ans = [0] * len(boxes)
lc = 0
lcost = 0
rc = 0
rcost = 0
for i in range(1, len(boxes)):
if boxes[i - 1] == '1':
lc += 1
lcost += lc
ans[i] = lcost
... |
class Solution:
def evalRPN(self, tokens: List[str]) -> int:
stack = []
op = {
"+": lambda x, y: x + y,
"-": lambda x, y: x - y,
"*": lambda x, y: x * y,
"/": lambda x, y: x // y if x * y >= 0 else -(-x // y),
}
for token in tokens:
... | class Solution:
def eval_rpn(self, tokens: List[str]) -> int:
stack = []
op = {'+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x // y if x * y >= 0 else -(-x // y)}
for token in tokens:
if token in op:
n2 = stack.pop()... |
# Created by MechAviv
# Map ID :: 402000630
# Desert Cavern : Below the Sinkhole
# Update Quest Record EX | Quest ID: [34931] | Data: dir=1;exp=1
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, False, False, False)
sm.setStandAloneMode(True)
sm.removeAdditionalEffect()
sm.zoomCamera... | sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, False, False, False)
sm.setStandAloneMode(True)
sm.removeAdditionalEffect()
sm.zoomCamera(0, 2000, 0, -142, -250)
sm.blind(1, 255, 0, 0, 0, 0, 0)
sm.sendDelay(1200)
sm.blind(0, 0, 0, 0, 0, 1000, 0)
sm.sendDelay(1400)
sm.sendDelay(500)
s... |
# "directions" are all the ways you can describe going some way;
# they are code-visible names for directions for adventure authors
direction_names = ["NORTH","SOUTH","EAST","WEST","UP","DOWN","RIGHT","LEFT",
"IN","OUT","FORWARD","BACK",
"NORTHWEST","NORTHEAST","SOUTHWEST","SOUTHE... | direction_names = ['NORTH', 'SOUTH', 'EAST', 'WEST', 'UP', 'DOWN', 'RIGHT', 'LEFT', 'IN', 'OUT', 'FORWARD', 'BACK', 'NORTHWEST', 'NORTHEAST', 'SOUTHWEST', 'SOUTHEAST']
direction_list = [north, south, east, west, up, down, right, left, in, out, forward, back, northwest, northeast, southwest, southeast] = range(len(direc... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def upsideDownBinaryTree(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
... | class Solution(object):
def upside_down_binary_tree(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
if not root:
return
left = self.upsideDownBinaryTree(root.left)
right = self.upsideDownBinaryTree(root.right)
if root.left:
... |
"""Top-level package for clinepunk."""
__author__ = """Taylor Monacelli"""
__email__ = "taylormonacelli@gmail.com"
__version__ = "0.1.14"
| """Top-level package for clinepunk."""
__author__ = 'Taylor Monacelli'
__email__ = 'taylormonacelli@gmail.com'
__version__ = '0.1.14' |
# -*- coding:utf-8 -*-
__author__ = 'zhangzhibo'
__date__ = '202018/5/18 16:56'
| __author__ = 'zhangzhibo'
__date__ = '202018/5/18 16:56' |
#Clases del ciclo de lavado
class lavando:
#Etapa 1. Lavado
def lavado(self):
print("Lavando...")
class enjuagando:
#Etapa 2. Enjuagado
def enjuagado(self):
print("Enjuagando...")
class centrifugando:
#Etapa 3. Centrifugado
def centrifugado(self):
print("Centrifugando.... | class Lavando:
def lavado(self):
print('Lavando...')
class Enjuagando:
def enjuagado(self):
print('Enjuagando...')
class Centrifugando:
def centrifugado(self):
print('Centrifugando...')
class Finalizado:
def finalizar(self):
print('Finalizado!')
class Lavadorafaca... |
'''
Date: 01/08/2019
Problem description:
===================
This problem was asked by Google.
Given an array of integers where every integer occurs three times
except for one integer, which only occurs once, find and return the
non-duplicated integer.
For example, given [6, 1, 3, 3, 3, 6, 6], return 1.
Given [1... | """
Date: 01/08/2019
Problem description:
===================
This problem was asked by Google.
Given an array of integers where every integer occurs three times
except for one integer, which only occurs once, find and return the
non-duplicated integer.
For example, given [6, 1, 3, 3, 3, 6, 6], return 1.
Given [1... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class FormatPipeline(object):
"""
All crawled items are passed through this pipeline
"""
def process_item(self... | class Formatpipeline(object):
"""
All crawled items are passed through this pipeline
"""
def process_item(self, item, spider):
"""
Process an item produced by the spider
"""
item['link'] = item['link'].strip()
item['category'] = [x.strip() for x in item['category... |
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def mergeKLists(self, lists):
"""
:type lists: List[ListNode]
:rtype: ListNode
"""
head = ListNode(0)
curr = ... | class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def merge_k_lists(self, lists):
"""
:type lists: List[ListNode]
:rtype: ListNode
"""
head = list_node(0)
curr = head
currs = [h for h in... |
START_BRAKING = 17
END_BRAKING = 25
BRAKE_SPEED = 1
""" Straight, please """
def reward_function(params):
# No rewards shaping yet, just add a brake by track position
if params['closest_waypoints'][0] >= START_BRAKING and params['closest_waypoints'][0] >= END_BRAKING and params['speed'] == BRAKE_SPEED:
... | start_braking = 17
end_braking = 25
brake_speed = 1
' Straight, please '
def reward_function(params):
if params['closest_waypoints'][0] >= START_BRAKING and params['closest_waypoints'][0] >= END_BRAKING and (params['speed'] == BRAKE_SPEED):
reward = 1
elif params['speed'] > BRAKE_SPEED:
reward ... |
# See file COPYING distributed with xnatrest for copyright and license.
class XNATRESTError(Exception):
"""base class for xnatrest exceptions"""
class CircularReferenceError(XNATRESTError):
def __init__(self, url):
self.url = url
return
def __str__(self):
return 'circular refere... | class Xnatresterror(Exception):
"""base class for xnatrest exceptions"""
class Circularreferenceerror(XNATRESTError):
def __init__(self, url):
self.url = url
return
def __str__(self):
return 'circular reference to %s' % self.url
class Unidentifiedservererror(XNATRESTError):
... |
# Start and end date
gldas_start_date = '2010-01-01'
gldas_end_date = '2014-01-01'
# Location (Latitude and Longitude)
gldas_geo_point = AutoParam([(38, -117), (38, -118)])
# Create data fetcher
gldasdf = GLDASDF([gldas_geo_point],start_date=gldas_start_date,
end_date=gldas_end_date, resample=Fals... | gldas_start_date = '2010-01-01'
gldas_end_date = '2014-01-01'
gldas_geo_point = auto_param([(38, -117), (38, -118)])
gldasdf = gldasdf([gldas_geo_point], start_date=gldas_start_date, end_date=gldas_end_date, resample=False) |
class IDGroup:
"""
The IDGroup Type
================
This type supports both iteration and the []
operator to get child ID properties.
You can also add new properties using the [] operator.
For example::
group['a float!'] = 0.0
group['an int!'] = 0
group['a string!'] = "hi!"
group['an array!'] = [0, ... | class Idgroup:
"""
The IDGroup Type
================
This type supports both iteration and the []
operator to get child ID properties.
You can also add new properties using the [] operator.
For example::
group['a float!'] = 0.0
group['an int!'] = 0
group['a string!'] = "hi!"
group['an array!'] = [... |
"""
Let's call an array A a mountain if the following properties hold:
A.length >= 3
There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1]
Given an array that is definitely a mountain, return any i such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] >... | """
Let's call an array A a mountain if the following properties hold:
A.length >= 3
There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1]
Given an array that is definitely a mountain, return any i such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] >... |
def hola():
def bienvenido():
print("hola!")
return bienvenido
# hola()()
def mensaje():
return "Este es un mensaje"
def test(function):
print(mensaje())
test(mensaje)
| def hola():
def bienvenido():
print('hola!')
return bienvenido
def mensaje():
return 'Este es un mensaje'
def test(function):
print(mensaje())
test(mensaje) |
def combination(a: int, b: int) -> int:
"""
Choose b from a. a >= b
"""
b = min(b, a - b)
numerator = 1
dominator = 1
for i in range(b):
numerator *= (a - i)
dominator *= (b - i)
return int(numerator / dominator)
if __name__ == '__main__':
t = int(input())
for... | def combination(a: int, b: int) -> int:
"""
Choose b from a. a >= b
"""
b = min(b, a - b)
numerator = 1
dominator = 1
for i in range(b):
numerator *= a - i
dominator *= b - i
return int(numerator / dominator)
if __name__ == '__main__':
t = int(input())
for _ in ra... |
# Getting all PAL : Prime and pallindrome numbers between two given numbers
def pallindrome(n):
temp=n
rev=0
while(n>0):
dig = n % 10
rev=rev*10 +dig
n = n/10
if temp == rev:
return True
else:
return False
def isprime(n):
if n<=1:
return False
if n<=3:
return True
if n % 2 == 0 or n % 3 == ... | def pallindrome(n):
temp = n
rev = 0
while n > 0:
dig = n % 10
rev = rev * 10 + dig
n = n / 10
if temp == rev:
return True
else:
return False
def isprime(n):
if n <= 1:
return False
if n <= 3:
return True
if n % 2 == 0 or n % 3 == ... |
async def iter_to_aiter(iter):
"""
:type iter: synchronous iterator
:param iter: a synchronous iterator
This converts a regular iterator to an async iterator.
"""
for _ in iter:
yield _
| async def iter_to_aiter(iter):
"""
:type iter: synchronous iterator
:param iter: a synchronous iterator
This converts a regular iterator to an async iterator.
"""
for _ in iter:
yield _ |
# buttons
PIN_BUTTON_PROG = 17
PIN_BUTTON_ERASE = 27
# LEDs
PIN_RED = 23
PIN_GREEN = 24
PIN_BLUE = 20
PIN_BLUE2 = 25
# Jumpers
PINS_PROFILES = [5, 6, 13, 19]
# MCU
PIN_RESET_ATMEGA = 16
PIN_MASTER_POWER = 12
PIN_ESP_RESET = 8
PIN_ESP_GPIO_0 = 4
# MISC
PIN_BUZZER = 26
# Interfaces
DEFAULT_SERIAL_SPEED = 9600
DEFAUL... | pin_button_prog = 17
pin_button_erase = 27
pin_red = 23
pin_green = 24
pin_blue = 20
pin_blue2 = 25
pins_profiles = [5, 6, 13, 19]
pin_reset_atmega = 16
pin_master_power = 12
pin_esp_reset = 8
pin_esp_gpio_0 = 4
pin_buzzer = 26
default_serial_speed = 9600
default_prgm_comm_speed = 115200
serial_port = '/dev/serial0' |
# -*- coding: utf-8 -*-
smtpserver = "smtp.qq.com" # will be read by smtp fixture
def test_showhelo(smtp_connection):
assert 0, smtp_connection.helo() | smtpserver = 'smtp.qq.com'
def test_showhelo(smtp_connection):
assert 0, smtp_connection.helo() |
# -*- coding: utf-8 -*-
project = 'test'
master_doc = 'index'
| project = 'test'
master_doc = 'index' |
s, n = map(int, input().split())
arr = [0] * n
for i in range(s):
p = int(input())
for j in range(0, len(arr), p):
arr[j] = 1
for i in arr:
print(i, end=" ")
print()
| (s, n) = map(int, input().split())
arr = [0] * n
for i in range(s):
p = int(input())
for j in range(0, len(arr), p):
arr[j] = 1
for i in arr:
print(i, end=' ')
print() |
CHAMP_ID_TO_EMOJI = {'266': '<:champ_266:601909182748164097>', '103': '<:champ_103:601909185243774976>', '84': '<:champ_84:601909188612063233>', '12': '<:champ_12:601909190809878530>', '32': '<:champ_32:601909193456222221>', '34': '<:champ_34:601909195968610356>', '1': '<:champ_1:601909198799896690>', '22': '<:champ_22... | champ_id_to_emoji = {'266': '<:champ_266:601909182748164097>', '103': '<:champ_103:601909185243774976>', '84': '<:champ_84:601909188612063233>', '12': '<:champ_12:601909190809878530>', '32': '<:champ_32:601909193456222221>', '34': '<:champ_34:601909195968610356>', '1': '<:champ_1:601909198799896690>', '22': '<:champ_22... |
"""Module that defines constants shared between agents."""
# pattoo-snmp constants
PATTOO_AGENT_SNMPD = 'pattoo_agent_snmpd'
PATTOO_AGENT_SNMP_IFMIBD = 'pattoo_agent_snmp_ifmibd'
| """Module that defines constants shared between agents."""
pattoo_agent_snmpd = 'pattoo_agent_snmpd'
pattoo_agent_snmp_ifmibd = 'pattoo_agent_snmp_ifmibd' |
class Preciousstone:
def __init__(self):
self.preciousStone = []
def storePreciousStone(self,name):
self.preciousStone.append(name)
if( len(self.preciousStone) > 5):
del(self.preciousStone[0])
def displayPreciousStone(self):
if(... | class Preciousstone:
def __init__(self):
self.preciousStone = []
def store_precious_stone(self, name):
self.preciousStone.append(name)
if len(self.preciousStone) > 5:
del self.preciousStone[0]
def display_precious_stone(self):
if len(self.preciousStone) > 0:
... |
class BufferList:
def __init__(self, maxlen):
self.data = []
self.maxlen = maxlen
def append(self, el):
if len(self.data) == self.maxlen:
popped = self.data.pop(0)
else:
popped = None
self.data.append(el)
return popped
de... | class Bufferlist:
def __init__(self, maxlen):
self.data = []
self.maxlen = maxlen
def append(self, el):
if len(self.data) == self.maxlen:
popped = self.data.pop(0)
else:
popped = None
self.data.append(el)
return popped
def peek(self,... |
actor_name = input("Enter the actor's name: ")
initial_points = int(input("Enter the points form academy: "))
judges_count = int(input("Enter the number of jury: "))
points_needed = 1250.5
for jury in range(judges_count):
judges_name = input("Enter the name of jury: ")
points_from_judge = float(input("Enter t... | actor_name = input("Enter the actor's name: ")
initial_points = int(input('Enter the points form academy: '))
judges_count = int(input('Enter the number of jury: '))
points_needed = 1250.5
for jury in range(judges_count):
judges_name = input('Enter the name of jury: ')
points_from_judge = float(input('Enter the... |
print("hello world")
a = 3
b = 4
c = a * b
print(c)
| print('hello world')
a = 3
b = 4
c = a * b
print(c) |
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
def get_resize_target(img_sz, crop_target, do_crop=False):
if crop_target is None: return None
ch,r,c = img_sz
target_r,target_c = c... | def get_resize_target(img_sz, crop_target, do_crop=False):
if crop_target is None:
return None
(ch, r, c) = img_sz
(target_r, target_c) = crop_target
ratio = (min if do_crop else max)(r / target_r, c / target_c)
return (ch, round(r / ratio), round(c / ratio)) |
# -*- coding: utf-8 -*-
"""
Created on August 26 20:16:44 2018
@author: ahmad
"""
"""
a program to encrypt and decrypt data in 8-bit XOR encryption using all
built-in functions. No libraries used. This program is for learning puposes
"""
def xor(x,y): #function to cypher text
g = []
for i in range(len(x)):
if ... | """
Created on August 26 20:16:44 2018
@author: ahmad
"""
'\na program to encrypt and decrypt data in 8-bit XOR encryption using all\nbuilt-in functions. No libraries used. This program is for learning puposes\n'
def xor(x, y):
g = []
for i in range(len(x)):
if x[i] == y[i]:
g.append(0)
... |
def func3(a):
a/0;
def func2(a, b):
func3(a);
def func1(a, b, c):
func2(a, b);
if __name__ == "__main__":
func1(12, 0, 89) | def func3(a):
a / 0
def func2(a, b):
func3(a)
def func1(a, b, c):
func2(a, b)
if __name__ == '__main__':
func1(12, 0, 89) |
def setup():
global pg
pg = createGraphics(1000, 1000)
noLoop()
def draw():
pg.beginDraw()
pg.colorMode(HSB, 360, 100, 100, 100)
pg.background(0, 0, 25)
pg.stroke(60, 7, 86, 100)
pg.noFill()
for i in range(100):
pg.ellipse(random(pg.width), random(pg.height), 100, 100)
pg.endDraw()
pg.save(... | def setup():
global pg
pg = create_graphics(1000, 1000)
no_loop()
def draw():
pg.beginDraw()
pg.colorMode(HSB, 360, 100, 100, 100)
pg.background(0, 0, 25)
pg.stroke(60, 7, 86, 100)
pg.noFill()
for i in range(100):
pg.ellipse(random(pg.width), random(pg.height), 100, 100)
... |
"""
File: anagram.py
Name: Yujing Wei
----------------------------------
This program recursively finds all the anagram(s)
for the word input by user and terminates when the
input string matches the EXIT constant defined
at line 19
If you correctly implement this program, you should see the
number of anagrams for each... | """
File: anagram.py
Name: Yujing Wei
----------------------------------
This program recursively finds all the anagram(s)
for the word input by user and terminates when the
input string matches the EXIT constant defined
at line 19
If you correctly implement this program, you should see the
number of anagrams for each... |
n=list(map(int,input("Enter the list").split(",")))
le=max(n)
while max(n)==le:
n.remove(max(n))
print(max(n))
| n = list(map(int, input('Enter the list').split(',')))
le = max(n)
while max(n) == le:
n.remove(max(n))
print(max(n)) |
class Solution(object):
def arrayPairSum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return sum([c for i, c in enumerate(sorted(nums)) if i % 2 == 0]) | class Solution(object):
def array_pair_sum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return sum([c for (i, c) in enumerate(sorted(nums)) if i % 2 == 0]) |
for i in range(int(input())):
text = input().replace('.', '')
countOpen = 0
countDiamonds = 0
for char in text:
if char == '<':
countOpen += 1
elif char == '>' and countOpen > 0:
countDiamonds += 1
countOpen -= 1
print(countDiamonds) | for i in range(int(input())):
text = input().replace('.', '')
count_open = 0
count_diamonds = 0
for char in text:
if char == '<':
count_open += 1
elif char == '>' and countOpen > 0:
count_diamonds += 1
count_open -= 1
print(countDiamonds) |
def read_n_values(n):
print("Please enter", n, "values.")
values = []
for i in range(n):
values.append(input("Value {}: ".format(i + 1)))
return values
def compute_average(values):
# set sum to first value of list
total_sum = values[0]
# iterate over remaining values and add them... | def read_n_values(n):
print('Please enter', n, 'values.')
values = []
for i in range(n):
values.append(input('Value {}: '.format(i + 1)))
return values
def compute_average(values):
total_sum = values[0]
for value in values[1:]:
total_sum += value
return float(total_sum) / le... |
load("@rules_python//python:python.bzl", "py_binary", "py_library", "py_test")
def py3_library(*args, **kwargs):
py_library(
srcs_version = "PY3",
*args,
**kwargs
)
def py3_binary(name, main = None, *args, **kwargs):
if main == None:
main = "%s.py" % (name)
py_binary(
... | load('@rules_python//python:python.bzl', 'py_binary', 'py_library', 'py_test')
def py3_library(*args, **kwargs):
py_library(*args, srcs_version='PY3', **kwargs)
def py3_binary(name, main=None, *args, **kwargs):
if main == None:
main = '%s.py' % name
py_binary(*args, name=name, main=main, legacy_cr... |
try:
test = int(input().strip())
while test!=0:
k,d0,d1 = map(int,input().strip().split())
d2 = (d1+d0)%10
if k == 2:
if (d1+d0)%3 == 0:
print("YES")
continue
else:
print("NO")
continue
elif k... | try:
test = int(input().strip())
while test != 0:
(k, d0, d1) = map(int, input().strip().split())
d2 = (d1 + d0) % 10
if k == 2:
if (d1 + d0) % 3 == 0:
print('YES')
continue
else:
print('NO')
continue... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.