content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
a = 1
b = 2
c = a + b
d = '668'
| a = 1
b = 2
c = a + b
d = '668' |
class RowSource(object):
def get_rows(self, start, count):
raise Exception("not implemented")
class FileRowSource(RowSource):
def __init__(self, fileobj):
super().__init__();
self.fileobj = fileobj
def next_page(self, rows):
lines = []
for i in range(rows):
... | class Rowsource(object):
def get_rows(self, start, count):
raise exception('not implemented')
class Filerowsource(RowSource):
def __init__(self, fileobj):
super().__init__()
self.fileobj = fileobj
def next_page(self, rows):
lines = []
for i in range(rows):
... |
#!/usr/bin/env python3
name = input("what is your name? ")
print("hello", name)
| name = input('what is your name? ')
print('hello', name) |
class LexStatusCodes:
LA_OK = 0
LA_FAIL = 1
LA_EXPIRED = 20
LA_SUSPENDED = 21
LA_GRACE_PERIOD_OVER = 22
LA_TRIAL_EXPIRED = 25
LA_LOCAL_TRIAL_EXPIRED = 26
LA_RELEASE_UPDATE_AVAILABLE = 30
LA_RELEASE_NO_UPDATE_AVAILABLE = 31
LA_E_FILE_PATH = 40
LA_E_PRODUCT_FILE = 41
... | class Lexstatuscodes:
la_ok = 0
la_fail = 1
la_expired = 20
la_suspended = 21
la_grace_period_over = 22
la_trial_expired = 25
la_local_trial_expired = 26
la_release_update_available = 30
la_release_no_update_available = 31
la_e_file_path = 40
la_e_product_file = 41
la_e_p... |
DEBUG=True
DEBUG_EXTRACT=True
DEBUG_ROOIBOS=True
DEBUG_PATCH_LOCATIONS=True
DEBUG_RESOLVE_DYNLIB=True
DEBUG_ADDR2LINE=True
DEBUG_PATCHING=True
DEBUG_LTRACE=False
DEBUG_FIND=True
TEST=True
| debug = True
debug_extract = True
debug_rooibos = True
debug_patch_locations = True
debug_resolve_dynlib = True
debug_addr2_line = True
debug_patching = True
debug_ltrace = False
debug_find = True
test = True |
class GuacamoleConfiguration(object):
def __init__(self, protocol=None):
self.connectionID = None
self.protocol = protocol
self.parameters = {}
@property
def connectionID(self):
return self._connectionID
@connectionID.setter
def connectionID(self, connectionID):
... | class Guacamoleconfiguration(object):
def __init__(self, protocol=None):
self.connectionID = None
self.protocol = protocol
self.parameters = {}
@property
def connection_id(self):
return self._connectionID
@connectionID.setter
def connection_id(self, connectionID):
... |
a, b, c = input().split(" ")
a = float(a)
b = float(b)
c = float(c)
if a >= b and a >= c:
n1 = a
if b >= c:
n2 = b
n3 = c
else:
n2 = c
n3 = b
if b >= a and b >= c:
n1 = b
if a >= c:
n2 = a
n3 = c
else:
n2 = c
n3 = a
if c >= a and c... | (a, b, c) = input().split(' ')
a = float(a)
b = float(b)
c = float(c)
if a >= b and a >= c:
n1 = a
if b >= c:
n2 = b
n3 = c
else:
n2 = c
n3 = b
if b >= a and b >= c:
n1 = b
if a >= c:
n2 = a
n3 = c
else:
n2 = c
n3 = a
if c >= a and ... |
def only_numbers(input_list):
integers_list = [list_entry for list_entry in input_list if type(list_entry) == int]
return integers_list
print(only_numbers([99, 'no data', 95, 93, 'no data']))
def only_numbers_greater_zero(input_list):
integers_list = [list_entry for list_entry in input_list if list_entry... | def only_numbers(input_list):
integers_list = [list_entry for list_entry in input_list if type(list_entry) == int]
return integers_list
print(only_numbers([99, 'no data', 95, 93, 'no data']))
def only_numbers_greater_zero(input_list):
integers_list = [list_entry for list_entry in input_list if list_entry >... |
## https://docs.python.org/3/howto/logging-cookbook.html#an-example-dictionary-based-configuration
## https://docs.djangoproject.com/en/1.9/topics/logging/#configuring-logging
logcfg = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)... | logcfg = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'verbose': {'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'}, 'simple': {'format': '[%(levelname)s]:[%(filename)s:%(lineno)d - %(funcName)20s() ]: %(message)s'}, 'standard': {'format': '%(asctime)s:[%(levelname... |
# Rolling hash usage of a multiply accumlate unit with multiplier from the FNV hash, but linear style like the Ghash of AES-GCM
def rolling_hash_by_mac(list):
hash = 0
for byte in list:
hash += byte
hash *= 0x01000193
hash %= 2**32
return(hash)
#powers of the multiplier o... | def rolling_hash_by_mac(list):
hash = 0
for byte in list:
hash += byte
hash *= 16777619
hash %= 2 ** 32
return hash
list1 = [88, 118, 84, 58, 190, 205]
list2 = [88, 103, 84, 58, 235, 205]
x = rolling_hash_by_mac(list1)
y = rolling_hash_by_mac(list2)
print('1st hash:', x)
print('2nd h... |
# OpenWeatherMap API Key
weather_api_key = "bfabad3eec079b77cd6e28110d3ad22f"
# Google API Key
g_key = "AIzaSyBKZyrmnIxatibyVFhiPyCHD87TQW0ulAA"
| weather_api_key = 'bfabad3eec079b77cd6e28110d3ad22f'
g_key = 'AIzaSyBKZyrmnIxatibyVFhiPyCHD87TQW0ulAA' |
target = 1000000
for i in range(1,500001):
if target % i != 0: continue
if '0' in str(i): continue
j = int(target / i)
if '0' in str(j): continue
print ('Factors: ' + str(i) + ' : ' + str(j))
exit
| target = 1000000
for i in range(1, 500001):
if target % i != 0:
continue
if '0' in str(i):
continue
j = int(target / i)
if '0' in str(j):
continue
print('Factors: ' + str(i) + ' : ' + str(j))
exit |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__all__ = ["test_bettersis", "test_siscompleter", "test_texteditor", "test_update_checker"]
| __all__ = ['test_bettersis', 'test_siscompleter', 'test_texteditor', 'test_update_checker'] |
'''
Dataset information
'''
coco_classes = [
'person',
'bicycle',
'car',
'motorcycle',
'airplane',
'bus',
'train',
'truck',
'boat',
'traffic_light',
'fire_hydrant',
'stop_sign',
'parking_meter',
'bench',
'bird',
'cat',
'dog',
'horse',
'sheep',... | """
Dataset information
"""
coco_classes = ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic_light', 'fire_hydrant', 'stop_sign', 'parking_meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handb... |
line = input().split()
n = int(line[0])
t = int(line[1])
visited = {0}
line = [int(i) for i in input().split()]
current = 1
while(current != t):
if(current in visited or current > len(line)):
print("NO")
break
else:
visited.add(current)
current += line[current - 1]
if(current == ... | line = input().split()
n = int(line[0])
t = int(line[1])
visited = {0}
line = [int(i) for i in input().split()]
current = 1
while current != t:
if current in visited or current > len(line):
print('NO')
break
else:
visited.add(current)
current += line[current - 1]
if current == t:... |
# Create a task list. A user is presented with the text below.
# Let them select an option to list all of their tasks, add a task to their list, delete a task, or quit the program.
# Make each option a different function in your program.
# Do NOT use Google.
# Do NOT use other students.
# Try to do this on your own.
... | def main():
problem1()
def problem1():
user = ''
things_to_do = ['dishes', 'cut grass', 'cook']
while thingsToDo != '0':
things_to_do = input(' Enter a task:')
print(Task1='List all task', Task2='Add a task to the list', Task3='Delete a task', Task4='To quit the program:')
if __name__ =... |
class StringFormat(object):
def format_string(self, pattern, *args, **kwargs):
return pattern.format(*args, **kwargs)
# To create distributable package:
#
# python3 setup.py bdist_wheel --universal
#
# Upload the package to pypi:
#
# twine upload dist/* | class Stringformat(object):
def format_string(self, pattern, *args, **kwargs):
return pattern.format(*args, **kwargs) |
# function to check string is
# palindrome or not
def isPalindrome(str):
# Run loop from 0 to len/2
for i in xrange(0, len(str)/2):
if str[i] != str[len(str)-i-1]:
return False
return True
# main function
s = "malayalam"
ans = isPalindrome(s)
if (ans):
print("Yes")
else:
print("No")
| def is_palindrome(str):
for i in xrange(0, len(str) / 2):
if str[i] != str[len(str) - i - 1]:
return False
return True
s = 'malayalam'
ans = is_palindrome(s)
if ans:
print('Yes')
else:
print('No') |
n = int(input())
s = [input().split() for _ in [0] * n]
c = 0
for i in s:
if i[1] == "JPY":
c += int(i[0])
else:
c += float(i[0]) * 380000
print(c)
| n = int(input())
s = [input().split() for _ in [0] * n]
c = 0
for i in s:
if i[1] == 'JPY':
c += int(i[0])
else:
c += float(i[0]) * 380000
print(c) |
# PingPong_Calculator.py
def convert_in2cm(inches):
return inches * 2.54
def convert_lb2kg(pounds):
return pounds / 2.2
height_in = int(input("Enter your height in inches: "))
weight_lb = int(input("Enter your weight in pounds: "))
height_cm = convert_in2cm(height_in)
weight_kg = convert_lb2kg(weight_lb)
ping_p... | def convert_in2cm(inches):
return inches * 2.54
def convert_lb2kg(pounds):
return pounds / 2.2
height_in = int(input('Enter your height in inches: '))
weight_lb = int(input('Enter your weight in pounds: '))
height_cm = convert_in2cm(height_in)
weight_kg = convert_lb2kg(weight_lb)
ping_pong_tall = round(height_... |
n = int(input())
count = [0]*5
for _ in range(n):
s = list(input())
if s[0] == "M":
count[0] += 1
if s[0] == "A":
count[1] += 1
if s[0] == "R":
count[2] += 1
if s[0] == "C":
count[3] += 1
if s[0] == "H":
count[4] += 1
ans = 0
for i in range(3):
for j ... | n = int(input())
count = [0] * 5
for _ in range(n):
s = list(input())
if s[0] == 'M':
count[0] += 1
if s[0] == 'A':
count[1] += 1
if s[0] == 'R':
count[2] += 1
if s[0] == 'C':
count[3] += 1
if s[0] == 'H':
count[4] += 1
ans = 0
for i in range(3):
for j... |
#
# PySNMP MIB module TRUNK-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRUNK-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) ... |
problem_string = '73167176531330624919225119674426574742355349194934'\
'96983520312774506326239578318016984801869478851843'\
'85861560789112949495459501737958331952853208805511'\
'12540698747158523863050715693290963295227443043557'\
'668966489504452445... | problem_string = '73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813533627661428280644448664523874930... |
def genesis_block_generation():
print("\nGenesis Block is generated. The Blockchain system is up...!")
print("Miners will now collect transactions from memPool and start building blocks...\n\n")
def block_info(block, consensus_algorithm):
print("The following block has been proposed by " + block['ge... | def genesis_block_generation():
print('\nGenesis Block is generated. The Blockchain system is up...!')
print('Miners will now collect transactions from memPool and start building blocks...\n\n')
def block_info(block, consensus_algorithm):
print('The following block has been proposed by ' + block['generator... |
# encoding: utf-8
# Versioning convention
# https://www.python.org/dev/peps/pep-0440/
__version__ = "0.4.0"
| __version__ = '0.4.0' |
def get_price(auction_id):
return 0
def make_bid(bid, auction_id):
auction_price = get_price(auction_id)
if bid <= auction_price:
return False
auction_price = bid
return True | def get_price(auction_id):
return 0
def make_bid(bid, auction_id):
auction_price = get_price(auction_id)
if bid <= auction_price:
return False
auction_price = bid
return True |
add_location_schema = {
"type": "object",
"properties": {
"state": {"type": "string"},
"capital": {"type": "string"}
},
"required": ["state", "capital"]
}
update_capital_schema = {
"type": "object",
"properties": {
"capital": {"type": "string"}
},
"required": ["c... | add_location_schema = {'type': 'object', 'properties': {'state': {'type': 'string'}, 'capital': {'type': 'string'}}, 'required': ['state', 'capital']}
update_capital_schema = {'type': 'object', 'properties': {'capital': {'type': 'string'}}, 'required': ['capital']} |
class Parentheses(object):
def find_pair(self, num_pairs):
if num_pairs is None:
raise TypeError('num_pairs cannot be None')
if num_pairs < 0:
raise ValueError('num_pairs cannot be < 0')
if not num_pairs:
return []
results = []
curr_result... | class Parentheses(object):
def find_pair(self, num_pairs):
if num_pairs is None:
raise type_error('num_pairs cannot be None')
if num_pairs < 0:
raise value_error('num_pairs cannot be < 0')
if not num_pairs:
return []
results = []
curr_resu... |
'''
* @Author: csy
* @Date: 2019-04-28 13:48:03
* @Last Modified by: csy
* @Last Modified time: 2019-04-28 13:48:03
'''
age = 12
if age < 4:
print("Your admission cost is $0.")
elif age < 18:
print("Your admission cost is $5.")
else:
print("Your admission cost is $10.")
age = 12
if age < 4:
price... | """
* @Author: csy
* @Date: 2019-04-28 13:48:03
* @Last Modified by: csy
* @Last Modified time: 2019-04-28 13:48:03
"""
age = 12
if age < 4:
print('Your admission cost is $0.')
elif age < 18:
print('Your admission cost is $5.')
else:
print('Your admission cost is $10.')
age = 12
if age < 4:
price ... |
def test_task_names_endpoint(client):
tasks_json = client.get(f'api/meta/tasks').json
tasks = [task['task_name'] for task in tasks_json]
assert {'classification',
'regression',
'ts_forecasting',
'clustering'} == set(tasks)
def test_metric_names_classification_endpoint(c... | def test_task_names_endpoint(client):
tasks_json = client.get(f'api/meta/tasks').json
tasks = [task['task_name'] for task in tasks_json]
assert {'classification', 'regression', 'ts_forecasting', 'clustering'} == set(tasks)
def test_metric_names_classification_endpoint(client):
classification_metrics_js... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def closestValue(self, root: TreeNode, target: float) -> int:
result = root.val
while root:
if abs(root.val - target) <... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def closest_value(self, root: TreeNode, target: float) -> int:
result = root.val
while root:
if abs(root.val - target) < abs(result - target):
... |
cooling_type_limits = {
'PASSIVE_COOLING': {'low': 0, 'high':35 },
'HI_ACTIVE_COOLING': {'low': 0, 'high':45 },
'MED_ACTIVE_COOLING': {'low': 0, 'high':40 }
}
boundary_constants_text = {'TOO_LOW':'too low', 'TOO_HIGH':'too high', 'NORMAL': 'normal'}
boundary_constants = {'low':'TOO_LOW', 'high': 'TOO_HIGH', 'normal' :... | cooling_type_limits = {'PASSIVE_COOLING': {'low': 0, 'high': 35}, 'HI_ACTIVE_COOLING': {'low': 0, 'high': 45}, 'MED_ACTIVE_COOLING': {'low': 0, 'high': 40}}
boundary_constants_text = {'TOO_LOW': 'too low', 'TOO_HIGH': 'too high', 'NORMAL': 'normal'}
boundary_constants = {'low': 'TOO_LOW', 'high': 'TOO_HIGH', 'normal': ... |
class SilverbachConjecture:
def solve(self, n):
ls = [True] * 2001
for i in xrange(2, 2001):
if ls[i]:
for j in xrange(2 * i, 2001, i):
ls[j] = False
for i in xrange(2, n - 1):
if not ls[i] and not ls[n - i]:
return ... | class Silverbachconjecture:
def solve(self, n):
ls = [True] * 2001
for i in xrange(2, 2001):
if ls[i]:
for j in xrange(2 * i, 2001, i):
ls[j] = False
for i in xrange(2, n - 1):
if not ls[i] and (not ls[n - i]):
retu... |
# Advent of Code - Davertical 2 - Part One
def result(data):
horizontal, vertical = 0, 0
for line in data:
direction, i = line.split(' ')
i = int(i)
if direction == 'forward':
horizontal += i
if direction == 'up':
vertical -= i
if direction == '... | def result(data):
(horizontal, vertical) = (0, 0)
for line in data:
(direction, i) = line.split(' ')
i = int(i)
if direction == 'forward':
horizontal += i
if direction == 'up':
vertical -= i
if direction == 'down':
vertical += i
ret... |
#
# @lc app=leetcode.cn id=277 lang=python3
#
# [277] find-the-celebrity
#
None
# @lc code=end | None |
#
# PySNMP MIB module E7-Notifications-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/E7-Notifications-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:58:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ... |
config = {
"domain": "example.com",
"ruleset": "autoses",
"s3bucket": "autoses-incoming",
"sidprefix": "sid-autoses",
"awsaccountid": "<FILL ME>",
"region": "us-east-1",
"sqs": {
"message_retention_period": 14 * 24 * 3600,
"visibility_timeout": 60,
},
"lambda": {
... | config = {'domain': 'example.com', 'ruleset': 'autoses', 's3bucket': 'autoses-incoming', 'sidprefix': 'sid-autoses', 'awsaccountid': '<FILL ME>', 'region': 'us-east-1', 'sqs': {'message_retention_period': 14 * 24 * 3600, 'visibility_timeout': 60}, 'lambda': {'file_name': 'lambda_function.py', 'handler': 'lambda_handler... |
# Lab 01 - Exercise 01
# First Number
print("Please insert a first number: ", end='')
try:
a = int(input())
except ValueError:
print("That didn't seem a number!")
quit()
# Second Number
print("Please now insert a second number: ", end='')
try:
b = int(input())
except ValueError:
print("That didn't... | print('Please insert a first number: ', end='')
try:
a = int(input())
except ValueError:
print("That didn't seem a number!")
quit()
print('Please now insert a second number: ', end='')
try:
b = int(input())
except ValueError:
print("That didn't seem a number!")
quit()
print('\nTheir sum is: ' + ... |
class Router(object):
def db_for_read(self, model, **hints):
if model._meta.model_name == 'articleotherdb':
return 'other'
return None
def db_for_write(self, model, **hints):
if model._meta.model_name == 'articleotherdb':
return 'other'
return None
d... | class Router(object):
def db_for_read(self, model, **hints):
if model._meta.model_name == 'articleotherdb':
return 'other'
return None
def db_for_write(self, model, **hints):
if model._meta.model_name == 'articleotherdb':
return 'other'
return None
... |
{
'targets': [
{
'target_name': 'DTraceProviderBindings',
'conditions': [
['OS=="mac" or OS=="solaris" or OS=="freebsd"', {
'sources': [
'dtrace_provider.cc',
'dtrace_probe.cc',
],
... | {'targets': [{'target_name': 'DTraceProviderBindings', 'conditions': [['OS=="mac" or OS=="solaris" or OS=="freebsd"', {'sources': ['dtrace_provider.cc', 'dtrace_probe.cc'], 'include_dirs': ['libusdt'], 'dependencies': ['libusdt'], 'libraries': ['-L<(module_root_dir)/libusdt -l usdt']}]]}, {'target_name': 'libusdt', 'ty... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"GaborLayer": "00_core.ipynb",
"GaborLayer.create_xy_grid": "00_core.ipynb",
"GaborLayer.build": "00_core.ipynb",
"GaborLayer.create_kernel": "00_core.ipynb",
"GaborLayer.c... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'GaborLayer': '00_core.ipynb', 'GaborLayer.create_xy_grid': '00_core.ipynb', 'GaborLayer.build': '00_core.ipynb', 'GaborLayer.create_kernel': '00_core.ipynb', 'GaborLayer.call': '00_core.ipynb', 'GaborLayer.get_config': '00_core.ipynb', 'SigmaRegula... |
def word_lengths(
file_path: str
) -> set:
return {
len(token)
for line in open(file_path)
for token in line.split()
}
def main():
file_path = 'comprehensions/file.txt'
result = word_lengths(file_path)
print(result)
if __name__ == '__main__':
main()
| def word_lengths(file_path: str) -> set:
return {len(token) for line in open(file_path) for token in line.split()}
def main():
file_path = 'comprehensions/file.txt'
result = word_lengths(file_path)
print(result)
if __name__ == '__main__':
main() |
# This file is executed on every boot (including wake-boot from deepsleep)
# notify
print('RUN: boot.py')
| print('RUN: boot.py') |
class EndnoteObject:
supported_cff_versions = ['1.0.3', '1.1.0']
supported_endnote_props = ['author', 'year', 'keyword', 'doi', 'name', 'url']
def __init__(self, cff_object, initialize_empty=False):
self.cff_object = cff_object
self.author = None
self.doi = None
self.keywor... | class Endnoteobject:
supported_cff_versions = ['1.0.3', '1.1.0']
supported_endnote_props = ['author', 'year', 'keyword', 'doi', 'name', 'url']
def __init__(self, cff_object, initialize_empty=False):
self.cff_object = cff_object
self.author = None
self.doi = None
self.keyword... |
class CoordinatesAreNotGiven(Exception):
def __init__(self, lon=1, lat=1, alt=1) -> None:
self.message = ""
if not lon:
self.message += "Lon can't be None\n"
if not lat:
self.message += "Lat can't be None\n"
if not alt:
self.message += "Alt can't ... | class Coordinatesarenotgiven(Exception):
def __init__(self, lon=1, lat=1, alt=1) -> None:
self.message = ''
if not lon:
self.message += "Lon can't be None\n"
if not lat:
self.message += "Lat can't be None\n"
if not alt:
self.message += "Alt can't ... |
def minRemoveToMakeValid(s):
# O(n) time and space
# doesn't use stack
s = list(s)
open_count = 0
for ind, c in enumerate(s):
if c == "(":
open_count += 1
elif c == ")":
if not open_count: # if open_count is 0
s[ind] = ""
... | def min_remove_to_make_valid(s):
s = list(s)
open_count = 0
for (ind, c) in enumerate(s):
if c == '(':
open_count += 1
elif c == ')':
if not open_count:
s[ind] = ''
else:
open_count -= 1
for i in range(len(s) - 1, -1, -1... |
def nonify(func):
def newAnB(*args, **arg):
res = func(*args, **arg)
return None if not res else res
return newAnB
| def nonify(func):
def new_an_b(*args, **arg):
res = func(*args, **arg)
return None if not res else res
return newAnB |
# [Required] Hero's Succession (22300)
echo = 20011005
successor = 1142158
mir = 1013000
sm.setSpeakerID(mir)
sm.sendNext("Master, master, look at this. There's something wrong with one of my scales!")
sm.setPlayerAsSpeaker()
sm.sendSay("That's...?! \r\n\r\n"
"Mir, one of your scales is showing the #bOnyx Dragon's ... | echo = 20011005
successor = 1142158
mir = 1013000
sm.setSpeakerID(mir)
sm.sendNext("Master, master, look at this. There's something wrong with one of my scales!")
sm.setPlayerAsSpeaker()
sm.sendSay("That's...?! \r\n\r\nMir, one of your scales is showing the #bOnyx Dragon's Symbol#k!")
sm.setSpeakerID(mir)
sm.sendSay("R... |
#from coustmer import formate_coustmer
def formate_coustmer(first, last ,location):
full_name = '%s' '%s' %(first,last)
if location:
return '%s (%s)' %(full_name,location)
else:
return full_name
if __name__ == '__main__':
print(formate_coustmer('Lilly ', 'jokowich',location = 'california'))
... | def formate_coustmer(first, last, location):
full_name = '%s%s' % (first, last)
if location:
return '%s (%s)' % (full_name, location)
else:
return full_name
if __name__ == '__main__':
print(formate_coustmer('Lilly ', 'jokowich', location='california')) |
# dashboard_generator.py
print("-----------------------")
print("MONTH: March 2018")
print("-----------------------")
print("CRUNCHING THE DATA...")
print("-----------------------")
print("TOTAL MONTHLY SALES: $12,000.71")
print("-----------------------")
print("TOP SELLING PRODUCTS:")
print(" 1) Button-Down Shirt... | print('-----------------------')
print('MONTH: March 2018')
print('-----------------------')
print('CRUNCHING THE DATA...')
print('-----------------------')
print('TOTAL MONTHLY SALES: $12,000.71')
print('-----------------------')
print('TOP SELLING PRODUCTS:')
print(' 1) Button-Down Shirt: $6,960.35')
print(' 2) Sup... |
class MulticastDelegate(object):
def __init__(self):
self.delegates = []
def __iadd__(self, delegate):
self.add(delegate)
return self
def add(self, delegate):
self.delegates.append(delegate)
def __isub__(self, delegate):
self.delegates.remove(delegate)
... | class Multicastdelegate(object):
def __init__(self):
self.delegates = []
def __iadd__(self, delegate):
self.add(delegate)
return self
def add(self, delegate):
self.delegates.append(delegate)
def __isub__(self, delegate):
self.delegates.remove(delegate)
... |
class Exceptions:
class NetworkError(Exception):
def __str__(self):
return "Network Error"
class FileSystemError(Exception):
def __str__(self):
return "File System Error" | class Exceptions:
class Networkerror(Exception):
def __str__(self):
return 'Network Error'
class Filesystemerror(Exception):
def __str__(self):
return 'File System Error' |
#!/usr/bin/env python3
l = ''
with open('input') as f:
l = [int(x) for x in f.read().split(',')]
s = sorted(l)[len(l)//2]
d = 0
for i in l:
d += abs(s - i)
print(d)
| l = ''
with open('input') as f:
l = [int(x) for x in f.read().split(',')]
s = sorted(l)[len(l) // 2]
d = 0
for i in l:
d += abs(s - i)
print(d) |
class UserDomain:
def is_active(self, user):
return user.email_confirmed
user_domain = UserDomain()
| class Userdomain:
def is_active(self, user):
return user.email_confirmed
user_domain = user_domain() |
FILTERS = []
ENDP_COUNT = 0
class Filter(object):
def __init__(self):
self.urls = []
self.filter_all = False
self.order = 0
def filter(self, request, response): pass
def _continue(self, request, response):
return {"request": request, "response": response} | filters = []
endp_count = 0
class Filter(object):
def __init__(self):
self.urls = []
self.filter_all = False
self.order = 0
def filter(self, request, response):
pass
def _continue(self, request, response):
return {'request': request, 'response': response} |
class LaneFitter():
def __init__(self, camera):
if camera is None:
raise Exception("Lane fitter needs a camera to undistort and warp")
self.camera = camera
def getfit(self, img, prev_left_fit=None, prev_right_fit=None):
undistorted = self.camera.undistort(img)
binary... | class Lanefitter:
def __init__(self, camera):
if camera is None:
raise exception('Lane fitter needs a camera to undistort and warp')
self.camera = camera
def getfit(self, img, prev_left_fit=None, prev_right_fit=None):
undistorted = self.camera.undistort(img)
binary_... |
#raspberry pi GPIO pin definitions
#using physical pin #'s, not GPIO #'s
class GpioPins:
LEFT_MOTOR_FORWARD = 31
LEFT_MOTOR_BACKWARD = 33
RIGHT_MOTOR_FORWARD = 35
RIGHT_MOTOR_BACKWARD = 37
ULTRASONIC_SENSOR_TRIG = 7
ULTRASONIC_SENSOR_ECHO = 12
IR_SENSOR_LEFT = 24
IR_SENSOR_RIGHT = 26
... | class Gpiopins:
left_motor_forward = 31
left_motor_backward = 33
right_motor_forward = 35
right_motor_backward = 37
ultrasonic_sensor_trig = 7
ultrasonic_sensor_echo = 12
ir_sensor_left = 24
ir_sensor_right = 26
servo_ultrasonic_sensor = 19
servo_horizontal_camera = 0
servo_v... |
n=int(input())
ans=0
fac=1
for i in range(1,n+1):
fac*=i
ans+=fac
print(ans) | n = int(input())
ans = 0
fac = 1
for i in range(1, n + 1):
fac *= i
ans += fac
print(ans) |
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | """
NIST physical constants
https://physics.nist.gov/cuu/Constants/
https://physics.nist.gov/cuu/Constants/Table/allascii.txt
"""
light_speed = 137.03599967994
bohr = 0.52917721092
alpha = 0.0072973525664
g_electron = 2.00231930436182
e_mass = 9.10938356e-31
proton_mass = 1.672621898e-27
bohr_magneton = 9.274009994e-2... |
des = 'Desafio-025 strings-004'
print ('{}'.format(des))
#Crie um programa que leia o nome de uma pessoa e diga se ela tem "silva" no seu nome.
nome = str(input('Digite um nome: ')).strip()
print ('Seu nome tem Silva? {}'.format('silva' in nome.lower()))
| des = 'Desafio-025 strings-004'
print('{}'.format(des))
nome = str(input('Digite um nome: ')).strip()
print('Seu nome tem Silva? {}'.format('silva' in nome.lower())) |
def is_armstrong_number(number):
number_string = str(number)
digits = len(number_string)
if digits == 1:
return True
else:
armstrong = sum([int(digit) ** digits for digit in number_string])
return number == armstrong
| def is_armstrong_number(number):
number_string = str(number)
digits = len(number_string)
if digits == 1:
return True
else:
armstrong = sum([int(digit) ** digits for digit in number_string])
return number == armstrong |
REPORT_CASE_INDEX="report_cases_czei39du507m9mmpqk3y01x72a3ux4p0"
REPORT_CASE_MAPPING={'_meta': {'comment': '2013-11-05 dmyung',
'created': None},
'date_detection': False,
'date_formats': ['yyyy-MM-dd',
"yyyy-MM-dd'T'HH:mm:ssZZ",
"yyyy-MM-dd'T'HH:mm:ss.SSSSSS",
... | report_case_index = 'report_cases_czei39du507m9mmpqk3y01x72a3ux4p0'
report_case_mapping = {'_meta': {'comment': '2013-11-05 dmyung', 'created': None}, 'date_detection': False, 'date_formats': ['yyyy-MM-dd', "yyyy-MM-dd'T'HH:mm:ssZZ", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'", "yyyy-MM-dd'T'HH:mm... |
class Result:
pass
class CombingResult(Result):
def __init__(self, elapsed_time_preprocess: int, elapsed_time_algo: int, hash: int, size_a: int, size_b: int,
name_a, name_b):
self.hash = hash
self.elapsed_time_algo = elapsed_time_algo
self.elapsed_time_preprocess = ela... | class Result:
pass
class Combingresult(Result):
def __init__(self, elapsed_time_preprocess: int, elapsed_time_algo: int, hash: int, size_a: int, size_b: int, name_a, name_b):
self.hash = hash
self.elapsed_time_algo = elapsed_time_algo
self.elapsed_time_preprocess = elapsed_time_preproc... |
# Defining constants
# TODO: add all species and experiments
# TODO mapping
RNA_SEQ_LIST = ['files/Caenorhabditis_elegans_RNA-Seq_read_counts_TPM_FPKM_GSE16552.tsv']
AFF_LIST = ['files/Caenorhabditis_elegans_probesets_GSE19972_A-AFFY-60_gcRMA.tsv']
exp_dict = {}
for file in RNA_SEQ_LIST:
# Opening the library fil... | rna_seq_list = ['files/Caenorhabditis_elegans_RNA-Seq_read_counts_TPM_FPKM_GSE16552.tsv']
aff_list = ['files/Caenorhabditis_elegans_probesets_GSE19972_A-AFFY-60_gcRMA.tsv']
exp_dict = {}
for file in RNA_SEQ_LIST:
with open(file) as lib_file:
lib_file.readline()
for line in lib_file:
line... |
s= raw_input()
if s=="yes" or s=="YES" or s=="Yes":
print ("Yes")
else:
print ("No") | s = raw_input()
if s == 'yes' or s == 'YES' or s == 'Yes':
print('Yes')
else:
print('No') |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: io
class DriverType(object):
UNDEFINED = 0
LIBHDFS = 1
LIBHDFS3 = 2
| class Drivertype(object):
undefined = 0
libhdfs = 1
libhdfs3 = 2 |
'''
Created on 1.11.2016
@author: Samuli Rahkonen
'''
def kbinterrupt_decorate(func):
'''
Decorator.
Adds KeyboardInterrupt handling to ControllerBase methods.
'''
def func_wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except KeyboardInterrupt:
... | """
Created on 1.11.2016
@author: Samuli Rahkonen
"""
def kbinterrupt_decorate(func):
"""
Decorator.
Adds KeyboardInterrupt handling to ControllerBase methods.
"""
def func_wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except KeyboardInterrupt:
... |
class BaseLayout(object):
@classmethod
def render(cls, items):
raise NotImplementedError
| class Baselayout(object):
@classmethod
def render(cls, items):
raise NotImplementedError |
# THIS FILE IS GENERATED FROM THEANO SETUP.PY
short_version = '0.9.0beta1'
version = '0.9.0beta1'
git_revision = 'RELEASE'
full_version = '0.9.0beta1.dev-%(git_revision)s' % {
'git_revision': git_revision}
release = False
if not release:
version = full_version
| short_version = '0.9.0beta1'
version = '0.9.0beta1'
git_revision = 'RELEASE'
full_version = '0.9.0beta1.dev-%(git_revision)s' % {'git_revision': git_revision}
release = False
if not release:
version = full_version |
#!/usr/bin/env python3
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
BUCKET_NAME_BKT = "aws-saas-s3"
BUCKET_NAME_PFX = "aws-saas-s3-prefix"
BUCKET_NAME_TAG = "aws-saas-s3-tag"
BUCKET_NAME_AP = "aws-saas-s3-ap"
BUCKET_NAME_NSDB = "aws-saas-s3-dbns"
| bucket_name_bkt = 'aws-saas-s3'
bucket_name_pfx = 'aws-saas-s3-prefix'
bucket_name_tag = 'aws-saas-s3-tag'
bucket_name_ap = 'aws-saas-s3-ap'
bucket_name_nsdb = 'aws-saas-s3-dbns' |
'''
The provided code stub reads and integer, n, from STDIN.
For all non-negative integers i<n, print i^2.
'''
if __name__ == '__main__':
n = int(input())
for i in range(n):
print(i**2)
| """
The provided code stub reads and integer, n, from STDIN.
For all non-negative integers i<n, print i^2.
"""
if __name__ == '__main__':
n = int(input())
for i in range(n):
print(i ** 2) |
#
# PySNMP MIB module CISCO-SYSLOG-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SYSLOG-CAPABILITY
# Produced by pysmi-0.3.4 at Wed May 1 12:13:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
princ_amount = float(input(" Please Enter the Principal Amount : "))
rate_of_int = float(input(" Please Enter the Rate Of Interest : "))
time_period = float(input(" Please Enter Time period in Years : "))
simple_interest = (princ_amount * rate_of_int * time_period) / 100
print("\nSimple Interest for Principal Amo... | princ_amount = float(input(' Please Enter the Principal Amount : '))
rate_of_int = float(input(' Please Enter the Rate Of Interest : '))
time_period = float(input(' Please Enter Time period in Years : '))
simple_interest = princ_amount * rate_of_int * time_period / 100
print('\nSimple Interest for Principal Amount ... |
M = int(input())
a = {int(i) for i in input().split()}
N = int(input())
b = {int(i) for i in input().split()}
c = sorted(a.symmetric_difference(b))
[print(i) for i in c]
| m = int(input())
a = {int(i) for i in input().split()}
n = int(input())
b = {int(i) for i in input().split()}
c = sorted(a.symmetric_difference(b))
[print(i) for i in c] |
class Solution:
def totalNQueens(self, n: int) -> int:
path = [-1] * n
used = [False] * n
cnt = 0
def backtrack(k):
'''
k is the current level, 0-idexed
'''
nonlocal path, used, cnt
if k == n:
cnt +=... | class Solution:
def total_n_queens(self, n: int) -> int:
path = [-1] * n
used = [False] * n
cnt = 0
def backtrack(k):
"""
k is the current level, 0-idexed
"""
nonlocal path, used, cnt
if k == n:
cnt += 1
... |
#
# PySNMP MIB module SIP-REGISTRAR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIP-REGISTRAR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:04:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
#Leia um numero inteiro e monte sua tabuada
n1 = int(input('Digite um numero inteiro: '))
print('Tabuada do numero : '.format(n1))
print(' 1 x {} = {}'.format(n1, n1*1))
print(' 2 x {} = {}'.format(n1, n1*2))
print(' 3 x {} = {}'.format(n1, n1*3))
print(' 4 x {} = {}'.format(n1, n1*4))
print(' 5 x {} = {}'.format(n1, n... | n1 = int(input('Digite um numero inteiro: '))
print('Tabuada do numero : '.format(n1))
print(' 1 x {} = {}'.format(n1, n1 * 1))
print(' 2 x {} = {}'.format(n1, n1 * 2))
print(' 3 x {} = {}'.format(n1, n1 * 3))
print(' 4 x {} = {}'.format(n1, n1 * 4))
print(' 5 x {} = {}'.format(n1, n1 * 5))
print(' 6 x {} = {}'.format(... |
def calc_eval(exp):
if isinstance(exp, Pair):
if exp.first == "and":
return eval_and(exp.rest)
else:
return calc_apply(calc_eval(exp, first), list(exp.rest.map(calc_eval)))
elif exp in OPERATORS:
return OPERATORS[exp]
else:
return exp
def eval_and(op... | def calc_eval(exp):
if isinstance(exp, Pair):
if exp.first == 'and':
return eval_and(exp.rest)
else:
return calc_apply(calc_eval(exp, first), list(exp.rest.map(calc_eval)))
elif exp in OPERATORS:
return OPERATORS[exp]
else:
return exp
def eval_and(ope... |
class ErrorMsg:
float
#float64 X_One
#float64 Height_Of_Cone
#float64 Area_Of_View_Top
#float64 Area_Of_View_Bottom
#bool Stop_Now
| class Errormsg:
float |
#
# PySNMP MIB module NTWS-RF-DETECT-TC (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTWS-RF-DETECT-TC
# Produced by pysmi-0.3.4 at Wed May 1 14:25:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint) ... |
# -*- coding: utf-8 -*-
#import ultron.sentry.api as api
#import ultron.sentry.Math as Math
#import ultron.sentry.Analysis as Analysis
#import ultron.sentry.Utilities as Utilities
__all__ = ['__version__']
__version__ = "0.0.1" | __all__ = ['__version__']
__version__ = '0.0.1' |
expected_output ={
"lisp_id": {
0: {
"instance_id": {
8188: {
"eid_table": "Vlan 210",
"entries": 1,
"eid_prefix": {
"0017.0100.0001/48": {
"uptime": "01:13:15",
... | expected_output = {'lisp_id': {0: {'instance_id': {8188: {'eid_table': 'Vlan 210', 'entries': 1, 'eid_prefix': {'0017.0100.0001/48': {'uptime': '01:13:15', 'expiry_time': '22:46:44', 'via': 'map-reply', 'map_reply_state': 'complete', 'prefix_location': 'local-to-site', 'source_type': 'map-reply', 'last_modified': '01:1... |
a = 100
b = 3
print(a % b)
print(divmod(a, b))
| a = 100
b = 3
print(a % b)
print(divmod(a, b)) |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''\
Nomad-RPi testing modules.
since: 23-APR-2018
'''
| """Nomad-RPi testing modules.
since: 23-APR-2018
""" |
ICONS = ['new_file', 'open_file', 'save', 'cut', 'copy', 'paste',
'undo', 'redo', 'find_text']
theme_color = {
'Default': '#000000.#FFFFFF',
'Greygarious': '#83406A.#D1D4D1',
'Aquamarine': '#5B8340.#D1E7E0',
'Bold Beige': '#4B4620.#FFF0E1',
'Cobalt Blue': '#ffff... | icons = ['new_file', 'open_file', 'save', 'cut', 'copy', 'paste', 'undo', 'redo', 'find_text']
theme_color = {'Default': '#000000.#FFFFFF', 'Greygarious': '#83406A.#D1D4D1', 'Aquamarine': '#5B8340.#D1E7E0', 'Bold Beige': '#4B4620.#FFF0E1', 'Cobalt Blue': '#ffffBB.#3333aa', 'Olive Green': '#D1E7E0.#5B8340', 'Night Mode'... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"convert_file_to_json": "00-documentation.ipynb",
"encode_file_as_utf8": "00-documentation.ipynb",
"convert_nb_to_md": "00-documentation.ipynb",
"junix.exporter.convert_file_to_json... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'convert_file_to_json': '00-documentation.ipynb', 'encode_file_as_utf8': '00-documentation.ipynb', 'convert_nb_to_md': '00-documentation.ipynb', 'junix.exporter.convert_file_to_json': '00-documentation.ipynb', 'MyHTMLParser': '00-documentation.ipynb... |
# Holds the state of the program, such as the items stored in the inventory
# The State class will only store data, and will not itself perform operations on data
class State:
def __init__(self, targetTier):
# Information about the world
self.itemDependencyGraph = {} # key: name of an ... | class State:
def __init__(self, targetTier):
self.itemDependencyGraph = {}
self.reverseItemDependencyGraph = {}
self.itemToConstituents = {}
self.itemToTier = {}
self.tierToItem = {}
self.tierToItem[targetTier] = []
self.itemNameToNumberOwned = {}
sel... |
class Solution:
def countRoutes(self, locations: List[int], start: int, finish: int, fuel: int) -> int:
dp = [[-1] * 201 for _ in range(101)]
MOD = 1000000007
def helper(pos, left):
if left < 0:
return 0
if dp[pos][left] != -1:
return d... | class Solution:
def count_routes(self, locations: List[int], start: int, finish: int, fuel: int) -> int:
dp = [[-1] * 201 for _ in range(101)]
mod = 1000000007
def helper(pos, left):
if left < 0:
return 0
if dp[pos][left] != -1:
retur... |
def make_averager():
## Scope average implementation, with nonlocal to best performance.
count = 0
total = 0
def averager(new_value):
nonlocal count, total
count += 1
total += new_value
return total / count
return averager
| def make_averager():
count = 0
total = 0
def averager(new_value):
nonlocal count, total
count += 1
total += new_value
return total / count
return averager |
class Solution:
def isMatch(self, s, p):
def compare(a, b):
return a == '.' or a == b
s = '=' + s + '='
p = '=' + p + '='
n = len(s)
m = len(p)
flag = [0] * n
flag[0] = 1
cur = 1
while cur < m:
target = p[cur]
... | class Solution:
def is_match(self, s, p):
def compare(a, b):
return a == '.' or a == b
s = '=' + s + '='
p = '=' + p + '='
n = len(s)
m = len(p)
flag = [0] * n
flag[0] = 1
cur = 1
while cur < m:
target = p[cur]
... |
'''
01 - Bar chart
Bar charts visualize data that is organized according to categories as a series of
bars, where the height of each bar represents the values of the data in this category.
For example, in this exercise, you will visualize the number of gold medals won by each
country in the provided me... | """
01 - Bar chart
Bar charts visualize data that is organized according to categories as a series of
bars, where the height of each bar represents the values of the data in this category.
For example, in this exercise, you will visualize the number of gold medals won by each
country in the provided me... |
SPOTIFY_SCOPE = "user-read-playback-state user-modify-playback-state"
SPOTIFY_CLIENT_ID = "123123adads"
SPOTIFY_CLIENT_SECRET = "76756757jgjghgjh"
# don't change or don't forget to update app.py as well
SPOTIFY_REDIRECT_URI = "http://localhost:8080/callback"
| spotify_scope = 'user-read-playback-state user-modify-playback-state'
spotify_client_id = '123123adads'
spotify_client_secret = '76756757jgjghgjh'
spotify_redirect_uri = 'http://localhost:8080/callback' |
words = input().split(" ")
dictionary = {}
for current_word in words:
current_word = current_word.lower()
if current_word not in dictionary:
dictionary[current_word] = 0
dictionary[current_word] += 1
for key, value in dictionary.items():
if value % 2 != 0:
print(key, end=" ") | words = input().split(' ')
dictionary = {}
for current_word in words:
current_word = current_word.lower()
if current_word not in dictionary:
dictionary[current_word] = 0
dictionary[current_word] += 1
for (key, value) in dictionary.items():
if value % 2 != 0:
print(key, end=' ') |
class FunctionNotAllowed(Exception):
...
class TelegramBaseException(Exception):
...
class TelegramAPIException(TelegramBaseException):
...
class TelegramDataObjectException(TelegramBaseException):
...
class HandlerException(TelegramBaseException):
...
class HandlerCloseException(TelegramB... | class Functionnotallowed(Exception):
...
class Telegrambaseexception(Exception):
...
class Telegramapiexception(TelegramBaseException):
...
class Telegramdataobjectexception(TelegramBaseException):
...
class Handlerexception(TelegramBaseException):
...
class Handlercloseexception(TelegramBaseEx... |
def check_bunch_match(bunch, symbol):
res = True
for one in bunch:
if one != symbol:
res = False
break
return res
def get_ttt_winner(board):
r, c = len(board), len(board[0])
for symbol in "XO":
for ri in range(r):
row = board[ri]
if ... | def check_bunch_match(bunch, symbol):
res = True
for one in bunch:
if one != symbol:
res = False
break
return res
def get_ttt_winner(board):
(r, c) = (len(board), len(board[0]))
for symbol in 'XO':
for ri in range(r):
row = board[ri]
i... |
def concat(*args, sep="/"):
return sep.join(args)
print(concat("earth", "mars", "venus"))
print(*list(range(5,10))) | def concat(*args, sep='/'):
return sep.join(args)
print(concat('earth', 'mars', 'venus'))
print(*list(range(5, 10))) |
def create_dictionaries():
JupiterMoons = ('Io','Europa','Ganymede','Callisto')
Radius = (1821.6,1560.8,2634.1,2410.3)
Gravity = (1.796,1.314,1.438,1.235)
Orbit = (1.769,3.551,7.154,16.689)
MeanRadius = dict()
SurfaceGravity = dict()
OrbitalPeriod = dict()
for index in range(len(JupiterM... | def create_dictionaries():
jupiter_moons = ('Io', 'Europa', 'Ganymede', 'Callisto')
radius = (1821.6, 1560.8, 2634.1, 2410.3)
gravity = (1.796, 1.314, 1.438, 1.235)
orbit = (1.769, 3.551, 7.154, 16.689)
mean_radius = dict()
surface_gravity = dict()
orbital_period = dict()
for index in ra... |
# Copyright 2018 - Nokia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | def db_row_to_dict(row):
return {'id': row.id, 'project_id': row.project_id, 'is_admin_webhook': row.is_admin_webhook, 'created_at': row.created_at, 'url': row.url, 'regex_filter': row.regex_filter, 'headers': row.headers} |
USER_AGENT_PRODUCT: str = "uHoo"
USER_AGENT_PRODUCT_VERSION: str = "10.3.1"
USER_AGENT_SYSTEM_INFORMATION: str = "iPhone;13.3; iOS 14.7.1; Scale/3.00"
APP_VERSION: int = 93
CLIENT_ID: str = "0000000000000000000|0000000000000000000"
| user_agent_product: str = 'uHoo'
user_agent_product_version: str = '10.3.1'
user_agent_system_information: str = 'iPhone;13.3; iOS 14.7.1; Scale/3.00'
app_version: int = 93
client_id: str = '0000000000000000000|0000000000000000000' |
def decoupling_softing_prepare(graph, sigma_square,lambda_input):
# get W matrix, Z(for row sum) and Z_prime(for col sum), and A_tilde
# get matrix W:
A = np.array(nx.adjacency_matrix(graph).todense())
d = np.sum(A, axis=1)
D = np.diag(d)
# Alternative way(19): set Sigma_square = sigma_square./... | def decoupling_softing_prepare(graph, sigma_square, lambda_input):
a = np.array(nx.adjacency_matrix(graph).todense())
d = np.sum(A, axis=1)
d = np.diag(d)
sigma_square = np.divide(sigma_square, d)
sigma = np.diag(Sigma_square)
w = np.dot(A, inv(Sigma))
w_col_sum = np.sum(W, axis=0)
w_row... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.