content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class HttpClient(object):
"""Represent a http client for sending request to a http[s] server.
If cookies need to be sent, they should be in a file p... | class Httpclient(object):
"""Represent a http client for sending request to a http[s] server.
If cookies need to be sent, they should be in a file pointed to by
COOKIE_FILE in the environment.
"""
@staticmethod
def get(url, params={}, timeout=120, retries=5, retry_interval=0.5, retry_if_not=None):
... |
# This simple calculator calculates the sum, the difference, the quotient and the product of two integers.
def calculator(input1,input2):
summe = input1+input2
difference=input1-input2
quotient=input1/input2
product=input1*input2
results = [summe,difference,quotient,product]
return ... | def calculator(input1, input2):
summe = input1 + input2
difference = input1 - input2
quotient = input1 / input2
product = input1 * input2
results = [summe, difference, quotient, product]
return results
print('Folgende Werte wurden berechnet:\nSumme ={:6.2f}'.format(summe), '\nDifferenz ={:6.... |
# CPU: 0.14 s
leg_a, leg_b, leg_c, total = map(int, input().split())
possible = False
for a in range(total // leg_a + 1):
for b in range(total // leg_b + 1):
for c in range(total // leg_c + 1):
if leg_a * a + leg_b * b + leg_c * c == total:
print(a, b, c)
possible = True
if not possible:
print("impossibl... | (leg_a, leg_b, leg_c, total) = map(int, input().split())
possible = False
for a in range(total // leg_a + 1):
for b in range(total // leg_b + 1):
for c in range(total // leg_c + 1):
if leg_a * a + leg_b * b + leg_c * c == total:
print(a, b, c)
possible = True
if n... |
i = 29 # ratio
z1 = 29 # disc teeth number
m = 3.5 # module
x = 0.2857 # correction coefficient
rc_star = 1 # fixed teeth radius coefficient
n = 600 # motor rotation speed [rpm]
T1 = 4000 # motor torque [Nmm]
T2 = 116000 # output... | i = 29
z1 = 29
m = 3.5
x = 0.2857
rc_star = 1
n = 600
t1 = 4000
t2 = 116000
s = 2
'-------------------------------------------------------'
l1 = 16
l2 = 14
l3 = 16
delta = 3
b = 13.5
zw = 4
dp = 12
dx = 40
phik0 = 0
eccentric_c0 = 34500
shaft_end_c0 = 2850 |
class Solution:
def recoverTree(self, root: TreeNode) -> None:
"""
Do not return anything, modify root in-place instead.
"""
container = []
def traverse(node):
if not node:
return
traverse(node.left)
container.a... | class Solution:
def recover_tree(self, root: TreeNode) -> None:
"""
Do not return anything, modify root in-place instead.
"""
container = []
def traverse(node):
if not node:
return
traverse(node.left)
container.append((nod... |
CURR_USD, CURR_EUR = range(1, 3)
CURRENCY_CHOICES = (
(CURR_USD, 'USD'),
(CURR_EUR, 'EUR'),
)
SR_PRIVAT, SR_MONO, SR_VKURSE, SR_OTP, SR_TAS, = range(1, 6)
SOURCE_CHOICES = (
(SR_PRIVAT, 'PrivetBank'),
(SR_MONO, 'MonoBank'),
(SR_VKURSE, 'Vkurse'),
(SR_OTP, 'OTP-bank'),
(SR_TAS, 'TasCom-ban... | (curr_usd, curr_eur) = range(1, 3)
currency_choices = ((CURR_USD, 'USD'), (CURR_EUR, 'EUR'))
(sr_privat, sr_mono, sr_vkurse, sr_otp, sr_tas) = range(1, 6)
source_choices = ((SR_PRIVAT, 'PrivetBank'), (SR_MONO, 'MonoBank'), (SR_VKURSE, 'Vkurse'), (SR_OTP, 'OTP-bank'), (SR_TAS, 'TasCom-bank')) |
n=int(input())
s=[]
s2=[]
for i in range(n):
s.append(input())
for i in range(n-1):
s2.append(input())
s.sort()
s2.sort()
for i in range(n-1):
if s[i]!=s2[i]:
print(s[i])
break
else:
print(s[-1]) | n = int(input())
s = []
s2 = []
for i in range(n):
s.append(input())
for i in range(n - 1):
s2.append(input())
s.sort()
s2.sort()
for i in range(n - 1):
if s[i] != s2[i]:
print(s[i])
break
else:
print(s[-1]) |
''' setting global variables/constants '''
GAP_SCORE = -0.9
MISMATCH_SCORE = -1.0
MATCH_SCORE = 0
| """ setting global variables/constants """
gap_score = -0.9
mismatch_score = -1.0
match_score = 0 |
class Constants(object):
HISTORY_FILE = "~/.spanner-cli-history"
MAX_RESULT = 1000
PYGMENT_STYLE = "monokai"
LOGFILE = "~/.spanner-cli.log"
LESS_FLAG = "-RXF"
| class Constants(object):
history_file = '~/.spanner-cli-history'
max_result = 1000
pygment_style = 'monokai'
logfile = '~/.spanner-cli.log'
less_flag = '-RXF' |
class BinTreeNode():
def __init__(self, element=None, left=None, right=None):
self.element = element
self.left = left
self.right = right
class BinaryTree(object): # Linked structure binary tree
def __init__(self):
self.root = None
# self.size = 0
def populate_tree... | class Bintreenode:
def __init__(self, element=None, left=None, right=None):
self.element = element
self.left = left
self.right = right
class Binarytree(object):
def __init__(self):
self.root = None
def populate_tree(self):
element = input('ROOT element: ')
... |
class NotReceived(Exception):
"""
Message has not been recieved by anyone
"""
class WrappedException(Exception):
"""
Exception raised when an exception raised
by RPC call could not be resolved, the innermessage
shows the exception raised on the RPC server.
"""
class RPCTimeoutError(E... | class Notreceived(Exception):
"""
Message has not been recieved by anyone
"""
class Wrappedexception(Exception):
"""
Exception raised when an exception raised
by RPC call could not be resolved, the innermessage
shows the exception raised on the RPC server.
"""
class Rpctimeouterror(Exc... |
# Solutions for Deblurring tutorial - PyData Global 2020 Tutorial
def Unsharp_Mask():
"""Unsharp Mask operator
"""
# load image from scikit-image
image = data.microaneurysms()
ny, nx = image.shape
# %load -s Diagonal_timing solutions/intro_sol.py
# Define matrix kernel
kernel_unsharp ... | def unsharp__mask():
"""Unsharp Mask operator
"""
image = data.microaneurysms()
(ny, nx) = image.shape
kernel_unsharp = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])
unsharp_op = convolve2_d(N=ny * nx, h=kernel_unsharp, offset=(kernel_unsharp.shape[0] // 2, kernel_unsharp.shape[1] // 2), dims=... |
"""
PASSENGERS
"""
numPassengers = 30593
passenger_arriving = (
(5, 7, 6, 7, 7, 0, 5, 3, 5, 0, 1, 0, 0, 7, 8, 4, 6, 4, 6, 4, 2, 2, 3, 2, 2, 0), # 0
(5, 16, 13, 11, 2, 2, 1, 5, 6, 3, 2, 0, 0, 10, 9, 10, 2, 4, 5, 4, 1, 3, 3, 1, 1, 0), # 1
(8, 14, 7, 7, 2, 3, 2, 2, 6, 4, 0, 2, 0, 14, 10, 4, 4, 6, 2, 4, 4, 0, 0, 0,... | """
PASSENGERS
"""
num_passengers = 30593
passenger_arriving = ((5, 7, 6, 7, 7, 0, 5, 3, 5, 0, 1, 0, 0, 7, 8, 4, 6, 4, 6, 4, 2, 2, 3, 2, 2, 0), (5, 16, 13, 11, 2, 2, 1, 5, 6, 3, 2, 0, 0, 10, 9, 10, 2, 4, 5, 4, 1, 3, 3, 1, 1, 0), (8, 14, 7, 7, 2, 3, 2, 2, 6, 4, 0, 2, 0, 14, 10, 4, 4, 6, 2, 4, 4, 0, 0, 0, 0, 0), (8, 8, 6... |
class FrameHeader:
fin: int
rsv1: int
rsv2: int
rsv3: int
opcode: int
masked: int
length: int
# Opcode
# https://tools.ietf.org/html/rfc6455#section-5.2
# Non-control frames
# %x0 denotes a continuation frame
OPCODE_CONTINUATION = 0x0
# %x1 denotes a text frame
O... | class Frameheader:
fin: int
rsv1: int
rsv2: int
rsv3: int
opcode: int
masked: int
length: int
opcode_continuation = 0
opcode_text = 1
opcode_binary = 2
opcode_close = 8
opcode_ping = 9
opcode_pong = 10
def __init__(self, opcode: int, fin: int=1, rsv1: int=0, rsv2... |
def is_one_to_one(df, col1, col2):
first = df.drop_duplicates([col1, col2]).groupby(col1)[col2].count().max()
second = df.drop_duplicates([col1, col2]).groupby(col2)[col1].count().max()
return first + second == 2
| def is_one_to_one(df, col1, col2):
first = df.drop_duplicates([col1, col2]).groupby(col1)[col2].count().max()
second = df.drop_duplicates([col1, col2]).groupby(col2)[col1].count().max()
return first + second == 2 |
class Color(object): # subclass color of nodes
def __init__(self):
self._RED = True
self._BLACK = False
@property
def RED(self):
return self._RED
@property
def BLACK(self):
return self._BLACK
| class Color(object):
def __init__(self):
self._RED = True
self._BLACK = False
@property
def red(self):
return self._RED
@property
def black(self):
return self._BLACK |
#
# PySNMP MIB module CISCO-CIPCMPC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CIPCMPC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:53:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, single_value_constraint, value_size_constraint) ... |
pwNextLetters = "abcdefghjkmnpqrstuvwxyz" # The next letter after a valid letter
pwInvalidNextLetters = "ijlmop" # The next letter after an invalid letter
pwInvalidLetters = "ilo"
def nextLetter(letter):
sequenceForNext = pwNextLetters if letter not in pwInvalidLetters else pwInvalidNextLetters
letterPos = ... | pw_next_letters = 'abcdefghjkmnpqrstuvwxyz'
pw_invalid_next_letters = 'ijlmop'
pw_invalid_letters = 'ilo'
def next_letter(letter):
sequence_for_next = pwNextLetters if letter not in pwInvalidLetters else pwInvalidNextLetters
letter_pos = sequenceForNext.index(letter)
if letterPos < len(sequenceForNext) - 1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__all__ = ["cli", "influx", "udp", "routines", "helper", "sample_dump", "colormap"]
| __all__ = ['cli', 'influx', 'udp', 'routines', 'helper', 'sample_dump', 'colormap'] |
class Version():
def __init__(self, major, minor, patch, revision, beta, protocol):
self.major = major
self.minor = minor
self.patch = patch
self.revision = revision
self.beta = beta
self.protocol = protocol
def __str__(self):
return 'Version: %d.%d.%... | class Version:
def __init__(self, major, minor, patch, revision, beta, protocol):
self.major = major
self.minor = minor
self.patch = patch
self.revision = revision
self.beta = beta
self.protocol = protocol
def __str__(self):
return 'Version: %d.%d.%d.%d\... |
for _ in range(int(input())):
N = input()
result = 0
while True:
if N == "6174":
print(result)
break
b = ''.join(sorted(N))
a = ''.join(sorted(N, reverse=True))
sub = str(int(a) - int(b))
sub += "0" * (4 - len(sub))
N = sub
resu... | for _ in range(int(input())):
n = input()
result = 0
while True:
if N == '6174':
print(result)
break
b = ''.join(sorted(N))
a = ''.join(sorted(N, reverse=True))
sub = str(int(a) - int(b))
sub += '0' * (4 - len(sub))
n = sub
resu... |
class Solution:
def isValidSudoku(self, board: List[List[str]]) -> bool:
for i in range(3):
d=""
for j in range(3):
d+=board[i*3][j*3]+board[i*3+1][j*3+1]+board[i*3+2][j*3+2]
for k in range(1,10):
if d.count(str(k))>1:
... | class Solution:
def is_valid_sudoku(self, board: List[List[str]]) -> bool:
for i in range(3):
d = ''
for j in range(3):
d += board[i * 3][j * 3] + board[i * 3 + 1][j * 3 + 1] + board[i * 3 + 2][j * 3 + 2]
for k in range(1, 10):
if d.count(... |
number = int(input()) # number of letters
a = 0
for i in range(0, number):
for k in range(0, number):
for h in range(0, number):
print(f"{chr(97 + i)}{chr(97 + k)}{chr(97 + h)}")
for f in range(0, 900000):
a += 1 | number = int(input())
a = 0
for i in range(0, number):
for k in range(0, number):
for h in range(0, number):
print(f'{chr(97 + i)}{chr(97 + k)}{chr(97 + h)}')
for f in range(0, 900000):
a += 1 |
def runner(
input_iterable=None,
transform_function=lambda x: x,
post_method=None
):
for item in input_iterable:
post_method(transform_function(item)) | def runner(input_iterable=None, transform_function=lambda x: x, post_method=None):
for item in input_iterable:
post_method(transform_function(item)) |
class Low_Memory_Aligner:
"""An aligner which can align two letter strings optimally in linear memory
A score matrix which has all possible match-ups of letters must be given.
find_midddle_edge: find the middle edge in the current alignment graph
"""
def __init__(self, one, two, score... | class Low_Memory_Aligner:
"""An aligner which can align two letter strings optimally in linear memory
A score matrix which has all possible match-ups of letters must be given.
find_midddle_edge: find the middle edge in the current alignment graph
"""
def __init__(self, one, two, score_matrix, ind... |
'''
chitragoopt: Test module.
Meant for use with py.test.
Write each test as a function named test_<something>.
Read more here: http://pytest.org/
Copyright 2015, Venkatesh Rao
Licensed under MIT
'''
def test_example():
assert True
| """
chitragoopt: Test module.
Meant for use with py.test.
Write each test as a function named test_<something>.
Read more here: http://pytest.org/
Copyright 2015, Venkatesh Rao
Licensed under MIT
"""
def test_example():
assert True |
__about__ = """
FIRST CONDITION : The Array should be sorted.
REAL TIME: The Data is Jumbled up so this is time consuming.
""" | __about__ = '\n\nFIRST CONDITION : The Array should be sorted.\nREAL TIME: The Data is Jumbled up so this is time consuming.\n\n' |
#
# PySNMP MIB module IEEE8021-BRIDGE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IEEE8021-BRIDGE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:52:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
"""
File: boggle.py
Name: Kevin Chen
----------------------------------------
Thank a lot for Sean's hint :D
"""
# This is the file name of the dictionary txt file
# we will be checking if a word exists by searching through it
FILE = 'dictionary.txt'
dictionary = []
total = []
def main():
# creating boggle grid
g... | """
File: boggle.py
Name: Kevin Chen
----------------------------------------
Thank a lot for Sean's hint :D
"""
file = 'dictionary.txt'
dictionary = []
total = []
def main():
grid = fill_gird()
if grid is not None:
play_boggle(grid)
def play_boggle(grid):
global total
read_dictionary()
us... |
paths = [
'LDRLDLRDUURULDDDRLLUULUDRDLRRD', # level "1".
'UDLLDDRUDDRRRRDUURUULLUURLULDRUDLLDRRUUR', # level "2".
'UUULRUULRRURRRUDRDLUULLLLLUDRDLLDDDDDRRRRRUULDDLLLLLDU', # level "3".
# level "4"; looks like '21'.
'LDDRLDLLDULURDDRRRDULRDUURULUDLUDRLDDLLURRDURRDURUDL',
# level "5"; top (of 2) sausage is... | paths = ['LDRLDLRDUURULDDDRLLUULUDRDLRRD', 'UDLLDDRUDDRRRRDUURUULLUURLULDRUDLLDRRUUR', 'UUULRUULRRURRRUDRDLUULLLLLUDRDLLDDDDDRRRRRUULDDLLLLLDU', 'LDDRLDLLDULURDDRRRDULRDUURULUDLUDRLDDLLURRDURRDURUDL', 'DRDLLULRDURURLULRU', 'UULLUDRDDDLLURRDULRDRUULRDRULLDURLRUDD', 'LDULUURRRDRUDRDDLLLUURUDLRRURULL', 'RULDLRRURRRUDRDDLU... |
example = [int(age) for age in open('./day 07/Xavier - Python/example.txt').readline().strip().split(',')]
input = [int(age) for age in open('./day 07/Xavier - Python/input.txt').readline().strip().split(',')]
def part_one(positions):
fuels = [sum([abs(i-x) for x in positions]) for i in range(min(positions), max(p... | example = [int(age) for age in open('./day 07/Xavier - Python/example.txt').readline().strip().split(',')]
input = [int(age) for age in open('./day 07/Xavier - Python/input.txt').readline().strip().split(',')]
def part_one(positions):
fuels = [sum([abs(i - x) for x in positions]) for i in range(min(positions), max... |
#!/usr/bin/env python
def inner_iter(iterations):
for i in range(0, iterations):
yield i * iterations
def outer_iter(iterations):
for i in range(0, iterations):
yield from inner_iter(i)
if __name__ == '__main__':
for i in outer_iter(10):
print(i)
| def inner_iter(iterations):
for i in range(0, iterations):
yield (i * iterations)
def outer_iter(iterations):
for i in range(0, iterations):
yield from inner_iter(i)
if __name__ == '__main__':
for i in outer_iter(10):
print(i) |
#
# PySNMP MIB module ALCATEL-IND1-MAC-ADDRESS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-MAC-ADDRESS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:02:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python vers... | (softent_ind1_mac_address,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'softentIND1MacAddress')
(vlan_number,) = mibBuilder.importSymbols('ALCATEL-IND1-VLAN-MGR-MIB', 'vlanNumber')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_val... |
# apply a value to functions
def applyFuns(L, x):
'''
assumes L is a list of functions
x is an int
'''
for f in L:
print(f(x)) | def apply_funs(L, x):
"""
assumes L is a list of functions
x is an int
"""
for f in L:
print(f(x)) |
# Copyright (c) 2019 The Felicia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
load("@local_config_python//:py.bzl", "PYTHON_BIN")
load("@local_config_env//:env.bzl", "ROS_DISTRO")
load("//bazel:felicia.bzl", "if_has_ros")
def _ros_... | load('@local_config_python//:py.bzl', 'PYTHON_BIN')
load('@local_config_env//:env.bzl', 'ROS_DISTRO')
load('//bazel:felicia.bzl', 'if_has_ros')
def _ros_cc_outs(srcs, gen_srv=False):
if gen_srv:
outs = []
for s in srcs:
name = s[:-len('.srv')]
outs.append(name + '.h')
... |
class _BotCommands:
def __init__(self):
self.StartCommand = 'start'
self.ListCommand = 'list'
self.AuthorizeCommand = 'authorize'
self.UnAuthorizeCommand = 'unauthorize'
self.PingCommand = 'ping'
self.StatsCommand = 'stats'
self.HelpCommand = 'help'
se... | class _Botcommands:
def __init__(self):
self.StartCommand = 'start'
self.ListCommand = 'list'
self.AuthorizeCommand = 'authorize'
self.UnAuthorizeCommand = 'unauthorize'
self.PingCommand = 'ping'
self.StatsCommand = 'stats'
self.HelpCommand = 'help'
s... |
# https://leetcode.com/problems/can-make-arithmetic-progression-from-sequence/
# Source: https://leetcode.com/problems/can-make-arithmetic-progression-from-sequence/discuss/720200/Clean-Python-3-O(N)
class Solution(object):
def canMakeArithmeticProgression(self, arr):
"""
:type arr: List[int]
... | class Solution(object):
def can_make_arithmetic_progression(self, arr):
"""
:type arr: List[int]
:rtype: bool
"""
arr.sort()
k = arr[1] - arr[0]
for i in range(1, len(arr) - 1):
if arr[i + 1] - arr[i] != k:
return False
ret... |
class Calculator(object):
num1 = None
num2 = None
def sum(self):
return self.num1 + self.num2 | class Calculator(object):
num1 = None
num2 = None
def sum(self):
return self.num1 + self.num2 |
# The problem has asked for longest contiguous subarray that contains only 1s. What makes this problem a little trickier
# is the K flips allowed from 0 --> 1. This means a contiguous subarray of 1's might not just contain 1's but also
# may contain some 0's. The number of 0's allowed in a given subarray is given by ... | class Solution:
def longest_ones(self, A: List[int], K: int) -> int:
left = 0
for right in range(len(A)):
if A[right] == 0:
k -= 1
if K < 0:
if A[left] == 0:
k += 1
left += 1
return right - left + 1
... |
a = list(input().split())
for i in a:
if int(i) == 0:
a.remove(i)
a.append(i)
print(*a) | a = list(input().split())
for i in a:
if int(i) == 0:
a.remove(i)
a.append(i)
print(*a) |
# Commands/methods
TURNON = 1
TURNOFF = 2
BELL = 4
TOGGLE = 8
DIM = 16
LEARN = 32
UP = 128
DOWN = 256
STOP = 512
RGBW = 1024
THERMOSTAT = 2048
# Sensor types
TEMPERATURE = "temp"
HUMIDITY = "humidity"
RAINRATE = "rrate"
RAINTOTAL = "rtot"
WINDDIRECTION = "wdir"
WINDAVERAGE = "wavg"
WINDGUST = "wgust"
UV = "uv"
POWER =... | turnon = 1
turnoff = 2
bell = 4
toggle = 8
dim = 16
learn = 32
up = 128
down = 256
stop = 512
rgbw = 1024
thermostat = 2048
temperature = 'temp'
humidity = 'humidity'
rainrate = 'rrate'
raintotal = 'rtot'
winddirection = 'wdir'
windaverage = 'wavg'
windgust = 'wgust'
uv = 'uv'
power = 'watt'
luminance = 'lum'
dew_point... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 6 22:10:06 2020
@author: stemonitis
"""
"""
Look-uptables LUTs
#getextraterrestial sun
The MODTRAN extraterrestrial spectra are high-resolution, with approximately 50,000 data points at 1 wavenumber (1 cm-1) resolution.
The MODTRAN ETR sp... | """
Created on Tue Oct 6 22:10:06 2020
@author: stemonitis
"""
'\n\n Look-uptables LUTs\n\n\n\n\n\n#getextraterrestial sun\n\nThe MODTRAN extraterrestrial spectra are high-resolution, with approximately 50,000 data points at 1 wavenumber (1 cm-1) resolution.\n\nThe MODTRAN ETR spectra are grouped in a tab delimited t... |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class CreatedApiKey(object):
"""Implementation of the 'CreatedApiKey' model.
Specifies a created API key.
Attributes:
created_time_msecs (int|long): Specifies the API key created time in
milli seconds.
created_user_sid (... | class Createdapikey(object):
"""Implementation of the 'CreatedApiKey' model.
Specifies a created API key.
Attributes:
created_time_msecs (int|long): Specifies the API key created time in
milli seconds.
created_user_sid (string): Specifies the user sid who created this API
... |
class ContentResult(object):
def __init__(self, content_type, content_item):
"""
:param content_type: a string indicating the type
:param content_item: a rule, transformer, or hook
"""
self.content_type = content_type
self.content_item = content_item
| class Contentresult(object):
def __init__(self, content_type, content_item):
"""
:param content_type: a string indicating the type
:param content_item: a rule, transformer, or hook
"""
self.content_type = content_type
self.content_item = content_item |
l = ['a', 'b', 'c']
try:
print("1. Inside try")
print("2. About to do something bad")
l[3]
print("3. After doing something bad")
except:
print("4. Caught the exception")
print("5. And exiting") | l = ['a', 'b', 'c']
try:
print('1. Inside try')
print('2. About to do something bad')
l[3]
print('3. After doing something bad')
except:
print('4. Caught the exception')
print('5. And exiting') |
# Set Data Type Demo
class SetDataTypeDemo:
Instances = 0
def __init__(self):
SetDataTypeDemo.Instances += 1
def displaySetValues(self, title, value):
print(f"----- {title} -----")
print(f'SetDataTypeDemo.Instances: {self.Instances}')
print(f'{value}')
def main():
tit... | class Setdatatypedemo:
instances = 0
def __init__(self):
SetDataTypeDemo.Instances += 1
def display_set_values(self, title, value):
print(f'----- {title} -----')
print(f'SetDataTypeDemo.Instances: {self.Instances}')
print(f'{value}')
def main():
title = 'Set Data Type ... |
"""
Results for SARIMAX tests
Results from Stata using script `test_sarimax_stata.do`.
See also Stata time series documentation.
Data from:
https://www.stata-press.com/data/r12/wpi1
https://www.stata-press.com/data/r12/air2
https://www.stata-press.com/data/r12/friedman2
Author: Chad Fulton
License: Simplified-BSD
"... | """
Results for SARIMAX tests
Results from Stata using script `test_sarimax_stata.do`.
See also Stata time series documentation.
Data from:
https://www.stata-press.com/data/r12/wpi1
https://www.stata-press.com/data/r12/air2
https://www.stata-press.com/data/r12/friedman2
Author: Chad Fulton
License: Simplified-BSD
"... |
# -*- coding: utf-8 -*-
def test_workflows_step_completed(slack_time):
assert slack_time.workflows.step_completed
def test_workflows_step_failed(slack_time):
assert slack_time.workflows.step_failed
def test_workflows_update_step(slack_time):
assert slack_time.workflows.update_step
| def test_workflows_step_completed(slack_time):
assert slack_time.workflows.step_completed
def test_workflows_step_failed(slack_time):
assert slack_time.workflows.step_failed
def test_workflows_update_step(slack_time):
assert slack_time.workflows.update_step |
_base_ = [
'../_base_/models/fast_scnn.py', '../_base_/datasets/publaynet.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_320k.py'
]
# Re-config the data sampler.
data = dict(samples_per_gpu=16, workers_per_gpu=4)
# Re-config the optimizer.
optimizer = dict(type='SGD', lr=0.12, momentum=0.9... | _base_ = ['../_base_/models/fast_scnn.py', '../_base_/datasets/publaynet.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_320k.py']
data = dict(samples_per_gpu=16, workers_per_gpu=4)
optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-05) |
class DNSQuery:
def __init__(self, data):
self.data=data
self.dominio=''
#print("Reading datagram data...")
m = data[2] # ord(data[2])
tipo = (m >> 3) & 15 # Opcode bits
if tipo == 0: # Standard query
ini=12
lon=data[ini] # ord(data[ini])
while lon !=... | class Dnsquery:
def __init__(self, data):
self.data = data
self.dominio = ''
m = data[2]
tipo = m >> 3 & 15
if tipo == 0:
ini = 12
lon = data[ini]
while lon != 0:
self.dominio += data[ini + 1:ini + lon + 1].decode('utf-8') ... |
#import stuff here
__version__ = '0.2'
| __version__ = '0.2' |
class Solution:
def longestConsecutive(self, nums: 'List[int]') -> 'int':
if len(nums) < 1: return 0
nums.sort()
longest, tmp = 1, 1
for i in range(1, len(nums)):
if nums[i] != nums[i - 1]:
if nums[i] == nums[i - 1] + 1:
tmp += 1
... | class Solution:
def longest_consecutive(self, nums: 'List[int]') -> 'int':
if len(nums) < 1:
return 0
nums.sort()
(longest, tmp) = (1, 1)
for i in range(1, len(nums)):
if nums[i] != nums[i - 1]:
if nums[i] == nums[i - 1] + 1:
... |
#!/bin/python3
def check_trap(prev_row, i, row_len):
if i - 1 < 0:
left = "."
else:
left = prev_row[i - 1]
if i + 1 > row_len - 1:
right = "."
else:
right = prev_row[i + 1]
if (left == "." and right == "^") or (left == "^" and right == "."):
return "^"
e... | def check_trap(prev_row, i, row_len):
if i - 1 < 0:
left = '.'
else:
left = prev_row[i - 1]
if i + 1 > row_len - 1:
right = '.'
else:
right = prev_row[i + 1]
if left == '.' and right == '^' or (left == '^' and right == '.'):
return '^'
else:
return... |
# task type can be either 'classification' or 'regression', based on the target feature in the dataset
TASK_TYPE = ''
# the header (all column names) of the input data file(s)
HEADERS = []
# the default values of all the columns of the input data, to help TF detect the data types of the columns
HEADER_DEFAULTS = []
... | task_type = ''
headers = []
header_defaults = []
numeric_feature_names = []
categorical_feature_names_with_vocabulary = {}
categorical_feature_names_with_hash_bucket = {}
categorical_feature_names = list(CATEGORICAL_FEATURE_NAMES_WITH_VOCABULARY.keys()) + list(CATEGORICAL_FEATURE_NAMES_WITH_HASH_BUCKET.keys())
feature_... |
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def sumOfLeftLeaves(self, root):
def sumOfLeftLeavesHelper(root, is_left):
if not root:
return 0
if not root.left and n... | class Treenode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def sum_of_left_leaves(self, root):
def sum_of_left_leaves_helper(root, is_left):
if not root:
return 0
if not root.l... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2012 Dag Wieers <dag@wieers.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | ansible_metadata = {'metadata_version': '1.0', 'status': ['stableinterface'], 'supported_by': 'core'}
documentation = '\n---\nmodule: fail\nshort_description: Fail with custom message\ndescription:\n - This module fails the progress with a custom message. It can be\n useful for bailing out when a certain cond... |
#In Python, a dictionary can only hold a single value for a given key.
#To workaround this, our single value can be a list containing multiple values.
#Here we have a dictionary called "wardrobe" with items of clothing and their colors.
#Fill in the blanks to print a line for each item of clothing with each color,
... | wardrobe = {'shirt': ['red', 'blue', 'white'], 'jeans': ['blue', 'black']}
for key in wardrobe:
for values in wardrobe[key]:
print('{} {}'.format(values, key)) |
#1. Reverse the order of the items in an array.
#Example:
#a = [1, 2, 3, 4, 5]
#Result:
#a = [5, 4, 3, 2, 1]
a = [1,2,3,4,5]
list.reverse(a)
print ('Ex1: Inverted list is:', a)
#2. Get the number of occurrences of var b in array a.
#Example:
#a = [1, 1, 2, 2, 2, 2, 3, 3, 3]
#b = 2
#Result:
#4
a = [1, 1, 2, 2, 2, 2, ... | a = [1, 2, 3, 4, 5]
list.reverse(a)
print('Ex1: Inverted list is:', a)
a = [1, 1, 2, 2, 2, 2, 3, 3, 3]
b = 2
count = 0
for i in a:
if i == b:
count += 1
print('Ex2: The number of occurences is:', count)
a = 'ana are mere si nu are pere'
res = a.count(' ') + 1
print('Ex3: Number of words in string is:', res) |
def spin(step):
mem = [0]
pos = 0
for i in range(1, 2018):
pos = (pos + step) % i + 1
mem.insert(pos, i)
return mem
my_spin = spin(349)
print("Part 1: {}".format(my_spin[my_spin.index(2017) + 1]))
def spin_2(step):
pos = 0
res = 0
for i in range(1, 50000000):
pos = ... | def spin(step):
mem = [0]
pos = 0
for i in range(1, 2018):
pos = (pos + step) % i + 1
mem.insert(pos, i)
return mem
my_spin = spin(349)
print('Part 1: {}'.format(my_spin[my_spin.index(2017) + 1]))
def spin_2(step):
pos = 0
res = 0
for i in range(1, 50000000):
pos = (... |
#https://leetcode.com/problems/linked-list-cycle-ii/
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def detectCycle(self, head: ListNode) -> ListNode:
#basially you want to see if a pointer is pointing to someth... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def detect_cycle(self, head: ListNode) -> ListNode:
nodes_set = set()
while head:
if head in nodes_set:
return head
nodes_set.add(head)
head... |
"""
Mybuild.
TODO docs. -- Eldar
"""
__author__ = "Eldar Abusalimov"
__copyright__ = "Copyright 2012-2013, The Embox Project"
__license__ = "New BSD"
__version__ = "0.5"
| """
Mybuild.
TODO docs. -- Eldar
"""
__author__ = 'Eldar Abusalimov'
__copyright__ = 'Copyright 2012-2013, The Embox Project'
__license__ = 'New BSD'
__version__ = '0.5' |
DOMAIN = "dyson_cloud"
CONF_REGION = "region"
CONF_AUTH = "auth"
DATA_ACCOUNT = "account"
DATA_DEVICES = "devices"
| domain = 'dyson_cloud'
conf_region = 'region'
conf_auth = 'auth'
data_account = 'account'
data_devices = 'devices' |
class Count:
def countAndSay(self, n: int) -> str:
cou='1'
for i in range(n-1):
j=0
new_count=''
while len(cou)>j:
count=1
while j<len(cou)-1 and cou[j]==cou[j+1]:
count+=1
j+=1
... | class Count:
def count_and_say(self, n: int) -> str:
cou = '1'
for i in range(n - 1):
j = 0
new_count = ''
while len(cou) > j:
count = 1
while j < len(cou) - 1 and cou[j] == cou[j + 1]:
count += 1
... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
# -*- python -*-
load("//tools/workspace:generate_file.bzl", "generate_file")
load("@drake//tools/workspace:github.bzl", "github_archive")
# Using the `drake` branch of this repository.
_REPOSITORY = "RobotLocomotion/pybind11"
_COMMIT = "c39ede1eedd4f39aa167d7b30b53ae45967c39b7"
_SHA256 = "2281eef20037b1d18e7f790a1... | load('//tools/workspace:generate_file.bzl', 'generate_file')
load('@drake//tools/workspace:github.bzl', 'github_archive')
_repository = 'RobotLocomotion/pybind11'
_commit = 'c39ede1eedd4f39aa167d7b30b53ae45967c39b7'
_sha256 = '2281eef20037b1d18e7f790a1c47d64c48aaf5ba4f65c74b2c01453a926b05ab'
def pybind11_repository(na... |
api_url = "https://developer-api.nest.com"
cam_url = "https://www.dropcam.com/api/wwn.get_snapshot/CjZKT2ljN2JJTGxIYzd3emF2S01DRFFtbm5Na2VGZzYwOEJaaUNVcG9oX3RYaHFSdDktY1JDTlESFk01T2dKTVg3cW1CQ0NGX202eEJYYVEaNkc4SElfUUpZbmtFUFlyZmR1M3lJUXV5OFZyUjdVU0QwdWljbWlLUU1rNXRBVW93RzNHWXVfZw?auth=019N06kj4pw8zmue62OkCF8p2yhICbCoq... | api_url = 'https://developer-api.nest.com'
cam_url = 'https://www.dropcam.com/api/wwn.get_snapshot/CjZKT2ljN2JJTGxIYzd3emF2S01DRFFtbm5Na2VGZzYwOEJaaUNVcG9oX3RYaHFSdDktY1JDTlESFk01T2dKTVg3cW1CQ0NGX202eEJYYVEaNkc4SElfUUpZbmtFUFlyZmR1M3lJUXV5OFZyUjdVU0QwdWljbWlLUU1rNXRBVW93RzNHWXVfZw?auth=019N06kj4pw8zmue62OkCF8p2yhICbCoq... |
# Time: O(n)
# Space: O(1)
class Solution(object):
def decodeAtIndex(self, S, K):
"""
:type S: str
:type K: int
:rtype: str
"""
i = 0
for c in S:
if c.isdigit():
i *= int(c)
else:
i += 1
... | class Solution(object):
def decode_at_index(self, S, K):
"""
:type S: str
:type K: int
:rtype: str
"""
i = 0
for c in S:
if c.isdigit():
i *= int(c)
else:
i += 1
for c in reversed(S):
... |
# -*- coding: utf-8 -*-
def similar_str(str1, str2):
"""
return the len of longest string both in str1 and str2
and the positions in str1 and str2
"""
max_len = tmp = pos1 = pos2 = 0
len1, len2 = len(str1), len(str2)
for p in range(len1):
for q in range(len2):
tmp = 0
... | def similar_str(str1, str2):
"""
return the len of longest string both in str1 and str2
and the positions in str1 and str2
"""
max_len = tmp = pos1 = pos2 = 0
(len1, len2) = (len(str1), len(str2))
for p in range(len1):
for q in range(len2):
tmp = 0
while p + t... |
nome = str(input('Qual seu nome completo? '))
print('Tem SILVA no nome?')
print('Silva' in nome)
| nome = str(input('Qual seu nome completo? '))
print('Tem SILVA no nome?')
print('Silva' in nome) |
def solve(n, m, k):
ncard = len(k)
for i1 in range(ncard):
n1 = k[i1]
for i2 in range(ncard):
n2 = k[i2]
for i3 in range(ncard):
n3 = k[i3]
for i4 in range(ncard):
if n1 + n2 + n3 + k[i4] == m:
... | def solve(n, m, k):
ncard = len(k)
for i1 in range(ncard):
n1 = k[i1]
for i2 in range(ncard):
n2 = k[i2]
for i3 in range(ncard):
n3 = k[i3]
for i4 in range(ncard):
if n1 + n2 + n3 + k[i4] == m:
pr... |
def edge_rotate(edge, ccw=False):
pass
def edge_split(edge, vert, fac):
pass
def face_flip(faces):
pass
def face_join(faces, remove=True):
pass
def face_split(face, vert_a, vert_b, coords=(), use_exist=True, example=None):
pass
def face_split_edgenet(face, edgenet):
pass
def face_ver... | def edge_rotate(edge, ccw=False):
pass
def edge_split(edge, vert, fac):
pass
def face_flip(faces):
pass
def face_join(faces, remove=True):
pass
def face_split(face, vert_a, vert_b, coords=(), use_exist=True, example=None):
pass
def face_split_edgenet(face, edgenet):
pass
def face_vert_sepa... |
class ESKException(Exception):
def __init__(self, status_code, message):
self.status = status_code
self.message = message
def __str__(self) -> str:
return f"{ self.status }: { self.message }" | class Eskexception(Exception):
def __init__(self, status_code, message):
self.status = status_code
self.message = message
def __str__(self) -> str:
return f'{self.status}: {self.message}' |
def requests_utils(request):
host = request.get_host()
port = request.get_port()
uri = '{}'.format(host)
real_uri = request.build_absolute_uri()
return {
'host': host,
'port': port,
'secure_uri': 'https://{}'.format(uri),
'insecure_uri': 'http://{}'.format(uri),
... | def requests_utils(request):
host = request.get_host()
port = request.get_port()
uri = '{}'.format(host)
real_uri = request.build_absolute_uri()
return {'host': host, 'port': port, 'secure_uri': 'https://{}'.format(uri), 'insecure_uri': 'http://{}'.format(uri), 'real_uri': real_uri} |
'''
Problem description:
Write a function, which takes a non-negative integer (seconds) as input and returns
the time in a human-readable format (HH:MM:SS)
HH = hours, padded to 2 digits, range: 00 - 99
MM = minutes, padded to 2 digits, range: 00 - 59
SS = seconds, padded to 2 digits, range: 00 - 59
The maximum time... | """
Problem description:
Write a function, which takes a non-negative integer (seconds) as input and returns
the time in a human-readable format (HH:MM:SS)
HH = hours, padded to 2 digits, range: 00 - 99
MM = minutes, padded to 2 digits, range: 00 - 59
SS = seconds, padded to 2 digits, range: 00 - 59
The maximum time... |
class Solution:
def minCost(self, costs):
"""
:type costs: List[List[int]]
:rtype: int
"""
cur = [0] * 3
for next in costs:
cur = [next[i] + min(cur[:i] + cur[i+1:]) for i in range(3)]
return min(cur)
| class Solution:
def min_cost(self, costs):
"""
:type costs: List[List[int]]
:rtype: int
"""
cur = [0] * 3
for next in costs:
cur = [next[i] + min(cur[:i] + cur[i + 1:]) for i in range(3)]
return min(cur) |
# -*- coding: utf-8 -*-
# Fixed for our Hot Dog & Pizza classes
NUM_CLASSES = 2
# Fixed for Hot Dog & Pizza color images
CHANNELS = 3
IMAGE_RESIZE = 224
RESNET50_POOLING_AVERAGE = 'avg'
DENSE_LAYER_ACTIVATION = 'sigmoid'
OBJECTIVE_FUNCTION = 'binary_crossentropy'
# The name of the .h5 file containing the pretrained... | num_classes = 2
channels = 3
image_resize = 224
resnet50_pooling_average = 'avg'
dense_layer_activation = 'sigmoid'
objective_function = 'binary_crossentropy'
weights_file = 'resnet50_weights_notop.h5'
scale = 300 |
# First Missing Positive: https://leetcode.com/problems/first-missing-positive/
# Given an unsorted integer array nums, find the smallest missing positive integer.
# You must implement an algorithm that runs in O(n) time and uses constant extra space.
# The brute force of this is to look through all of nums for each... | class Solution:
def first_missing_positive(self, nums) -> int:
has_one = False
for i in range(len(nums)):
if nums[i] == 1:
has_one = True
if nums[i] <= 0:
nums[i] = 1
if not hasOne:
return 1
if hasOne and len(nums) ... |
# File generated by hadoop record compiler. Do not edit.
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apac... | """
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use... |
"""Gemini2 Exception Inheritance Tree
Gemini2Exception
G2BackendException
G2BackendCommandNotSupportedError
G2BackendFeatureNotSupportedError
G2BackendFeatureNotImplementedYetError
G2BackendCommandError
G2BackendResponseError
G2BackendReadTimeoutError
G2CommandException
G2Command... | """Gemini2 Exception Inheritance Tree
Gemini2Exception
G2BackendException
G2BackendCommandNotSupportedError
G2BackendFeatureNotSupportedError
G2BackendFeatureNotImplementedYetError
G2BackendCommandError
G2BackendResponseError
G2BackendReadTimeoutError
G2CommandException
G2Command... |
n = int(input())
A = list(map(int, input().split()))
abs_sum = 0
minus = 0
abs_list = []
for i in range(n):
if A[i] < 0:
minus += 1
abs_list.append(abs(A[i]))
abs_sum += abs_list[i]
if minus % 2 != 0:
abs_sum -= min(abs_list)*2
print(abs_sum)
| n = int(input())
a = list(map(int, input().split()))
abs_sum = 0
minus = 0
abs_list = []
for i in range(n):
if A[i] < 0:
minus += 1
abs_list.append(abs(A[i]))
abs_sum += abs_list[i]
if minus % 2 != 0:
abs_sum -= min(abs_list) * 2
print(abs_sum) |
def main():
_, array = input(), map(int, input().split())
A, B = (set(map(int, input().split())) for _ in range(2))
print(sum((x in A) - (x in B) for x in array))
if __name__ == '__main__':
main()
| def main():
(_, array) = (input(), map(int, input().split()))
(a, b) = (set(map(int, input().split())) for _ in range(2))
print(sum(((x in A) - (x in B) for x in array)))
if __name__ == '__main__':
main() |
"""Decompose GPS Events."""
class GpsDecomposer(object):
"""GPS Decomposer."""
@classmethod
def decompose(cls, scan_document):
"""Decompose a GPS event.
Args:
scan_document (dict): Geo json from GPS device.
Returns:
list: One two-item tuple in list. Posi... | """Decompose GPS Events."""
class Gpsdecomposer(object):
"""GPS Decomposer."""
@classmethod
def decompose(cls, scan_document):
"""Decompose a GPS event.
Args:
scan_document (dict): Geo json from GPS device.
Returns:
list: One two-item tuple in list. Posit... |
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
if len(strs)==1:
return strs[0]
minlen = min([len(each) for each in strs])
result=""
for i in range(minlen):
basis = strs[-1][i]
for j in range(len(strs)-1):
if ... | class Solution:
def longest_common_prefix(self, strs: List[str]) -> str:
if len(strs) == 1:
return strs[0]
minlen = min([len(each) for each in strs])
result = ''
for i in range(minlen):
basis = strs[-1][i]
for j in range(len(strs) - 1):
... |
"""
PASSENGERS
"""
numPassengers = 4076
passenger_arriving = (
(5, 13, 10, 1, 1, 0, 9, 11, 11, 3, 1, 0), # 0
(3, 15, 9, 4, 1, 0, 9, 15, 6, 4, 2, 0), # 1
(5, 6, 9, 3, 4, 0, 13, 12, 9, 6, 2, 0), # 2
(5, 7, 12, 5, 1, 0, 7, 11, 7, 5, 2, 0), # 3
(3, 7, 5, 5, 4, 0, 8, 7, 7, 3, 1, 0), # 4
(4, 15, 9, 3, 1, 0, 7, ... | """
PASSENGERS
"""
num_passengers = 4076
passenger_arriving = ((5, 13, 10, 1, 1, 0, 9, 11, 11, 3, 1, 0), (3, 15, 9, 4, 1, 0, 9, 15, 6, 4, 2, 0), (5, 6, 9, 3, 4, 0, 13, 12, 9, 6, 2, 0), (5, 7, 12, 5, 1, 0, 7, 11, 7, 5, 2, 0), (3, 7, 5, 5, 4, 0, 8, 7, 7, 3, 1, 0), (4, 15, 9, 3, 1, 0, 7, 8, 5, 4, 0, 0), (6, 13, 7, 4, 0, 0... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 19 07:02:28 2021
@author: bnorthan
"""
def tomarkdown(data, racename, outname ):
markdown='## '+racename+'\n\n'
markdown+=data.to_markdown()
out_file=open(outname, "w")
out_file.write(markdown)
out_file.close()
| """
Created on Tue Jan 19 07:02:28 2021
@author: bnorthan
"""
def tomarkdown(data, racename, outname):
markdown = '## ' + racename + '\n\n'
markdown += data.to_markdown()
out_file = open(outname, 'w')
out_file.write(markdown)
out_file.close() |
def PlusOne(arr:list) -> list:
string = ''
for x in arr:
string = string + str(x)
number = int(string) + 1
new_arr = []
for x in str(number):
new_arr.append(int(x))
return new_arr
arr = [0]
new_arr = PlusOne(arr)
print(new_arr) | def plus_one(arr: list) -> list:
string = ''
for x in arr:
string = string + str(x)
number = int(string) + 1
new_arr = []
for x in str(number):
new_arr.append(int(x))
return new_arr
arr = [0]
new_arr = plus_one(arr)
print(new_arr) |
a = list(map(str,input().split()))
b = []
c = 0
d = []
e = []
while a!= ['-1']:
b.append(a)
a = list(map(str,input().split()))
for i in b:
e += [[i[1],i[2]]]
if i[2] == 'right':
c += int(i[0])
for k in range(65,91):
count = 0
for l in e:
count += l.count(chr(k))
for l in e... | a = list(map(str, input().split()))
b = []
c = 0
d = []
e = []
while a != ['-1']:
b.append(a)
a = list(map(str, input().split()))
for i in b:
e += [[i[1], i[2]]]
if i[2] == 'right':
c += int(i[0])
for k in range(65, 91):
count = 0
for l in e:
count += l.count(chr(k))
for l in... |
#!/usr/bin/env python3
class filterParameter:
def __init__(self):
self.newData = {}
self.arrayParameter = []
def filterKeyValueParameter(self, data):
for key, value in data.items():
if "." not in key and value != '':
self.newData[key] = value
retu... | class Filterparameter:
def __init__(self):
self.newData = {}
self.arrayParameter = []
def filter_key_value_parameter(self, data):
for (key, value) in data.items():
if '.' not in key and value != '':
self.newData[key] = value
return self.newData
... |
class Module:
def __init__(self,name,lessons,course):
self.course = course
self.plataform = self.course.plataform
self.name = name
self.lessons = lessons
| class Module:
def __init__(self, name, lessons, course):
self.course = course
self.plataform = self.course.plataform
self.name = name
self.lessons = lessons |
sexo = str(input("Digite o seu genero [M] ou [F] ")).strip().upper()[0]
while(sexo not in "MmFf"):
sexo = input("Dados invalidos. Digite o seu genero [M] ou [F] ").strip().upper()
print("Sexo Cadastrado com sucesso! Obrigado!")
| sexo = str(input('Digite o seu genero [M] ou [F] ')).strip().upper()[0]
while sexo not in 'MmFf':
sexo = input('Dados invalidos. Digite o seu genero [M] ou [F] ').strip().upper()
print('Sexo Cadastrado com sucesso! Obrigado!') |
numbers = [int(x) for x in list(input())]
def odd_and_even_sum():
even_sum = 0
odd_sum = 0
for current_number in numbers:
if current_number % 2 == 0:
even_sum += current_number
else:
odd_sum += current_number
print(f"Odd sum = {odd_sum}, Even sum = {even_sum}... | numbers = [int(x) for x in list(input())]
def odd_and_even_sum():
even_sum = 0
odd_sum = 0
for current_number in numbers:
if current_number % 2 == 0:
even_sum += current_number
else:
odd_sum += current_number
print(f'Odd sum = {odd_sum}, Even sum = {even_sum}')
o... |
#
# File: recordedfuture_consts.py
#
# Copyright (c) Recorded Future, Inc., 2019-2020
#
# This unpublished material is proprietary to Recorded Future.
# All rights reserved. The methods and
# techniques described herein are considered trade secrets
# and/or confidential. Reproduction or distribution, in whole
# or in p... | version = '2.1.0-rc1'
buildid = '139690'
intelligence_map = {'ip': ('/ip/%s', ['entity', 'risk', 'timestamps', 'threatLists', 'intelCard', 'metrics', 'location', 'relatedEntities'], 'ip', False), 'domain': ('/domain/idn:%s', ['entity', 'risk', 'timestamps', 'threatLists', 'intelCard', 'metrics', 'relatedEntities'], 'do... |
#App.open("Yousician Launcher.app")
#wait("png/home.png", 60)
App.focus("Yousician")
click("png/settings.png")
wait("png/guitar.png")
click("png/guitar.png")
wait("png/challenges.png")
click("png/challenges.png")
wait("png/history.png")
click("png/history.png")
wait(1)
click(Location(700, 400))
wait(1)
print(Region(100... | App.focus('Yousician')
click('png/settings.png')
wait('png/guitar.png')
click('png/guitar.png')
wait('png/challenges.png')
click('png/challenges.png')
wait('png/history.png')
click('png/history.png')
wait(1)
click(location(700, 400))
wait(1)
print(region(100, 100, 1266, 100).text())
print(region(457, 231, 647, 516).tex... |
def sumOfDigits(n):
if n <= 9:
return n
recAns = sumOfDigits(n//10)
return recAns + (n % 10)
print(sumOfDigits(984))
| def sum_of_digits(n):
if n <= 9:
return n
rec_ans = sum_of_digits(n // 10)
return recAns + n % 10
print(sum_of_digits(984)) |
'''
Module containing configuration for ExternalUrl objects.
'''
# dictionary of External URL (key, type)
EXTERNAL_URL_TYPES = {
"BLOG" : "blog",
"REPOSITORY": "repository",
"HOMEPAGE": "homepage",
"REFERENCE": "reference",
... | """
Module containing configuration for ExternalUrl objects.
"""
external_url_types = {'BLOG': 'blog', 'REPOSITORY': 'repository', 'HOMEPAGE': 'homepage', 'REFERENCE': 'reference', 'TRACKER': 'tracker', 'USECASE': 'usecase', 'POLICY': 'policy', 'ROADMAPS': 'roadmaps', 'DOWNLOAD': 'download', 'ADMIN_DOCS': 'admin_docs',... |
def places_per_neighborhood(gfN, gf, neighborhood):
gfNeighborhood = gfN.query('nhood == @neighborhood')
nhood_places = gpd.sjoin(gf, gfNeighborhood, how="inner", op='within')
return(nhood_places)
| def places_per_neighborhood(gfN, gf, neighborhood):
gf_neighborhood = gfN.query('nhood == @neighborhood')
nhood_places = gpd.sjoin(gf, gfNeighborhood, how='inner', op='within')
return nhood_places |
name = input()
age = int(input())
town = input()
salary = float(input())
print(f"Name: {name}\nAge: {age}\nTown: {town}\nSalary: ${salary:.2f}")
age_range = None
if age < 18:
age_range = "teen"
elif age < 70:
age_range = "adult"
else:
age_range = "elder"
print(f"Age range: {age_range}")
salary_range = ... | name = input()
age = int(input())
town = input()
salary = float(input())
print(f'Name: {name}\nAge: {age}\nTown: {town}\nSalary: ${salary:.2f}')
age_range = None
if age < 18:
age_range = 'teen'
elif age < 70:
age_range = 'adult'
else:
age_range = 'elder'
print(f'Age range: {age_range}')
salary_range = None
... |
frogarian = """\
\033[0;34;40m :\033[0;5;33;40m%\033[0;5;34;40mX\033[0;32;40m:\033[0;31;40m.\033[0;32;40m \033[0;34;40m
\033[0;32;40m.\033[0;5;30;40m8\033[0;5;33;40mt \033[0;5;31;40mS\033[0;32;40m.\033[0;34;40m
\033[0;31;40m \033[0;1;30;40m8\033[0;5;35;40m.\033[0;1;30;47m:\03... | frogarian = '\x1b[0;34;40m :\x1b[0;5;33;40m%\x1b[0;5;34;40mX\x1b[0;32;40m:\x1b[0;31;40m.\x1b[0;32;40m \x1b[0;34;40m\n \x1b[0;32;40m.\x1b[0;5;30;40m8\x1b[0;5;33;40mt \x1b[0;5;31;40mS\x1b[0;32;40m.\x1b[0;34;40m\n \x1b[0;31;40m \x1b[0;1;30;40m8\x1b[0;5;35;40m.\x1b[0;1;30;47m:\x1b[0... |
# Declare second integer, double, and String variables.
a=int(input())
b=float(input())
c=input()
# Read and save an integer, double, and String to your variables.
# Print the sum of both integer variables on a new line.
print(i+a)
# Print the sum of the double variables on a new line.
print(b+d)
# Concatenate and pri... | a = int(input())
b = float(input())
c = input()
print(i + a)
print(b + d)
print(s + c) |
OUTGOING_KEY = "5a4d2016bc16dc64883194ffd9"
INCOMING_KEY = "c91d9eec420160730d825604e0"
STATE_LENGTH = 256
class RC4:
def __init__(self, key):
self.key = bytearray.fromhex(key)
self.x = 0
self.y = 0
self.state = [0] * STATE_LENGTH
self.reset()
def process(se... | outgoing_key = '5a4d2016bc16dc64883194ffd9'
incoming_key = 'c91d9eec420160730d825604e0'
state_length = 256
class Rc4:
def __init__(self, key):
self.key = bytearray.fromhex(key)
self.x = 0
self.y = 0
self.state = [0] * STATE_LENGTH
self.reset()
def process(self, data):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.