content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class PoolUserConfiguration:
def __init__(self,
pool_name: str,
username: str,
password: str):
self.pool_name = pool_name
self.username = username
self.password = password
def __eq__(self, other):
if not isinstance(other, PoolU... | class Pooluserconfiguration:
def __init__(self, pool_name: str, username: str, password: str):
self.pool_name = pool_name
self.username = username
self.password = password
def __eq__(self, other):
if not isinstance(other, PoolUserConfiguration):
return False
... |
if not ( ( 'a' in vars() or 'a' in globals() ) and type(a) == type(0) ):
print("no suitable a")
else:
print("good to go")
| if not (('a' in vars() or 'a' in globals()) and type(a) == type(0)):
print('no suitable a')
else:
print('good to go') |
"""
0147. Insertion Sort List
Medium
Sort a linked list using insertion sort.
A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list.
With each iteration one element (red) is removed from the input data and inserted in-place into the sorted list
... | """
0147. Insertion Sort List
Medium
Sort a linked list using insertion sort.
A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list.
With each iteration one element (red) is removed from the input data and inserted in-place into the sorted list
... |
# Part of the awpa package: https://github.com/pyga/awpa
# See LICENSE for copyright.
"""Token constants (from "token.h")."""
# This file is automatically generated; please don't muck it up!
#
# To update the symbols in this file, 'cd' to the top directory of
# the python source tree after building the interpreter... | """Token constants (from "token.h")."""
endmarker = 0
name = 1
number = 2
string = 3
newline = 4
indent = 5
dedent = 6
lpar = 7
rpar = 8
lsqb = 9
rsqb = 10
colon = 11
comma = 12
semi = 13
plus = 14
minus = 15
star = 16
slash = 17
vbar = 18
amper = 19
less = 20
greater = 21
equal = 22
dot = 23
percent = 24
backquote = 2... |
'''
A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.
For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contai... | """
A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.
For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contai... |
class Node:
"""
Class that represent a tile or node in a senku game.
...
Attributes
----------
"""
def __init__(self, matrix):
self.step = 0 # The step or node geneared
self.parent_id = 0 # The Node parent id
self.name = f'Node: {str(self.step)}!' # Node... | class Node:
"""
Class that represent a tile or node in a senku game.
...
Attributes
----------
"""
def __init__(self, matrix):
self.step = 0
self.parent_id = 0
self.name = f'Node: {str(self.step)}!'
self.matrix = matrix
self.level = 0
self.p... |
l = [0,1,2,3,4,5,6,7,8,9,]
def f(x):
return x**2
print(list(map(f,l)))
def fake_map(function,list):
list_new = []
for n in list:
i = function(n)
list_new.append(i)
return list_new
print(fake_map(f,l))
| l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
def f(x):
return x ** 2
print(list(map(f, l)))
def fake_map(function, list):
list_new = []
for n in list:
i = function(n)
list_new.append(i)
return list_new
print(fake_map(f, l)) |
working = True
match working:
case True:
print("OK")
case False:
print() | working = True
match working:
case True:
print('OK')
case False:
print() |
"""
tdc_helper.py - tdc helper functions
Copyright (C) 2017 Lucas Bates <lucasb@mojatatu.com>
"""
def get_categorized_testlist(alltests, ucat):
""" Sort the master test list into categories. """
testcases = dict()
for category in ucat:
testcases[category] = list(filter(lambda x: category in x['ca... | """
tdc_helper.py - tdc helper functions
Copyright (C) 2017 Lucas Bates <lucasb@mojatatu.com>
"""
def get_categorized_testlist(alltests, ucat):
""" Sort the master test list into categories. """
testcases = dict()
for category in ucat:
testcases[category] = list(filter(lambda x: category in x['cat... |
def test_scout_tumor_normal(invoke_cli, tumor_normal_config):
# GIVEN a tumor-normal config file
# WHEN running analysis
result = invoke_cli([
'plugins', 'scout', '--sample-config', tumor_normal_config,
'--customer-id', 'cust000'
])
# THEN it should run without any error
print(r... | def test_scout_tumor_normal(invoke_cli, tumor_normal_config):
result = invoke_cli(['plugins', 'scout', '--sample-config', tumor_normal_config, '--customer-id', 'cust000'])
print(result)
assert result.exit_code == 0
def test_scout_tumor_only(invoke_cli, tumor_only_config):
result = invoke_cli(['plugins'... |
'''
# Copyright (C) 2020 by ZestIOT. All rights reserved. The
# information in this document is the property of ZestIOT. Except
# as specifically authorized in writing by ZestIOT, the receiver
# of this document shall keep the information contained herein
# confidential and shall protect the same in whole or ... | """
# Copyright (C) 2020 by ZestIOT. All rights reserved. The
# information in this document is the property of ZestIOT. Except
# as specifically authorized in writing by ZestIOT, the receiver
# of this document shall keep the information contained herein
# confidential and shall protect the same in whole or ... |
# funcs01.py
def test_para_02(l1: list ):
l1.append(42)
def test_para(a: int, b: int, c: int = 10 ):
print("*"*34, "test_para", "*"*35)
print("Parameter a: ", a)
print("Parameter b: ", b)
print("Parameter c: ", c)
print("*"*80, "\n")
x: int = 10
y = 12
z = 13
test_para(x, y, z)
print("x: ... | def test_para_02(l1: list):
l1.append(42)
def test_para(a: int, b: int, c: int=10):
print('*' * 34, 'test_para', '*' * 35)
print('Parameter a: ', a)
print('Parameter b: ', b)
print('Parameter c: ', c)
print('*' * 80, '\n')
x: int = 10
y = 12
z = 13
test_para(x, y, z)
print('x: ', x)
test_para(2... |
"""
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
\
2
/
3
return [1,3,2].
Note: Recursive solution is trivial, could you do it iteratively?
confused what "{1,#,2,3}" means? > read more on how binary tree is serialized on OJ.
"""... | """
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,3,2].
Note: Recursive solution is trivial, could you do it iteratively?
confused what "{1,#,2,3}" means? > read more on how binary tree is serialized on OJ.
"""
_... |
##
## This file is maintained by Ansible - CHANGES WILL BE OVERWRITTEN
##
USERS = (
'nate@bx.psu.edu',
'clements@galaxyproject.org',
'outreach@galaxyproject.org'
)
NORM_USERS = [ u.lower() for u in USERS ]
def dynamic_normal_reserved( user_email ):
if user_email is not None and user_email.lower() in ... | users = ('nate@bx.psu.edu', 'clements@galaxyproject.org', 'outreach@galaxyproject.org')
norm_users = [u.lower() for u in USERS]
def dynamic_normal_reserved(user_email):
if user_email is not None and user_email.lower() in NORM_USERS:
return 'reserved'
return 'slurm_normal'
def dynamic_normal_reserved_1... |
# Game
GAME_NAME = 'Pong-v0'
# Preprocessing
STACK_SIZE = 4
FRAME_H = 84
FRAME_W = 84
# Model
STATE_SHAPE = [FRAME_H, FRAME_W, STACK_SIZE]
# Training
NUM_EPISODES = 2500
# Discount factor
GAMMA = 0.99
# RMSProp
LEARNING_RATE = 2.5e-4
# Save the model every 50 episodes
SAVE_EVERY = 50
SAVE_PATH = './checkpoints' | game_name = 'Pong-v0'
stack_size = 4
frame_h = 84
frame_w = 84
state_shape = [FRAME_H, FRAME_W, STACK_SIZE]
num_episodes = 2500
gamma = 0.99
learning_rate = 0.00025
save_every = 50
save_path = './checkpoints' |
SECRET_KEY = 'dev'
SQLALCHEMY_DATABASE_URI = 'postgresql:///sopy'
SQLALCHEMY_TRACK_MODIFICATIONS = False
ALEMBIC_CONTEXT = {
'compare_type': True,
'compare_server_default': True,
'user_module_prefix': 'user',
}
# Set the following in <app.instance_path>/config.py
# On dev that's <project>/instance/config... | secret_key = 'dev'
sqlalchemy_database_uri = 'postgresql:///sopy'
sqlalchemy_track_modifications = False
alembic_context = {'compare_type': True, 'compare_server_default': True, 'user_module_prefix': 'user'} |
class Tagger(object):
tags = []
def __call__(self, tokens):
raise NotImplementedError
def check_tag(self, tag):
return tag in self.tags
class PassTagger(Tagger):
def __call__(self, tokens):
for token in tokens:
yield token
class TaggersComposition(Tagger):
... | class Tagger(object):
tags = []
def __call__(self, tokens):
raise NotImplementedError
def check_tag(self, tag):
return tag in self.tags
class Passtagger(Tagger):
def __call__(self, tokens):
for token in tokens:
yield token
class Taggerscomposition(Tagger):
d... |
sys.stdout = open("3-letter.txt", "w")
data = "abcdefghijklmnopqrstuvwxyz"
data += data.upper()
for a in data:
for b in data:
for c in data:
print(a+b+c)
sys.stdout.close()
| sys.stdout = open('3-letter.txt', 'w')
data = 'abcdefghijklmnopqrstuvwxyz'
data += data.upper()
for a in data:
for b in data:
for c in data:
print(a + b + c)
sys.stdout.close() |
# date: 17/07/2020
# Description:
# Given a set of words,
# find all words that are concatenations of other words in the set.
class Solution(object):
def findAllConcatenatedWords(self, words):
seen = []
wrds = []
for i,a in enumerate(words):
for j,b in enumerate(... | class Solution(object):
def find_all_concatenated_words(self, words):
seen = []
wrds = []
for (i, a) in enumerate(words):
for (j, b) in enumerate(words):
if i != j:
if a + b in words and a + b not in seen:
wrds.append(a... |
# iterators/iterator.py
class OddEven:
def __init__(self, data):
self._data = data
self.indexes = (list(range(0, len(data), 2)) +
list(range(1, len(data), 2)))
def __iter__(self):
return self
def __next__(self):
if self.indexes:
return s... | class Oddeven:
def __init__(self, data):
self._data = data
self.indexes = list(range(0, len(data), 2)) + list(range(1, len(data), 2))
def __iter__(self):
return self
def __next__(self):
if self.indexes:
return self._data[self.indexes.pop(0)]
raise StopI... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Scratch buffer slice with manual indexing
class BufferSlice:
def __init__(self, buf, name):
self.name = name
self.buf = buf
self.offset = -1 # Offset into the global scratch buffer
self.chunks = []
# Ret... | class Bufferslice:
def __init__(self, buf, name):
self.name = name
self.buf = buf
self.offset = -1
self.chunks = []
def get_global_index(self, index):
assert self.offset > -1, 'set_offset needs to be called first'
return self.offset + index
def get_buffer(s... |
# Generated by h2py from stdin
TCS_MULTILINE = 0x0200
CBRS_ALIGN_LEFT = 0x1000
CBRS_ALIGN_TOP = 0x2000
CBRS_ALIGN_RIGHT = 0x4000
CBRS_ALIGN_BOTTOM = 0x8000
CBRS_ALIGN_ANY = 0xF000
CBRS_BORDER_LEFT = 0x0100
CBRS_BORDER_TOP = 0x0200
CBRS_BORDER_RIGHT = 0x0400
CBRS_BORDER_BOTTOM = 0x0800
CBRS_BORDER_ANY = 0x0F0... | tcs_multiline = 512
cbrs_align_left = 4096
cbrs_align_top = 8192
cbrs_align_right = 16384
cbrs_align_bottom = 32768
cbrs_align_any = 61440
cbrs_border_left = 256
cbrs_border_top = 512
cbrs_border_right = 1024
cbrs_border_bottom = 2048
cbrs_border_any = 3840
cbrs_tooltips = 16
cbrs_flyby = 32
cbrs_float_multi = 64
cbrs_... |
"""Remove Dups: Write code to remove duplicates from an unsorted linked list."""
def remove_dups(linked_list):
"""Remove duplicates from a linked list."""
prev_node = None
curr_node = linked_list.head
vals_seen = set()
while curr_node:
if curr_node.val in vals_seen:
prev_node.n... | """Remove Dups: Write code to remove duplicates from an unsorted linked list."""
def remove_dups(linked_list):
"""Remove duplicates from a linked list."""
prev_node = None
curr_node = linked_list.head
vals_seen = set()
while curr_node:
if curr_node.val in vals_seen:
prev_node.ne... |
x = 1
if x == 1:
# indented four spaces
print("Hello World")
| x = 1
if x == 1:
print('Hello World') |
#!/usr/bin/python3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# With a given integral number n, write a program to generate a
# dictionary that contains (i, i*i) such that is an integral number
# between 1 and n (both included). and then the program should print the
# dictionary.
#
# Supp... | n = 10
dict = {i: i * i for i in range(1, n + 1)}
print(dict) |
n = [3, 5, 7]
def total(numbers):
result = 0
for i in range(len(numbers)):
result += numbers[i]
return result
print(total(n))
| n = [3, 5, 7]
def total(numbers):
result = 0
for i in range(len(numbers)):
result += numbers[i]
return result
print(total(n)) |
with open("input.txt") as fp:
instructions = [(line.strip('\n')[0], int(line.strip('\n')[1:]))
for line in fp]
moves = {'E': 1, 'W': -1, 'N': 1, 'S': -1, 'R': 1, 'L': -1}
sides = 'ESWN'
current_direction = 'E'
current_coords = (0, 0)
current_waypoint_offset = (10, 1)
current_waypoint_coords = (... | with open('input.txt') as fp:
instructions = [(line.strip('\n')[0], int(line.strip('\n')[1:])) for line in fp]
moves = {'E': 1, 'W': -1, 'N': 1, 'S': -1, 'R': 1, 'L': -1}
sides = 'ESWN'
current_direction = 'E'
current_coords = (0, 0)
current_waypoint_offset = (10, 1)
current_waypoint_coords = (current_coords[0] + c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""WDOM: Browser-based GUI library for python."""
| """WDOM: Browser-based GUI library for python.""" |
#!/usr/bin/python
command = (oiio_app("maketx") + " --filter lanczos3 "
+ parent + "/oiio-images/grid-overscan.exr"
+ " -o grid-overscan.exr ;\n")
command = command + testtex_command ("grid-overscan.exr", "--wrap black")
outputs = [ "out.exr" ]
| command = oiio_app('maketx') + ' --filter lanczos3 ' + parent + '/oiio-images/grid-overscan.exr' + ' -o grid-overscan.exr ;\n'
command = command + testtex_command('grid-overscan.exr', '--wrap black')
outputs = ['out.exr'] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author:
"""
class Roboter:
pass
if __name__ == "__main__":
x = Roboter()
y = Roboter()
print(x)
print(y)
print(x == y)
| """
Author:
"""
class Roboter:
pass
if __name__ == '__main__':
x = roboter()
y = roboter()
print(x)
print(y)
print(x == y) |
n = int(input())
horas = n // 3600
n %= 3600
minutos = n // 60
n %= 60
segundos = n
print(f'{horas}:{minutos}:{segundos}')
| n = int(input())
horas = n // 3600
n %= 3600
minutos = n // 60
n %= 60
segundos = n
print(f'{horas}:{minutos}:{segundos}') |
# optimizer
optimizer = dict(type='AdamW', lr=0.0001, weight_decay=0.0005)
optimizer_config = dict(grad_clip=dict(max_norm=1, norm_type=2))
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=1000,
warmup_ratio=0.001,
step=[60000, 72000],
by_epoch=False)
# runtime se... | optimizer = dict(type='AdamW', lr=0.0001, weight_decay=0.0005)
optimizer_config = dict(grad_clip=dict(max_norm=1, norm_type=2))
lr_config = dict(policy='step', warmup='linear', warmup_iters=1000, warmup_ratio=0.001, step=[60000, 72000], by_epoch=False)
runner = dict(type='IterBasedRunner', max_iters=80000)
checkpoint_c... |
#!/usr/bin/env python3
#global num_path
#num_path = 0
class Path:
num_path = 0
def __init__(self, start, end):
self.passed_by = False
self.start = start
self.end = end
def __str__(self):
return "{}-{} [{}]".format(self.start, self.end, "T" if self.passed_by else "F")
def __eq__(self, n):
retur... | class Path:
num_path = 0
def __init__(self, start, end):
self.passed_by = False
self.start = start
self.end = end
def __str__(self):
return '{}-{} [{}]'.format(self.start, self.end, 'T' if self.passed_by else 'F')
def __eq__(self, n):
return self.start == n.sta... |
#!/usr/bin/env python3
"""
Simple python file allowing one to add a row (or multiple rows) into the
sinkhole list in one fell swoop in combination with the add_rows.py file.
Simply populate this data structure and run add_rows.py at the terminal to
add rows to the sinkhole list.
"""
# Example. Only th... | """
Simple python file allowing one to add a row (or multiple rows) into the
sinkhole list in one fell swoop in combination with the add_rows.py file.
Simply populate this data structure and run add_rows.py at the terminal to
add rows to the sinkhole list.
"""
addition = [{'Organization': 'OpenDNS', 'I... |
execfile("Modified_data/data_record.dr")
trick.sim_services.exec_set_terminate_time(300.0)
| execfile('Modified_data/data_record.dr')
trick.sim_services.exec_set_terminate_time(300.0) |
class BaseConfig:
DEBUG = True
TESTING = False
SECRET_KEY = 'melhor isso aqui depois =D'
class Producao(BaseConfig):
SECRET_KEY = 'aqui deve ser melhorado ainda mais - de um arquivo de fora.'
DEBUG = False
class Desenvolvimento(BaseConfig):
TESTING = True
| class Baseconfig:
debug = True
testing = False
secret_key = 'melhor isso aqui depois =D'
class Producao(BaseConfig):
secret_key = 'aqui deve ser melhorado ainda mais - de um arquivo de fora.'
debug = False
class Desenvolvimento(BaseConfig):
testing = True |
def regular_intervals(points, interval):
cum_distance = 0.0
first = True
for p in points:
if first:
yield p
first = False
else:
cum_distance += p['distance']
last_p = p
if cum_distance >= interval:
yield p
cum_dista... | def regular_intervals(points, interval):
cum_distance = 0.0
first = True
for p in points:
if first:
yield p
first = False
else:
cum_distance += p['distance']
last_p = p
if cum_distance >= interval:
yield p
cum_distan... |
# Base of the number - count of digits used un that number system
# Smallest entity of data in computing is a bit - either 0 or 1
# bit = BInary digiT
# Bit to the extreme left is the MSB (Most Significant Bit)
# Bit to the extreme right is the LSB (Least Significant Bit)
class ConvertToBinary:
def __init__(self, ... | class Converttobinary:
def __init__(self, i):
self.i = i
def dec2bin(self):
if isinstance(self.i, int):
return self.int2bin()
elif isinstance(self.i, float):
return self.float2bin()
else:
raise value_error('Given value is neither integer nor ... |
"""**nte**
A CLI scratch pad for notes, commands, lists, etc
"""
__version__ = "0.0.7"
| """**nte**
A CLI scratch pad for notes, commands, lists, etc
"""
__version__ = '0.0.7' |
with open('2017/day_02/list.txt', encoding="utf-8") as f:
lines = f.readlines()
v = 0
for i in lines:
t = i.split('\t')
t[len(t)-1] = t[len(t)-1].split('\n')[0]
t.sort(key=int)
v += int(t[len(t)-1]) - int(t[0])
print(v) | with open('2017/day_02/list.txt', encoding='utf-8') as f:
lines = f.readlines()
v = 0
for i in lines:
t = i.split('\t')
t[len(t) - 1] = t[len(t) - 1].split('\n')[0]
t.sort(key=int)
v += int(t[len(t) - 1]) - int(t[0])
print(v) |
class Nodo():
def __init__(self, val, izq=None, der=None):
self.valor = val
self.izq = izq
self.der = der
| class Nodo:
def __init__(self, val, izq=None, der=None):
self.valor = val
self.izq = izq
self.der = der |
x = int(input('Digite um valor:'))
print('{} x {} = {}'.format(x, 1, (x *1)))
print('{} x {} = {}'.format(x, 2, (x*2)))
print('{} x {} = {} '.format(x, 3,(x*3)))
print('{} x {} = {}'.format(x, 4, (x*4)))
print('{} x {} = {}'.format(x, 5, (x*5)))
print('{} x {} = {}'.format(x, 6, (x*6)))
print('{} x {} = {} '.format(x,... | x = int(input('Digite um valor:'))
print('{} x {} = {}'.format(x, 1, x * 1))
print('{} x {} = {}'.format(x, 2, x * 2))
print('{} x {} = {} '.format(x, 3, x * 3))
print('{} x {} = {}'.format(x, 4, x * 4))
print('{} x {} = {}'.format(x, 5, x * 5))
print('{} x {} = {}'.format(x, 6, x * 6))
print('{} x {} = {} '.format(x, ... |
li = [1, 1] #_ [int,int,]
it = iter(li) #_ listiterator
tu = (1, 1) #_ (int,int,)
it = iter(tu) #_ tupleiterator
ra = range(2) #_ [int,int,]
it = iter(ra) #_ listiterator
| li = [1, 1]
it = iter(li)
tu = (1, 1)
it = iter(tu)
ra = range(2)
it = iter(ra) |
# -*- encoding: utf-8 -*-
# @Time : 11/24/18 3:00 PM
# @File : settings.py
TEXTS_SIZE = 400
TEXT_NOISE_SIZE = 410
EMBEDDING_SIZE = 300
PREFIX = "/gated_fusion_network"
IMAGES_SIZE = 4
IMAGE_NOISE_SIZE = 50
LEAVES_SIZE = 300
LEAF_NOISE_SIZE = 350
EMBEDDING_MATRIX_FN = PREFIX + "/word2vec_embedding_matrix.pkl... | texts_size = 400
text_noise_size = 410
embedding_size = 300
prefix = '/gated_fusion_network'
images_size = 4
image_noise_size = 50
leaves_size = 300
leaf_noise_size = 350
embedding_matrix_fn = PREFIX + '/word2vec_embedding_matrix.pkl'
gfn_init_parameters = {'texts_size': TEXTS_SIZE, 'embedding_size': EMBEDDING_SIZE, 'v... |
class Solution(object):
def numSquares(self, n):
"""
:type n: int
:rtype: int
"""
squares = []
j = 1
while j * j <= n:
squares.append(j * j)
j += 1
level = 0
queue = [n]
visited = [False] * (n + 1)
... | class Solution(object):
def num_squares(self, n):
"""
:type n: int
:rtype: int
"""
squares = []
j = 1
while j * j <= n:
squares.append(j * j)
j += 1
level = 0
queue = [n]
visited = [False] * (n + 1)
whil... |
"""
@author: David Lei
@since: 21/08/2016
@modified:
Not a comparison sort, so comparison O(n log n) lower bound doesn't apply
Visualization: https://www.cs.usfca.edu/~galles/visualization/CountingSort.html
How it works: Integer sorting algorithm - it counts the number of objects
Applies when element... | """
@author: David Lei
@since: 21/08/2016
@modified:
Not a comparison sort, so comparison O(n log n) lower bound doesn't apply
Visualization: https://www.cs.usfca.edu/~galles/visualization/CountingSort.html
How it works: Integer sorting algorithm - it counts the number of objects
Applies when element... |
def grade(autogen, key):
n = autogen.instance
if "flag_{}_do_the_hard_work_to_make_it_simple".format(n) == key.lower().strip():
return True, "Correct!"
else:
return False, "Try Again."
| def grade(autogen, key):
n = autogen.instance
if 'flag_{}_do_the_hard_work_to_make_it_simple'.format(n) == key.lower().strip():
return (True, 'Correct!')
else:
return (False, 'Try Again.') |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 17 09:27:36 2016
@author: tih
"""
def Accounts(Type=None):
User_Pass = {
'NASA': ['',''],
'GLEAM': ['', ''],
'FTP_WA': ['',''],
'MSWEP': ['', ''],
'Copernicus': ['', ''], #https://land.copernicus.vgt.vito.be/PDF/
'VITO': ['', '']} ... | """
Created on Thu Mar 17 09:27:36 2016
@author: tih
"""
def accounts(Type=None):
user__pass = {'NASA': ['', ''], 'GLEAM': ['', ''], 'FTP_WA': ['', ''], 'MSWEP': ['', ''], 'Copernicus': ['', ''], 'VITO': ['', '']}
selected__path = User_Pass[Type]
return Selected_Path |
score_regular = {'A': 11, 'K': 4, 'Q': 3, 'J': 2, 'T': 10, '9': 0, '8': 0, '7': 0}
score_trump = {'A': 11, 'K': 4, 'Q': 3, 'J': 20, 'T': 10, '9': 14, '8': 0, '7': 0}
inp = input().split()
hands = int(inp[0])
trump_suite = inp[1]
score = 0
for i in range(4*hands):
hand = input()
score += score_trump[hand[0]] i... | score_regular = {'A': 11, 'K': 4, 'Q': 3, 'J': 2, 'T': 10, '9': 0, '8': 0, '7': 0}
score_trump = {'A': 11, 'K': 4, 'Q': 3, 'J': 20, 'T': 10, '9': 14, '8': 0, '7': 0}
inp = input().split()
hands = int(inp[0])
trump_suite = inp[1]
score = 0
for i in range(4 * hands):
hand = input()
score += score_trump[hand[0]] i... |
# A single node of a singly linked list
class Node:
# constructor
def __init__(self, data, next=None):
self.data = data
self.next = next
# Creating a single node
first = Node(3)
print(first.data)
| class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
first = node(3)
print(first.data) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Desc:
@Author: shane
@Contact: iamshanesue@gmail.com
@Software: PyCharm
@Since: Python3.6
@Date: 2019/1/9
@All right reserved
""" | """
@Desc:
@Author: shane
@Contact: iamshanesue@gmail.com
@Software: PyCharm
@Since: Python3.6
@Date: 2019/1/9
@All right reserved
""" |
def get_index(flower_n):
if flower_n == "Roses":
return 0
elif flower_n == "Dahlias":
return 1
elif flower_n == "Tulips":
return 2
elif flower_n == "Narcissus":
return 3
elif flower_n == "Gladiolus":
return 4
flower = input()
count_of_flowers = int(input())
... | def get_index(flower_n):
if flower_n == 'Roses':
return 0
elif flower_n == 'Dahlias':
return 1
elif flower_n == 'Tulips':
return 2
elif flower_n == 'Narcissus':
return 3
elif flower_n == 'Gladiolus':
return 4
flower = input()
count_of_flowers = int(input())
bu... |
# Copyright 2014 The Bazel 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 required by applicable la... | load('@io_bazel_rules_go//go/private:common.bzl', 'split_srcs', 'to_set', 'sets')
load('@io_bazel_rules_go//go/private:mode.bzl', 'get_mode', 'mode_string')
load('@io_bazel_rules_go//go/private:providers.bzl', 'GoLibrary', 'GoSourceList', 'GoArchive', 'GoArchiveData', 'sources')
load('@io_bazel_rules_go//go/platform:li... |
class Condor:
def __init__(self):
self.desc = 'load2: jsub_ext3.backend.condor.Condor'
class ClassWithSpecificName:
def __init__(self):
self.desc = 'load1: jsub_ext3.backend.condor.ClassWithSpecificName'
class ClassWithAnotherName:
def __init__(self):
self.desc = 'load2: jsub_ext3.... | class Condor:
def __init__(self):
self.desc = 'load2: jsub_ext3.backend.condor.Condor'
class Classwithspecificname:
def __init__(self):
self.desc = 'load1: jsub_ext3.backend.condor.ClassWithSpecificName'
class Classwithanothername:
def __init__(self):
self.desc = 'load2: jsub_ex... |
n=str(input())
d={"0":"zero","1":"one","2":"two","3":"three","4":"four","5":"five",
"6":"six","7":"seven","8":"eight","9":"nine"}
for i in n:
print(d[i],end=" ")
| n = str(input())
d = {'0': 'zero', '1': 'one', '2': 'two', '3': 'three', '4': 'four', '5': 'five', '6': 'six', '7': 'seven', '8': 'eight', '9': 'nine'}
for i in n:
print(d[i], end=' ') |
# -*- coding: utf-8 -*-
"""Top-level package for nider."""
__author__ = """Vladyslav Ovchynnykov"""
__email__ = 'ovd4mail@gmail.com'
__version__ = '0.5.0'
| """Top-level package for nider."""
__author__ = 'Vladyslav Ovchynnykov'
__email__ = 'ovd4mail@gmail.com'
__version__ = '0.5.0' |
# Much faster and more elegant than brute force solution
def remove(array, even):
if even:
mod = 2
else:
mod = 1
return [array[i] for i in range(len(array)) if i % 3 == mod]
num_elves = 3014387
elves = [i + 1 for i in range(num_elves)]
while len(elves) > 1:
midpoint = int(len(elves) ... | def remove(array, even):
if even:
mod = 2
else:
mod = 1
return [array[i] for i in range(len(array)) if i % 3 == mod]
num_elves = 3014387
elves = [i + 1 for i in range(num_elves)]
while len(elves) > 1:
midpoint = int(len(elves) / 2)
preserved_array = elves[:midpoint]
to_prune_arra... |
#Config
MYSQL_HOST = '45.78.57.84'
MYSQL_PORT = 3306
MYSQL_USER = 'ss'
MYSQL_PASS = 'ss'
MYSQL_DB = 'shadowsocks'
MANAGE_PASS = 'ss233333333'
#if you want manage in other server you should set this value to global ip
MANAGE_BIND_IP = '127.0.0.1'
#make sure this port is idle
MANAGE_PORT = 23333
| mysql_host = '45.78.57.84'
mysql_port = 3306
mysql_user = 'ss'
mysql_pass = 'ss'
mysql_db = 'shadowsocks'
manage_pass = 'ss233333333'
manage_bind_ip = '127.0.0.1'
manage_port = 23333 |
class Solution:
# @param s, a string
# @return a string
def reverseWords(self, s):
b = s.rstrip().lstrip().split(' ')
b = filter(lambda x: len(x) > 0, b)
b.reverse()
return ' '.join(b) | class Solution:
def reverse_words(self, s):
b = s.rstrip().lstrip().split(' ')
b = filter(lambda x: len(x) > 0, b)
b.reverse()
return ' '.join(b) |
# Copyright (c) 2020-2022, Adam Karpierz
# Licensed under the BSD license
# https://opensource.org/licenses/BSD-3-Clause
__import__("pkg_about").about()
__copyright__ = f"Copyright (c) 2020-2022 {__author__}" # noqa
| __import__('pkg_about').about()
__copyright__ = f'Copyright (c) 2020-2022 {__author__}' |
n=100
f=1
for i in range(1,101):
f*=i
print(f)
s=0
c=str(f)
for i in c:
s+=int(i)
print("sum is ",s)
| n = 100
f = 1
for i in range(1, 101):
f *= i
print(f)
s = 0
c = str(f)
for i in c:
s += int(i)
print('sum is ', s) |
"""
Homework | Exceptions
18-09-2020
Alejandro AS
"""
# how to create a custom exception
class CustomError(Exception):
# class need to extends from BaseException
# you can declare a constructor to recibe some custom values like a message
def __init__(self, *args):
""" This method inits ... | """
Homework | Exceptions
18-09-2020
Alejandro AS
"""
class Customerror(Exception):
def __init__(self, *args):
""" This method inits the Error can or not recibe a list of args """
if args:
self.message = args[0]
else:
self.message = None
def __str__... |
# a terrible brute force way to get a list of values (with key) in disired order
def ez_sort(ListToSort,ListInOrder,index=0):
Ordered = []
for x in ListInOrder:
i = 0
for y in ListToSort:
if y[index] == x:
Ordered.append(y)
i = i + 1
return Ordered
... | def ez_sort(ListToSort, ListInOrder, index=0):
ordered = []
for x in ListInOrder:
i = 0
for y in ListToSort:
if y[index] == x:
Ordered.append(y)
i = i + 1
return Ordered
testcase = ([1, 2, 3, 4, 5], [[2, 11], [3, 23], [1, 32], [4, 45]])
tc1 = [2, 3, 1,... |
'''
Control:
robot.move_forward()
robot.rotate_right()
robot.rotate_left()
robot.display_color(string)
robot.finish_round()
Sensors:
robot.ultrasonic_front() -> int
robot.ultrasonic_right() -> int
robot.ultrasonic_left() -> int
robot.get_color() -> string
'''
def main():
robot.m... | """
Control:
robot.move_forward()
robot.rotate_right()
robot.rotate_left()
robot.display_color(string)
robot.finish_round()
Sensors:
robot.ultrasonic_front() -> int
robot.ultrasonic_right() -> int
robot.ultrasonic_left() -> int
robot.get_color() -> string
"""
def main():
robot.m... |
name = '{name:s}'
isins = 'isinstance(' + name + ', '
isStr = 'isinstance({name:s}, str)'
isstr = isStr + ' or {name:s} is None'
isTpl = 'isinstance({name:s}, tuple)'
istpl = isTpl + ' or {name:s} is None'
isBool = 'isinstance({name:s}, (bool, np.bool_))'
isbool = isBool + ' or {name:s} is None'
isInt = 'isinstance({n... | name = '{name:s}'
isins = 'isinstance(' + name + ', '
is_str = 'isinstance({name:s}, str)'
isstr = isStr + ' or {name:s} is None'
is_tpl = 'isinstance({name:s}, tuple)'
istpl = isTpl + ' or {name:s} is None'
is_bool = 'isinstance({name:s}, (bool, np.bool_))'
isbool = isBool + ' or {name:s} is None'
is_int = 'isinstance... |
class LFSR():
"""
Class that implements 'basic' Linear Feedback Shift Register (LFSR) for the generation of pseudo random numbers
"""
def __init__(self, fb_poly):
self.fb_poly = fb_poly
exponents = fb_poly.split()
self.degree = int(exponents[0])
indices = ["0"]*(self.deg... | class Lfsr:
"""
Class that implements 'basic' Linear Feedback Shift Register (LFSR) for the generation of pseudo random numbers
"""
def __init__(self, fb_poly):
self.fb_poly = fb_poly
exponents = fb_poly.split()
self.degree = int(exponents[0])
indices = ['0'] * (self.deg... |
# keyboard input and concatenation
name = input("Enter Name: ")
color = input("What's your favorite color? ")
count = input("How many? ")
print(name + " ate " + count + ' ' + color + " dicks today.") | name = input('Enter Name: ')
color = input("What's your favorite color? ")
count = input('How many? ')
print(name + ' ate ' + count + ' ' + color + ' dicks today.') |
# coding: utf-8
class Issue(object):
def __init__(self, api):
"""
:param api:
"""
self.api = api
def list(self, **kwargs):
"""
https://developer.nulab-inc.com/ja/docs/backlog/api/2/get-issue-list/
:param kwargs: query parameter
:return:
... | class Issue(object):
def __init__(self, api):
"""
:param api:
"""
self.api = api
def list(self, **kwargs):
"""
https://developer.nulab-inc.com/ja/docs/backlog/api/2/get-issue-list/
:param kwargs: query parameter
:return:
"""
_ur... |
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020-2021 EntySec
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to... | class Dictionary:
def __init__(self):
self.paths = ['~root', '~toor', '~bin', '~daemon', '~adm', '~lp', '~sync', '~shutdown', '~halt', '~mail', '~pop', '~postmaster', '~news', '~uucp', '~operator', '~games', '~gopher', '~ftp', '~nobody', '~nscd', '~mailnull', '~ident', '~rpc', '~rpcuser', '~xfs', '~gdm', '... |
SERVER_HOST = '0.0.0.0'
SERVER_PORT = 5000
SECRET_KEY = 'ABCJKSKMKJFJIF'
DEBUG = True
| server_host = '0.0.0.0'
server_port = 5000
secret_key = 'ABCJKSKMKJFJIF'
debug = True |
# my_lambbdata/polos.py
# Polo Class!
# attributes / properties (NOUNS): size, style, color, texture, price
# methods (VERBS): wash, fold, pop collar
class Polo():
def __init__(self, size, color):
self.size = size
self.color = color
@property
def full_name(self):
return f"{self.si... | class Polo:
def __init__(self, size, color):
self.size = size
self.color = color
@property
def full_name(self):
return f'{self.size} {self.color}'
def wash(self):
print(f'WASHING THE {self.size} {self.color} POLO!')
@staticmethod
def fold():
print(f'FO... |
class IncompatibilityCause(Exception):
"""
The reason and Incompatibility's terms are incompatible.
"""
class RootCause(IncompatibilityCause):
pass
class NoVersionsCause(IncompatibilityCause):
pass
class DependencyCause(IncompatibilityCause):
pass
class ConflictCause(IncompatibilityCa... | class Incompatibilitycause(Exception):
"""
The reason and Incompatibility's terms are incompatible.
"""
class Rootcause(IncompatibilityCause):
pass
class Noversionscause(IncompatibilityCause):
pass
class Dependencycause(IncompatibilityCause):
pass
class Conflictcause(IncompatibilityCause):
... |
# Constants
IMG_SIZE = (48, 48)
EMOTIONS = {
# 'anger': 1,
# 'disgust': 2,
# 'fear': 3,
4: 'happy',
# 'sad': 5,
6: 'surprise',
}
THRESHOLDS = {
# 1: 0.5,
# 2: 0.5,
# 3: 0.5,
4: 0.80,
# 5: 0.5,
6: 0.6,
}
| img_size = (48, 48)
emotions = {4: 'happy', 6: 'surprise'}
thresholds = {4: 0.8, 6: 0.6} |
class FrontendPortName(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_frontend_port_name(idx_name)
class FrontendPortNameColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_frontend_ports()
| class Frontendportname(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_frontend_port_name(idx_name)
class Frontendportnamecolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_frontend_ports() |
# part 1
with open("inputs/day1.txt", "r") as f:
lines = f.read().strip().split("\n")
n_increases = 0
for left, right in zip(lines[:-1], lines[1:]):
if int(right) > int(left):
n_increases += 1
print("Part 1:", n_increases)
# part 2
n_increases = 0
prevval = None
for left, middle, right in zip(lin... | with open('inputs/day1.txt', 'r') as f:
lines = f.read().strip().split('\n')
n_increases = 0
for (left, right) in zip(lines[:-1], lines[1:]):
if int(right) > int(left):
n_increases += 1
print('Part 1:', n_increases)
n_increases = 0
prevval = None
for (left, middle, right) in zip(lines[:-2], lines[1:-1],... |
"""Madlibs Stories."""
class Story:
"""Madlibs story.
To make a story, pass a list of prompts, and the text
of the template.
>>> s = Story(["noun", "verb"],
... "I love to {verb} a good {noun}.")
To generate text from a story, pass in a dictionary-like thing
of {prompt: ans... | """Madlibs Stories."""
class Story:
"""Madlibs story.
To make a story, pass a list of prompts, and the text
of the template.
>>> s = Story(["noun", "verb"],
... "I love to {verb} a good {noun}.")
To generate text from a story, pass in a dictionary-like thing
of {prompt: answ... |
#!/usr/bin/env python
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | class Rule(object):
"""An optional base class for rule implementations.
The rule_parser looks for the 'IsType' and 'ApplyRule' methods by name, so
rules are not strictly required to extend this class.
"""
def is_type(self, rule_type_name):
"""Returns True if the name matches this rule."""
... |
class C:
def method(self):
def foo():
def bar():
pass
# bar
# bar
# bar
# method
# class
| class C:
def method(self):
def foo():
def bar():
pass |
class TemplateError(Exception):
pass
class TemplateSyntaxError(TemplateError):
"""Raised to tell the user that there is a problem with the template."""
def __init__(self, message, lineno=None, name=None,
source=None, filename=None, node=None):
TemplateError.__init__(self, message... | class Templateerror(Exception):
pass
class Templatesyntaxerror(TemplateError):
"""Raised to tell the user that there is a problem with the template."""
def __init__(self, message, lineno=None, name=None, source=None, filename=None, node=None):
TemplateError.__init__(self, message)
self.mes... |
""". regress totemp gnpdefl gnp unemp armed pop year
Source | SS df MS Number of obs = 16
-------------+------------------------------ F( 6, 9) = 330.29
Model | 184172402 6 30695400.3 Prob > F = 0.0000
Residual | 836424.129 ... | """. regress totemp gnpdefl gnp unemp armed pop year
Source | SS df MS Number of obs = 16
-------------+------------------------------ F( 6, 9) = 330.29
Model | 184172402 6 30695400.3 Prob > F = 0.0000
Residual | 836424.129 ... |
# -*- coding: utf-8 -*-
__author__ = """Jason Emerick"""
__email__ = 'jason@mobelux.com'
__version__ = '0.3.2'
| __author__ = 'Jason Emerick'
__email__ = 'jason@mobelux.com'
__version__ = '0.3.2' |
def test_user_login_logged_in(cli_run, mock_user):
result = cli_run(['user', 'login'])
assert result.exit_code == 0
assert 'Hello' in result.output
| def test_user_login_logged_in(cli_run, mock_user):
result = cli_run(['user', 'login'])
assert result.exit_code == 0
assert 'Hello' in result.output |
class Solution:
def findMedianSortedArrays(self, nums1: [int], nums2: [int]) -> float:
if len(nums1) > len(nums2): nums1, nums2 = nums2, nums1
l, r = 0, 2 * len(nums1)
while l <= r:
m1 = (l + r) // 2
m2 = len(nums1) + len(nums2) - m1
left1 = nums1[(m1 - 1)... | class Solution:
def find_median_sorted_arrays(self, nums1: [int], nums2: [int]) -> float:
if len(nums1) > len(nums2):
(nums1, nums2) = (nums2, nums1)
(l, r) = (0, 2 * len(nums1))
while l <= r:
m1 = (l + r) // 2
m2 = len(nums1) + len(nums2) - m1
... |
#!/usr/bin/env python3
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def removeNthFromEnd(self, head, n):
"""
:type head: ListNode
:type n: int
:rtype: ListNode
... | class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def remove_nth_from_end(self, head, n):
"""
:type head: ListNode
:type n: int
:rtype: ListNode
"""
curr = head
for _ in range(n):
... |
class BUILD_TREE(object):
def __init__(self, **args):
self.tree = {}
def _convertargs(self, args):
for item, value in args.items():
if not ((type(value) is list) or (type(value) is dict)):
args[item] = str(value)
def populateTree(self, tag, text='', attr=None, c... | class Build_Tree(object):
def __init__(self, **args):
self.tree = {}
def _convertargs(self, args):
for (item, value) in args.items():
if not (type(value) is list or type(value) is dict):
args[item] = str(value)
def populate_tree(self, tag, text='', attr=None, c... |
__author__ = 'ktisha'
class A:
ccc = True
def foo(self):
self.ccc = False | __author__ = 'ktisha'
class A:
ccc = True
def foo(self):
self.ccc = False |
class Solution(object):
def countBattleships(self, board):
"""
:type board: List[List[str]]
:rtype: int
"""
# cycle through each point
# check surrounding
# add one
# set surroundgs to .
count = 0
for row in range(0, len(board)):
... | class Solution(object):
def count_battleships(self, board):
"""
:type board: List[List[str]]
:rtype: int
"""
count = 0
for row in range(0, len(board)):
for column in range(0, len(board[0])):
if board[row][column] == 'X':
... |
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
F=open('input.txt','r')
W=open('output.txt','w')
a=F.readline()
b=int(F.readline())
W.write(str('RL'[a[0]=='f'and b<2 or a[0]=='b'and b>1]))
W.close()
| """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
f = open('input.txt', 'r')
w = open('output.txt', 'w')
a = F.readline()
b = int(F.readline())
W.write(str('RL'[a[0] == 'f' and b < 2 or (a[0] == 'b' and b > 1)]))
W.close() |
#
# PySNMP MIB module ERI-DNX-SMC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ERI-DNX-SMC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:51:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
class File_List:
wordList=[]
def __init__(self):
self.wordList = ['.c', '.h', '.java', '.py', '.php',
'.html', '.css', '.xml', '.tcp', 'sqlite3.o',
'sqlite.o', 'sqlite2.o', '.sh', '.dat', '.josn',
'http', 'www', 'sconscript',
... | class File_List:
word_list = []
def __init__(self):
self.wordList = ['.c', '.h', '.java', '.py', '.php', '.html', '.css', '.xml', '.tcp', 'sqlite3.o', 'sqlite.o', 'sqlite2.o', '.sh', '.dat', '.josn', 'http', 'www', 'sconscript']
def get_list(self):
return self.wordList |
_base_ = [
'../_base_/models/resnet50_doc_quality.py', '../_base_/datasets/doc_quality.py',
'../_base_/schedules/schedule_200.py', '../_base_/default_runtime.py'
]
| _base_ = ['../_base_/models/resnet50_doc_quality.py', '../_base_/datasets/doc_quality.py', '../_base_/schedules/schedule_200.py', '../_base_/default_runtime.py'] |
load("//python:python_grpc_compile.bzl", "python_grpc_compile")
def python_grpc_library(**kwargs):
# Compile protos
name_pb = kwargs.get("name") + "_pb"
python_grpc_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
)
# Pick de... | load('//python:python_grpc_compile.bzl', 'python_grpc_compile')
def python_grpc_library(**kwargs):
name_pb = kwargs.get('name') + '_pb'
python_grpc_compile(name=name_pb, **{k: v for (k, v) in kwargs.items() if k in ('deps', 'verbose')})
if 'python_version' not in kwargs or kwargs['python_version'] == 'PY3'... |
class ChangelogError(Exception):
pass
class ChangelogParseError(ChangelogError):
pass
class ChangelogValidationError(ChangelogError):
pass
class ChangelogMissingConfigError(ChangelogError):
def __init__(self, message: str, field: str = None):
super().__init__(message)
self.field = ... | class Changelogerror(Exception):
pass
class Changelogparseerror(ChangelogError):
pass
class Changelogvalidationerror(ChangelogError):
pass
class Changelogmissingconfigerror(ChangelogError):
def __init__(self, message: str, field: str=None):
super().__init__(message)
self.field = fiel... |
def no_space(x):
l = []
for i in x:
if i == " " :
continue
l.append(i)
return ''.join(l)
def no_space1(x):
x = x.replace(" ", "")
return x | def no_space(x):
l = []
for i in x:
if i == ' ':
continue
l.append(i)
return ''.join(l)
def no_space1(x):
x = x.replace(' ', '')
return x |
# fn to generate fibonacci numbers upto a given range
def fibonacci_Series(upto):
fibonacci_list = []
x = 0
y = 1
while x < upto:
fibonacci_list.append(x)
x, y = y, x+y
return fibonacci_list
# Driver's Code
print(fibonacci_Series(100)) | def fibonacci__series(upto):
fibonacci_list = []
x = 0
y = 1
while x < upto:
fibonacci_list.append(x)
(x, y) = (y, x + y)
return fibonacci_list
print(fibonacci__series(100)) |
people = {'name': 'Henrique', 'sex': 'M', 'age': 24}
print(f'{people["name"]} is {people["age"]} years old')
print(people.keys())
print(people.values())
print(people.items())
for key, values in people.items():
print(f'{key} = {values}')
del people['sex']
print(people)
people['name'] = 'Gustavo'
people['weight'] ... | people = {'name': 'Henrique', 'sex': 'M', 'age': 24}
print(f"{people['name']} is {people['age']} years old")
print(people.keys())
print(people.values())
print(people.items())
for (key, values) in people.items():
print(f'{key} = {values}')
del people['sex']
print(people)
people['name'] = 'Gustavo'
people['weight'] =... |
try:
print(int(input()))
except:
print("Bad String")
| try:
print(int(input()))
except:
print('Bad String') |
def pairwise(iterable):
it = iter(iterable)
a = next(it, None)
for b in it:
yield (a, b)
a = b
num_tests = int(input())
for test in range(num_tests):
num_walls = int(input())
walls = list(map(int, input().split()))
h = l = 0
if len(walls) >= 2:
for c, n in pairwise(walls):
if n > c:
... | def pairwise(iterable):
it = iter(iterable)
a = next(it, None)
for b in it:
yield (a, b)
a = b
num_tests = int(input())
for test in range(num_tests):
num_walls = int(input())
walls = list(map(int, input().split()))
h = l = 0
if len(walls) >= 2:
for (c, n) in pairwise(... |
# MIT License
#
# Copyright (c) 2019 Nathaniel Brough
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | load('@rules_cc//cc:defs.bzl', 'cc_toolchain')
load('@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl', 'tool_path')
load('@bazel_tools//tools/build_defs/cc:action_names.bzl', 'ACTION_NAMES')
load('@com_llvm_compiler//:defs.bzl', 'SYSTEM_INCLUDE_COMMAND_LINE', 'SYSTEM_INCLUDE_PATHS', 'SYSTEM_SYSROOT')
load('//toolch... |
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE', which is part of this source code package.
#
class Menu:
def __init__(self, header=None, choices=None, on_show=None, on_invalid_choice=None, key_sep=': ', input_text='Choice: ', invalid_choice_text='Invalid input.'):
self.head... | class Menu:
def __init__(self, header=None, choices=None, on_show=None, on_invalid_choice=None, key_sep=': ', input_text='Choice: ', invalid_choice_text='Invalid input.'):
self.header = header
self.choices = choices
self.on_show = on_show
self.on_invalid_choice = on_invalid_choice
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.