content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# A Simple Art of Murder
chart = ["actually", "ahead", "almost", "alone", "also", "always", "anyway", "apparently", "arch", "artificially", "artistically", "atmospheric", "automatically", "away", "back", "carefully", "certainly", "closely", "completely", "constantly", "coun... | chart = (['actually', 'ahead', 'almost', 'alone', 'also', 'always', 'anyway', 'apparently', 'arch', 'artificially', 'artistically', 'atmospheric', 'automatically', 'away', 'back', 'carefully', 'certainly', 'closely', 'completely', 'constantly', 'counter', 'customarily', 'daily', 'deadly', 'dishonestly', 'drastically', ... |
def data_getter(target_name, file_name, data_name):
#rule
native.genrule(
name = target_name,
srcs = [data_name],
outs = [file_name],
tools = ["//code/programs/transcompilers/data_getter:data_getter"],
cmd = "$(location //code/programs/transcompilers/data_getter:data_gett... | def data_getter(target_name, file_name, data_name):
native.genrule(name=target_name, srcs=[data_name], outs=[file_name], tools=['//code/programs/transcompilers/data_getter:data_getter'], cmd='$(location //code/programs/transcompilers/data_getter:data_getter) -i $(SRCS) -o $@') |
#Adicionando estruturas logicas na List comprehensions
#exemplos
numeros=[1,2,3,4,5]
pares=[numero for numero in numeros if numero%2==0]
impares=[numero for numero in numeros if numero%2==1]
print(pares)
print(impares) | numeros = [1, 2, 3, 4, 5]
pares = [numero for numero in numeros if numero % 2 == 0]
impares = [numero for numero in numeros if numero % 2 == 1]
print(pares)
print(impares) |
def cari_binary (list_a, l, r, nilai):
idtengah = (l + r) // 2
if nilai == list_a[idtengah]:
return idtengah
elif l > r:
return -1
elif nilai > list_a[idtengah]:
return cari_binary(list_a, idtengah+ 1 , r, nilai)
elif nilai < list_a[idtengah]:
retur... | def cari_binary(list_a, l, r, nilai):
idtengah = (l + r) // 2
if nilai == list_a[idtengah]:
return idtengah
elif l > r:
return -1
elif nilai > list_a[idtengah]:
return cari_binary(list_a, idtengah + 1, r, nilai)
elif nilai < list_a[idtengah]:
return cari_binary(list_a... |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-ExternalTimingDS1MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-ExternalTimingDS1MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:20:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 1... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection, constraints_union) ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
bonds = {'N-N': 3, 'N-H': 6}
externalSymmetry = 2
spinMultiplicity = 1
opticalIsomers = 2
energy = {'CCSD(T)-F12/cc-pVTZ-f12': Log('sp.out')}
geometry = Log('freq.log')
frequencies = Log('freq.log')
| bonds = {'N-N': 3, 'N-H': 6}
external_symmetry = 2
spin_multiplicity = 1
optical_isomers = 2
energy = {'CCSD(T)-F12/cc-pVTZ-f12': log('sp.out')}
geometry = log('freq.log')
frequencies = log('freq.log') |
def on(object):
object.__enable__()
def off(object):
object.__disable__()
def sus(object):
object.__shield__()
def res(object):
object.__ishield__()
| def on(object):
object.__enable__()
def off(object):
object.__disable__()
def sus(object):
object.__shield__()
def res(object):
object.__ishield__() |
#Geografija
#povrsina najvecih zemalja svijeta (km2)
drzave = {
"Rusija" : 16377742,
"Kanada" : 9093507,
"Kina" : 9569901,
"USA" : 9158960,
"Brazil" : 8460415,
"Australija": 7682300,
"Indija" : 2973193,
"Argentina" : 2736690,
"Kazahstan" : 2699700,
"Alzir"... | drzave = {'Rusija': 16377742, 'Kanada': 9093507, 'Kina': 9569901, 'USA': 9158960, 'Brazil': 8460415, 'Australija': 7682300, 'Indija': 2973193, 'Argentina': 2736690, 'Kazahstan': 2699700, 'Alzir': 238741, 'Kongo': 2267048, 'Saud.Arab': 2149690, 'Meksiko': 1943945, 'Indonezija': 1811569, 'Libija': 1759540, 'Iran': 153159... |
class Addition:
first=0
second=0
ans=0
def __init__(self,f,s): #parameterised constructor
self.first=f
self.second=s
def display(self):
print("The first number=",self.first )
print("The second number=",self.second)
print("Addition of two numb... | class Addition:
first = 0
second = 0
ans = 0
def __init__(self, f, s):
self.first = f
self.second = s
def display(self):
print('The first number=', self.first)
print('The second number=', self.second)
print('Addition of two numbers is=', self.ans)
def c... |
sum = [0]
max_level = [-(2**32)]
class createNode:
def __init__(self, data):
self.d = data
self.l = None
self.r = None
def sumOfNodesAtMaxDepth(ro, level):
if(ro == None):
return
if(level > max_level[0]):
sum[0] = ro . d
... | sum = [0]
max_level = [-2 ** 32]
class Createnode:
def __init__(self, data):
self.d = data
self.l = None
self.r = None
def sum_of_nodes_at_max_depth(ro, level):
if ro == None:
return
if level > max_level[0]:
sum[0] = ro.d
max_level[0] = level
elif level... |
covR = 0.24577818347786398
overR = 1-9.990976150341012e-08
beta = 100000
for beta in [100000, 1, 1/100000]:
product = (beta * covR) * overR
print(product) | cov_r = 0.24577818347786398
over_r = 1 - 9.990976150341012e-08
beta = 100000
for beta in [100000, 1, 1 / 100000]:
product = beta * covR * overR
print(product) |
KEY_INCLUDE_EVENTDATA_COLLECTION_NAMES = 'include_eventdata_collection_names'
KEY_EVENTDATA_DATASETS = 'EVENTDATA_DATASETS'
FOLDER_COLLECTIONS = 'collections'
ALL_COLLECTIONS_2019 = ['cline_phoenix_fbis.json',
'cline_phoenix_nyt.json',
'cline_phoenix_swb.json',
... | key_include_eventdata_collection_names = 'include_eventdata_collection_names'
key_eventdata_datasets = 'EVENTDATA_DATASETS'
folder_collections = 'collections'
all_collections_2019 = ['cline_phoenix_fbis.json', 'cline_phoenix_nyt.json', 'cline_phoenix_swb.json', 'cline_speed.json', 'ged.json', 'gtd.json', 'icews.json', ... |
class Animal:
@classmethod
def description(cls):
return "An animal"
class Bird(Animal):
@classmethod
def description(cls):
s = super()
print(s)
print(s.description)
return s.description() + " with wings"
class Flamingo(Bird):
@classmethod
def descripti... | class Animal:
@classmethod
def description(cls):
return 'An animal'
class Bird(Animal):
@classmethod
def description(cls):
s = super()
print(s)
print(s.description)
return s.description() + ' with wings'
class Flamingo(Bird):
@classmethod
def descript... |
class LRU_Cache():
def __init__(self, capacity):
self.size = 0
self.capacity = capacity
self.cache = {}
self.llist = Doubly_Linked_List() # tail is LRU
def get(self, key):
if self.cache.get(key):
new_node = self.cache[key]
if new_node != self.ll... | class Lru_Cache:
def __init__(self, capacity):
self.size = 0
self.capacity = capacity
self.cache = {}
self.llist = doubly__linked__list()
def get(self, key):
if self.cache.get(key):
new_node = self.cache[key]
if new_node != self.llist.head:
... |
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | version_v1 = 'v1'
api_v1 = 'api/{}'.format(VERSION_V1)
streams_v1 = 'streams/{}'.format(VERSION_V1)
services_v1 = 'services/{}'.format(VERSION_V1)
rewrite_services_v1 = 'rewrite-services/{}'.format(VERSION_V1)
ws_v1 = 'ws/{}'.format(VERSION_V1)
auth_v1 = 'auth/{}'.format(VERSION_V1)
polyaxon_cloud = 'cloud.polyaxon.com... |
while True:
print('Height: ', end='');
user_input = input()
if user_input.is_numeric():
pyramid_height = int(user_input)
if pyramid_height >= 1 and pyramid_height <= 8:
break
for i in range(pyramid_height):
spaces = (pyramid_height - 1 - i) * " "
bricks = (i + 1) * "#"
... | while True:
print('Height: ', end='')
user_input = input()
if user_input.is_numeric():
pyramid_height = int(user_input)
if pyramid_height >= 1 and pyramid_height <= 8:
break
for i in range(pyramid_height):
spaces = (pyramid_height - 1 - i) * ' '
bricks = (i + 1) * '#'
... |
titles = [
'This is my first paste',
'Testing Testing',
'Whoa this is cool',
'TITLE!!!!!',
'What is this even'
] | titles = ['This is my first paste', 'Testing Testing', 'Whoa this is cool', 'TITLE!!!!!', 'What is this even'] |
# https://codeforces.com/problemset/problem/281/A
capital_Input = input("")
compare_List = list(capital_Input)
a = compare_List[0].upper()
print(a+capital_Input[1:])
| capital__input = input('')
compare__list = list(capital_Input)
a = compare_List[0].upper()
print(a + capital_Input[1:]) |
h=input("Enter your height in inches: ")
total = (int(h)/0.069)*0.25
print(total)
| h = input('Enter your height in inches: ')
total = int(h) / 0.069 * 0.25
print(total) |
def get_output_window_size(frequency):
if frequency == 'D':
return 59
elif frequency == 'h':
return 192
elif frequency == '900s':
return 192
else:
raise Exception('Unknown frequency %s' % (frequency, )) | def get_output_window_size(frequency):
if frequency == 'D':
return 59
elif frequency == 'h':
return 192
elif frequency == '900s':
return 192
else:
raise exception('Unknown frequency %s' % (frequency,)) |
default_encoder = {
"layer_1_2": {
"num_filters_out": 16,
"num_convs": 1,
},
"layer_2_3": {
"num_filters_out": 32,
"num_convs": 1,
},
}
default_decoder = {
"layer_3_2": {
"num_filters_out": 32,
"num_convs": 1,
},
"layer_2_1": {
"num_fi... | default_encoder = {'layer_1_2': {'num_filters_out': 16, 'num_convs': 1}, 'layer_2_3': {'num_filters_out': 32, 'num_convs': 1}}
default_decoder = {'layer_3_2': {'num_filters_out': 32, 'num_convs': 1}, 'layer_2_1': {'num_filters_out': 16, 'num_convs': 1}}
default_central = {'num_filters_out': 64, 'num_convs': 1} |
# based on: https://github.com/tigertv/secretpy/blob/master/secretpy/ciphers/zigzag.py
class cipher_zigzag:
def __enc(self, key, text):
crypted = ""
step = (key - 1) << 1
textlen = len(text)
# first row
left = 0
while (left < textlen):
crypted += text[le... | class Cipher_Zigzag:
def __enc(self, key, text):
crypted = ''
step = key - 1 << 1
textlen = len(text)
left = 0
while left < textlen:
crypted += text[left]
left += step
for row in range(1, key):
left = row
while left < t... |
class BaseRenderer:
def __init__(self):
pass
def render(self, stream, obj):
raise NotImplementedError()
| class Baserenderer:
def __init__(self):
pass
def render(self, stream, obj):
raise not_implemented_error() |
# http://www.alexa.com/topsites/countries/US
seeds = ['twitter.com', 'bing.com', 'paypal.com', 'nytimes.com', 'reddit.com', 'live.com', 'craigslist.org', 'ebay.com', 'espn.com', 'facebook.com', 'cnn.com', 'yahoo.com', 'wikipedia.org', 'tumblr.com', 'google.com', 'chase.com', 'amazon.com']
# http://www.pagetraffic.com/... | seeds = ['twitter.com', 'bing.com', 'paypal.com', 'nytimes.com', 'reddit.com', 'live.com', 'craigslist.org', 'ebay.com', 'espn.com', 'facebook.com', 'cnn.com', 'yahoo.com', 'wikipedia.org', 'tumblr.com', 'google.com', 'chase.com', 'amazon.com']
searches = [['hotels'], ['facebook'], ['youtube'], ['craigslist'], ['facebo... |
_base_ = ['./mask_rcnn_r50_fpn_sample1e-3_mstrain_1x_lvis_v1_pretrain.py']
lr_config = dict(step=[8,10,11])
total_epochs = 12
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.000025)
evaluation = dict(interval=2,metric=['bbox', 'segm'])
checkpoint_config = dict(interval=2, create_symlink=False)
... | _base_ = ['./mask_rcnn_r50_fpn_sample1e-3_mstrain_1x_lvis_v1_pretrain.py']
lr_config = dict(step=[8, 10, 11])
total_epochs = 12
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=2.5e-05)
evaluation = dict(interval=2, metric=['bbox', 'segm'])
checkpoint_config = dict(interval=2, create_symlink=False)
data... |
class Node:
def __init__(self,data):
self.left = None
self.rigth = None
self.data = data
def insert(self,data):
if data == self.data:
self.data = data
elif self.data:
if data < self.data:
if self.left is None:
s... | class Node:
def __init__(self, data):
self.left = None
self.rigth = None
self.data = data
def insert(self, data):
if data == self.data:
self.data = data
elif self.data:
if data < self.data:
if self.left is None:
... |
prices = {
"ACME": 45.23,
"AAPL": 612.79,
"IBM": 205.55,
"HPQ": 37.50,
"FB": 10.74
}
min_price = min(zip(prices.values(), prices.keys()))
max_price = max(zip(prices.values(), prices.keys()))
sorted_price = sorted(zip(prices.values(), prices.keys()))
# Return the name of the max or min value.
min_s... | prices = {'ACME': 45.23, 'AAPL': 612.79, 'IBM': 205.55, 'HPQ': 37.5, 'FB': 10.74}
min_price = min(zip(prices.values(), prices.keys()))
max_price = max(zip(prices.values(), prices.keys()))
sorted_price = sorted(zip(prices.values(), prices.keys()))
min_stock = min(prices, key=lambda k: prices[k])
max_stock = max(prices, ... |
class insect:
def __init__(self):
self.type = None
self.moved = False
self.breedCounter = 0
def __repr__(self):
return self.getType()
def getType(self):
return self.type
def didMove(self):
return self.moved
def move(self):
self.mo... | class Insect:
def __init__(self):
self.type = None
self.moved = False
self.breedCounter = 0
def __repr__(self):
return self.getType()
def get_type(self):
return self.type
def did_move(self):
return self.moved
def move(self):
self.moved = T... |
def bubble_sort(array, length):
is_swapper = True
while is_swapper:
is_swapper = False
for i in range(length - 1):
if array[i] > array[i + 1]:
array[i], array[i + 1] = array[i + 1], array[i]
is_swapper = True
return array
| def bubble_sort(array, length):
is_swapper = True
while is_swapper:
is_swapper = False
for i in range(length - 1):
if array[i] > array[i + 1]:
(array[i], array[i + 1]) = (array[i + 1], array[i])
is_swapper = True
return array |
URL = 'https://raw.githubusercontent.com/django-haystack/django-haystack/master/docs/changelog.rst'
def get_urls(releases, **kwargs):
return {URL}, set()
| url = 'https://raw.githubusercontent.com/django-haystack/django-haystack/master/docs/changelog.rst'
def get_urls(releases, **kwargs):
return ({URL}, set()) |
'''
Input: a List of integers as well as an integer `k` representing the size of the sliding window
Returns: a List of integers
'''
def sliding_window_max(nums, k):
max_nums = []
idx = 0
while idx <= len(nums) - k:
window_max = max(nums[idx: idx + k])
max_nums.append(window_max)
idx... | """
Input: a List of integers as well as an integer `k` representing the size of the sliding window
Returns: a List of integers
"""
def sliding_window_max(nums, k):
max_nums = []
idx = 0
while idx <= len(nums) - k:
window_max = max(nums[idx:idx + k])
max_nums.append(window_max)
idx ... |
#
# PySNMP MIB module Wellfleet-FAKE-EVENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-FAKE-EVENT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:33:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_intersection, constraints_union, single_value_constraint) ... |
def add(num1,num2,oparation):
return num1 + num2
def sub(num1,num2,oparation):
return num1 - num2
def mul(num1,num2,oparation):
return num1 * num2
def div(num1,num2,oparation):
return num1 / num2 | def add(num1, num2, oparation):
return num1 + num2
def sub(num1, num2, oparation):
return num1 - num2
def mul(num1, num2, oparation):
return num1 * num2
def div(num1, num2, oparation):
return num1 / num2 |
print('I will now count my chickens:')
print("Hens", 25+30/6)
print("Rosetrer", 100 - 25 * 3 % 4)
print("Now i will count the eggs:")
print(3+2+1-5+4%2-1/6+4)
print("Is it true that 3+2<5-7?")
print(3+2<5-7)
print("What is 3+2?", 3+2)
print("What is 5-7", 5-7)
print("Oh , that's why is's False:")... | print('I will now count my chickens:')
print('Hens', 25 + 30 / 6)
print('Rosetrer', 100 - 25 * 3 % 4)
print('Now i will count the eggs:')
print(3 + 2 + 1 - 5 + 4 % 2 - 1 / 6 + 4)
print('Is it true that 3+2<5-7?')
print(3 + 2 < 5 - 7)
print('What is 3+2?', 3 + 2)
print('What is 5-7', 5 - 7)
print("Oh , that's why is's F... |
#
# PySNMP MIB module Unisphere-Data-PPPoE-Profile-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-PPPoE-Profile-CONF
# Produced by pysmi-0.3.4 at Wed May 1 15:32:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ... |
class AutocompleteSystem:
def __init__(self, sentences: List[str], times: List[int]):
self.cur = self.root = {}
self.rank = collections.defaultdict(int)
for i, s in enumerate(sentences):
self.s = s
self.rank[s] = times[i] - 1
self.input('#')
def ... | class Autocompletesystem:
def __init__(self, sentences: List[str], times: List[int]):
self.cur = self.root = {}
self.rank = collections.defaultdict(int)
for (i, s) in enumerate(sentences):
self.s = s
self.rank[s] = times[i] - 1
self.input('#')
def mo... |
def average():
total_sum = 0
for num in range(n):
number = int(input("enter the number:"))
total_sum = total_sum+number
output = total_sum/n
print(output)
n = int(input("Enter how many no:"))
average()
| def average():
total_sum = 0
for num in range(n):
number = int(input('enter the number:'))
total_sum = total_sum + number
output = total_sum / n
print(output)
n = int(input('Enter how many no:'))
average() |
{
"includes": [ "cstar-example-opengl.gypi", "gypis/targets.gypi" ],
"target_defaults": {
"include_dirs": [
"."
]
}
} | {'includes': ['cstar-example-opengl.gypi', 'gypis/targets.gypi'], 'target_defaults': {'include_dirs': ['.']}} |
anoNascimento = int(input())
anoAtual = int(input())
idadeAtual = anoAtual - anoNascimento
idade_2017 = 2017 - anoNascimento
print(f"{idadeAtual}\n{idade_2017}")
| ano_nascimento = int(input())
ano_atual = int(input())
idade_atual = anoAtual - anoNascimento
idade_2017 = 2017 - anoNascimento
print(f'{idadeAtual}\n{idade_2017}') |
# wechat
appid = '' #''
secrect = '' # ''
# test_user_list
test_user_list = {'lpt'}
# server
token = '' | appid = ''
secrect = ''
test_user_list = {'lpt'}
token = '' |
TILE_MAP = (17, 62)
TILE = (25, 7)
TILE_PADDING = 3
_levels = {
0: {
'bricks': [' ',
' ',
' ',
' ',
' ',
' ',
... | tile_map = (17, 62)
tile = (25, 7)
tile_padding = 3
_levels = {0: {'bricks': [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ... |
class C(object):
@property
def x(self):
return 0
c = C()
c.__dict__['x'] = 1
print(c.x)
c.__dict__['y'] = 1
print(c.y)
| class C(object):
@property
def x(self):
return 0
c = c()
c.__dict__['x'] = 1
print(c.x)
c.__dict__['y'] = 1
print(c.y) |
def add_article_help():
print('adds new article to database')
print('paste or type the url directly after the command')
print('add_article [article_url]')
def add_category_help():
print('Creates a new category')
print('add_category [category_name]')
print('eg. add_category Canada creates a cate... | def add_article_help():
print('adds new article to database')
print('paste or type the url directly after the command')
print('add_article [article_url]')
def add_category_help():
print('Creates a new category')
print('add_category [category_name]')
print('eg. add_category Canada creates a cate... |
# MenuTitle: Align Components With Background
l = Glyphs.font.selectedLayers[0]
for c in l.components:
cbox = c.bounds
for p in l.background.paths:
pbox = p.bounds
if cbox.size.width == pbox.size.width and cbox.size.height == pbox.size.height:
if cbox.origin.x != pbox.origin.x or cbox.origin.y != pbox.origin.... | l = Glyphs.font.selectedLayers[0]
for c in l.components:
cbox = c.bounds
for p in l.background.paths:
pbox = p.bounds
if cbox.size.width == pbox.size.width and cbox.size.height == pbox.size.height:
if cbox.origin.x != pbox.origin.x or cbox.origin.y != pbox.origin.y:
c... |
# Part 1
class Main():
def __init__(self, input):
self.input = input
def partOne(input: str) -> int:
map = {
"depth": 0,
"hPos": 0,
"up": lambda x: map["depth"] - x,
"down": lambda x: map["depth"] + x,
"forward": lambda x... | class Main:
def __init__(self, input):
self.input = input
def part_one(input: str) -> int:
map = {'depth': 0, 'hPos': 0, 'up': lambda x: map['depth'] - x, 'down': lambda x: map['depth'] + x, 'forward': lambda x: map['hPos'] + x}
for (i, v) in enumerate(input):
(move, distan... |
expected_output = {
"allocation_status": "Sufficient",
"chassis": "ASR1006-X",
"excess_capacity_percent": 72,
"excess_power": 3201,
"fan_alc": 250,
"fru_alc": 949,
"load_capacity_percent": 15,
"power_capacity": 4400,
"redundancy_mode": "nplus1",
"redundant_alc": 0,
"slot": {
... | expected_output = {'allocation_status': 'Sufficient', 'chassis': 'ASR1006-X', 'excess_capacity_percent': 72, 'excess_power': 3201, 'fan_alc': 250, 'fru_alc': 949, 'load_capacity_percent': 15, 'power_capacity': 4400, 'redundancy_mode': 'nplus1', 'redundant_alc': 0, 'slot': {'0': {'allocation': 64.0, 'state': 'ok', 'type... |
# coding: utf8
char_code_map = {
u"a": ".-",
u"b": "-...",
u"c": "-.-.",
u"d": "-..",
u"e": ".",
u"f": "..-.",
u"g": "--.",
u"h": "....",
u"i": "..",
u"j": ".---",
u"k": "-.-",
u"l": ".-..",
u"m": "--",
u"n": "-.",
u"o": "---",
u"p": ".--.",
u"q": "--... | char_code_map = {u'a': '.-', u'b': '-...', u'c': '-.-.', u'd': '-..', u'e': '.', u'f': '..-.', u'g': '--.', u'h': '....', u'i': '..', u'j': '.---', u'k': '-.-', u'l': '.-..', u'm': '--', u'n': '-.', u'o': '---', u'p': '.--.', u'q': '--.-', u'r': '.-.', u's': '...', u't': '-', u'u': '..-', u'v': '...-', u'w': '.--', u'x... |
BUYING = 'buying'
DOMESTIC = 'domestic'
DSO = 'dso'
EUEXIT = 'euexit'
EVENTS = 'events'
EXPORT_ADVICE = 'export-advice'
EXPORT_OPPORTUNITIES = 'export-opportunities'
SELLING_ONLINE_OVERSEAS = 'selling-online-overseas'
FINANCE = 'finance'
GREAT_ACCOUNT = 'great-account'
GREAT_SERVICES = 'great-services'
INTERNATIONAL = ... | buying = 'buying'
domestic = 'domestic'
dso = 'dso'
euexit = 'euexit'
events = 'events'
export_advice = 'export-advice'
export_opportunities = 'export-opportunities'
selling_online_overseas = 'selling-online-overseas'
finance = 'finance'
great_account = 'great-account'
great_services = 'great-services'
international = ... |
#simple example of using a python file to externalize config data
configdict = {'1':'one',
'2':'two',
'3':'cat'}
| configdict = {'1': 'one', '2': 'two', '3': 'cat'} |
[ ## this file was manually modified by jt
{
'functor' : {
'arity' : '1',
'call_types' : [],
'ret_arity' : '0',
'rturn' : {
'default' : 'vT',
},
'special' : ['swar'],
'simd_types' : ['real_'],
'type_defs' : [],
... | [{'functor': {'arity': '1', 'call_types': [], 'ret_arity': '0', 'rturn': {'default': 'vT'}, 'special': ['swar'], 'simd_types': ['real_'], 'type_defs': [], 'types': ['real_'], 'simd_types': ['real_', 'signed_int_', 'unsigned_int_']}, 'info': 'manually modified', 'unit': {'global_header': {'first_stamp': 'created by jt ... |
class Measurement:
def __init__(self, data):
self.data = data
self.time = data[0]
self.acceleration = data[1:4]
self.rotation = data[4:7]
self.rotationRate = data[7:10]
self.orientation = data[10]
| class Measurement:
def __init__(self, data):
self.data = data
self.time = data[0]
self.acceleration = data[1:4]
self.rotation = data[4:7]
self.rotationRate = data[7:10]
self.orientation = data[10] |
class Board(object):
board_dimension = 8
w_pieces = [ [ 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P' ],
[ 'R', 'N', 'B', 'K', 'Q', 'B', 'N', 'R' ] ]
b_pieces = [ [ 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p' ],
[ 'r', 'n', 'b', 'k', 'q', 'b', 'n', 'r' ] ]
piece_id... | class Board(object):
board_dimension = 8
w_pieces = [['P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'], ['R', 'N', 'B', 'K', 'Q', 'B', 'N', 'R']]
b_pieces = [['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'], ['r', 'n', 'b', 'k', 'q', 'b', 'n', 'r']]
piece_id_key = {'p': lambda x_coord, y_coord: pawn('p', x_coord, y_coor... |
#Fibonacci-Folge
a1=1
a2=1
print("Die ersten 20 Zahlen der Fibonacci-Folge sind:")
print(a1,a2,end=" ")
for i in range (18):
a=a1+a2
print(a,end=" ")
a1, a2=a2, a
| a1 = 1
a2 = 1
print('Die ersten 20 Zahlen der Fibonacci-Folge sind:')
print(a1, a2, end=' ')
for i in range(18):
a = a1 + a2
print(a, end=' ')
(a1, a2) = (a2, a) |
fruit = ["apple","orange","banana","cherry"]
print([1,2] + [3,4])
print(fruit + [5,6,7,8])
print((fruit + [0,1]) * 2)
print(fruit + [1] * 4)
| fruit = ['apple', 'orange', 'banana', 'cherry']
print([1, 2] + [3, 4])
print(fruit + [5, 6, 7, 8])
print((fruit + [0, 1]) * 2)
print(fruit + [1] * 4) |
#!C:\python32\
def function1(bnum):
dnum=0
base=1
r=0
while(bnum>0):
r= (bnum%10)
bnum= (bnum // 10)
dnum+=r*base
base*=2
return dnum
def main():
bnum=input("Enter a binary number:\n-->")
re=function1(int(bnum))
print("The decimal form ... | def function1(bnum):
dnum = 0
base = 1
r = 0
while bnum > 0:
r = bnum % 10
bnum = bnum // 10
dnum += r * base
base *= 2
return dnum
def main():
bnum = input('Enter a binary number:\n-->')
re = function1(int(bnum))
print('The decimal form is {}'.format(re)... |
## Copyright 2019 The Rules Protobuf Authors. 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 require... | dependencies = {'bazel_skylib': {'sha256': '2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e', 'urls': ['https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz']}, 'com_google_protobuf': {'sha256': '03d2e5ef101aee4c2f6ddcf145d2a04926b9c19e7086944df3842b1b8502b783', ... |
with open('input.txt') as file:
commands = [[i.strip()[0],int(i.strip()[1:])] for i in file.readlines()]
class Ship:
def __init__(self,facing):
self.point_of_compass = ['N','E','S','W']
self.facing = facing
self.coor = [0,0]
def show_pos(self,manhattan=False):
print(f'Ship Coordinates : {self.coor}, Facin... | with open('input.txt') as file:
commands = [[i.strip()[0], int(i.strip()[1:])] for i in file.readlines()]
class Ship:
def __init__(self, facing):
self.point_of_compass = ['N', 'E', 'S', 'W']
self.facing = facing
self.coor = [0, 0]
def show_pos(self, manhattan=False):
print... |
# --- Day 6: Custom Customs ---
# As your flight approaches the regional airport where you'll switch to a much larger plane, customs declaration forms are distributed to the passengers.
# The form asks a series of 26 yes-or-no questions marked a through z. All you need to do is identify the questions for which anyone ... | def file_input():
f = open('day6-input.txt', 'r')
with open('day6-input.txt') as f:
read_data = f.read().split('\n\n')
f.close()
return read_data
def question_counter(data):
count = 0
for line in data:
line = {char for char in line}
line.discard('\n')
count = cou... |
text = 'There are two different ways for rsync to contact a remote system: using a remote-shell program as the transport (such as ssh or rsh) or contacting an rsync daemon directly via TCP. The remote-shell transport is used whenever the source or destination path contains a single colon (:) separator after a host... | text = 'There are two different ways for rsync to contact a remote system: using a remote-shell program as the transport (such as ssh or rsh) or contacting an rsync daemon directly via TCP. The remote-shell transport is used whenever the source or destination path contains a single colon (:) separator after a host ... |
f_in = open('supplementary_tableS1.txt')
f_out = open('disease_names.txt', 'w')
f_out.write(f_in.readline())
for line in f_in:
did, name = line.strip().replace('"', '').split('\t')[:2]
name = name.split(',')[0]
f_out.write('%s\t%s\n' % (did, name))
f_in.close()
f_out.close()
| f_in = open('supplementary_tableS1.txt')
f_out = open('disease_names.txt', 'w')
f_out.write(f_in.readline())
for line in f_in:
(did, name) = line.strip().replace('"', '').split('\t')[:2]
name = name.split(',')[0]
f_out.write('%s\t%s\n' % (did, name))
f_in.close()
f_out.close() |
class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
carry = 1
for ind in range(len(digits) - 1, -1, -1):
if carry == 0:
break
digits[ind] = digits[ind] + carry
carry = digits[ind] // 10
digits[ind] = digits[ind] % 10
if carry != 0:
tmp = [i for i in digits]
digits[0] = carry
... | class Solution:
def plus_one(self, digits: List[int]) -> List[int]:
carry = 1
for ind in range(len(digits) - 1, -1, -1):
if carry == 0:
break
digits[ind] = digits[ind] + carry
carry = digits[ind] // 10
digits[ind] = digits[ind] % 10
... |
while True:
n = int(input('Quer ver a tabuada de qual valor? '))
if n < 0:
break
for cont in range(1, 11):
print(f'{n} x {cont} = {n*cont}')
print('PROGRAMA TABUADA ENCERRAADO. Volte sempre')
| while True:
n = int(input('Quer ver a tabuada de qual valor? '))
if n < 0:
break
for cont in range(1, 11):
print(f'{n} x {cont} = {n * cont}')
print('PROGRAMA TABUADA ENCERRAADO. Volte sempre') |
class OlympicGame(object):
hostCity = None
year = None
lema = None
numNations = None
numAthletes = None
numEvents = None
medalTable = {}
openingDate = None
closingDate = None
stadiumName = None
image = None
latitude = None
longitude = None
def __init__(self, host... | class Olympicgame(object):
host_city = None
year = None
lema = None
num_nations = None
num_athletes = None
num_events = None
medal_table = {}
opening_date = None
closing_date = None
stadium_name = None
image = None
latitude = None
longitude = None
def __init__(se... |
class User(object):
name = None
is_staff = False
def __init__(self, name='Anonymous'):
self.name = name
super(User, self).__init__()
def is_authorized(self):
return self.is_staff
anonymous = User()
print(anonymous.name)
print(anonymous.is_authorized()) | class User(object):
name = None
is_staff = False
def __init__(self, name='Anonymous'):
self.name = name
super(User, self).__init__()
def is_authorized(self):
return self.is_staff
anonymous = user()
print(anonymous.name)
print(anonymous.is_authorized()) |
class Colors(object):
BLACK = 'k'
WHITE = 'w'
BLUE = 'b'
YELLOW = 'y'
RED = 'r'
GREEN = 'g'
SKY_BLUE = 'c'
MAGENTA = 'm'
| class Colors(object):
black = 'k'
white = 'w'
blue = 'b'
yellow = 'y'
red = 'r'
green = 'g'
sky_blue = 'c'
magenta = 'm' |
class DiscardPile:
def __init__(self):
self.cards = []
def add(self, card):
if type(card) == list:
self.cards += card
else:
self.cards.append(card)
def remove(self, index):
return self.cards.pop(index)
def __str__(self):
return str(list(... | class Discardpile:
def __init__(self):
self.cards = []
def add(self, card):
if type(card) == list:
self.cards += card
else:
self.cards.append(card)
def remove(self, index):
return self.cards.pop(index)
def __str__(self):
return str(list... |
def match_documents(source, target, comparable_field="id"):
matched_documents = list()
for document in source:
if type(document) is dict:
for target_document in target:
if type(target_document) is dict:
if str(document[comparable_field]) == str(target_docu... | def match_documents(source, target, comparable_field='id'):
matched_documents = list()
for document in source:
if type(document) is dict:
for target_document in target:
if type(target_document) is dict:
if str(document[comparable_field]) == str(target_docu... |
# Basic path from a node to another
g = {
'a':['b', 'c'],
'b':['c', 'd'],
'c':['d'],
'd':['c'],
'e':['f'],
'f':['c']
}
def getPath(g, start, end, path = []):
path += [start]
if start == end:
return path
if start not in g:
return []
for eragon in g[start]:
if eragon not in path:
eldest = getPath(g,... | g = {'a': ['b', 'c'], 'b': ['c', 'd'], 'c': ['d'], 'd': ['c'], 'e': ['f'], 'f': ['c']}
def get_path(g, start, end, path=[]):
path += [start]
if start == end:
return path
if start not in g:
return []
for eragon in g[start]:
if eragon not in path:
eldest = get_path(g, ... |
with open("input_4.txt", "r") as f:
lines = f.readlines()
# byr (Birth Year) - four digits; at least 1920 and at most 2002.
# iyr (Issue Year) - four digits; at least 2010 and at most 2020.
# eyr (Expiration Year) - four digits; at least 2020 and at most 2030.
# hgt (Height) - a number followed by either cm or in:... | with open('input_4.txt', 'r') as f:
lines = f.readlines()
people = []
acc = []
for line in lines:
if len(line.strip()) == 0:
people.append(acc)
acc = []
else:
acc.append(line)
num_valid = 0
for person in people:
d = {}
for line in person:
properties = line.split(' ')
... |
# This is a configuration file that's used when opening the Jupyter notebooks
# in this directory.
# See https://nbviewer.jupyter.org/github/mgeier/python-audio/blob/master/plotting/matplotlib-inline-defaults.ipynb
c.InlineBackend.figure_formats = {'svg'}
c.InlineBackend.rc = {'figure.dpi': 96}
| c.InlineBackend.figure_formats = {'svg'}
c.InlineBackend.rc = {'figure.dpi': 96} |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class FileWriterOLS:
def __init__(self, filename):
self.file = open(filename, "w");
def set_sample_rate(self, sample_rate):
self.sample_rate = sample_rate;
def write_header(self):
self.file.write(";Rate: %i\n" % int(self.sample_rate));
self.... | class Filewriterols:
def __init__(self, filename):
self.file = open(filename, 'w')
def set_sample_rate(self, sample_rate):
self.sample_rate = sample_rate
def write_header(self):
self.file.write(';Rate: %i\n' % int(self.sample_rate))
self.file.write(';Channels: 16\n')
... |
class NewNode:
def __init__(self, val):
self.data = val
self.left = None
self.right = None
def dive_deep(node,level):
if node != None:
level+=1
global max_level
global max_val
if level > max_level:
max_level = level
max_val = nod... | class Newnode:
def __init__(self, val):
self.data = val
self.left = None
self.right = None
def dive_deep(node, level):
if node != None:
level += 1
global max_level
global max_val
if level > max_level:
max_level = level
max_val = n... |
quality = Summary.copy()
quality.drop_duplicates(subset=['WALIS_ID'],inplace=True)
#Remove all data with no quality score (this deletes RSL datapoints from corals and speleothems)
noqual_data=len(quality[quality['Quality of RSL information'] == ''])
quality = quality[quality['Quality of RSL information'] != '']
Nation1... | quality = Summary.copy()
quality.drop_duplicates(subset=['WALIS_ID'], inplace=True)
noqual_data = len(quality[quality['Quality of RSL information'] == ''])
quality = quality[quality['Quality of RSL information'] != '']
nation1 = widgets.Dropdown(options=quality['Nation'].unique(), description='1st Nation:', disabled=Fa... |
'''
The First line of the input contains an integer T denoting the number of test cases. Then T test cases follow. Each tese case consists of two lines. The first line of each test case consists of two space separated integers P and Q denoting the length of the strings str1 and str2 respectively. The second line of eac... | """
The First line of the input contains an integer T denoting the number of test cases. Then T test cases follow. Each tese case consists of two lines. The first line of each test case consists of two space separated integers P and Q denoting the length of the strings str1 and str2 respectively. The second line of eac... |
# Task1. Write a function that returns the largest number of two numbers
# (use DocStrings documentation strings in the function).
def largest_number(a, b):
return a if a > b else b
print(largest_number(4, 7))
| def largest_number(a, b):
return a if a > b else b
print(largest_number(4, 7)) |
# Dictionary
# loop through items
# keys, values & items return a view object
# view object is an iterator & so we loop the items.
# view object is linked to the dictionary
# Dictionary -------------------------------------------
print(" Dictionary with string keys ".center(44, "-"))
dict_employee_IDs = {"ID01": 'John... | print(' Dictionary with string keys '.center(44, '-'))
dict_employee_i_ds = {'ID01': 'John Papa', 'ID02': 'David Thompson', 'ID03': 'Terry Gao', 'ID04': 'Barry Tex'}
print(dict_employee_IDs)
print(' keys returns a view object with all keys '.center(64, '-'))
dict_employee_i_ds_keys = dict_employee_IDs.keys()
print(dict... |
encoders = {
"libx264": {
"pix_fmt": {
"yuv420p",
"yuvj420p",
"yuv422p",
"yuvj422p",
"yuv444p",
"yuvj444p",
"nv12",
"nv16",
"nv21",
"yuv420p10le",
"yuv422p10le",
"y... | encoders = {'libx264': {'pix_fmt': {'yuv420p', 'yuvj420p', 'yuv422p', 'yuvj422p', 'yuv444p', 'yuvj444p', 'nv12', 'nv16', 'nv21', 'yuv420p10le', 'yuv422p10le', 'yuv444p10le', 'nv20le', 'gray', 'gray10le'}}, 'libx264rgb': {'pix_fmt': {'bgr0', 'bgr24', 'rgb24'}}, 'h264_videotoolbox': {'pix_fmt': {'videotoolbox_vld', 'nv12... |
API_BASE_URI = '/api/v1/namerequests/'
NAME_REQUEST_RESOURCE_API_URI = '/api/v1/name-request/'
NAME_REQUESTS_COLLECTION_API_URI = '/api/v1/namerequests/'
ENDPOINT_PATH = API_BASE_URI + ''
| api_base_uri = '/api/v1/namerequests/'
name_request_resource_api_uri = '/api/v1/name-request/'
name_requests_collection_api_uri = '/api/v1/namerequests/'
endpoint_path = API_BASE_URI + '' |
#############################
# Collaborators: (enter people or resources who/that helped you)
# If none, write none
#
#
#############################
# Write your code here:
print("Hello, welcome to the game! Are you ready?")
ready = ""
while ready != "yes":
ready = input("Enter yes whe ready: ")
print("Yay")... | print('Hello, welcome to the game! Are you ready?')
ready = ''
while ready != 'yes':
ready = input('Enter yes whe ready: ')
print('Yay') |
# Copyright 2020 The Jetstack cert-manager contributors.
#
# 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 l... | def helm_pkg(name, path, chart_name=None, srcs=[], helm_cmd='//hack/bin:helm', **kwargs):
if chart_name == None:
parts = path.split('/')
chart_name = parts[len(parts) - 1]
cmds = []
cmds = cmds + ['version=$$(cat $(location //:version))']
cmds = cmds + [' '.join(['$(location %s)' % helm_... |
MIN_MAX = float('inf') * -1
# Using readliness()
file1 = open('depth_readings.txt', 'r')
Lines = file1.readlines()
# ******************************************
# PART 2 - Sliding window
# Consider sums of a three-measurement sliding window. How many sums are larger than the previous sum?
# ***************************... | min_max = float('inf') * -1
file1 = open('depth_readings.txt', 'r')
lines = file1.readlines()
count = 0
a = MIN_MAX
b = a
c = a
last_sum = a
for line in Lines:
last_val = float(line)
if a == MIN_MAX:
a = lastVal
elif b == MIN_MAX:
b = lastVal
elif c == MIN_MAX:
c = lastVal
el... |
# dict = data structiors that alow us to store key value pairs
phonebook = {"ADela": 832723, "Tyler": 28362}
if "Herb" in phonebook:
print("Yes")
else:
print("no")
phonebook["Herb"] = 6783512873
phonebook["ADela"] = 2222222
del phonebook["Tyler"]
print(phonebook.keys())
for k in phonebook.keys():
prin... | phonebook = {'ADela': 832723, 'Tyler': 28362}
if 'Herb' in phonebook:
print('Yes')
else:
print('no')
phonebook['Herb'] = 6783512873
phonebook['ADela'] = 2222222
del phonebook['Tyler']
print(phonebook.keys())
for k in phonebook.keys():
print(k)
print(phonebook.items())
print(phonebook.values())
for (key, val... |
#code block and indentation example
i=10
j=10
str1="hello"
str2="hello"
print("Normal level or Level 0 indentation")
if str1==str2:
print("level 1 code block start with new indentation")
if i==j:
print("level 2 code block start with new indentation")
j=20
str2="students"
print("... | i = 10
j = 10
str1 = 'hello'
str2 = 'hello'
print('Normal level or Level 0 indentation')
if str1 == str2:
print('level 1 code block start with new indentation')
if i == j:
print('level 2 code block start with new indentation')
j = 20
str2 = 'students'
print("{0}, {1} today's stud... |
result = 0
counter = 1
while counter < 101:
result += counter
counter += 1
print(result)
| result = 0
counter = 1
while counter < 101:
result += counter
counter += 1
print(result) |
# https://www.hackerrank.com/contests/game-of-codes-3-0/challenges/ramanujans-prime-substrings
# https://www.hackerrank.com/rest/contests/game-of-codes-3-0/challenges/ramanujans-prime-substrings/download_pdf?language=English
def SieveOfEratosthenes(n):
# Create a boolean array "prime[0..n]" and initialize
... | def sieve_of_eratosthenes(n):
prime = [True for i in range(n + 1)]
p = 2
while p * p <= n:
if prime[p] == True:
for i in range(p * 2, n + 1, p):
prime[i] = False
p += 1
prime[0] = False
prime[1] = False
return prime
sieve = sieve_of_eratosthenes(10 ** ... |
class Solution:
def outerTrees(self, points: List[List[int]]) -> List[List[int]]:
if len(points) <= 2:
return points
def orient(p1, p2, p3):
return (p2[1] - p3[1]) * (p1[0] - p3[0]) - (p1[1] - p3[1]) * (p2[0] - p3[0])
points.sort(key=lambda x: (x[0], -x[1]))
... | class Solution:
def outer_trees(self, points: List[List[int]]) -> List[List[int]]:
if len(points) <= 2:
return points
def orient(p1, p2, p3):
return (p2[1] - p3[1]) * (p1[0] - p3[0]) - (p1[1] - p3[1]) * (p2[0] - p3[0])
points.sort(key=lambda x: (x[0], -x[1]))
... |
def known_plugins():
plugins = [
('molo.core', 'Molo'),
('molo.commenting', 'Commenting'),
('molo.forms', 'Forms'),
('molo.servicedirectory', 'Service Directory')
]
return plugins
| def known_plugins():
plugins = [('molo.core', 'Molo'), ('molo.commenting', 'Commenting'), ('molo.forms', 'Forms'), ('molo.servicedirectory', 'Service Directory')]
return plugins |
#type casting = convert dat type of a value to another data type
x = 1 #int
y = 2.0 #float
z = "3" #string
print(x)
print(y)
print(z)
print(int(y))
print(z*3)
print(int(z)*3)
print(float(x))
print(str(x))
print("X is "+str(x))
print("Y is "+str(y)) | x = 1
y = 2.0
z = '3'
print(x)
print(y)
print(z)
print(int(y))
print(z * 3)
print(int(z) * 3)
print(float(x))
print(str(x))
print('X is ' + str(x))
print('Y is ' + str(y)) |
def lowercase_list(string_list):
'''
Convert a list of strings to lower case
'''
return [x.lower() for x in string_list]
| def lowercase_list(string_list):
"""
Convert a list of strings to lower case
"""
return [x.lower() for x in string_list] |
mac = ['aabb:cc80:7000', 'aabb:dd80:7340', 'aabb:ee80:7000', 'aabb:ff80:7000']
mac_cisco = []
for item in mac:
mac_cisco.append(item.replace(':', '.'))
print(mac_cisco) | mac = ['aabb:cc80:7000', 'aabb:dd80:7340', 'aabb:ee80:7000', 'aabb:ff80:7000']
mac_cisco = []
for item in mac:
mac_cisco.append(item.replace(':', '.'))
print(mac_cisco) |
with open('input.txt', 'r') as f:
a = f.read()
seats_draft = a.splitlines()
seats = []
#creating a list with elements as a list of rows
for row_string in seats_draft:
row_list = list(row_string)
seats.append(row_list)
# determining length of each row in the pattern.
# Each row is of equal size and each... | with open('input.txt', 'r') as f:
a = f.read()
seats_draft = a.splitlines()
seats = []
for row_string in seats_draft:
row_list = list(row_string)
seats.append(row_list)
row_length = len(seats[0])
def list_equality(list1, list2):
if len(list1) != len(list2):
return False
for i in range(0, le... |
# Environment Variables
ENV_DEV_MODE = 'DYNOSCALE_DEV_MODE'
ENV_HEROKU_DYNO = 'DYNO'
ENV_DYNOSCALE_URL = 'DYNOSCALE_URL'
# Redis
ENV_REDIS_URL = 'REDIS_URL'
ENV_REDISTOGO_URL = 'REDISTOGO_URL'
ENV_OPENREDIS_URL = 'OPENREDIS_URL'
ENV_REDISGREEN_URL = 'REDISGREEN_URL'
ENV_REDISCLOUD_URL = 'REDISCLOUD_URL'
# Header
HTTP_X... | env_dev_mode = 'DYNOSCALE_DEV_MODE'
env_heroku_dyno = 'DYNO'
env_dynoscale_url = 'DYNOSCALE_URL'
env_redis_url = 'REDIS_URL'
env_redistogo_url = 'REDISTOGO_URL'
env_openredis_url = 'OPENREDIS_URL'
env_redisgreen_url = 'REDISGREEN_URL'
env_rediscloud_url = 'REDISCLOUD_URL'
http_x_request_start = 'HTTP_X_REQUEST_START'
x... |
semaine = [
"lundi",
"mardi",
"mercredi",
"jeudi",
"vendredi",
"samedi",
"dimanche"
]
calendOct18 = []
for i in range(1, 32):
calendOct18 += [semaine[i % 7 - 1] + " " + str(i) + " octobre"]
print(calendOct18)
| semaine = ['lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche']
calend_oct18 = []
for i in range(1, 32):
calend_oct18 += [semaine[i % 7 - 1] + ' ' + str(i) + ' octobre']
print(calendOct18) |
_base_='../htc/htc_r50_fpn_1x_coco.py'
dataset_type='CocoDataset'
prefix='../coco-annotator/datasets/test/'
classes=('plasticbottle','alu can','box')
model = dict(
roi_head=dict(
))
model = dict(
roi_head=dict(
semantic_head=dict(
num_classes=3
),
bbox_head=[
... | _base_ = '../htc/htc_r50_fpn_1x_coco.py'
dataset_type = 'CocoDataset'
prefix = '../coco-annotator/datasets/test/'
classes = ('plasticbottle', 'alu can', 'box')
model = dict(roi_head=dict())
model = dict(roi_head=dict(semantic_head=dict(num_classes=3), bbox_head=[dict(type='Shared2FCBBoxHead', num_classes=3), dict(type=... |
#
# PySNMP MIB module CISCO-NOTIFICATION-CONTROL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-NOTIFICATION-CONTROL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:08:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) ... |
class Solution:
def maxDepth(self, root: TreeNode) -> int:
def depth(node):
if node is None:
return 0
leftDepth = depth(node.left)
rightDepth = depth(node.right)
return max(leftDepth, rightDepth) + 1
return depth(root) | class Solution:
def max_depth(self, root: TreeNode) -> int:
def depth(node):
if node is None:
return 0
left_depth = depth(node.left)
right_depth = depth(node.right)
return max(leftDepth, rightDepth) + 1
return depth(root) |
'''
- Leetcode problem: 946
- Difficulty: Medium
- Brief problem description:
Given two sequences pushed and popped with distinct values, return true if and only if this could have been the result
of a sequence of push and pop operations on an initially empty stack.
Example 1:
Input: pushed = [1,2,3,4,5], popped... | """
- Leetcode problem: 946
- Difficulty: Medium
- Brief problem description:
Given two sequences pushed and popped with distinct values, return true if and only if this could have been the result
of a sequence of push and pop operations on an initially empty stack.
Example 1:
Input: pushed = [1,2,3,4,5], popped... |
ALPHABET = "abcdefghijklmnopqrstuvwxyz"
def increment(pwd):
incremented = ""
pos_not_z = len(pwd) - 1
while pwd[pos_not_z] == "z":
incremented = "a" + incremented
pos_not_z -= 1
incremented = pwd[:pos_not_z] + ALPHABET[ALPHABET.index(pwd[pos_not_z]) + 1] + incremented
return increm... | alphabet = 'abcdefghijklmnopqrstuvwxyz'
def increment(pwd):
incremented = ''
pos_not_z = len(pwd) - 1
while pwd[pos_not_z] == 'z':
incremented = 'a' + incremented
pos_not_z -= 1
incremented = pwd[:pos_not_z] + ALPHABET[ALPHABET.index(pwd[pos_not_z]) + 1] + incremented
return increme... |
'''
Min, Max, and Sorting Dictionaries:
'''
stocks={
'GOOD':520.24,
'FB':76.45,
'YHOO':39.28,
'AMZN':306.21,
'AAPL':99.76
}
print(sorted(zip(stocks.keys(),stocks.values()))) | """
Min, Max, and Sorting Dictionaries:
"""
stocks = {'GOOD': 520.24, 'FB': 76.45, 'YHOO': 39.28, 'AMZN': 306.21, 'AAPL': 99.76}
print(sorted(zip(stocks.keys(), stocks.values()))) |
class Utilities:
@staticmethod
def formatBalance(web3, balance):
return float(web3.fromWei(balance, "ether"))
@staticmethod
def getTotal(balances):
total = 0
for bal in balances:
total += sum([x["balInDollar"] for x in bal])
return total
@staticmethod
... | class Utilities:
@staticmethod
def format_balance(web3, balance):
return float(web3.fromWei(balance, 'ether'))
@staticmethod
def get_total(balances):
total = 0
for bal in balances:
total += sum([x['balInDollar'] for x in bal])
return total
@staticmethod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.