content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Mail:
def __init__(self, application, driver_config=None):
self.application = application
self.drivers = {}
self.driver_config = driver_config or {}
self.options = {}
def add_driver(self, name, driver):
self.drivers.update({name: driver})
def set_configuration... | class Mail:
def __init__(self, application, driver_config=None):
self.application = application
self.drivers = {}
self.driver_config = driver_config or {}
self.options = {}
def add_driver(self, name, driver):
self.drivers.update({name: driver})
def set_configuratio... |
#
# PySNMP MIB module H3C-BLG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-BLG-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:21:27 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... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ... |
class AutoTuneCommands(object):
_command = "ju"
def __init__(self, send_command):
self._send_command = send_command
async def call(self):
return await self._send_command(self._command, 1)
| class Autotunecommands(object):
_command = 'ju'
def __init__(self, send_command):
self._send_command = send_command
async def call(self):
return await self._send_command(self._command, 1) |
#Heap Sort as the name suggests, uses the heap data structure.
#First the array is converted into a binary heap. Then the first element which is the maximum elemet in case of a max-heap,
#is swapped with the last element so that the maximum element goes to the end of the array as it should be in a sorted array.
#Then t... | count = 0
def max_heapify(array, heap_size, i):
left = 2 * i + 1
right = 2 * i + 2
largest = i
global count
if left < heap_size:
count += 1
if array[left] > array[largest]:
largest = left
if right < heap_size:
count += 1
if array[right] > array[larges... |
class A:
def __init__(self, *, a):
pass
class B(A):
def __init__(self, a):
super().__init__(a=a) | class A:
def __init__(self, *, a):
pass
class B(A):
def __init__(self, a):
super().__init__(a=a) |
class Ball:
def __init__(self):
self.position = PVector(width * 0.5, height * 0.5)
self.w = 20
self.velocity = PVector(5, 5)
self.score_player_one = False
self.score_player_two = False
def show(self):
fill(255)
ellipse(self.position.x, self.position.y, sel... | class Ball:
def __init__(self):
self.position = p_vector(width * 0.5, height * 0.5)
self.w = 20
self.velocity = p_vector(5, 5)
self.score_player_one = False
self.score_player_two = False
def show(self):
fill(255)
ellipse(self.position.x, self.position.y,... |
ISOCHRONES_DATASET_NAME = "webapp_isochrones"
LOCATIONS_DATASET_NAME = "webapp_locations"
CUSTOMERS_DATASET_NAME = "webapp_customers"
CUSTOMERS_NO_FILTERING_COLUMNS = [
'id',
'customer_uuid',
'location_uuid',
'isochrone_type',
'distance_customer_location',
'isochrone_id',
'isochrone_amplit... | isochrones_dataset_name = 'webapp_isochrones'
locations_dataset_name = 'webapp_locations'
customers_dataset_name = 'webapp_customers'
customers_no_filtering_columns = ['id', 'customer_uuid', 'location_uuid', 'isochrone_type', 'distance_customer_location', 'isochrone_id', 'isochrone_amplitude', 'isochrone_label', 'isoch... |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:29:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) ... |
class Solution:
def XXX(self, a: str, b: str) -> str:
if len(a) < len(b):
a, b = b, a
b = '0' * (len(a) - len(b)) + b
c = []
flag = 0
for i in range(1, len(a) + 1):
c.insert(0, str( (int(a[-i]) + int(b[-i]) + flag) % 2))
flag = ( int(a[-i]... | class Solution:
def xxx(self, a: str, b: str) -> str:
if len(a) < len(b):
(a, b) = (b, a)
b = '0' * (len(a) - len(b)) + b
c = []
flag = 0
for i in range(1, len(a) + 1):
c.insert(0, str((int(a[-i]) + int(b[-i]) + flag) % 2))
flag = (int(a[-... |
def application(environment, start_response):
response_body = (
'Greetings to all Python developers! '
'This is standard WSGI handler.'
)
status = '200 OK'
response_headers = [
('Content-Type', 'text/plain'),
('Content-Length', str(len(response_body))),
]
start_re... | def application(environment, start_response):
response_body = 'Greetings to all Python developers! This is standard WSGI handler.'
status = '200 OK'
response_headers = [('Content-Type', 'text/plain'), ('Content-Length', str(len(response_body)))]
start_response(status, response_headers)
return [respo... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isValidBST(self, root: TreeNode) -> bool:
if not root:
return True
stack=[(r... | class Solution:
def is_valid_bst(self, root: TreeNode) -> bool:
if not root:
return True
stack = [(root, -math.inf, math.inf)]
while stack:
(node, lower, upper) = stack.pop()
if node:
val = node.val
print(val, lower, upper)... |
def test_soap(app):
project_list = app.soap.get_project_name_list("administrator", "root")
print("\n" + str(project_list))
print(len(project_list))
| def test_soap(app):
project_list = app.soap.get_project_name_list('administrator', 'root')
print('\n' + str(project_list))
print(len(project_list)) |
MOCK_DATA = [
{
"symbol": "AMD",
"companyName": "Advanced Micro Devices Inc.",
"exchange": "NASDAQ Capital Market",
"industry": "Semiconductors",
"website": "http://www.amd.com",
"description": "Advanced Micro Devices Inc designs and produces microprocessors and low-p... | mock_data = [{'symbol': 'AMD', 'companyName': 'Advanced Micro Devices Inc.', 'exchange': 'NASDAQ Capital Market', 'industry': 'Semiconductors', 'website': 'http://www.amd.com', 'description': 'Advanced Micro Devices Inc designs and produces microprocessors and low-power processor solutions for the computer, communicati... |
class Solution:
# O(n) time | O(1) space - where n is the length of the input list.
def maxProfit(self, prices: List[int]) -> int:
minPrice = prices[0]
maxProfit = 0
for i in range(1, len(prices)):
if prices[i] < minPrice:
minPrice = prices[i]
eli... | class Solution:
def max_profit(self, prices: List[int]) -> int:
min_price = prices[0]
max_profit = 0
for i in range(1, len(prices)):
if prices[i] < minPrice:
min_price = prices[i]
elif prices[i] - minPrice > maxProfit:
max_profit = pri... |
class Article:
def __init__(self,title,urlToImage,description,url,author):
self.title=title
self.urlToImage=urlToImage
self.description=description
self.author=author
self.url=url
class Source:
def __init__(self,name,description):
self.name=name
self.desc... | class Article:
def __init__(self, title, urlToImage, description, url, author):
self.title = title
self.urlToImage = urlToImage
self.description = description
self.author = author
self.url = url
class Source:
def __init__(self, name, description):
self.name = n... |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Coupon_validity, obj[4]: Gender, obj[5]: Age, obj[6]: Children, obj[7]: Education, obj[8]: Occupation, obj[9]: Income, obj[10]: Bar, obj[11]: Coffeehouse, obj[12]: Restaurant20to50, obj[13]: Direction_same, obj[14]: Distance
# {"feature":... | def find_decision(obj):
if obj[6] > 0:
if obj[10] <= 1.0:
if obj[1] > 0:
if obj[12] <= 1.0:
return 'False'
elif obj[12] > 1.0:
return 'True'
else:
return 'True'
elif obj[1] <= ... |
class Solution:
def XXX(self, nums: List[int]) -> bool:
nextdis = 0
curdis = 0
for i in range(len(nums)):
nextdis = max(i+nums[i], nextdis)
if i==curdis:
curdis = nextdis
if nextdis >= len(nums)-1:
return True
... | class Solution:
def xxx(self, nums: List[int]) -> bool:
nextdis = 0
curdis = 0
for i in range(len(nums)):
nextdis = max(i + nums[i], nextdis)
if i == curdis:
curdis = nextdis
if nextdis >= len(nums) - 1:
return True... |
name = 'pyjoystick'
version = '1.2.4'
description = 'Tools to get Joystick events.'
url = 'https://github.com/justengel/pyjoystick'
author = 'Justin Engel'
author_email = 'jengel@sealandaire.com'
| name = 'pyjoystick'
version = '1.2.4'
description = 'Tools to get Joystick events.'
url = 'https://github.com/justengel/pyjoystick'
author = 'Justin Engel'
author_email = 'jengel@sealandaire.com' |
pi = "141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128"
pi += "48111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458... | pi = '141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128'
pi += '48111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458... |
#Before running this code we should run 2 commands in command prompt they are :-
#1) pip install Image
#2) pip install qrcodeimport qrcode
code=qrcode.QRCode(version=5,box_size=15,border=5)
link=input("copy the content:")
code.add_data(link)
code.make(fit=True)
img=code.make_image(fill="black",back_color="white... | code = qrcode.QRCode(version=5, box_size=15, border=5)
link = input('copy the content:')
code.add_data(link)
code.make(fit=True)
img = code.make_image(fill='black', back_color='white')
img.save(input('Enter the Qrcode name:') + '.png') |
def find_outlier(integers):
even, odd = [], []
for i in sorted(integers):
if i % 2 != 0:
odd.append(i)
else:
even.append(i)
if len(even) > 1 and len(odd) != 0:
return odd[0]
elif len(odd) > 1 and len(even) != 0:
return even[0]
| def find_outlier(integers):
(even, odd) = ([], [])
for i in sorted(integers):
if i % 2 != 0:
odd.append(i)
else:
even.append(i)
if len(even) > 1 and len(odd) != 0:
return odd[0]
elif len(odd) > 1 and len(even) != 0:
return even[0] |
#Thea M Factorial of a positive no
def func_factorial(n):
# factorial is n * by all the '+' no less than it
#n= 7
#if n == 1:
# if n is 1 return 1
#return n
#else:
#return n * (n-1)
#
# Python program to find the factorial of a number provided by the user.
# ch... | def func_factorial(n):
factorial = 1
if n < 0:
print('not doing factorial for zero')
elif n == 0:
print('The factorial of 0 is 1')
else:
for i in range(1, n + 1):
factorial = factorial * i
print('The factorial of', n, 'is', factorial)
func_factorial(7) |
def build_ast_dictionary(code, prefix=tuple(), d=None):
if d is None:
d = dict()
if prefix == tuple():
d['total'] = code
else:
d[prefix] = code
tag, subcode = code
if isinstance(subcode, list):
for i, subitem in enumerate(subcode):
build_ast_dictionary(su... | def build_ast_dictionary(code, prefix=tuple(), d=None):
if d is None:
d = dict()
if prefix == tuple():
d['total'] = code
else:
d[prefix] = code
(tag, subcode) = code
if isinstance(subcode, list):
for (i, subitem) in enumerate(subcode):
build_ast_dictionary... |
_base_ = [
'../_base_/models/upernet_swin.py', '../_base_/datasets/Vaihingen.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'
]
model = dict(
pretrained='pretrain/swin_tiny_patch4_window7_224.pth',
backbone=dict(
embed_dims=96,
depths=[2, 2, 6, 2],
num_h... | _base_ = ['../_base_/models/upernet_swin.py', '../_base_/datasets/Vaihingen.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py']
model = dict(pretrained='pretrain/swin_tiny_patch4_window7_224.pth', backbone=dict(embed_dims=96, depths=[2, 2, 6, 2], num_heads=[3, 6, 12, 24], window_size=7, use_abs_... |
num = 1
for i in range(5):
for j in range(i+1):
print(num, end=" ")
num+=1
print() | num = 1
for i in range(5):
for j in range(i + 1):
print(num, end=' ')
num += 1
print() |
class Quiz:
def __init__(self,question, alt, correct):
self.question = question
self.alt = alt
self.correct = correct
self.s =""
for a in range(len(self.alt)):
self.s =self.s+str(a+1)+". "+self.alt[a]+"\n"
def corect_ansrer_txt(self):
return "correct ... | class Quiz:
def __init__(self, question, alt, correct):
self.question = question
self.alt = alt
self.correct = correct
self.s = ''
for a in range(len(self.alt)):
self.s = self.s + str(a + 1) + '. ' + self.alt[a] + '\n'
def corect_ansrer_txt(self):
re... |
program_list = []
def execute_command_with_params(input):
command, params = input.split(sep=" ", maxsplit=1)
if command == "insert":
i, e = map(int, params.split(sep=" ", maxsplit=1))
program_list.insert(i, e)
if command == "remove":
e = int(params)
program_list.remove(e)... | program_list = []
def execute_command_with_params(input):
(command, params) = input.split(sep=' ', maxsplit=1)
if command == 'insert':
(i, e) = map(int, params.split(sep=' ', maxsplit=1))
program_list.insert(i, e)
if command == 'remove':
e = int(params)
program_list.remove(e... |
def help():
help_file = "help.txt"
with open(help_file) as help:
content = help.read()
return(content)
| def help():
help_file = 'help.txt'
with open(help_file) as help:
content = help.read()
return content |
def euclide_e(a, n):
u, v = 1, 0
u1, v1 = 0, 1
while n > 0:
u1_t = u - a // n * u1
v1_t = v - a // n * v1
u, v = u1, v1
u1, v1 = u1_t, v1_t
a, n = n, a - a // n * n;
return [u, v, a]
print(euclide_e(39, 5))
| def euclide_e(a, n):
(u, v) = (1, 0)
(u1, v1) = (0, 1)
while n > 0:
u1_t = u - a // n * u1
v1_t = v - a // n * v1
(u, v) = (u1, v1)
(u1, v1) = (u1_t, v1_t)
(a, n) = (n, a - a // n * n)
return [u, v, a]
print(euclide_e(39, 5)) |
# Third-party dependencies fetched by Bazel
# Unlike WORKSPACE, the content of this file is unordered.
# We keep them separate to make the WORKSPACE file more maintainable.
# Install the nodejs "bootstrap" package
# This provides the basic tools for running and packaging nodejs programs in Bazel
load("@bazel_tools//to... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def fetch_dependencies():
http_archive(name='build_bazel_rules_nodejs', sha256='8f5f192ba02319254aaf2cdcca00ec12eaafeb979a80a1e946773c520ae0a2c9', urls=['https://github.com/bazelbuild/rules_nodejs/releases/download/3.7.0/rules_nodejs-3.7.0.tar.gz... |
class Solution:
def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]:
def dfs(cur, path):
if cur == len(graph) - 1:
res.append(path)
else:
for i in graph[cur]:
dfs(i, path + [i])
res = []
dfs(0, ... | class Solution:
def all_paths_source_target(self, graph: List[List[int]]) -> List[List[int]]:
def dfs(cur, path):
if cur == len(graph) - 1:
res.append(path)
else:
for i in graph[cur]:
dfs(i, path + [i])
res = []
df... |
# model settings
# norm_cfg = dict(type='BN', requires_grad=False)
model = dict(
type='FasterRCNN',
pretrained='open-mmlab://resnext101_32x4d', #resnet50_caffe
backbone=dict(
type='ResNeXt',
depth=101, #50
groups=32,
num_stages=3,
strides=(1, 2, 2),
dilations=... | model = dict(type='FasterRCNN', pretrained='open-mmlab://resnext101_32x4d', backbone=dict(type='ResNeXt', depth=101, groups=32, num_stages=3, strides=(1, 2, 2), dilations=(1, 1, 1), out_indices=(2,), frozen_stages=1, style='pytorch'), shared_head=dict(type='ResxLayer', depth=101, stage=3, stride=1, dilation=2, style='p... |
def resolve():
'''
code here
'''
N, H = [int(item) for item in input().split()]
ab = [[int(item) for item in input().split()] for _ in range(N)]
a_max = max(ab, key=lambda x:x[0])
res = H // a_max
if H % a_max != 0:
res += 1
temp_attack = res * a_max
b_delta = [b - ... | def resolve():
"""
code here
"""
(n, h) = [int(item) for item in input().split()]
ab = [[int(item) for item in input().split()] for _ in range(N)]
a_max = max(ab, key=lambda x: x[0])
res = H // a_max
if H % a_max != 0:
res += 1
temp_attack = res * a_max
b_delta = [b - a_m... |
def parensvalid(stringInput):
opencount = 0
closedcount = 0
for i in range(0, len(stringInput), 1):
if stringInput[i] == "(":
opencount += 1
elif stringInput[i] == ")":
closedcount += 1
if closedcount > opencount:
return False
... | def parensvalid(stringInput):
opencount = 0
closedcount = 0
for i in range(0, len(stringInput), 1):
if stringInput[i] == '(':
opencount += 1
elif stringInput[i] == ')':
closedcount += 1
if closedcount > opencount:
return False
if opencount ... |
expected_output = {
"operation_summary": {
1: {
"command": "rollback",
"duration": "00:00:04",
"end_date": "2021-11-02",
"end_time": "06:50:48",
"op_id": 1,
"start_date": "2021-11-02",
"start_time": "06:50:44",
"... | expected_output = {'operation_summary': {1: {'command': 'rollback', 'duration': '00:00:04', 'end_date': '2021-11-02', 'end_time': '06:50:48', 'op_id': 1, 'start_date': '2021-11-02', 'start_time': '06:50:44', 'status': 'Fail', 'uuid': '2021_11_02_06_50_44_op_rollback'}, 2: {'command': 'rollback', 'duration': '00:00:05',... |
a = int(input("Input number a:\n"))
b = int(input("Input number b:\n"))
print(f"a + b = {a+b}")
print(f"a - b = {a-b}")
print(f"a * b = {a*b}")
print(f"a / b = {a/b}")
print(f"a ** b = {a**b}")
| a = int(input('Input number a:\n'))
b = int(input('Input number b:\n'))
print(f'a + b = {a + b}')
print(f'a - b = {a - b}')
print(f'a * b = {a * b}')
print(f'a / b = {a / b}')
print(f'a ** b = {a ** b}') |
NAME = "vt2geojson"
DESCRIPTION = "Dump vector tiles to GeoJSON from remote URLs or local system files."
AUTHOR = "Theophile Dancoisne"
AUTHOR_EMAIL = "dancoisne.theophile@gmail.com"
URL = "https://github.com/Amyantis/python-vt2geojson"
__version__ = "0.2.1"
| name = 'vt2geojson'
description = 'Dump vector tiles to GeoJSON from remote URLs or local system files.'
author = 'Theophile Dancoisne'
author_email = 'dancoisne.theophile@gmail.com'
url = 'https://github.com/Amyantis/python-vt2geojson'
__version__ = '0.2.1' |
n= int(input())
my_dict = {}
for i in range((n*(n-1))//2):
mylist = []
x, y, z = input().split()
mylist.append(x)
mylist.append(y)
mylist.append(z)
first_t=mylist[0]
second_t = mylist[1]
first_t_score = mylist[2][0]
second_t_score = mylist[2][2]
if first_t_score<second_t_score:
... | n = int(input())
my_dict = {}
for i in range(n * (n - 1) // 2):
mylist = []
(x, y, z) = input().split()
mylist.append(x)
mylist.append(y)
mylist.append(z)
first_t = mylist[0]
second_t = mylist[1]
first_t_score = mylist[2][0]
second_t_score = mylist[2][2]
if first_t_score < second... |
'''
Katie Naughton
Final Project
Intro to Programming
Sources:
'''
| """
Katie Naughton
Final Project
Intro to Programming
Sources:
""" |
# https://leetcode.com/problems/remove-duplicate-letters/
# Given a string s, remove duplicate letters so that every letter appears once and
# only once. You must make sure your result is the smallest in lexicographical
# order among all possible results.
##############################################################... | class Solution:
def remove_duplicate_letters(self, s: str) -> str:
last_pos = {}
for (idx, char) in enumerate(s):
last_pos[char] = idx
stack = []
for (idx, char) in enumerate(s):
if char not in stack:
while stack and char < stack[-1] and (idx ... |
def random_gauss(mean, standard_deviation):
sum = 0
for _ in range(12):
sum = sum + random()
centered_around_zero = sum - 6
deviated = centered_around_zero * standard_deviation
gauss_value = deviated + mean
return gauss_value
# use the returned value as the next seed
# and use any numbe... | def random_gauss(mean, standard_deviation):
sum = 0
for _ in range(12):
sum = sum + random()
centered_around_zero = sum - 6
deviated = centered_around_zero * standard_deviation
gauss_value = deviated + mean
return gauss_value
def random(seed, a, b, c):
rand = (a * seed + b) % c
... |
class Point2D():
def __init__(self, x,y):
self.coord = [x,y]
def __str__(self):
return f'Point:({self.coord[0]},{self.coord[1]})'
def __eq__(self,other):
return (self.coord[0]==other.coord[0])&(self.coord[1]==other.coord[1])
def __ne__(self,other):
return (self.coord[0]... | class Point2D:
def __init__(self, x, y):
self.coord = [x, y]
def __str__(self):
return f'Point:({self.coord[0]},{self.coord[1]})'
def __eq__(self, other):
return (self.coord[0] == other.coord[0]) & (self.coord[1] == other.coord[1])
def __ne__(self, other):
return (sel... |
# Dictionary Carrent book with attributes
currentBook = {
"title": "Possibility of an Island",
"author": "Michel Houellebecq",
"price": 40
}
print(currentBook)
print(currentBook["author"])
currentBook["ISBN"] = "374795"
print("The Current book has these values:")
for value in currentBook.values():
p... | current_book = {'title': 'Possibility of an Island', 'author': 'Michel Houellebecq', 'price': 40}
print(currentBook)
print(currentBook['author'])
currentBook['ISBN'] = '374795'
print('The Current book has these values:')
for value in currentBook.values():
print(' => {}'.format(value)) |
# optimizes artifacts per roll, not exact values
# e.g. a +20 artifact has 5 rolls total
# rolls are averaged, with data from
# https://genshin-impact.fandom.com/wiki/Artifacts/Stats
# ===============================================
# how this works:
# ===============================================
# our damage equa... | max_rolls = 5
dp_stat_order = ['ATKb', 'ERb', 'CRCDb']
max_num_stats = len(dp_stat_order)
dp_statlv = [[(0, None) for i in range(max_num_stats + 1)] for j in range(MAX_ROLLS + 1)]
crcdlv = [(0, None) for j in range(MAX_ROLLS)]
def transformative_em_rolls_dmg(_rolls_em, _curr_stats):
return _rolls_em * 2 - 3
def a... |
def fo1():
print('1')
print('2')
print('3')
def main():
fo1()
print('a')
print('b')
print('c')
main() | def fo1():
print('1')
print('2')
print('3')
def main():
fo1()
print('a')
print('b')
print('c')
main() |
#!/usr/bin/python3
def solve(input_fname):
lines = []
pos = depth = aim = 0
with open(input_fname) as ifile:
for line in ifile:
lines.append(line.strip().split())
for cmd, unit in lines:
unit = int(unit)
if cmd == "forward":
pos += unit
depth ... | def solve(input_fname):
lines = []
pos = depth = aim = 0
with open(input_fname) as ifile:
for line in ifile:
lines.append(line.strip().split())
for (cmd, unit) in lines:
unit = int(unit)
if cmd == 'forward':
pos += unit
depth += aim * unit
... |
{
"files.associations": {
"**/*.html": "html",
"**/templates/**/*.html": "django-html",
"**/templates/**/*": "django-txt",
"**/requirements{/**,*}.{txt,in}": "pip-requirements"
},
"emmet.includeLanguages": {
"django-html": "html"
},
"python.pythonPath": "/usr/... | {'files.associations': {'**/*.html': 'html', '**/templates/**/*.html': 'django-html', '**/templates/**/*': 'django-txt', '**/requirements{/**,*}.{txt,in}': 'pip-requirements'}, 'emmet.includeLanguages': {'django-html': 'html'}, 'python.pythonPath': '/usr/local/bin/python3'} |
class DevConfig(object):
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/octocd'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = 'DEV_KEY'
| class Devconfig(object):
debug = True
sqlalchemy_database_uri = 'sqlite:////tmp/octocd'
sqlalchemy_track_modifications = False
secret_key = 'DEV_KEY' |
class Education:
def __init__(self, school, time, title, desc):
self.school = school
self.time = time
self.title = title
self.desc = desc | class Education:
def __init__(self, school, time, title, desc):
self.school = school
self.time = time
self.title = title
self.desc = desc |
'''
## The PyLCONF
A LCONF parser and emitter for Python.
### Web Presence
* PyLCONF [web site](http://lconf-data-serialization-format.github.io/PyLCONF/)
* PyLCONF [github repository](https://github.com/LCONF-Data-Serialization-Format/PyLCONF/)
### Copyrights & Licenses
The *PyLCONF package* is licensed under ... | """
## The PyLCONF
A LCONF parser and emitter for Python.
### Web Presence
* PyLCONF [web site](http://lconf-data-serialization-format.github.io/PyLCONF/)
* PyLCONF [github repository](https://github.com/LCONF-Data-Serialization-Format/PyLCONF/)
### Copyrights & Licenses
The *PyLCONF package* is licensed under ... |
#!/usr/bin/env python3
class FilterMiddleware(object):
def __init__(self, wsgi_app):
self.wsgi_app = wsgi_app
self.blacklist = ["sqlmap", "dirbuster"]
def __call__(self, environ, start_response):
try:
if any((x for x in self.blacklist if x in environ["HTTP_USER_AGENT"].low... | class Filtermiddleware(object):
def __init__(self, wsgi_app):
self.wsgi_app = wsgi_app
self.blacklist = ['sqlmap', 'dirbuster']
def __call__(self, environ, start_response):
try:
if any((x for x in self.blacklist if x in environ['HTTP_USER_AGENT'].lower())):
... |
w, b = input().split()
w = int(w)
b = float(b)
if (w % 5 == 0 and b>(w+.5)):
b = b - w - 0.5
print('%.2f' % b)
else:
print('%.2f' % b) | (w, b) = input().split()
w = int(w)
b = float(b)
if w % 5 == 0 and b > w + 0.5:
b = b - w - 0.5
print('%.2f' % b)
else:
print('%.2f' % b) |
def valid_card(card):
return (
not sum(
[
d if i & 1 else d % 5 * 2 + d / 5
for i, d in enumerate(map(int, card.replace(" ", "")))
]
)
% 10
)
| def valid_card(card):
return not sum([d if i & 1 else d % 5 * 2 + d / 5 for (i, d) in enumerate(map(int, card.replace(' ', '')))]) % 10 |
def XPLMFindCommand(command):
return 1
def XPLMCommandOnce(commandID):
pass
| def xplm_find_command(command):
return 1
def xplm_command_once(commandID):
pass |
SERVICE_KPI_HOOK = (u"kpi_hook", u"KPI Hook POST")
SERVICE_CHOICES = (
SERVICE_KPI_HOOK,
)
default_app_config = "onadata.apps.restservice.app.RestServiceConfig"
| service_kpi_hook = (u'kpi_hook', u'KPI Hook POST')
service_choices = (SERVICE_KPI_HOOK,)
default_app_config = 'onadata.apps.restservice.app.RestServiceConfig' |
# ---- ratings ----
urlpatterns += patterns('',
(r'^ratings/', include('ratings.urls')),
) | urlpatterns += patterns('', ('^ratings/', include('ratings.urls'))) |
# Total Purchase
# Simple Regsiter Program
print("In the fields below, enter the prices of five items")
totalAmount = float(input("What is the price of the first item? "))
totalAmount += float(input("What is the price of the second item? "))
totalAmount += float(input("What is the price of the third item? "))
totalAmo... | print('In the fields below, enter the prices of five items')
total_amount = float(input('What is the price of the first item? '))
total_amount += float(input('What is the price of the second item? '))
total_amount += float(input('What is the price of the third item? '))
total_amount += float(input('What is the price of... |
n = int(input())
ans = n//4*"abcd"
if n%4==1:
ans += "a"
elif n%4==2:
ans += "ab"
elif n%4==3:
ans += "abc"
print(ans)
| n = int(input())
ans = n // 4 * 'abcd'
if n % 4 == 1:
ans += 'a'
elif n % 4 == 2:
ans += 'ab'
elif n % 4 == 3:
ans += 'abc'
print(ans) |
# Trigger: com.android.internal.telephony.gsm.GSMPhone.handleMessage(Landroid/os/Message;)V
# Callback: android.content.Context.sendOrderedBroadcast(Landroid/content/Intent;Ljava/lang/String;ILandroid/content/BroadcastReceiver;Landroid/os/Handler;ILjava/lang/String;Landroid/os/Bundle;)V
IFAv0 = Int('IFAv0') # <Inpu... | if_av0 = int('IFAv0')
s.add(IFAv0 == 16) |
LOGFILE = '/tmp/robots.log'
def log(msg):
with open(LOGFILE, 'a') as f:
f.write(str(msg)+'\n')
| logfile = '/tmp/robots.log'
def log(msg):
with open(LOGFILE, 'a') as f:
f.write(str(msg) + '\n') |
## Beginner Series #2 Clock
## 8 kyu
## https://www.codewars.com/kata/55f9bca8ecaa9eac7100004a
def past(h, m, s):
hours = h * 60 * 60 * 1000
minutes = m * 60 * 1000
seconds = s * 1000
return hours + minutes + seconds
| def past(h, m, s):
hours = h * 60 * 60 * 1000
minutes = m * 60 * 1000
seconds = s * 1000
return hours + minutes + seconds |
miles = 1000.0 # A floating point
name = "John" # A string
print(miles)
print(name)
| miles = 1000.0
name = 'John'
print(miles)
print(name) |
class ScriptPlatformScriptGen:
def __init__(self):
pass
def GenerateScriptStart(self):
Script = "var layers = null;\r\n"
Script += "var filePath = activeDocument.fullName.path;\r\n"
Script += "var newDoc = app.activeDocument.duplicate();\r\n"
Script += "... | class Scriptplatformscriptgen:
def __init__(self):
pass
def generate_script_start(self):
script = 'var layers = null;\r\n'
script += 'var filePath = activeDocument.fullName.path;\r\n'
script += 'var newDoc = app.activeDocument.duplicate();\r\n'
script += 'app.activeDocu... |
class MyClass:
pass
var: [MyClass] = MyClass() | class Myclass:
pass
var: [MyClass] = my_class() |
## Get the mean of an array
## 8 kyu
## https://www.codewars.com/kata/563e320cee5dddcf77000158
def get_average(marks):
return sum(marks) // len(marks)
| def get_average(marks):
return sum(marks) // len(marks) |
def main():
s=[]
minlen = 257
n=int(input())
for i in range(n):
s.append(list(input()))
s[i].reverse()
if len(s[i])<minlen: minlen = len(s[i])
kuchiguse = 0
nai = False
for i in range(minlen):
same = True
for j in range(1,n):
if s[j][i] !=... | def main():
s = []
minlen = 257
n = int(input())
for i in range(n):
s.append(list(input()))
s[i].reverse()
if len(s[i]) < minlen:
minlen = len(s[i])
kuchiguse = 0
nai = False
for i in range(minlen):
same = True
for j in range(1, n):
... |
lorem_file = open("lorem.txt")
for line in lorem_file:
print(line.rstrip())
lorem_file.close()
| lorem_file = open('lorem.txt')
for line in lorem_file:
print(line.rstrip())
lorem_file.close() |
class Articles:
'''
articles class to define article objects
'''
def __init__(self,id,author,description,url,urlToImage,publishedAt,content):
self.id = id
self.author = author
self.description = description
self.url = url
self.urlToImage = urlToImage
self.... | class Articles:
"""
articles class to define article objects
"""
def __init__(self, id, author, description, url, urlToImage, publishedAt, content):
self.id = id
self.author = author
self.description = description
self.url = url
self.urlToImage = urlToImage
... |
#Activity 9
def factorial(n):
f = 1
for i in range (1, n + 1):
f = f * i
return f
def pascal(n):
for i in range (n):
for j in range (1, n - i):
print(" ", end = '')
for k in range (0, i + 1):
c = int(factorial(i) / (factorial(k) * factorial(i-k)))
... | def factorial(n):
f = 1
for i in range(1, n + 1):
f = f * i
return f
def pascal(n):
for i in range(n):
for j in range(1, n - i):
print(' ', end='')
for k in range(0, i + 1):
c = int(factorial(i) / (factorial(k) * factorial(i - k)))
print(' ', ... |
#!/usr/bin/env python
# coding: utf-8
# In[2]:
for i in range(0, 6):
if i == 3:
print("skip 3")
continue
print(i)
# In[3]:
for i in range(0, 6):
if i == 3:
print("skip 3")
break
print(i)
| for i in range(0, 6):
if i == 3:
print('skip 3')
continue
print(i)
for i in range(0, 6):
if i == 3:
print('skip 3')
break
print(i) |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'conditions': [
['OS=="android"', {
'targets': [
{
'target_name': 'native_test_apk',
'message': 'building nativ... | {'conditions': [['OS=="android"', {'targets': [{'target_name': 'native_test_apk', 'message': 'building native test apk', 'type': 'none', 'dependencies': ['native_test_native_code'], 'actions': [{'action_name': 'native_test_apk', 'inputs': ['<(DEPTH)/testing/android/native_test_apk.xml', '<!@(find <(DEPTH)/testing/andro... |
def declarations(declaration):
if len(declaration[2][0]) > 1:
string = '%s _%s[%s];\n' %(
declaration[3][0],
declaration[0],
']['.join([
str(int(ranges[2]) - int(ranges[1]) + 1)
for ranges in declaration[2]
if len(ranges) > 1
])
)
string += '%s __%s(void) {\n' %(
declaration[3][0],
... | def declarations(declaration):
if len(declaration[2][0]) > 1:
string = '%s _%s[%s];\n' % (declaration[3][0], declaration[0], ']['.join([str(int(ranges[2]) - int(ranges[1]) + 1) for ranges in declaration[2] if len(ranges) > 1]))
string += '%s __%s(void) {\n' % (declaration[3][0], declaration[0])
... |
class RainyRoad:
def isReachable(self, road):
for i, j in zip(*road):
if i == j == 'W':
return 'NO'
return 'YES'
| class Rainyroad:
def is_reachable(self, road):
for (i, j) in zip(*road):
if i == j == 'W':
return 'NO'
return 'YES' |
data_path = '../data'
app_path = '../web-app'
naics_dict = {
'11': 'Agriculture, Forestry, Fishing, and Hunting',
'21': 'Mining, Quarrying, and Oil and Gas Extraction',
'22': 'Utilities',
'23': 'Construction',
'31': 'Manufacturing',
'32': 'Manufacturing',
'33': 'Manufacturing',
'42': '... | data_path = '../data'
app_path = '../web-app'
naics_dict = {'11': 'Agriculture, Forestry, Fishing, and Hunting', '21': 'Mining, Quarrying, and Oil and Gas Extraction', '22': 'Utilities', '23': 'Construction', '31': 'Manufacturing', '32': 'Manufacturing', '33': 'Manufacturing', '42': 'Wholesale Trade', '44': 'Retail Tra... |
sample_sizes = [100, 500, 1000, 5000, 10000, 15000, y.size]
scores_sample_sizes = {}
rng = np.random.RandomState(0)
for n_samples in sample_sizes:
sample_idx = rng.choice(
np.arange(y.size), size=n_samples, replace=False
)
X_sampled, y_sampled = X.iloc[sample_idx], y[sample_idx]
size, score = m... | sample_sizes = [100, 500, 1000, 5000, 10000, 15000, y.size]
scores_sample_sizes = {}
rng = np.random.RandomState(0)
for n_samples in sample_sizes:
sample_idx = rng.choice(np.arange(y.size), size=n_samples, replace=False)
(x_sampled, y_sampled) = (X.iloc[sample_idx], y[sample_idx])
(size, score) = make_cv_an... |
'''Given: A DNA string s
s
of length at most 1000 nt.
Return: Four integers (separated by spaces) counting the respective number of times that the symbols 'A', 'C', 'G', and 'T' occur in s
'''
s = 'AGACTCGCGCACTCACGATGAATCCCAAGACAGCCTGGCGGAGTATGGTACTACGGCCGTCCTCACCAAGGCATTTCGGTCCGAGTAGCGGATTGTGTGCCAGCCCTGAGGGCGAGTTA... | """Given: A DNA string s
s
of length at most 1000 nt.
Return: Four integers (separated by spaces) counting the respective number of times that the symbols 'A', 'C', 'G', and 'T' occur in s
"""
s = 'AGACTCGCGCACTCACGATGAATCCCAAGACAGCCTGGCGGAGTATGGTACTACGGCCGTCCTCACCAAGGCATTTCGGTCCGAGTAGCGGATTGTGTGCCAGCCCTGAGGGCGAGTTAT... |
# 200020001
if 2400 == chr.getJob():
sm.warp(915010000, 1)# should be instance ?
elif 2410 <= chr.getJob() <= 2411:
sm.warp(915020000, 2)
else:
sm.chat("Only Phantoms can enter.")
sm.dispose()
| if 2400 == chr.getJob():
sm.warp(915010000, 1)
elif 2410 <= chr.getJob() <= 2411:
sm.warp(915020000, 2)
else:
sm.chat('Only Phantoms can enter.')
sm.dispose() |
[
{'base_name': 'HEASARC_swiftmastr',
'service_type': 'tap',
'access_url': 'https://heasarc.gsfc.nasa.gov/xamin/vo/tap',
'adql':'''
SELECT
*
FROM swiftmastr
WHERE
1=CONTAINS(POINT('ICRS', ra, dec),
CIRCLE('ICRS', {}, {}, {}))
'''
}
]
| [{'base_name': 'HEASARC_swiftmastr', 'service_type': 'tap', 'access_url': 'https://heasarc.gsfc.nasa.gov/xamin/vo/tap', 'adql': "\nSELECT\n *\n FROM swiftmastr\n WHERE \n 1=CONTAINS(POINT('ICRS', ra, dec),\n CIRCLE('ICRS', {}, {}, {}))\n "}] |
#Los atributos describen las caracteristicas de los objetos, las clases es donde declaramos estos atributos,el atributo se utiliza segun las variables o tipos de datos que disponemos en python
# Metodos son acciones/funciones
# Constructor o inicializador para inicializar los objetos de una forma predeterminada que pod... | class Persona:
n_brazos = 0
n_piernas = 0
cabello = True
c_cabello = 'Defecto'
hambre = 0
def __init__(self):
self.nBrazos = 2
self.nPiernas = 2
def dormir():
pass
def comer(self):
self.hambre = 5
class Hombre(Persona):
nombre = 'Defecto'
sexo ... |
BATCH_SIZE = 16
PROPOSAL_NUM = 6
CAT_NUM = 4
INPUT_SIZE = (448, 448) # (w, h)
LR = 0.0001
WD = 1e-4
SAVE_FREQ = 1
resume = ''
test_model = './checkpoints/model.ckpt'
save_dir = './trainlog/'
| batch_size = 16
proposal_num = 6
cat_num = 4
input_size = (448, 448)
lr = 0.0001
wd = 0.0001
save_freq = 1
resume = ''
test_model = './checkpoints/model.ckpt'
save_dir = './trainlog/' |
class Credentials:
BASE_URL = "http://localhost:8080"
# Login Page
LOGIN_PAGE_TITLE = "OpenProject"
USERNAME = "admin"
PASSWORD = "qazwsxedcr"
# Home Page
HOME_PAGE_TITLE = "OpenProject"
HOME_PAGE_SELECTED_PROJECT = "TestProject1"
# New Project page
NEW_PROJECT_PAGE_TITLE = "N... | class Credentials:
base_url = 'http://localhost:8080'
login_page_title = 'OpenProject'
username = 'admin'
password = 'qazwsxedcr'
home_page_title = 'OpenProject'
home_page_selected_project = 'TestProject1'
new_project_page_title = 'New project | OpenProject'
new_project_name = 'Hello Wo... |
x1 = float(input("Enter x1: "))
y1 = float(input("Enter y1: "))
x2 = float(input("Enter x2: "))
y2 = float(input("Enter y2: "))
m = (y2 - y1) / (x2 - x1)
print("Gradient is {:g}".format(m))
c = y1 - (m * x1)
print("y-int is {:g}".format(c))
print("Equation: y = {:g}x + {:g}".format(m,c)) | x1 = float(input('Enter x1: '))
y1 = float(input('Enter y1: '))
x2 = float(input('Enter x2: '))
y2 = float(input('Enter y2: '))
m = (y2 - y1) / (x2 - x1)
print('Gradient is {:g}'.format(m))
c = y1 - m * x1
print('y-int is {:g}'.format(c))
print('Equation: y = {:g}x + {:g}'.format(m, c)) |
# See https://developers.notion.com/reference/request-limits
RICH_TEXT_CONTENT_MAX_LENGTH = 2000
RICH_TEXT_LINK_MAX_LENGTH = 1000
EQUATION_EXPRESSION_MAX_LENGTH = 1000 | rich_text_content_max_length = 2000
rich_text_link_max_length = 1000
equation_expression_max_length = 1000 |
#---
def plotUAVcontrolSignals(df,plt):
## - Plot the Control Signals
fig, axs = plt.subplots(2,2, sharex=True)
fig.suptitle("Control Signals (Executed by the Drone)")
# ---------- u_\theta
axs[0,0].plot(df['time'], df['A.pSCU[0]'])
axs[0,0].set(ylabel=r'$u_{\theta}~$ [rad]')
axs[0,0].... | def plot_ua_vcontrol_signals(df, plt):
(fig, axs) = plt.subplots(2, 2, sharex=True)
fig.suptitle('Control Signals (Executed by the Drone)')
axs[0, 0].plot(df['time'], df['A.pSCU[0]'])
axs[0, 0].set(ylabel='$u_{\\theta}~$ [rad]')
axs[0, 0].grid(True)
axs[0, 0].set(xlim=(min(df['time']), max(df['t... |
def arr_pair_sum(arr, k):
# edge case
if len(arr) < 2:
return
# set for tracking
seen = set()
output = set()
for num in arr:
target = k - num
if target not in seen:
seen.add(num)
else:
output.add((min(num, target), max(num, target)))
... | def arr_pair_sum(arr, k):
if len(arr) < 2:
return
seen = set()
output = set()
for num in arr:
target = k - num
if target not in seen:
seen.add(num)
else:
output.add((min(num, target), max(num, target)))
return len(output)
print(arr_pair_sum([1,... |
def sanitize(time_string):
if "-" in time_string:
splitter = "-"
elif ":" in time_string:
splitter = ":"
else:
return time_string
(mins, secs) = time_string.split(splitter)
return mins + "." + secs
with open("james.txt") as jaf:
data = jaf.readline()
james = sorted([sani... | def sanitize(time_string):
if '-' in time_string:
splitter = '-'
elif ':' in time_string:
splitter = ':'
else:
return time_string
(mins, secs) = time_string.split(splitter)
return mins + '.' + secs
with open('james.txt') as jaf:
data = jaf.readline()
james = sorted([sanit... |
# Backport of str.removeprefix.
# TODO Remove when minimum python version is 3.9 or above
def removeprefix(string: str, prefix: str) -> str:
if string.startswith(prefix):
return string[len(prefix) :]
return string
| def removeprefix(string: str, prefix: str) -> str:
if string.startswith(prefix):
return string[len(prefix):]
return string |
# Some magic data values exist.
# They often represent missing data. More information can be found at the following link.
# https://www.census.gov/data/developers/data-sets/acs-1year/notes-on-acs-estimate-and-annotation-values.html
class Magic:
MISSING_VALUES = [
None,
-999999999,
-8888888... | class Magic:
missing_values = [None, -999999999, -888888888, -666666666, -555555555, -333333333, -222222222] |
def sample(task):
if task is not logistic:
raise NotImplementedError
# Parametric Generator for Logistic Regression Task (TODO: Generalize for Task - Parameter Specification)
theta = [np.random.uniform( 1, 10),
np.random.uniform( 1, 10),
np.random.uniform(-1, 1)]
return task(samp... | def sample(task):
if task is not logistic:
raise NotImplementedError
theta = [np.random.uniform(1, 10), np.random.uniform(1, 10), np.random.uniform(-1, 1)]
return (task(sample_space, theta), theta)
def sample_points(task, batch_size):
idx = np.random.choice(np.arange(len(sample_space)), batch_s... |
def read_input():
joltages = []
with open('day10_input.txt') as input_file:
for line in input_file:
line = line.strip()
joltages.append( int(line) )
return joltages
# Find a chain that uses all of your adapters to connect the charging outlet
# to your device's built-in adap... | def read_input():
joltages = []
with open('day10_input.txt') as input_file:
for line in input_file:
line = line.strip()
joltages.append(int(line))
return joltages
def part1(joltages):
diffs = [0, 0, 0, 1]
for i in range(1, len(joltages)):
diff = joltages[i] -... |
def main(request, response):
response.headers.set(b"Access-Control-Allow-Origin", request.headers.get(b"origin"))
token = request.GET[b"token"]
request.server.stash.put(token, b"")
response.content = b"PASS"
| def main(request, response):
response.headers.set(b'Access-Control-Allow-Origin', request.headers.get(b'origin'))
token = request.GET[b'token']
request.server.stash.put(token, b'')
response.content = b'PASS' |
class Address:
def __init__(self, street_address, city, country):
self.country = country
self.city = city
self.street_address = street_address
def __str__(self):
return f'{self.street_address}, {self.city}, {self.country}'
| class Address:
def __init__(self, street_address, city, country):
self.country = country
self.city = city
self.street_address = street_address
def __str__(self):
return f'{self.street_address}, {self.city}, {self.country}' |
def extractBetwixtedtranslationsBlogspotCom(item):
'''
Parser for 'betwixtedtranslations.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Transmigrated Senior Martial Brother', ... | def extract_betwixtedtranslations_blogspot_com(item):
"""
Parser for 'betwixtedtranslations.blogspot.com'
"""
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [('Transmigrated Senior ... |
#
# This file contains the Python code from Program 16.20 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by Bruno R. Preiss.
#
# Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm16_20.txt
#
class Algorithms(... | class Algorithms(object):
class Earliesttimevisitor(Visitor):
def __init__(self, earliestTime):
super(Algorithms.EarliestTimeVisitor, self).__init__()
self._earliestTime = earliestTime
def visit(self, w):
t = self._earliestTime[0]
for e in w.inciden... |
day_num = 15
file_load = open("input/day15.txt", "r")
file_in = file_load.read()
file_load.close()
file_in = list(map(int, file_in.split(",")))
def run():
def game(input_in, round_hunt):
num_last = {}
for temp_pos, temp_num in enumerate(input_in, 1):
num_last[temp_num] = temp_pos
game_round ... | day_num = 15
file_load = open('input/day15.txt', 'r')
file_in = file_load.read()
file_load.close()
file_in = list(map(int, file_in.split(',')))
def run():
def game(input_in, round_hunt):
num_last = {}
for (temp_pos, temp_num) in enumerate(input_in, 1):
num_last[temp_num] = temp_pos
... |
def findDuplicatesSequence(sequence):
stringySequence = str(sequence)
while stringySequence[0] == stringySequence[-1]:
stringySequence = stringySequence[-1] + stringySequence[0:-1]
iterableSequenceDuplicates = (re.finditer(r"(\d)\1+", str(stringySequence)))
duplicatesList = [iterable[0] for iter... | def find_duplicates_sequence(sequence):
stringy_sequence = str(sequence)
while stringySequence[0] == stringySequence[-1]:
stringy_sequence = stringySequence[-1] + stringySequence[0:-1]
iterable_sequence_duplicates = re.finditer('(\\d)\\1+', str(stringySequence))
duplicates_list = [iterable[0] fo... |
#
# PySNMP MIB module NNCBELLCOREGR820DS1STATISTICS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NNCBELLCOREGR820DS1STATISTICS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:13:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ... |
cities = [
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York",
},
{
"city": "Los Angeles",
"growth_from_2000_to_2013": "4... | cities = [{'city': 'New York', 'growth_from_2000_to_2013': '4.8%', 'latitude': 40.7127837, 'longitude': -74.0059413, 'population': '8405837', 'rank': '1', 'state': 'New York'}, {'city': 'Los Angeles', 'growth_from_2000_to_2013': '4.8%', 'latitude': 34.0522342, 'longitude': -118.2436849, 'population': '3884307', 'rank':... |
class QualifierClassifier:
def __init__(self):
pass
@staticmethod
def get_qualifiers(act_state):
return {}
| class Qualifierclassifier:
def __init__(self):
pass
@staticmethod
def get_qualifiers(act_state):
return {} |
a=int(input("enter the first number:"))
b=int(input("enter the second number:"))
s=(a&b) #sum
print(s)
u=(a/b) #or
print(u)
k=(~a) #not
print(k)
m=(a^b) #x-or
print(m)
o=(a<<b) #left shift
print(o)
t=(a>>b) #right shift
print(t)
| a = int(input('enter the first number:'))
b = int(input('enter the second number:'))
s = a & b
print(s)
u = a / b
print(u)
k = ~a
print(k)
m = a ^ b
print(m)
o = a << b
print(o)
t = a >> b
print(t) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.