content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
my_dict = {}
my_dict[(1,2,4)] = 8
my_dict[(4,2,1)] = 10
my_dict[(1,2)] = 12
sum = 0
for k in my_dict:
sum += my_dict[k]
print (sum)
print(my_dict)
| my_dict = {}
my_dict[1, 2, 4] = 8
my_dict[4, 2, 1] = 10
my_dict[1, 2] = 12
sum = 0
for k in my_dict:
sum += my_dict[k]
print(sum)
print(my_dict) |
user = input("Say something! ")
print(user.upper())
print(user.lower())
print(user.swapcase())
| user = input('Say something! ')
print(user.upper())
print(user.lower())
print(user.swapcase()) |
# 1. The code below prints the numbers from 1 to 50. Rewrite the code using a while loop to
# accomplish the same thing.
# for i in range(1,51):
# print(i)
i = 1
while i <= 50:
print(i)
i += 1
| i = 1
while i <= 50:
print(i)
i += 1 |
#!/usr/bin/env python
def vowel_percent(in_str):
vowels = 'aeiou'
consonants = 'bcdfghjklmnpqrstvwxyz'
vowel_count = 0
consonant_count = 0
total = 0
for a_char in in_str:
if a_char in vowels or a_char in consonants:
total += 1 # only increment total for letters, not space/pu... | def vowel_percent(in_str):
vowels = 'aeiou'
consonants = 'bcdfghjklmnpqrstvwxyz'
vowel_count = 0
consonant_count = 0
total = 0
for a_char in in_str:
if a_char in vowels or a_char in consonants:
total += 1
if a_char in vowels:
vowel_count += 1
... |
#Code written by Ryan Helgoth
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
sol = []
for i in range(len(nums)):
currentNum = nums[i]
if currentNum <= target:
amountLeft = target - currentNum
try:
... | class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
sol = []
for i in range(len(nums)):
current_num = nums[i]
if currentNum <= target:
amount_left = target - currentNum
try:
index1 = i
... |
class UsersPage:
TITLE = "All users"
INVITE_BUTTON = "Invite a new user"
MANAGE_ROLES_BUTTON = "Manage roles"
INVITE_SUCCESSFUL_BANNER = "User has been invited successfully"
class Table:
NAME = "Name"
EMAIL = "Email"
TEAM = "Team"
ROLE = "Role"
STATUS = "Stat... | class Userspage:
title = 'All users'
invite_button = 'Invite a new user'
manage_roles_button = 'Manage roles'
invite_successful_banner = 'User has been invited successfully'
class Table:
name = 'Name'
email = 'Email'
team = 'Team'
role = 'Role'
status = 'Stat... |
SETTINGS = {
"FPS": 60,
"WIDTH": 1280,
"HEIGHT": 720,
"SOUNDS_VOLUME": 1.0,
"MUSICS_VOLUME": 0.1
} | settings = {'FPS': 60, 'WIDTH': 1280, 'HEIGHT': 720, 'SOUNDS_VOLUME': 1.0, 'MUSICS_VOLUME': 0.1} |
#
# PySNMP MIB module BAS-SONET-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAS-SONET-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:17:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
class Question:
def __init__(self, prompt, answer):
self.prompt = prompt
self.answer = answer
question_prompt = ["what is my name? \n" , "When was I born? \n", "Name my by color \n"]
questions = [Question(question_prompt[0], "Michael"),
Question(question_prompt[1], 2002),
... | class Question:
def __init__(self, prompt, answer):
self.prompt = prompt
self.answer = answer
question_prompt = ['what is my name? \n', 'When was I born? \n', 'Name my by color \n']
questions = [question(question_prompt[0], 'Michael'), question(question_prompt[1], 2002), question(question_prompt[2]... |
Scale.default = Scale.egyptian
Root.default = 0
Clock.bpm = 120
print(SynthDefs)
print(BufferManager())
print(Player.get_attributes())
p1 >> play(
P["@+ET"],
).every(3, "stutter", dur=1/2)
p1 >> play(
P["V+EA"],
).every(3, "stutter", dur=1/2)
p2 >> play(
P["<X >< n >"],#.layer("mirror"),
sample = ... | Scale.default = Scale.egyptian
Root.default = 0
Clock.bpm = 120
print(SynthDefs)
print(buffer_manager())
print(Player.get_attributes())
p1 >> play(P['@+ET']).every(3, 'stutter', dur=1 / 2)
p1 >> play(P['V+EA']).every(3, 'stutter', dur=1 / 2)
p2 >> play(P['<X >< n >'], sample=2)
p2.stop()
p3.stop()
p4.stop()
p5 >> pla... |
# coding: utf-8
def check(a,b,s,ans):
for j in range(b):
if [s[k] for k in range(12) if k%b==j].count('X')==a:
ans.append('%dx%d'%(a,b))
return ans
return ans
t = int(input())
for i in range(t):
ans = []
s = input()
ans = check(1,12,s,ans)
ans = check(2,6,s,ans)
... | def check(a, b, s, ans):
for j in range(b):
if [s[k] for k in range(12) if k % b == j].count('X') == a:
ans.append('%dx%d' % (a, b))
return ans
return ans
t = int(input())
for i in range(t):
ans = []
s = input()
ans = check(1, 12, s, ans)
ans = check(2, 6, s, ans)... |
####################################SLICING######################################
# x[start:stop:step]
# result starts at <start> including it
# result ends at <stop> excluding it
# optional third argument determines which arguments are carved out (default is 1)
# slice assgnments ->
###############################... | letters_amazon = '\nWe spent several years building our own database engine,\nAmazon Aurora, a fully-managed MySQL and PostgreSQL-compatible\nservice with the same or better durability and availability as\nthe commercial engines, but at one-tenth of the cost. We were\nnot surprised when this worked.\n'
find = lambda x,... |
# Python program to find largest
# number in a list
# list of numbers
list1 = [10, 20, 4, 45, 99]
# printing the maximum element
print("Largest element is:", max(list1))
| list1 = [10, 20, 4, 45, 99]
print('Largest element is:', max(list1)) |
t = int(input())
visit = None
sequence = None
def dfs(x, y, r, c, dist):
global visit, sequence
visit[x][y] = True
# print(x, y, dist)
# print(visit)
sequence[x][y] = dist
if dist == r * c - 1:
return True
for nx in range(r):
for ny in range(c):
if visit[nx][ny... | t = int(input())
visit = None
sequence = None
def dfs(x, y, r, c, dist):
global visit, sequence
visit[x][y] = True
sequence[x][y] = dist
if dist == r * c - 1:
return True
for nx in range(r):
for ny in range(c):
if visit[nx][ny] or nx == x or ny == y or (nx - ny == x - y)... |
#!/usr/bin/env python3
# -*- coding utf-8 -*-
__Author__ ='eamon'
'Object Oriented Programming'
std1={'name':'Eamon','Score':99}
std2={'name':'chen','Score':100}
def print_score(std):
print('%s: %s' % (std['name'], std['Score']))
print_score(std1)
print_score(std2)
class Student(object):
def __init__(se... | ___author__ = 'eamon'
'Object Oriented Programming'
std1 = {'name': 'Eamon', 'Score': 99}
std2 = {'name': 'chen', 'Score': 100}
def print_score(std):
print('%s: %s' % (std['name'], std['Score']))
print_score(std1)
print_score(std2)
class Student(object):
def __init__(self, name, score):
self.__name =... |
class HostManagerBase(object):
def get_sni_host(self, ip):
return "", ""
| class Hostmanagerbase(object):
def get_sni_host(self, ip):
return ('', '') |
n = int(input("Enter the month number:"))
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = 2
if n in a:
print("The total number of days in month",n,"is 31")
elif n in b:
print("The total number of days in month",n,"is 30")
elif n == c:
print("This month may have 28 or 29 days based on leap year")
else:
... | n = int(input('Enter the month number:'))
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = 2
if n in a:
print('The total number of days in month', n, 'is 31')
elif n in b:
print('The total number of days in month', n, 'is 30')
elif n == c:
print('This month may have 28 or 29 days based on leap year')
else:... |
# Hyperparameters
BUFFER_SIZE = int(1e6)
BATCH_SIZE = 64
GAMMA = 0.99
TAU = 0.01
LRA = 1e-4
LRC = 1e-3
HIDDEN_1 = 400
HIDDEN_2 = 300
MAX_EPISODES = 50000
MAX_STEPS = 200
GLOBAL_LINEAR_EPS_DECAY = 1e-5 # Decay over 100 thousand transitions
OPTION_LINEAR_EPS_DECAY = 2e-5 # Decay over 50 thousand transitions
PRINT_EVE... | buffer_size = int(1000000.0)
batch_size = 64
gamma = 0.99
tau = 0.01
lra = 0.0001
lrc = 0.001
hidden_1 = 400
hidden_2 = 300
max_episodes = 50000
max_steps = 200
global_linear_eps_decay = 1e-05
option_linear_eps_decay = 2e-05
print_every = 10 |
# @author: cchen
# pretty long and should be simplified later
class Solution:
# @param {string} s
# @return {string}
def longestPalindrome(self, s):
size = len(s)
ls = []
ll = 0
rr = 0
l = 0
r = 0
maxlen = r - l + 1
for i in range(1, size):
... | class Solution:
def longest_palindrome(self, s):
size = len(s)
ls = []
ll = 0
rr = 0
l = 0
r = 0
maxlen = r - l + 1
for i in range(1, size):
if s[i - 1] == s[i]:
r = i
else:
if r - l + 1 > maxlen... |
class ParseError(Exception):
pass
class NotEnoughInputError(ParseError):
pass
class ImproperInputError(ParseError):
pass
class PlaceholderError(Exception):
pass
| class Parseerror(Exception):
pass
class Notenoughinputerror(ParseError):
pass
class Improperinputerror(ParseError):
pass
class Placeholdererror(Exception):
pass |
# --------------
# Code starts here
# Create the lists
class_1 = ['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio']
class_2 = ['Hilary Mason','Carla Gentry','Corinna Cortes']
# Concatenate both the strings
new_class = class_1 + class_2
print(new_class)
# Append the list
new_class.append('P... | class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.pop(5)
print(new_class)
courses = {'Math': 65, 'English': 70, 'History'... |
#################################################################
#Config
base_data_dir='/home/shawn/data/nist/ECODSEdataset/'
hs_image_dir = base_data_dir + 'RSdata/hs/'
chm_image_dir= base_data_dir + 'RSdata/chm/'
rgb_image_dir= base_data_dir + 'RSdata/camera/'
training_polygons_dir = base_data_dir + 'Task1/ITC/'
p... | base_data_dir = '/home/shawn/data/nist/ECODSEdataset/'
hs_image_dir = base_data_dir + 'RSdata/hs/'
chm_image_dir = base_data_dir + 'RSdata/chm/'
rgb_image_dir = base_data_dir + 'RSdata/camera/'
training_polygons_dir = base_data_dir + 'Task1/ITC/'
prediction_polygons_dir = base_data_dir + 'Task1/predictions/'
image_type... |
a=4
b=2
# addition operator
print(a+b)
| a = 4
b = 2
print(a + b) |
found_coins = 20
magic_coins = 10
stolen_coins = 3
print(found_coins + magic_coins * 365 - stolen_coins * 52)
stolen_coins = 2
print(found_coins + magic_coins * 365 - stolen_coins * 52)
magic_coins = 13
print(found_coins + magic_coins * 365 - stolen_coins * 52) | found_coins = 20
magic_coins = 10
stolen_coins = 3
print(found_coins + magic_coins * 365 - stolen_coins * 52)
stolen_coins = 2
print(found_coins + magic_coins * 365 - stolen_coins * 52)
magic_coins = 13
print(found_coins + magic_coins * 365 - stolen_coins * 52) |
class RecordsBase:
pass
class VersionBase:
pass
class VersionsBase:
pass
| class Recordsbase:
pass
class Versionbase:
pass
class Versionsbase:
pass |
# O(n) time | O(1) space
def findLoop(head):
first = head.next
second = head.next.next
while first != second:
first = first.next
second = second.next.next
first = head
while first != second:
first = first.next
second = second.next
return first | def find_loop(head):
first = head.next
second = head.next.next
while first != second:
first = first.next
second = second.next.next
first = head
while first != second:
first = first.next
second = second.next
return first |
class Solution:
# @param {integer} dividend
# @param {integer} divisor
# @return {integer}
def divide(self, dividend, divisor):
if divisor == 0:
return None
sig = 1-2*(1 if dividend * divisor<0 else 0)
dividend,divisor = abs(dividend), abs(divisor)
if divisor ... | class Solution:
def divide(self, dividend, divisor):
if divisor == 0:
return None
sig = 1 - 2 * (1 if dividend * divisor < 0 else 0)
(dividend, divisor) = (abs(dividend), abs(divisor))
if divisor == 1:
return min(max(dividend * sig, -2147483648), 2147483647)
... |
ratings = 0
all_mean = 0
user_mean = 0
item_mean = 0
user_similarity = 0
item_similarity = 0
user_similarity_norm = 0
item_similarity_norm = 0
n_users = 943
n_items = 1682
| ratings = 0
all_mean = 0
user_mean = 0
item_mean = 0
user_similarity = 0
item_similarity = 0
user_similarity_norm = 0
item_similarity_norm = 0
n_users = 943
n_items = 1682 |
_base_ = [
'../_base_/models/resnest50.py', '../_base_/datasets/diseased_bs32_pil_resize.py',
'../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py'
]
model = dict(
head=dict(
num_classes=2,
topk=(1,))
) | _base_ = ['../_base_/models/resnest50.py', '../_base_/datasets/diseased_bs32_pil_resize.py', '../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py']
model = dict(head=dict(num_classes=2, topk=(1,))) |
def hanoi(n, from_tower, to_tower, other_tower):
if n == 1: # recursion bottom
print(f'{from_tower} -> {to_tower}')
else: # recursion step
hanoi(n - 1, from_tower, other_tower, to_tower)
print(f'{from_tower} -> {to_tower}')
hanoi(n - 1, other_tower, to_tower, from_tower)
h... | def hanoi(n, from_tower, to_tower, other_tower):
if n == 1:
print(f'{from_tower} -> {to_tower}')
else:
hanoi(n - 1, from_tower, other_tower, to_tower)
print(f'{from_tower} -> {to_tower}')
hanoi(n - 1, other_tower, to_tower, from_tower)
hanoi(4, 1, 3, 2) |
# Sample Code For Assignment #3
# Printing Formatted Data in Python
# Copyright (C) 2021 Clinton Garwood
# MIT Open Source Initiative Approved License
# hw_assignment_3.py
# CIS-135 Python
# Resources:
# https://www.w3schools.com/python/ref_string_format.asp
# https://www.w3schools.com/python/python_string_... | my_int = 10
my_string = 'Clinton'
chevy = 'Cheverolet Silverado 586,675 $ 28,595.00'
chevy = 'Cheverolet Equinox 1,270,994 $ 25,000.00'
ti = ('Car Make', 'Car Model', 'Units Sold', 'Starting Price')
sep = ['--------', '---------', '----------', '--------------']
cs = ['Chevrolet', 'Silve... |
class VanillaRNN(nn.Module):
def __init__(self, layers, output_size, hidden_size, vocab_size, embed_size,
device):
super(VanillaRNN, self).__init__()
self.n_layers= layers
self.hidden_size = hidden_size
self.device = device
# Define the embedding
self.embeddings = nn.Embedding(v... | class Vanillarnn(nn.Module):
def __init__(self, layers, output_size, hidden_size, vocab_size, embed_size, device):
super(VanillaRNN, self).__init__()
self.n_layers = layers
self.hidden_size = hidden_size
self.device = device
self.embeddings = nn.Embedding(vocab_size, embed_s... |
__all__ = ("country_codes",)
country_codes = { # talk about ugly lol
"oc": 1,
"eu": 2,
"ad": 3,
"ae": 4,
"af": 5,
"ag": 6,
"ai": 7,
"al": 8,
"am": 9,
"an": 10,
"ao": 11,
"aq": 12,
"ar": 13,
"as": 14,
"at": 15,
"au": 16,
"aw": 17,
"az": 18,
"b... | __all__ = ('country_codes',)
country_codes = {'oc': 1, 'eu': 2, 'ad': 3, 'ae': 4, 'af': 5, 'ag': 6, 'ai': 7, 'al': 8, 'am': 9, 'an': 10, 'ao': 11, 'aq': 12, 'ar': 13, 'as': 14, 'at': 15, 'au': 16, 'aw': 17, 'az': 18, 'ba': 19, 'bb': 20, 'bd': 21, 'be': 22, 'bf': 23, 'bg': 24, 'bh': 25, 'bi': 26, 'bj': 27, 'bm': 28, 'bn... |
# Code strings the E6-B code
# OCR from European patent EP1825626B1.pdf (may have a few errors)
# The codes for the following PRNs have been compared with recorded signals and should be error-free:
# 1 2 3 4 5 7 8 9 11 12 13 14 15 18 19 21 24 25 26 27 30 31 33 36
e6b_strings = {
1: "5mSKpe/wkHoXA3f7IM7e4ejSU9rCSWgxA... | e6b_strings = {1: '5mSKpe/wkHoXA3f7IM7e4ejSU9rCSWgxAQM2tEQna6qxflmVSLGnnGc3n5jfDLga6NkU7klHCTrcuU/0s5Fu5WKkyv1KWgSXIWBuVf/+smyUnXyLCretL33bv4ipsJFRDSCaqj9sg+z7jeIbd+eTqedZ5zp+1jMDlf2TgOjobwpRHg/sjgtlAZg/p8aT////cZ7+QknvKVtXjlFIF9nobrwQkXs7dla+9smquCALIN7lS/2xhyijOTRQ8gsIp6yEqflFOY4TQ0vTB2CH8yyhZa+5T+qWhpJOgxukvXas9i17I... |
#!/usr/bin/env python
#coding: utf-8
class Solution:
# @param gas, a list of integers
# @param cost, a list of integers
# @return an integer
def canCompleteCircuit(self, gas, cost):
total, tank, start = 0, 0, 0
lg = len(gas)
for i in range(lg):
tank = tank + gas[i] ... | class Solution:
def can_complete_circuit(self, gas, cost):
(total, tank, start) = (0, 0, 0)
lg = len(gas)
for i in range(lg):
tank = tank + gas[i] - cost[i]
if tank < 0:
start = i + 1
total += tank
tank = 0
retu... |
# Jadoo, the Space Alien has befriended Koba upon landing on Earth. Since then, he wishes Koba to be more like him. In order to do so he decides to slowly transcribe Koba's DNA into RNA. But he has to write a very short code in order to do the transcription so as not to make Koba aware of the change.
# The four nucleo... | string = input()
flag = True
out = ''
for s in string:
if s == 'A':
out += 'U'
elif s == 'G':
out += 'C'
elif s == 'C':
out += 'G'
elif s == 'T':
out += 'A'
else:
flag = False
if flag:
print(out)
else:
print('Invalid Input') |
class NameTooShortError(ValueError):
pass
raise NameTooShortError("foo")
| class Nametooshorterror(ValueError):
pass
raise name_too_short_error('foo') |
# O((2n)!/((n!((n + 1)!)))) time | O((2n)!/((n!((n + 1)!)))) space -
# where n is the input number
def generateDivTags(numberOfTags):
matchedDivTags = []
generateDivTagsFromPrefix(numberOfTags, numberOfTags, "", matchedDivTags)
return matchedDivTags
def generateDivTagsFromPrefix(openingTagsNeede... | def generate_div_tags(numberOfTags):
matched_div_tags = []
generate_div_tags_from_prefix(numberOfTags, numberOfTags, '', matchedDivTags)
return matchedDivTags
def generate_div_tags_from_prefix(openingTagsNeeded, closingTagsNeeded, prefix, result):
if openingTagsNeeded > 0:
new_prefix = prefix +... |
# md5 : d385b6882bfe47bedf2a2b9547c91a16
# sha1 : 907eec7568423245054be9c59638f0e2bc04afad
# sha256 : a4e40c348031047b966c18f2761ee0460a226905721d2f29327528cb2b213cb1
ord_names = {
1: b'AcquireSRWLockExclusive',
2: b'AcquireSRWLockShared',
3: b'ActivateActCtx',
4: b'ActivateActCtxWorker',
5: b'AddA... | ord_names = {1: b'AcquireSRWLockExclusive', 2: b'AcquireSRWLockShared', 3: b'ActivateActCtx', 4: b'ActivateActCtxWorker', 5: b'AddAtomA', 6: b'AddAtomW', 7: b'AddConsoleAliasA', 8: b'AddConsoleAliasW', 9: b'AddDllDirectory', 10: b'AddIntegrityLabelToBoundaryDescriptor', 11: b'AddLocalAlternateComputerNameA', 12: b'AddL... |
# -*- coding: utf-8 -*-
class Solution:
def countOdds(self, low: int, high: int) -> int:
return (high + 1) // 2 - low // 2
if __name__ == '__main__':
solution = Solution()
assert 3 == solution.countOdds(3, 7)
assert 1 == solution.countOdds(8, 10)
| class Solution:
def count_odds(self, low: int, high: int) -> int:
return (high + 1) // 2 - low // 2
if __name__ == '__main__':
solution = solution()
assert 3 == solution.countOdds(3, 7)
assert 1 == solution.countOdds(8, 10) |
def solution(x, y):
result = 0
if y == 1:
result = (1 + x) * x / 2
elif y == 2:
result = (1 + x) * x / 2 + x
else:
end = x + y - 2
result = (1 + end) * end / 2 + x
return str(result)
| def solution(x, y):
result = 0
if y == 1:
result = (1 + x) * x / 2
elif y == 2:
result = (1 + x) * x / 2 + x
else:
end = x + y - 2
result = (1 + end) * end / 2 + x
return str(result) |
#
# PySNMP MIB module MAU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MAU-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:49:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ... |
capac = int(input())
qtn500 = capac // 500
capac = capac - (qtn500 * 500)
qtn100 = capac // 100
capac = capac - (qtn100 * 100)
qtn25 = capac // 25
capac = capac - (qtn25 * 25)
print(qtn500)
print(qtn100)
print(qtn25)
print(capac) | capac = int(input())
qtn500 = capac // 500
capac = capac - qtn500 * 500
qtn100 = capac // 100
capac = capac - qtn100 * 100
qtn25 = capac // 25
capac = capac - qtn25 * 25
print(qtn500)
print(qtn100)
print(qtn25)
print(capac) |
def split_all_strings(input_array,splitter,keep_empty=False):
out=[]
while(len(input_array)):
current=input_array.pop(0).split(splitter)
while(len(current)):
i=current.pop(0)
if(len(i) or keep_empty):
out.append(i)
return(out)
if __name__ == '__main__':
test = 'hello world or something like that'.spl... | def split_all_strings(input_array, splitter, keep_empty=False):
out = []
while len(input_array):
current = input_array.pop(0).split(splitter)
while len(current):
i = current.pop(0)
if len(i) or keep_empty:
out.append(i)
return out
if __name__ == '__mai... |
with open("encoded.bmp", "rb") as f:
f.seek(0x7d0)
buf = f.read(0x32 * 8)
flag = ''
bin_flag = ''
for i, c in enumerate(buf):
bin_flag += str(c & 1)
if i % 8 == 7:
flag += chr(int(bin_flag[::-1], 2) + 5)
bin_flag = ''
print(repr(flag))
| with open('encoded.bmp', 'rb') as f:
f.seek(2000)
buf = f.read(50 * 8)
flag = ''
bin_flag = ''
for (i, c) in enumerate(buf):
bin_flag += str(c & 1)
if i % 8 == 7:
flag += chr(int(bin_flag[::-1], 2) + 5)
bin_flag = ''
print(repr(flag)) |
numero = int(input('Digite um numero: '))
count = 1
while count <= numero:
print(count)
count = count + 1
| numero = int(input('Digite um numero: '))
count = 1
while count <= numero:
print(count)
count = count + 1 |
def Trace(tag=''):
pass
def TracePrint(strMsg):
pass
_traceEnabled = False
_traceIndent = 0
| def trace(tag=''):
pass
def trace_print(strMsg):
pass
_trace_enabled = False
_trace_indent = 0 |
# https://programmers.co.kr/learn/courses/30/lessons/42748
def solution(array, commands):
answer = []
for idx in range(len(commands)):
i, j, k = commands[idx]
values = array[i-1:j]
values.sort()
v = values[k-1]
answer.append(v)
return answer | def solution(array, commands):
answer = []
for idx in range(len(commands)):
(i, j, k) = commands[idx]
values = array[i - 1:j]
values.sort()
v = values[k - 1]
answer.append(v)
return answer |
a = source()
b = source2()
c = source3()
d = source4()
e = a
f = b + c
g = 2*c + d
c = 1
print(sink(sink(e), c, sink(f), sink(g, 4*a))) | a = source()
b = source2()
c = source3()
d = source4()
e = a
f = b + c
g = 2 * c + d
c = 1
print(sink(sink(e), c, sink(f), sink(g, 4 * a))) |
def gcd(a: int, b: int) -> int :
if a == 0:
return b
return gcd(b % a, a)
def lcm(a: int, b: int) -> int:
return (a / gcd(a,b))* b | def gcd(a: int, b: int) -> int:
if a == 0:
return b
return gcd(b % a, a)
def lcm(a: int, b: int) -> int:
return a / gcd(a, b) * b |
def find_lcm(a:int, b:int)->int:
if a <= b: # 1 45000
for i in range(1, a + 1):
if a % i == 0 and b % i == 0:
gcd = i
lcm = int(a * b / gcd)
return lcm
if a > b: # 6, 2
for i in range(1, b + 1):
if a % i == 0 and b % i == 0:
... | def find_lcm(a: int, b: int) -> int:
if a <= b:
for i in range(1, a + 1):
if a % i == 0 and b % i == 0:
gcd = i
lcm = int(a * b / gcd)
return lcm
if a > b:
for i in range(1, b + 1):
if a % i == 0 and b % i == 0:
gcd ... |
class BaseParser:
@classmethod
def parse(cls, headers, entries):
violations = []
for entry in entries:
tokens = cls.parse_entry(headers, entry)
violations.extend(cls.process_tokens(tokens))
return violations
@classmethod
def parse_entry(cls, headers, ent... | class Baseparser:
@classmethod
def parse(cls, headers, entries):
violations = []
for entry in entries:
tokens = cls.parse_entry(headers, entry)
violations.extend(cls.process_tokens(tokens))
return violations
@classmethod
def parse_entry(cls, headers, ent... |
# This is where you store your creds to your wifi, and your API key for Openweathermap.org.
# Rename this file to secrets.py before use and enter your wifi / api details.
secrets = {
'ssid' : 'my_wifi', # Wifi Name to connect to
'password' : 'mypassword123', # Wifi Password
'timezone' ... | secrets = {'ssid': 'my_wifi', 'password': 'mypassword123', 'timezone': 'America/Chicago', 'time_api': 'http://worldtimeapi.org/api/timezone/america/chicago', 'owm_apikey': 'xxxxxxxx', 'owm_cityid': '4887398'} |
# config.py
cfg = {
'name': 'YuFaceDetectNet',
#'min_sizes': [[32, 64, 128], [256], [512]],
#'steps': [32, 64, 128],
'min_sizes': [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]],
'steps': [8, 16, 32, 64],
'variance': [0.1, 0.2],
'clip': False,
'loc_weight': 1.0,
'gpu_train': Tru... | cfg = {'name': 'YuFaceDetectNet', 'min_sizes': [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]], 'steps': [8, 16, 32, 64], 'variance': [0.1, 0.2], 'clip': False, 'loc_weight': 1.0, 'gpu_train': True} |
# ----------------------------------------------------------------------
# Copyright (c) 2014 Rafael Gonzalez.
#
# See the LICENSE file for details
# ----------------------------------------------------------------------
class DiscreteValueError(ValueError):
'''Discrete Value is not in range'''
def __str__(sel... | class Discretevalueerror(ValueError):
"""Discrete Value is not in range"""
def __str__(self):
s = self.__doc__
if self.args:
s = '{0}: {1} -> {2}'.format(s, self.args[0], str(self.args[1]))
s = '{0}.'.format(s)
return s
class Validationerror(ValueError):
pass
c... |
# LOCAL DEVELOPMENT CONFIG FILE
# More config options: https://flask.palletsprojects.com/en/1.1.x/config/
# Flask specific values
TESTING = True
APPLICATION_ROOT = "/"
PREFERRED_URL_SCHEME = "http"
# Custom values
# Possible logging levels:
# CRITICAL - FATAL - ERROR - WARNING - INFO - DEBUG - NOTSET
LOGGER_LEVEL = "... | testing = True
application_root = '/'
preferred_url_scheme = 'http'
logger_level = 'DEBUG'
log_file_name = 'pi-car.log'
file_logging = True |
class Equipamento():
def __init__(self, id, numeroEquipamento, marca, modelo, situacao):
self.id = id
self.numeroEquipamento = numeroEquipamento
self.marca=marca
self.modelo = modelo
self.situacao = situacao
def atualizar(self, dados):
try:
id = dados... | class Equipamento:
def __init__(self, id, numeroEquipamento, marca, modelo, situacao):
self.id = id
self.numeroEquipamento = numeroEquipamento
self.marca = marca
self.modelo = modelo
self.situacao = situacao
def atualizar(self, dados):
try:
id = dado... |
def is_prime(a):
if a % 2 == 0:
print("Brawo!!")
return ":)"
return ":("
x = is_prime(4)
print(x)
| def is_prime(a):
if a % 2 == 0:
print('Brawo!!')
return ':)'
return ':('
x = is_prime(4)
print(x) |
PERMISSIONS = (
# 'notify', # leads to unsupported access form
'friends',
'photos',
'audio',
'video',
'stories',
'pages',
'status',
'notes',
# 'messages', # available only after moderation
'wall',
'offline',
'docs',
'groups',
'notifications',
'stats',
... | permissions = ('friends', 'photos', 'audio', 'video', 'stories', 'pages', 'status', 'notes', 'wall', 'offline', 'docs', 'groups', 'notifications', 'stats', 'email', 'market')
bitmasks = {'notify': 1, 'friends': 2, 'photos': 4, 'audio': 8, 'video': 16, 'stories': 64, 'pages': 128, 'status': 1024, 'notes': 2048, 'message... |
a = {}
b = 123
c = ''
d = {}
print(a)
e = 123.456
f = [1, "2", "3.14", False, {}, [4, "5", {}, True]]
g = (1, "2", True, None) | a = {}
b = 123
c = ''
d = {}
print(a)
e = 123.456
f = [1, '2', '3.14', False, {}, [4, '5', {}, True]]
g = (1, '2', True, None) |
def parse_string(input, vars={}):
for var in vars:
input = input.replace(f"${var}$", vars[var])
return input
| def parse_string(input, vars={}):
for var in vars:
input = input.replace(f'${var}$', vars[var])
return input |
class ListSecure(list):
def get(self, index, default=None):
try:
return self.__getitem__(index)
except IndexError:
return default
| class Listsecure(list):
def get(self, index, default=None):
try:
return self.__getitem__(index)
except IndexError:
return default |
class Solution:
def firstUniqChar(self, s: str) -> int:
count = collections.Counter(s)
for indx, ch in enumerate(s):
if count[ch] < 2:
return indx
return -1
| class Solution:
def first_uniq_char(self, s: str) -> int:
count = collections.Counter(s)
for (indx, ch) in enumerate(s):
if count[ch] < 2:
return indx
return -1 |
def bitcoinToEuros(bitcoin_amount, bitcoin_value_euros):
euros_value=bitcoin_amount*bitcoin_value_euros
return euros_value
bitcoin_to_euros=25000
valor_bitcoin=bitcoinToEuros(1,bitcoin_to_euros)
print(valor_bitcoin)
if valor_bitcoin<=30000:
print("el valor esta por debajo de 30000", valor_bitcoin)
| def bitcoin_to_euros(bitcoin_amount, bitcoin_value_euros):
euros_value = bitcoin_amount * bitcoin_value_euros
return euros_value
bitcoin_to_euros = 25000
valor_bitcoin = bitcoin_to_euros(1, bitcoin_to_euros)
print(valor_bitcoin)
if valor_bitcoin <= 30000:
print('el valor esta por debajo de 30000', valor_bit... |
# Code generated by font-to-py.py.
# Font: DejaVuSans.ttf
version = '0.26'
def height():
return 12
def max_width():
return 12
def hmap():
return False
def reverse():
return False
def monospaced():
return False
def min_ch():
return 32
def max_ch():
return 126
_font =\
b'\x06\x00\x02\x... | version = '0.26'
def height():
return 12
def max_width():
return 12
def hmap():
return False
def reverse():
return False
def monospaced():
return False
def min_ch():
return 32
def max_ch():
return 126
_font = b'\x06\x00\x02\x00r\x01\x1a\x00\x0c\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\... |
def primeFactors(n):
prime_list=[2,3,5,7, 11, 13, 17, 19, 23, 29
, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71
, 73, 79, 83, 89, 97,101,103,107,109,113
,127,131,137,139,149,151,157,163,167,173
,179,181,191,193,197,199,211,223,227,229
,233,239,241,251,257,263,269,271,277,281
,283,293,307,311,313,317,331,337,347,349... | def prime_factors(n):
prime_list = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293,... |
foods = ['bacon', 'tuna', 'ham', 'sausages', 'beef']
for f in foods:
print(f)
print(len(f)) | foods = ['bacon', 'tuna', 'ham', 'sausages', 'beef']
for f in foods:
print(f)
print(len(f)) |
base = [2.7, 3.1, 3.5, 3.8]
def calculate(n: int):
return [n+2.7, n+3.1, n+3.5, n+3.8]
def solve(n: list):
result = []
for roll in n:
for numeral in calculate(roll):
result.append(round(numeral, 1))
return list(dict.fromkeys(result))
print(solve(base)) | base = [2.7, 3.1, 3.5, 3.8]
def calculate(n: int):
return [n + 2.7, n + 3.1, n + 3.5, n + 3.8]
def solve(n: list):
result = []
for roll in n:
for numeral in calculate(roll):
result.append(round(numeral, 1))
return list(dict.fromkeys(result))
print(solve(base)) |
a: int
def Main() -> int:
return a
| a: int
def main() -> int:
return a |
def read_file(filepath):
with open(filepath) as f:
for line in f.readlines():
yield line.strip()
def solution():
grid = [[0 for x in range(1000)] for y in range(1000)]
grid_summary = {}
overlapped_square_count = 0
for line in read_file("input.txt"):
claim_id, rect_detai... | def read_file(filepath):
with open(filepath) as f:
for line in f.readlines():
yield line.strip()
def solution():
grid = [[0 for x in range(1000)] for y in range(1000)]
grid_summary = {}
overlapped_square_count = 0
for line in read_file('input.txt'):
(claim_id, rect_detai... |
def Value_Investing(self, training_data, testing_data=""):
if testing_data == "":
percent_taken = 30
index = ((100 - percent_taken) / 100) * len(training_data)
testing_data = training_data[index:]
return 0 | def value__investing(self, training_data, testing_data=''):
if testing_data == '':
percent_taken = 30
index = (100 - percent_taken) / 100 * len(training_data)
testing_data = training_data[index:]
return 0 |
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
if len(s) <= 1: return len(s)
longest = 1
i = 1
curr = s[0]
while i < len(s):
if s[i] in curr:
longest = max(longest, len(curr))
idx = curr.find(s[i])
... | class Solution:
def length_of_longest_substring(self, s: str) -> int:
if len(s) <= 1:
return len(s)
longest = 1
i = 1
curr = s[0]
while i < len(s):
if s[i] in curr:
longest = max(longest, len(curr))
idx = curr.find(s[i]... |
t = int(input())
while t:
N = int(input())
S = list(input())
R = list(input())
if S.count('1') == R.count('1'):
print('YES')
else:
print('NO')
t = t-1 | t = int(input())
while t:
n = int(input())
s = list(input())
r = list(input())
if S.count('1') == R.count('1'):
print('YES')
else:
print('NO')
t = t - 1 |
class UnknownOSException(Exception):
pass
class ChromeError(Exception):
pass
| class Unknownosexception(Exception):
pass
class Chromeerror(Exception):
pass |
def read_matrix():
r, c = [int(n) for n in input().split(', ')]
matrix = []
for _ in range(r):
row = [int(n) for n in input().split(', ')]
matrix.append(row)
return matrix
matrix = read_matrix()
total_sum = 0
for el in matrix:
total_sum += sum(el)
print(total_sum)
print(matrix) | def read_matrix():
(r, c) = [int(n) for n in input().split(', ')]
matrix = []
for _ in range(r):
row = [int(n) for n in input().split(', ')]
matrix.append(row)
return matrix
matrix = read_matrix()
total_sum = 0
for el in matrix:
total_sum += sum(el)
print(total_sum)
print(matrix) |
class ViewBackgroundLightHandler(object):
def __init__(self, viewOptions, grid, action):
self.viewOptions = viewOptions
self.action = action
self.action.checkable = True
self.action.connect("triggered()", self._onChecked)
# background was 0,0,0 (black). now charcoal
... | class Viewbackgroundlighthandler(object):
def __init__(self, viewOptions, grid, action):
self.viewOptions = viewOptions
self.action = action
self.action.checkable = True
self.action.connect('triggered()', self._onChecked)
self.properties = {viewOptions: {'Gradient background... |
class Clickomania:
def __init__(self, N, M, K, state):
self.row = N
self.column = M
self.color = K
self.score = 0
self.state = state
#This make a copy from the state
def clone(self):
NewClickomania = Clickomania(self.row, self.column, self.color, self.state... | class Clickomania:
def __init__(self, N, M, K, state):
self.row = N
self.column = M
self.color = K
self.score = 0
self.state = state
def clone(self):
new_clickomania = clickomania(self.row, self.column, self.color, self.state)
NewClickomania.score = self... |
f1 = open("name.txt")
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
f1.close()
| f1 = open('name.txt')
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
f1.close() |
class Square:
def __init__(self, side):
self.side = side
def __str__(self):
return 'A square with side %s' % self.side
| class Square:
def __init__(self, side):
self.side = side
def __str__(self):
return 'A square with side %s' % self.side |
SLACK_HOOK = {
'url' : '',
'port': 443,
'method': 'POST',
'channel': '',
'headers': {
'Content-Type': 'application/json'
}
}
GITHUB_TOKEN = ""
REPO_TOPIC = ""
GITHUB_ORG = ""
| slack_hook = {'url': '', 'port': 443, 'method': 'POST', 'channel': '', 'headers': {'Content-Type': 'application/json'}}
github_token = ''
repo_topic = ''
github_org = '' |
workers = 2
bind = '127.0.0.1:8000'
workers = 1
timeout = 60
errorlog = '/usr/local/apps/blog-nestor/nblog.gunicorng.error'
accesslog = '/usr/local/apps/blog-nestor/nblog.gunicorng.access'
| workers = 2
bind = '127.0.0.1:8000'
workers = 1
timeout = 60
errorlog = '/usr/local/apps/blog-nestor/nblog.gunicorng.error'
accesslog = '/usr/local/apps/blog-nestor/nblog.gunicorng.access' |
pay = 1
pay = 2
pay = 3
over
| pay = 1
pay = 2
pay = 3
over |
def gcd(i, j):
for n in reversed(range(max(i, j)+1)):
if i % n == 0 and j % n == 0:
return n
def is_coprime(i, j):
return gcd(i, j) == 1
def totient(m):
n = 0
for i in reversed(range(m+1)):
if is_coprime(m, i):
n = n + 1
return n
def test_totient():
... | def gcd(i, j):
for n in reversed(range(max(i, j) + 1)):
if i % n == 0 and j % n == 0:
return n
def is_coprime(i, j):
return gcd(i, j) == 1
def totient(m):
n = 0
for i in reversed(range(m + 1)):
if is_coprime(m, i):
n = n + 1
return n
def test_totient():
... |
print("Strings, (c) Verloka Vadim 2018\n\n\n")
S1 = "Hello, {0}, how are you{1}"
print(S1.format("Vadim", "?"))
print("{:<20}".format("left"))
print("{:>20}".format("right"))
print("{:^20}".format("right"))
print("{:*<20}".format("left"))
print("{:*>20}".format("right"))
print("{:*^20}".format("right"))
print("{:1... | print('Strings, (c) Verloka Vadim 2018\n\n\n')
s1 = 'Hello, {0}, how are you{1}'
print(S1.format('Vadim', '?'))
print('{:<20}'.format('left'))
print('{:>20}'.format('right'))
print('{:^20}'.format('right'))
print('{:*<20}'.format('left'))
print('{:*>20}'.format('right'))
print('{:*^20}'.format('right'))
print('{:1<20}'... |
# Time: O(n)
# Space: O(1)
class Solution(object):
lookup = {'0':'0', '1':'1', '6':'9', '8':'8', '9':'6'}
# @param {string} num
# @return {boolean}
def isStrobogrammatic(self, num):
n = len(num)
for i in range((n+1) / 2):
if num[n-1-i] not in self.lookup or \
... | class Solution(object):
lookup = {'0': '0', '1': '1', '6': '9', '8': '8', '9': '6'}
def is_strobogrammatic(self, num):
n = len(num)
for i in range((n + 1) / 2):
if num[n - 1 - i] not in self.lookup or num[i] != self.lookup[num[n - 1 - i]]:
return False
return... |
[2,1,3]
[5,1,4,null,null,3,6]
[2,1,4,null,null,3,6]
[2,1,4,null,null,8,6]
[]
[1, 1, 1]
[0, 1]
[0, 1, 3]
[10,5,15,null,null,6,20]
[10,5,15,3,11,12,20]
[3,null,30,10,null,null,15,null,45]
[3,null,30,10,null,null,15,null,19]
| [2, 1, 3]
[5, 1, 4, null, null, 3, 6]
[2, 1, 4, null, null, 3, 6]
[2, 1, 4, null, null, 8, 6]
[]
[1, 1, 1]
[0, 1]
[0, 1, 3]
[10, 5, 15, null, null, 6, 20]
[10, 5, 15, 3, 11, 12, 20]
[3, null, 30, 10, null, null, 15, null, 45]
[3, null, 30, 10, null, null, 15, null, 19] |
load("//tools/bzl:maven_jar.bzl", "maven_jar")
AWS_SDK_VER = "2.16.19"
AWS_KINESIS_VER = "2.3.4"
JACKSON_VER = "2.10.4"
def external_plugin_deps():
maven_jar(
name = "junit-platform",
artifact = "org.junit.platform:junit-platform-commons:1.4.0",
sha1 = "34d9983705c953b97abb01e1cd04647f4727... | load('//tools/bzl:maven_jar.bzl', 'maven_jar')
aws_sdk_ver = '2.16.19'
aws_kinesis_ver = '2.3.4'
jackson_ver = '2.10.4'
def external_plugin_deps():
maven_jar(name='junit-platform', artifact='org.junit.platform:junit-platform-commons:1.4.0', sha1='34d9983705c953b97abb01e1cd04647f47272fe5')
maven_jar(name='amazo... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def increasingBST(self, root):
new_head = TreeNode(-1)
self.rearrange(new_head, root)
return new_head.right
def rearr... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def increasing_bst(self, root):
new_head = tree_node(-1)
self.rearrange(new_head, root)
return new_head.right
def rearrange(self, n_head, node):
... |
expected_output = {
"track": {
"1": {
"type": "Interface",
"instance": "Ethernet1/4",
"subtrack": "IP Routing",
"state": "DOWN",
"change_count": 1,
"last_change": "3w5d",
"tracked_by": {
... | expected_output = {'track': {'1': {'type': 'Interface', 'instance': 'Ethernet1/4', 'subtrack': 'IP Routing', 'state': 'DOWN', 'change_count': 1, 'last_change': '3w5d', 'tracked_by': {1: {'name': 'HSRP', 'interface': 'Vlan2', 'id': '2'}, 2: {'name': 'HSRP', 'interface': 'Ethernet1/1', 'id': '1'}, 3: {'name': 'VRRPV3', '... |
scores = {'AA': 10, 'BB': 20, "CC": 30}
print("AA score:", scores['AA'])
print("Before BB score:", scores['BB'])
scores['BB'] = 100
print("After BB score:", scores["BB"])
age = {1, 2, 3}
print(age)
| scores = {'AA': 10, 'BB': 20, 'CC': 30}
print('AA score:', scores['AA'])
print('Before BB score:', scores['BB'])
scores['BB'] = 100
print('After BB score:', scores['BB'])
age = {1, 2, 3}
print(age) |
def mySqrt(x):
if(x==0):
return 0
right = x
left = 0
if right <=2 :
return 1
if right > 10:
left == 10
if (right > 2):
while left <= right:
m = (left+right)//2
if (m * m == x):
return m
if m * m < x:
... | def my_sqrt(x):
if x == 0:
return 0
right = x
left = 0
if right <= 2:
return 1
if right > 10:
left == 10
if right > 2:
while left <= right:
m = (left + right) // 2
if m * m == x:
return m
if m * m < x:
... |
class JwtAuthorizationTicket:
def __init__(self, accessToken, refreshToken):
self.access_token = accessToken
self.refresh_token = refreshToken
class JwtAuthorizationTicketHolder:
def set_ticket(self, ticket):
pass
def get_ticket(self):
pass
class TransientJwtAuthorizat... | class Jwtauthorizationticket:
def __init__(self, accessToken, refreshToken):
self.access_token = accessToken
self.refresh_token = refreshToken
class Jwtauthorizationticketholder:
def set_ticket(self, ticket):
pass
def get_ticket(self):
pass
class Transientjwtauthorizatio... |
class Cart:
def __init__(self):
self._contents = dict()
def __repr__(self):
return "{0} {1}".format(Cart, self.__dict__)
def process(self, order):
if order.add:
if not order.item in self._contents:
self._contents[order.item] = 0
... | class Cart:
def __init__(self):
self._contents = dict()
def __repr__(self):
return '{0} {1}'.format(Cart, self.__dict__)
def process(self, order):
if order.add:
if not order.item in self._contents:
self._contents[order.item] = 0
self._conten... |
SCHEMA = {
'REFERENCE': {
'gender': 'Gender',
'ethnicity': 'Ethnicity',
'economic_status': 'Economic Status',
'enrolled_8th': '8th Grade (FY 2009)',
'enrolled_9th': 'Enrolled in 9th Grade (FY 2010)',
'enrolled_9th_percent': '% Enrolled in 9th Grade (FY 2010)',
... | schema = {'REFERENCE': {'gender': 'Gender', 'ethnicity': 'Ethnicity', 'economic_status': 'Economic Status', 'enrolled_8th': '8th Grade (FY 2009)', 'enrolled_9th': 'Enrolled in 9th Grade (FY 2010)', 'enrolled_9th_percent': '% Enrolled in 9th Grade (FY 2010)', 'enrolled_10th': 'Enrolled in 10th Grade(FY 2011)', 'enrolled... |
data = (
'ddwim', # 0x00
'ddwib', # 0x01
'ddwibs', # 0x02
'ddwis', # 0x03
'ddwiss', # 0x04
'ddwing', # 0x05
'ddwij', # 0x06
'ddwic', # 0x07
'ddwik', # 0x08
'ddwit', # 0x09
'ddwip', # 0x0a
'ddwih', # 0x0b
'ddyu', # 0x0c
'ddyug', # 0x0d
'ddyugg', # 0x0e
'ddyugs... | data = ('ddwim', 'ddwib', 'ddwibs', 'ddwis', 'ddwiss', 'ddwing', 'ddwij', 'ddwic', 'ddwik', 'ddwit', 'ddwip', 'ddwih', 'ddyu', 'ddyug', 'ddyugg', 'ddyugs', 'ddyun', 'ddyunj', 'ddyunh', 'ddyud', 'ddyul', 'ddyulg', 'ddyulm', 'ddyulb', 'ddyuls', 'ddyult', 'ddyulp', 'ddyulh', 'ddyum', 'ddyub', 'ddyubs', 'ddyus', 'ddyuss', ... |
def lcs(str1, str2):
if not str1 or not str2:
return ""
x, xs, y, ys = str1[0], str1[1:], str2[0], str2[1:]
if x == y:
return x + lcs(xs, ys)
else:
return max(lcs(str1, ys), lcs(xs, str2), key=len)
def ascii_deletion_distance(str1, str2):
sub = lcs(str1,str2)
x,y,= sum([o... | def lcs(str1, str2):
if not str1 or not str2:
return ''
(x, xs, y, ys) = (str1[0], str1[1:], str2[0], str2[1:])
if x == y:
return x + lcs(xs, ys)
else:
return max(lcs(str1, ys), lcs(xs, str2), key=len)
def ascii_deletion_distance(str1, str2):
sub = lcs(str1, str2)
(x, y)... |
class SimulationResult:
def __init__(self, initialTileList, coordinateList, moves, attackStrategy):
self.initialTileList = initialTileList
self.coordinateList = coordinateList
self.moves = moves
self.attackStrategy = attackStrategy
def SimulationResultString(self):
... | class Simulationresult:
def __init__(self, initialTileList, coordinateList, moves, attackStrategy):
self.initialTileList = initialTileList
self.coordinateList = coordinateList
self.moves = moves
self.attackStrategy = attackStrategy
def simulation_result_string(self):
re... |
ALPHA = dict({
('A', 'A'): 0,
('C', 'C'): 0,
('G', 'G'): 0,
('T', 'T'): 0,
('A', 'C'): 110,
('C', 'A'): 110,
('A', 'G'): 48,
('G', 'A'): 48,
('A', 'T'): 94,
('T', 'A'): 94,
('C', 'G'): 118,
('G', 'C'): 118,
('C', 'T'): 48,
('T', 'C'): 48,
('G', 'T'): 110,
... | alpha = dict({('A', 'A'): 0, ('C', 'C'): 0, ('G', 'G'): 0, ('T', 'T'): 0, ('A', 'C'): 110, ('C', 'A'): 110, ('A', 'G'): 48, ('G', 'A'): 48, ('A', 'T'): 94, ('T', 'A'): 94, ('C', 'G'): 118, ('G', 'C'): 118, ('C', 'T'): 48, ('T', 'C'): 48, ('G', 'T'): 110, ('T', 'G'): 110})
delta = 30 |
#
# PySNMP MIB module Dell-BRIDGEMIBOBJECTS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Dell-BRIDGEMIBOBJECTS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:55:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
def enumerate_states(n_states, state_len, state, results):
if n_states > 0:
for sym in ('x', 'o', '_'):
enumerate_states(n_states - 1, state_len, state + sym, results)
if len(state) == state_len:
results.append(state)
state_len = 9
results = []
enumerate_states(state_len, state_... | def enumerate_states(n_states, state_len, state, results):
if n_states > 0:
for sym in ('x', 'o', '_'):
enumerate_states(n_states - 1, state_len, state + sym, results)
if len(state) == state_len:
results.append(state)
state_len = 9
results = []
enumerate_states(state_len, state_len, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.