content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
microcode = '''
def macroop VPADDD_XMM_XMM {
vaddi dest=xmm0, src1=xmm0v, src2=xmm0m, size=4, VL=16
};
def macroop VPADDD_XMM_M {
ldfp128 ufp1, seg, sib, "DISPLACEMENT + 0", dataSize=16
vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=16
};
def macroop VPADDD_XMM_P {
rdip t7
ldfp128 ufp1, seg, r... | microcode = '\ndef macroop VPADDD_XMM_XMM {\n vaddi dest=xmm0, src1=xmm0v, src2=xmm0m, size=4, VL=16\n};\n\ndef macroop VPADDD_XMM_M {\n ldfp128 ufp1, seg, sib, "DISPLACEMENT + 0", dataSize=16\n vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=16\n};\n\ndef macroop VPADDD_XMM_P {\n rdip t7\n ldfp128 uf... |
# -*- coding: utf-8 -*-
'''
@author: Andreas Peldszus
'''
folds = [
['micro_k009', 'micro_b050', 'micro_b055', 'micro_b041', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_d08', 'micro_b033', 'micro_b060', 'micro_b034', 'micro_k003', 'micro_d15', 'micro_d20', 'micro_k012', 'micro_d13', 'micro_b010', 'micro_k029... | """
@author: Andreas Peldszus
"""
folds = [['micro_k009', 'micro_b050', 'micro_b055', 'micro_b041', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_d08', 'micro_b033', 'micro_b060', 'micro_b034', 'micro_k003', 'micro_d15', 'micro_d20', 'micro_k012', 'micro_d13', 'micro_b010', 'micro_k029', 'micro_d14', 'micro_b024', '... |
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
def rules_web_dependencies():
sass_repositories()
| load('@io_bazel_rules_sass//:defs.bzl', 'sass_repositories')
def rules_web_dependencies():
sass_repositories() |
count = 0
inputNum = 1
prevInput = -1
while (inputNum > 0):
inputNum = int(input())
if inputNum == prevInput:
count += 1
prevInput = inputNum
print (f'{count}')
| count = 0
input_num = 1
prev_input = -1
while inputNum > 0:
input_num = int(input())
if inputNum == prevInput:
count += 1
prev_input = inputNum
print(f'{count}') |
def snail(h, a, b):
now_high = 0
d = 0
while now_high < h:
now_high += a
if now_high < h:
now_high -= b
d += 1
print(d)
snail(int(input()), int(input()), int(input()))
| def snail(h, a, b):
now_high = 0
d = 0
while now_high < h:
now_high += a
if now_high < h:
now_high -= b
d += 1
print(d)
snail(int(input()), int(input()), int(input())) |
apiAttachAvailable = u'API tillg\xe4ngligt'
apiAttachNotAvailable = u'Inte tillg\xe4ngligt'
apiAttachPendingAuthorization = u'Godk\xe4nnande avvaktas'
apiAttachRefused = u'Nekades'
apiAttachSuccess = u'Det lyckades'
apiAttachUnknown = u'Ok\xe4nd'
budDeletedFriend = u'Borttagen fr\xe5n kontaktlistan'
budFriend = u'V\xe4... | api_attach_available = u'API tillgängligt'
api_attach_not_available = u'Inte tillgängligt'
api_attach_pending_authorization = u'Godkännande avvaktas'
api_attach_refused = u'Nekades'
api_attach_success = u'Det lyckades'
api_attach_unknown = u'Okänd'
bud_deleted_friend = u'Borttagen från kontaktlistan'
bud_friend = u'Vän... |
class Student:
def __init__(self, name, school):
self.name = name
self.school = school
self.marks = []
def average(self):
return sum(self.marks) / len(self.marks)
@classmethod
def friend(cls, origin, friend_name, *args, **kwargs):
return cls(friend_name, origin... | class Student:
def __init__(self, name, school):
self.name = name
self.school = school
self.marks = []
def average(self):
return sum(self.marks) / len(self.marks)
@classmethod
def friend(cls, origin, friend_name, *args, **kwargs):
return cls(friend_name, origin... |
def round_counter():
RCi = 0
RCi_list = []
# print(type(RCi))
l = 0
for l in range (48):
# print(type(RCi))
RCi = bin(RCi)[2:].zfill(6)
RCi_one_list = [int(d) for d in str((RCi))]
# print(RCi_one_list)
t = 1 + RCi_one_list[0] + RCi_one_list[1]
t = t % ... | def round_counter():
r_ci = 0
r_ci_list = []
l = 0
for l in range(48):
r_ci = bin(RCi)[2:].zfill(6)
r_ci_one_list = [int(d) for d in str(RCi)]
t = 1 + RCi_one_list[0] + RCi_one_list[1]
t = t % 2
RCi_one_list.append(RCi_one_list.pop(0))
RCi_one_list[5] = t
... |
# enter your file path
DATA_PATH = "./lab1/data"
# file names
IN_FILE = "input.txt"
OUT_FILE = "output.txt"
def main():
lines = []
# open input file
with open("{}/{}".format(DATA_PATH, IN_FILE), "r") as file:
# reach each line
for line in file:
# print removing newline
... | data_path = './lab1/data'
in_file = 'input.txt'
out_file = 'output.txt'
def main():
lines = []
with open('{}/{}'.format(DATA_PATH, IN_FILE), 'r') as file:
for line in file:
print(line.strip())
lines.append(line)
lines = lines[-1::-1]
with open('{}/{}'.format(DATA_PATH, O... |
#!/usr/bin/python
# Copyright 2017 Hewlett-Packard Enterprise Development Company, L.P.
# 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.... | def integer(value):
return value
def object_name(value):
return (value,)
phy_drive_mib_output = {'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.0': {'cpqDaPhyDrvCntlrIndex': {object_name('2.0'): integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.1': {'cpqDaPhyDrvCntlrIndex': {object_name('2.1'): integer(2)}}... |
# Simple account class with balance
class Account:
def __init__(self, name, balance):
self.name = name
self.balance = balance
print("Account is created for {}".format(self.name))
def deposit(self, amount):
if amount > 0:
self.balance += amount
def withdr... | class Account:
def __init__(self, name, balance):
self.name = name
self.balance = balance
print('Account is created for {}'.format(self.name))
def deposit(self, amount):
if amount > 0:
self.balance += amount
def withdraw(self, amount):
if 0 < amount < s... |
def isPrime(number):
prime = True
global code
for c in range(2, number):
if number % c == 0:
prime = False
if prime is True and len(str(number)) == 3:
code = number
code = counter = 0
while True:
isPrime(counter)
if counter == 1000:
break
counter += 1
pr... | def is_prime(number):
prime = True
global code
for c in range(2, number):
if number % c == 0:
prime = False
if prime is True and len(str(number)) == 3:
code = number
code = counter = 0
while True:
is_prime(counter)
if counter == 1000:
break
counter += 1
pr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'ole'
class Message:
irc = None
propagate = True
# IRC-protocol attributes
prefix = ""
command = []
content = ""
# IRC-command dependent attributes
cmd = [] # bot-command within message
nick = ""
channel = None
de... | __author__ = 'ole'
class Message:
irc = None
propagate = True
prefix = ''
command = []
content = ''
cmd = []
nick = ''
channel = None
def __init__(self, irc, message):
self.irc = irc
prefix_end = 0
if len(message) > 0 and message[0] == ':':
prefi... |
# Done by Carlos Amaral (2020/09/22)
# SCU 4.7 - Range Function with a For Loop
for i in range(1,10):
print(i, " squared is ", i**2)
| for i in range(1, 10):
print(i, ' squared is ', i ** 2) |
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
INSTALLED_APPS = [
'tests.testapp',
]
ROOT_URLCONF = 'tests.urls'
| debug = True
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
installed_apps = ['tests.testapp']
root_urlconf = 'tests.urls' |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "nebula"
class BeFilteredException(Exception):
def __init__(self, t):
self._t = t
@property
def type(self):
return self._t
| __author__ = 'nebula'
class Befilteredexception(Exception):
def __init__(self, t):
self._t = t
@property
def type(self):
return self._t |
def gcd_iter(u, v):
while v:
u, v = v, u % v
return abs(u)
| def gcd_iter(u, v):
while v:
(u, v) = (v, u % v)
return abs(u) |
# Silvio Dunst
# Variables can be of type function, and we can call those variables.
# This means that lists, tuples and dicts can have variables of type function in them,
# so we could have a dict that stores the letter of the menu and the function associated with that letter.
# We could access that function by that... | def fun1():
print('this is fun1')
def fun2():
print('this is fun2')
which_fun = fun1
which_fun()
which_fun = fun2
which_fun() |
def isInterleave(s1: str, s2: str, s3: str) -> bool:
def dfs(i, j, k): # dfs with memo
if i == len(s1):
return s2[j:] == s3[k:]
if j == len(s2):
return s1[i:] == s3[k:]
if (i, j) in memo:
return memo[(i, j)]
res = F... | def is_interleave(s1: str, s2: str, s3: str) -> bool:
def dfs(i, j, k):
if i == len(s1):
return s2[j:] == s3[k:]
if j == len(s2):
return s1[i:] == s3[k:]
if (i, j) in memo:
return memo[i, j]
res = False
if s1[i] == s3[k] and dfs(i + 1, j, ... |
with open("inputs/6.txt") as f:
input = f.read()
groups = [group.split() for group in input.split('\n\n')]
total_answers = 0
for group in groups:
total_answers += len(set(''.join(group)))
print("Part 1 answer:", total_answers)
total_answers = 0
for group in groups:
sets = list(map(set, group))
total... | with open('inputs/6.txt') as f:
input = f.read()
groups = [group.split() for group in input.split('\n\n')]
total_answers = 0
for group in groups:
total_answers += len(set(''.join(group)))
print('Part 1 answer:', total_answers)
total_answers = 0
for group in groups:
sets = list(map(set, group))
total_ans... |
#disorder
def distinct_list(a):
return list(set(a))
| def distinct_list(a):
return list(set(a)) |
f = open('in_domain_dev.tsv', 'r').readlines()
g1 = open('val.src', 'w')
g2 = open('val.tgt', 'w')
for line in f:
line = line.split('\t')
_, label, _, text = line
g1.write('{}'.format(text))
g2.write('{}\n'.format(label))
| f = open('in_domain_dev.tsv', 'r').readlines()
g1 = open('val.src', 'w')
g2 = open('val.tgt', 'w')
for line in f:
line = line.split('\t')
(_, label, _, text) = line
g1.write('{}'.format(text))
g2.write('{}\n'.format(label)) |
matriz = [[0,0,0],[0,0,0],[0,0,0]]
for l in range(0,3):
for c in range(0,3):
matriz[l][c] = int(input(f'Digite os valores para [{l}, {c}]: '))
print('=-='*30)
for l in range(0,3):
for c in range(0,3):
print(f'[{matriz[l][c]: ^5}', end = '')
print() | matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for l in range(0, 3):
for c in range(0, 3):
matriz[l][c] = int(input(f'Digite os valores para [{l}, {c}]: '))
print('=-=' * 30)
for l in range(0, 3):
for c in range(0, 3):
print(f'[{matriz[l][c]: ^5}', end='')
print() |
def node_to_string(node, layer = 0):
message = '|' * layer + repr(node) + '\n'
for child in node.children:
message += node_to_string(child, layer + 1)
return message
| def node_to_string(node, layer=0):
message = '|' * layer + repr(node) + '\n'
for child in node.children:
message += node_to_string(child, layer + 1)
return message |
config = {
"host_server": "<host_address>",
'token_request':{
'client_id': '<client_id>',
'client_secret': '<client_secret>',
'Ocp-Apim-Subscription-Key': '<Ocp-Apim-Subscription-Key> For Access Token',
},
'ecom':{
'Content-Type': 'application/json',
'Ocp... | config = {'host_server': '<host_address>', 'token_request': {'client_id': '<client_id>', 'client_secret': '<client_secret>', 'Ocp-Apim-Subscription-Key': '<Ocp-Apim-Subscription-Key> For Access Token'}, 'ecom': {'Content-Type': 'application/json', 'Ocp-Apim-Subscription-Key': '<Ocp-Apim-Subscription-Key> For the eComme... |
def calc(n):
if n<12:
return n
if dp[n]:
return dp[n]
x=calc(n//2)+calc(n//3)+calc(n//4)
dp[n]=max(n,x)
return dp[n]
dp=[0 for i in range(1000000)]
n=int(input())
print(calc(n))
#==============================
def decode(s):
for i in range(2,len(s)+1):
prev=... | def calc(n):
if n < 12:
return n
if dp[n]:
return dp[n]
x = calc(n // 2) + calc(n // 3) + calc(n // 4)
dp[n] = max(n, x)
return dp[n]
dp = [0 for i in range(1000000)]
n = int(input())
print(calc(n))
def decode(s):
for i in range(2, len(s) + 1):
prev = int(s[i - 2])
... |
'''For a range of numbers starting at 2, determine whether the number is 'perfect', 'abundant' or 'deficient',
'''
topNum = input("What is the upper number for the range:")
topNum = int(topNum)
theNum=2
while theNum <= topNum:
# sum up the divisors
divisor = 1
sumOfDivisors = 0
while divisor < theNum:... | """For a range of numbers starting at 2, determine whether the number is 'perfect', 'abundant' or 'deficient',
"""
top_num = input('What is the upper number for the range:')
top_num = int(topNum)
the_num = 2
while theNum <= topNum:
divisor = 1
sum_of_divisors = 0
while divisor < theNum:
if theNum %... |
def div(n1,n2):
d = n1 // n2
r = n1 - n2 * d
print(r)
while True:
try:
num1 = float(input("Please enter the first number:"))
num2 = float(input("Please enter the second number:"))
except ValueError:
print("Please enter the number correctly.")
else:
div(num1,num2)
... | def div(n1, n2):
d = n1 // n2
r = n1 - n2 * d
print(r)
while True:
try:
num1 = float(input('Please enter the first number:'))
num2 = float(input('Please enter the second number:'))
except ValueError:
print('Please enter the number correctly.')
else:
div(num1, num2... |
#!/usr/bin/env python
# coding=utf-8
def concat(*args, sep = "/"):
return sep.join(args)
concat("earth","mars","venus")
concat("earth","mars","venus", sep=".")
| def concat(*args, sep='/'):
return sep.join(args)
concat('earth', 'mars', 'venus')
concat('earth', 'mars', 'venus', sep='.') |
class Television:
def __init__(self):
self.ligada = False
self.canal = 4
def power(self):
if self.ligada:
self.ligada = False
else:
self.ligada = True
def canal_up(self):
if self.ligada:
self.canal += 1
def canal_down(self):
... | class Television:
def __init__(self):
self.ligada = False
self.canal = 4
def power(self):
if self.ligada:
self.ligada = False
else:
self.ligada = True
def canal_up(self):
if self.ligada:
self.canal += 1
def canal_down(self):... |
# Use words.txt as the file name
fname = input("Enter file name: ")
fh = open(fname)
for inp in fname:
print(inp.isUpper())
print('hello im the impostor, changes made by satyam raj')
print('ima a hacker, coz im doing this bullshit for hacktoberfest')
| fname = input('Enter file name: ')
fh = open(fname)
for inp in fname:
print(inp.isUpper())
print('hello im the impostor, changes made by satyam raj')
print('ima a hacker, coz im doing this bullshit for hacktoberfest') |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def dfs(self, node: TreeNode, sum: int) -> int:
res = 1 if node.val == sum else 0
if node.le... | class Solution:
def dfs(self, node: TreeNode, sum: int) -> int:
res = 1 if node.val == sum else 0
if node.left:
res += self.dfs(node.left, sum - node.val)
if node.right:
res += self.dfs(node.right, sum - node.val)
return res
def path_sum(self, root: Tree... |
def sssi(M, s):
L = []
for i in M[::-1]:
if s >= i:
s -= i
L.append(1)
else:
L.append(0)
if s == 0:
return L[::-1]
print("!!!!!")
| def sssi(M, s):
l = []
for i in M[::-1]:
if s >= i:
s -= i
L.append(1)
else:
L.append(0)
if s == 0:
return L[::-1]
print('!!!!!') |
__title__ = 'consign'
__description__ = 'Python storage for humans.'
__url__ = 'https://requests.readthedocs.io'
__version__ = '0.2.2'
__author__ = 'Daniel Jadraque'
__author_email__ = 'jadraque@hey.com'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2021 Daniel Jadraque' | __title__ = 'consign'
__description__ = 'Python storage for humans.'
__url__ = 'https://requests.readthedocs.io'
__version__ = '0.2.2'
__author__ = 'Daniel Jadraque'
__author_email__ = 'jadraque@hey.com'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2021 Daniel Jadraque' |
nome = input("Digite seu nome: ")
nome = nome.strip().title()
print("No seu nome tem silva? {}".format("Silva" in nome))
print("O seu nome: {}".format(nome))
| nome = input('Digite seu nome: ')
nome = nome.strip().title()
print('No seu nome tem silva? {}'.format('Silva' in nome))
print('O seu nome: {}'.format(nome)) |
class Employee:
numEmployee = 0
def __init__(self, name, rate):
self.owed = 0
self.name = name
self.rate = rate
Employee.numEmployee += 1
def __repr__(self):
return "a custom object (%r)" % self.name
def __del__(self):
Employee.numEmployee -= 1
def... | class Employee:
num_employee = 0
def __init__(self, name, rate):
self.owed = 0
self.name = name
self.rate = rate
Employee.numEmployee += 1
def __repr__(self):
return 'a custom object (%r)' % self.name
def __del__(self):
Employee.numEmployee -= 1
de... |
def get_unique_iterable_objects_in_order(iterable):
unique_objects_in_order = []
for object_ in iterable:
if object_ not in unique_objects_in_order:
unique_objects_in_order.append(object_)
return unique_objects_in_order
| def get_unique_iterable_objects_in_order(iterable):
unique_objects_in_order = []
for object_ in iterable:
if object_ not in unique_objects_in_order:
unique_objects_in_order.append(object_)
return unique_objects_in_order |
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['D:\\temp\\main.py'],
pathex=['D:\\temp'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
... | block_cipher = None
a = analysis(['D:\\temp\\main.py'], pathex=['D:\\temp'], binaries=[], datas=[], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False)
pyz = pyz(a.pure, a.zipped_data, cipher=block_cipher)
exe ... |
RAWDATA_DIR = '/staging/as/skchoudh/rna-seq-datasets/single/ornithorhynchus_anatinus/SRP007412'
OUT_DIR = '/staging/as/skchoudh/rna-seq-output/ornithorhynchus_anatinus/SRP007412'
CDNA_FA_GZ = '/home/cmb-panasas2/skchoudh/genomes/ornithorhynchus_anatinus/cdna/Ornithorhynchus_anatinus.OANA5.cdna.all.fa.gz'
CDNA_IDX ... | rawdata_dir = '/staging/as/skchoudh/rna-seq-datasets/single/ornithorhynchus_anatinus/SRP007412'
out_dir = '/staging/as/skchoudh/rna-seq-output/ornithorhynchus_anatinus/SRP007412'
cdna_fa_gz = '/home/cmb-panasas2/skchoudh/genomes/ornithorhynchus_anatinus/cdna/Ornithorhynchus_anatinus.OANA5.cdna.all.fa.gz'
cdna_idx = '/h... |
def say_hello(name):
print("Hello,", name)
user_name = input("What is your name? ")
say_hello(user_name)
| def say_hello(name):
print('Hello,', name)
user_name = input('What is your name? ')
say_hello(user_name) |
#xsv Libraries / dictionaries / variables or
# WHATEVER YOU FUCKING CALL THEM!
exampleVars = [
{
'Name': 'xH',
'Info': {
'Staff': ['Council'],
'Dev': ['Im Dynamic'],
'Office': ['Couch'],
'Role... | example_vars = [{'Name': 'xH', 'Info': {'Staff': ['Council'], 'Dev': ['Im Dynamic'], 'Office': ['Couch'], 'Role': []}}, {'Name': 'xsv', 'Info': {'Staff': ['Im Dynamic'], 'Dev': ['@Blynd'], 'Office': [], 'Role': ['Development Team']}}] |
BATCH_SIZE = 128
EPOCHS = 120
LR = 0.001
NGRAM = 10
NUM_CLASS = 20
EMBEDDING_DIM = 100
CUDA = True
DEVICE = 3
DEBUG = False
# FILENAME = '../bsnn/data/tor_erase_tls2.traffic'
FILENAME = '../bsnn/data/20_header_payload_all.traffic'
# LABELS ={'facebook': 0, 'yahoomail': 1, 'Youtube': 2, 'itunes': 3, 'mysql': 4, 'fi... | batch_size = 128
epochs = 120
lr = 0.001
ngram = 10
num_class = 20
embedding_dim = 100
cuda = True
device = 3
debug = False
filename = '../bsnn/data/20_header_payload_all.traffic'
labels = {'reddit': 0, 'facebook': 1, 'NeteaseMusic': 2, 'twitter': 3, 'qqmail': 4, 'instagram': 5, 'weibo': 6, 'iqiyi': 7, 'imdb': 8, 'TED'... |
def inputGrades(nm):
grades = []
for i in range(0,nm,1):
grade = float(input('Enter your Grade: '))
grades.append(grade)
return grades
def printGrades(nm,x):
for i in range(0,nm,1):
print(x[i])
def avgGrades(nm,x):
Sum = 0
for i in range(0,nm,1):
Sum = Sum + x[i... | def input_grades(nm):
grades = []
for i in range(0, nm, 1):
grade = float(input('Enter your Grade: '))
grades.append(grade)
return grades
def print_grades(nm, x):
for i in range(0, nm, 1):
print(x[i])
def avg_grades(nm, x):
sum = 0
for i in range(0, nm, 1):
sum ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by Ross on 2019/8/21
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
dp = [0] * len(nums)
if len(nums) == 0:
return 0
dp[0] = 1
for i in range(1, len(nums)):
maxval = 0
for j in ... | class Solution:
def length_of_lis(self, nums: List[int]) -> int:
dp = [0] * len(nums)
if len(nums) == 0:
return 0
dp[0] = 1
for i in range(1, len(nums)):
maxval = 0
for j in range(0, i):
if nums[j] < nums[i]:
ma... |
class TransformationTypeEnum():
__DOUBLE_SIGMOID = "double_sigmoid"
__SIGMOID = "sigmoid"
__REVERSE_SIGMOID = "reverse_sigmoid"
__RIGHT_STEP = "right_step"
__LEFT_STEP = "left_step"
__STEP = "step"
__CUSTOM_INTERPOLATION = "custom_interpolation"
__NO_TRANSFORMATION = "no_transformation"... | class Transformationtypeenum:
__double_sigmoid = 'double_sigmoid'
__sigmoid = 'sigmoid'
__reverse_sigmoid = 'reverse_sigmoid'
__right_step = 'right_step'
__left_step = 'left_step'
__step = 'step'
__custom_interpolation = 'custom_interpolation'
__no_transformation = 'no_transformation'
... |
a = True # Creates a variable set to true
while a: # While this variable is true, loop. Used to handle for 2+ word inputs
inp = input('Enter ONE word: ') # Takes the users input
test = inp.split() # Makes the users input a list of each word, to check how many words are there
if len(test) == 1: # If thi... | a = True
while a:
inp = input('Enter ONE word: ')
test = inp.split()
if len(test) == 1:
a = False
print(inp[::-1])
else:
print('Your input was either 2 words, or nothing at all. Please try again :)') |
def main(request, response):
type = request.GET.first("type", None)
is_revalidation = request.headers.get("If-Modified-Since", None)
content = "/* nothing to see here */"
response.add_required_headers = False
if is_revalidation is not None:
response.writer.write_status(304)
response.wr... | def main(request, response):
type = request.GET.first('type', None)
is_revalidation = request.headers.get('If-Modified-Since', None)
content = '/* nothing to see here */'
response.add_required_headers = False
if is_revalidation is not None:
response.writer.write_status(304)
response.... |
def calcula_soma(A: int, B: int):
if (not isinstance(A, int) or not isinstance(B, int)):
raise TypeError
return f'SOMA = {A + B}'
| def calcula_soma(A: int, B: int):
if not isinstance(A, int) or not isinstance(B, int):
raise TypeError
return f'SOMA = {A + B}' |
# Flask config reference: http://flask.pocoo.org/docs/1.0/config/
# Flask-Sqlalchemy config reference: http://flask-sqlalchemy.pocoo.org/2.3/config/
POSTGRES_ENV_VARS_DEV = {
'user': 'postgres',
'pwd': '1qaz2wsx',
'host': 'jblin',
'port': '5432',
'db': 'postgres',
}
POSTGRES_ENV_VARS_PRD = {
#... | postgres_env_vars_dev = {'user': 'postgres', 'pwd': '1qaz2wsx', 'host': 'jblin', 'port': '5432', 'db': 'postgres'}
postgres_env_vars_prd = {}
class Baseconfig(object):
debug = False
testing = False
secret_key = '12qwaszx'
jsonify_mimetype = 'application/json'
sqlalchemy_database_uri = 'postgresql:/... |
def sort_address_results(addresses, postcode):
'''
# Not to be used. Address Index API should sort for us.
If required address object should include the following fields:
paoStartNumber = address['nag']['pao']['paoStartNumber']
saoStartNumber = address['nag']['sao']['saoStartNumber']
street_num... | def sort_address_results(addresses, postcode):
"""
# Not to be used. Address Index API should sort for us.
If required address object should include the following fields:
paoStartNumber = address['nag']['pao']['paoStartNumber']
saoStartNumber = address['nag']['sao']['saoStartNumber']
street_num... |
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/851/A
n,k,t = list(map(int,input().split()))
print(min(t,n+k-t,k))
| (n, k, t) = list(map(int, input().split()))
print(min(t, n + k - t, k)) |
# Ch02-FlowControl-while_break_continue_statements.py
# This is an example for while, break, continue statements.
#
# https://automatetheboringstuff.com/chapter2/
# Flow Control Statements: Lesson 6 - while Loops, break, and continue
#
# I changed the original code slightly.
count = 0
while True:
print('What is y... | count = 0
while True:
print('What is your name?')
name = input()
if name != 'Joe':
if count > 2:
print('Hint: The name should be Joe.')
count = count + 1
continue
print('Hi, Joe. What is the password?')
password = input()
if password == 'swordfish':
br... |
#!/bin/python3
# Complete the solve function below.
def solve(s):
words = s.split(' ')
for i in range(len(words)):
words[i] = words[i].capitalize()
return ' '.join(words)
if __name__ == '__main__':
s = input()
result = solve(s)
print(result)
| def solve(s):
words = s.split(' ')
for i in range(len(words)):
words[i] = words[i].capitalize()
return ' '.join(words)
if __name__ == '__main__':
s = input()
result = solve(s)
print(result) |
# Assignment 6
# Author: Jignesh Chaudhary, Student Id: 197320
# a) Heapsort: Implement the heapsort algorithm from your textbook (Algorithm 7.5) but modify it so it ends after finding z largest keys
# in non-increasing order. You can hardcode the keys to be integer type. Implement test program to provide unsorted i... | class Heap:
"""This class take array as a input and find z number of largest key in non-increasing order
class has method call siftdown, makeheap, removekey and display"""
def __init__(self, array, z):
"""Constructur which create unsorted array from input and take int z to find z number of largest ... |
def main(str1, str2):
m = len(str1)
n = len(str2)
j = 0
i = 0
while j < m and i < n:
if str1[j] == str2[i]:
j = j+1
i = i + 1
return j == m
str2 = str(input())
N = int(input())
for i in range(N):
str1 = str(input())
if main(str1, str2):
print("... | def main(str1, str2):
m = len(str1)
n = len(str2)
j = 0
i = 0
while j < m and i < n:
if str1[j] == str2[i]:
j = j + 1
i = i + 1
return j == m
str2 = str(input())
n = int(input())
for i in range(N):
str1 = str(input())
if main(str1, str2):
print('POSITI... |
def process_blok(x0_x1_y0_y1_z0_z1_):
x0_, x1_, y0_, y1_, z0_, z1_ = x0_x1_y0_y1_z0_z1_
print('Setting number of threads in process_blok to %d.\n' %nthread)
os.environ['MKL_NUM_THREADS'] = str(nthread)
# load and dilate initial voxel peak positions
voxl_peaklidx_blok = np.zeros_like(bimag... | def process_blok(x0_x1_y0_y1_z0_z1_):
(x0_, x1_, y0_, y1_, z0_, z1_) = x0_x1_y0_y1_z0_z1_
print('Setting number of threads in process_blok to %d.\n' % nthread)
os.environ['MKL_NUM_THREADS'] = str(nthread)
voxl_peaklidx_blok = np.zeros_like(bimage_peak_fine.value)
voxl_peaklidx_blok[x0_:x1_, y0_:y1_,... |
add_library('video')
c=None
w=640.0
h=480.0
darkmode=False
def setup():
global c,cx,cy
size(640,480)
background(0 if darkmode else 255)
stroke(23,202,230)
imageMode(CENTER)
c=Capture(this,640,480)
c.start();
def genart():
line(dx,cy-h/2,dx,cy+h/2)
def draw():
cx=width/2
cy=he... | add_library('video')
c = None
w = 640.0
h = 480.0
darkmode = False
def setup():
global c, cx, cy
size(640, 480)
background(0 if darkmode else 255)
stroke(23, 202, 230)
image_mode(CENTER)
c = capture(this, 640, 480)
c.start()
def genart():
line(dx, cy - h / 2, dx, cy + h / 2)
def draw(... |
#
# PySNMP MIB module CLNS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CLNS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:25:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
VERSION = (0, 2, 2, '', 1)
if VERSION[3] and VERSION[4]:
VERSION_TEXT = '{0}.{1}.{2}{3}{4}'.format(*VERSION)
else:
VERSION_TEXT = '{0}.{1}.{2}'.format(*VERSION[0:3])
VERSION_EXTRA = ''
LICENSE = 'MIT License'
| version = (0, 2, 2, '', 1)
if VERSION[3] and VERSION[4]:
version_text = '{0}.{1}.{2}{3}{4}'.format(*VERSION)
else:
version_text = '{0}.{1}.{2}'.format(*VERSION[0:3])
version_extra = ''
license = 'MIT License' |
#NOTE: LIST - Secuence of mutable values
names = ["Harry", "Hik", "Linkin", "Park"]
#ADDS ANOTHER ITEM IN THE LIST
names.append("Paramore")
#SORT THE LIST IN APLHABETIC ORDER
names.sort()
#PRINTS THE LIST
print(names) | names = ['Harry', 'Hik', 'Linkin', 'Park']
names.append('Paramore')
names.sort()
print(names) |
__author__ = "Ian Goodfellow"
class Agent(object):
pass
| __author__ = 'Ian Goodfellow'
class Agent(object):
pass |
c = 41 # THE VARIABLE C equals 41
c == 40 # c eqauls 40 which is false becasue of the variable above
c != 40 and c <41 #c does not equal 40 is a true statement but the other statement is false, making it a false statement
c != 40 or c <41 #True statement in an or statement
not c == 40 #this is a true statement
not c > ... | c = 41
c == 40
c != 40 and c < 41
c != 40 or c < 41
not c == 40
not c > 40
c <= 41
not false
True and false
false or True
false or false or false
True and True and false
false == 0
True == 0
True == 1 |
dna = 'ACGTN'
rna = 'ACGUN'
# dictionary nucleotide acronym to full name
nuc2name = {
'A': 'Adenosine',
'C': 'Cysteine',
'T': 'Thymine',
'G': 'Guanine',
'U': 'Uracil',
'N': 'Unknown'
} | dna = 'ACGTN'
rna = 'ACGUN'
nuc2name = {'A': 'Adenosine', 'C': 'Cysteine', 'T': 'Thymine', 'G': 'Guanine', 'U': 'Uracil', 'N': 'Unknown'} |
print("Checking Imports")
import_list = ['signal', 'psutil', 'time', 'pypresence', 'random']
modules = {}
for package in import_list:
try:
modules[package] = __import__(package)
except ImportError:
print(f"Package: {package} is missing please install")
print("Loading CONFIG\n")
# # # # # # # # ... | print('Checking Imports')
import_list = ['signal', 'psutil', 'time', 'pypresence', 'random']
modules = {}
for package in import_list:
try:
modules[package] = __import__(package)
except ImportError:
print(f'Package: {package} is missing please install')
print('Loading CONFIG\n')
client_id = '8089... |
# A linked list node
class Node:
def __init__(self, value=None, next=None):
self.value = value
self.next = next
# Helper function to print given linked list
def printList(head):
ptr = head
while ptr:
print(ptr.value, end=" -> ")
ptr = ptr.next
print("None")
# Function to remove duplicates from a sorted... | class Node:
def __init__(self, value=None, next=None):
self.value = value
self.next = next
def print_list(head):
ptr = head
while ptr:
print(ptr.value, end=' -> ')
ptr = ptr.next
print('None')
def remove_duplicates(head):
previous = None
current = head
s = ... |
#!/usr/bin/env python3
# https://www.urionlinejudge.com.br/judge/en/problems/view/1014
def main():
X = int(input())
Y = float(input())
CONSUMPTION = X / Y
print(format(CONSUMPTION, '.3f'), "km/l")
# Start the execution if it's the main script
if __name__ == "__main__":
main()
| def main():
x = int(input())
y = float(input())
consumption = X / Y
print(format(CONSUMPTION, '.3f'), 'km/l')
if __name__ == '__main__':
main() |
'''
Data Columns - Exercise 1
The file reads the file with neuron lengths (neuron_data.txt)
and saves an identical copy of the file.
'''
Infile = open('neuron_data.txt')
Outfile = open('neuron_data-copy.txt', 'w')
for line in Infile:
Outfile.write(line)
Outfile.close()
| """
Data Columns - Exercise 1
The file reads the file with neuron lengths (neuron_data.txt)
and saves an identical copy of the file.
"""
infile = open('neuron_data.txt')
outfile = open('neuron_data-copy.txt', 'w')
for line in Infile:
Outfile.write(line)
Outfile.close() |
class Video:
def __init__(self, files):
self.files = files
def setFiles(self, files):
self.files = files
def getFiles(self):
return self.files | class Video:
def __init__(self, files):
self.files = files
def set_files(self, files):
self.files = files
def get_files(self):
return self.files |
class JsonUtil:
@staticmethod
def list_obj_dict(list):
new_list = []
for obj in list:
new_list.append(obj.__dict__)
return new_list
| class Jsonutil:
@staticmethod
def list_obj_dict(list):
new_list = []
for obj in list:
new_list.append(obj.__dict__)
return new_list |
# 1
x = float(input("First number: "))
y = float(input("Second number: "))
if x > y:
print(f"{x} is greater than {y}")
elif x < y:
print(f"{x} is less than {y}")
else:
print(f"{x} is equal to {y}")
# bb
quiz = float(input("quiz: "))
mid_term = float(input("midterm: "))
final = float(input("final: "))
avg ... | x = float(input('First number: '))
y = float(input('Second number: '))
if x > y:
print(f'{x} is greater than {y}')
elif x < y:
print(f'{x} is less than {y}')
else:
print(f'{x} is equal to {y}')
quiz = float(input('quiz: '))
mid_term = float(input('midterm: '))
final = float(input('final: '))
avg = (quiz + m... |
x = {}
print(type(x))
file_counts = {"jpg":10, "txt":14, "csv":2, "py":23}
print(file_counts)
print(file_counts["txt"])
print("html" in file_counts) #true if found
#dictionaries are mutable
file_counts["cfg"] = 8 #add item
print(file_counts)
file_counts["csv"] = 17 #replaces value for already assigned csv
print... | x = {}
print(type(x))
file_counts = {'jpg': 10, 'txt': 14, 'csv': 2, 'py': 23}
print(file_counts)
print(file_counts['txt'])
print('html' in file_counts)
file_counts['cfg'] = 8
print(file_counts)
file_counts['csv'] = 17
print(file_counts)
del file_counts['cfg']
print(file_counts)
file_counts = {'jpg': 10, 'txt': 14, 'cs... |
# Tweepy
# Copyright 2010-2021 Joshua Roesslein
# See LICENSE for details.
def list_to_csv(item_list):
if item_list:
return ','.join(map(str, item_list))
| def list_to_csv(item_list):
if item_list:
return ','.join(map(str, item_list)) |
'''
Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.
If target is not found in the array, return [-1, -1].
You must write an algorithm with O(log n) runtime complexity
'''
class Solution:
def searchRange(self, nums: List[int], target... | """
Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.
If target is not found in the array, return [-1, -1].
You must write an algorithm with O(log n) runtime complexity
"""
class Solution:
def search_range(self, nums: List[int], targe... |
_base_ = [
'../_base_/models/resnet50.py', '../_base_/datasets/imagenet_bs32.py',
'../_base_/schedules/imagenet_bs256.py', '../_base_/default_runtime.py'
]
load_from = "https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth" | _base_ = ['../_base_/models/resnet50.py', '../_base_/datasets/imagenet_bs32.py', '../_base_/schedules/imagenet_bs256.py', '../_base_/default_runtime.py']
load_from = 'https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth' |
x = int(input("Please enter a number: "))
if x % 2 == 0 :
print(x, "is even")
else :
print(x, "is odd")
| x = int(input('Please enter a number: '))
if x % 2 == 0:
print(x, 'is even')
else:
print(x, 'is odd') |
class Memoization:
allow_attr_memoization = False
def _set_attr(obj, attr_name, value_func):
setattr(obj, attr_name, value_func())
return getattr(obj, attr_name)
def _memoize_attr(obj, attr_name, value_func):
if not Memoization.allow_attr_memoization:
return value_func()
try:
return getattr(obj, a... | class Memoization:
allow_attr_memoization = False
def _set_attr(obj, attr_name, value_func):
setattr(obj, attr_name, value_func())
return getattr(obj, attr_name)
def _memoize_attr(obj, attr_name, value_func):
if not Memoization.allow_attr_memoization:
return value_func()
try:
retur... |
class BotConfiguration(object):
def __init__(self, auth_token, name, avatar):
self._auth_token = auth_token
self._name = name
self._avatar = avatar
@property
def name(self):
return self._name
@property
def avatar(self):
return self._avatar
@property
def auth_token(self):
return self._auth_token
| class Botconfiguration(object):
def __init__(self, auth_token, name, avatar):
self._auth_token = auth_token
self._name = name
self._avatar = avatar
@property
def name(self):
return self._name
@property
def avatar(self):
return self._avatar
@property
... |
#author SANKALP SAXENA
# Complete the has_cycle function below.
#
# For your reference:
#
# SinglyLinkedListNode:
# int data
# SinglyLinkedListNode next
#
#
def has_cycle(head):
s = set()
temp = head
while True:
if temp.next == None:
return False
if temp.next not i... | def has_cycle(head):
s = set()
temp = head
while True:
if temp.next == None:
return False
if temp.next not in s:
s.add(temp.next)
else:
return True
temp = temp.next
return False |
{
'targets': [
{
'target_name': 'test_new_target',
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
'sources': [
'../entry_point.c',
'test_new_target.c'
]
}
]
}
| {'targets': [{'target_name': 'test_new_target', 'defines': ['V8_DEPRECATION_WARNINGS=1'], 'sources': ['../entry_point.c', 'test_new_target.c']}]} |
usa = ['atlanta','new york','chicago','baltimore']
uk = ['london','bristol','cambridge']
india = ['mumbai','delhi','banglore']
'''
#(a)
i=input("Enter city name: ")
if i in usa:
print('city is in USA')
elif i in uk:
print('city is in UK')
elif i in india:
print('city is in INDIA')
else:
print('idk the ... | usa = ['atlanta', 'new york', 'chicago', 'baltimore']
uk = ['london', 'bristol', 'cambridge']
india = ['mumbai', 'delhi', 'banglore']
'\n#(a)\ni=input("Enter city name: ")\nif i in usa:\n print(\'city is in USA\')\nelif i in uk:\n print(\'city is in UK\')\nelif i in india:\n print(\'city is in INDIA\')\nelse:\... |
#Base Class, Uses a descriptor to set a value
class Descriptor:
def __init__(self, name=None, **opts):
self.name = name
for key, value in opts.items():
setattr( self, key, value)
def __set__(self, instance, value):
instance.__dict__[self.name] = value
#Descriptor for enforci... | class Descriptor:
def __init__(self, name=None, **opts):
self.name = name
for (key, value) in opts.items():
setattr(self, key, value)
def __set__(self, instance, value):
instance.__dict__[self.name] = value
class Typed(Descriptor):
expected_type = type(None)
def _... |
{
"targets": [
{
"target_name": "napi_test",
"sources": [ "napi.test.c" ]
},
{
"target_name": "napi_arguments",
"sources": [ "napi_arguments.c" ]
},
{
"target_name": "napi_async",
"sources": [ "napi_async.cc" ]
},
{
"target_name": "napi_construct",... | {'targets': [{'target_name': 'napi_test', 'sources': ['napi.test.c']}, {'target_name': 'napi_arguments', 'sources': ['napi_arguments.c']}, {'target_name': 'napi_async', 'sources': ['napi_async.cc']}, {'target_name': 'napi_construct', 'sources': ['napi_construct.c']}, {'target_name': 'napi_error', 'sources': ['napi_erro... |
__title__ = 'Django Platform Data Service'
__version__ = '0.0.4'
__author__ = 'Komol Nath Roy'
__license__ = 'MIT'
__copyright__ = 'Copyright 2020 Komol Nath Roy'
VERSION = __version__
default_app_config = 'django_pds.apps.DjangoPdsConfig'
| __title__ = 'Django Platform Data Service'
__version__ = '0.0.4'
__author__ = 'Komol Nath Roy'
__license__ = 'MIT'
__copyright__ = 'Copyright 2020 Komol Nath Roy'
version = __version__
default_app_config = 'django_pds.apps.DjangoPdsConfig' |
#!C:\Python27
# For 500,000 mutables, this takes WAY to long. Look for better options
orgFile = open('InputList.txt', 'r')
newFile = open('SortedList.txt', 'w')
unsortedList = [line.strip() for line in orgFile]
def bubble_sort(list):
for i in reversed(range(len(list))):
finished = True
... | org_file = open('InputList.txt', 'r')
new_file = open('SortedList.txt', 'w')
unsorted_list = [line.strip() for line in orgFile]
def bubble_sort(list):
for i in reversed(range(len(list))):
finished = True
for j in range(i):
if list[j] > list[j + 1]:
(list[j], list[j + 1])... |
students = []
def displayMenu():
print("What would you like to do?")
print("\t(a) Add new student: ")
print("\t(v) View students: ")
print("\t(q) Quit: ")
choice = input("Type one letter (a/v/q): ").strip()
return choice
#test the function
def doAdd():
currentstudent = {}
currentstude... | students = []
def display_menu():
print('What would you like to do?')
print('\t(a) Add new student: ')
print('\t(v) View students: ')
print('\t(q) Quit: ')
choice = input('Type one letter (a/v/q): ').strip()
return choice
def do_add():
currentstudent = {}
currentstudent['name'] = input... |
def collect(items, item):
if item in collecting_items:
return
collecting_items.append(item)
return
def drop(items, item):
if item in collecting_items:
collecting_items.remove(item)
return
return
def combine_items(old, new):
if old in collecting_items:
for el i... | def collect(items, item):
if item in collecting_items:
return
collecting_items.append(item)
return
def drop(items, item):
if item in collecting_items:
collecting_items.remove(item)
return
return
def combine_items(old, new):
if old in collecting_items:
for el in ... |
# Make this unique, and don't share it with anybody.
SECRET_KEY = ''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if using sqlite3.
'USER': '... | secret_key = ''
databases = {'default': {'ENGINE': 'django.db.backends.', 'NAME': '', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': ''}}
jobs_new_threshold = 1
jobs_notification_list = []
gatekeeper_enable_automoderation = True
gatekeeper_default_status = 0
gatekeeper_moderator_list = JOBS_NOTIFICATION_LIST |
#* Asked by Facebook
#? Given a list of sorted numbers, build a list of strings displaying numbers,
#? Where each string is first and last number of linearly increasing numbers.
#! Example:
#? Input: [0,1,2,2,5,7,8,9,9,10,11,15]
#? Output: ['0 -> 2','5 -> 5','7 -> 11','15 -> 15']
#! Note that numbers will not be l... | def truncate_list(lst):
if len(lst) == 0:
return list()
num = lst[0]
next_num = num + 1
start_num = num
final_lst = list()
i = 1
while i < len(lst):
if lst[i] == num or lst[i] == next_num:
pass
else:
final_lst.append(f'{start_num} -> {num}')
... |
expected_output = {
"session_type": {
"AnyConnect": {
"username": {
"lee": {
"index": {
1: {
"assigned_ip": "192.168.246.1",
"bytes": {"rx": 4942, "tx": 11079},
... | expected_output = {'session_type': {'AnyConnect': {'username': {'lee': {'index': {1: {'assigned_ip': '192.168.246.1', 'bytes': {'rx': 4942, 'tx': 11079}, 'duration': '0h:00m:15s', 'encryption': 'RC4 AES128', 'group_policy': 'EngPolicy', 'hashing': 'SHA1', 'inactivity': '0h:00m:00s', 'license': 'AnyConnect Premium', 'lo... |
# Author: Jochen Gast <jochen.gast@visinf.tu-darmstadt.de>
class MovingAverage:
postfix = "avg"
def __init__(self):
self.sum = 0.0
self.count = 0
def add_value(self, sigma, addcount=1):
self.sum += sigma
self.count += addcount
def add_average(self, avg, addcount):
... | class Movingaverage:
postfix = 'avg'
def __init__(self):
self.sum = 0.0
self.count = 0
def add_value(self, sigma, addcount=1):
self.sum += sigma
self.count += addcount
def add_average(self, avg, addcount):
self.sum += avg * addcount
self.count += addcou... |
ejem = "esto es un ejemplo"
print (ejem)
print (ejem[8:18], ejem[5:7], ejem[0:4])
subejem = ejem[8:18] + ejem[4:8] + ejem[0:4]
print (subejem)
#ejem = ejem.split(" ")
#print (ejem[2:4], ejem[1::-1]) | ejem = 'esto es un ejemplo'
print(ejem)
print(ejem[8:18], ejem[5:7], ejem[0:4])
subejem = ejem[8:18] + ejem[4:8] + ejem[0:4]
print(subejem) |
max_char = 105
sample_rate = 22050
n_fft = 1024
hop_length = 256
win_length = 1024
preemphasis = 0.97
ref_db = 20
max_db = 100
mel_dim = 80
max_length = 780
reduction = 4
embedding_dim = 128
symbol_length = 70
d = 256
c = 512
f = n_fft // 2 + 1
batch_size = 16
checkpoint_step = 500
max_T = 160
learning_rate = 0.0002
be... | max_char = 105
sample_rate = 22050
n_fft = 1024
hop_length = 256
win_length = 1024
preemphasis = 0.97
ref_db = 20
max_db = 100
mel_dim = 80
max_length = 780
reduction = 4
embedding_dim = 128
symbol_length = 70
d = 256
c = 512
f = n_fft // 2 + 1
batch_size = 16
checkpoint_step = 500
max_t = 160
learning_rate = 0.0002
be... |
'''
Problem Description
The program takes two dictionaries and
concatenates them into one dictionary.
Problem Solution
1. Declare and initialize two dictionaries
with some key-value pairs
2. Use the update() function to add the
key-value pair from the second dictionary
to the first dictionary.
3. Print ... | """
Problem Description
The program takes two dictionaries and
concatenates them into one dictionary.
Problem Solution
1. Declare and initialize two dictionaries
with some key-value pairs
2. Use the update() function to add the
key-value pair from the second dictionary
to the first dictionary.
3. Print the final d... |
LOC_RECENT = u'/AppData/Roaming/Microsoft/Windows/Recent/'
LOC_REG = u'/Windows/System32/config/'
LOC_WINEVT = LOC_REG
LOC_WINEVTX = u'/Windows/System32/winevt/logs/'
LOC_AMCACHE = u'/Windows/AppCompat/Programs/'
SYSTEM_FILE = [ # [artifact, src_path, dest_dir]
# registry hives
['regb', LOC_REG + u'RegBack/SA... | loc_recent = u'/AppData/Roaming/Microsoft/Windows/Recent/'
loc_reg = u'/Windows/System32/config/'
loc_winevt = LOC_REG
loc_winevtx = u'/Windows/System32/winevt/logs/'
loc_amcache = u'/Windows/AppCompat/Programs/'
system_file = [['regb', LOC_REG + u'RegBack/SAM', u'/Registry/RegBack/'], ['regb', LOC_REG + u'RegBack/SECU... |
class Config():
appId = None
apiKey = None
domain = None
def __init__(self, appId, apiKey, domain):
self.appId = appId
self.apiKey = apiKey
self.domain = domain | class Config:
app_id = None
api_key = None
domain = None
def __init__(self, appId, apiKey, domain):
self.appId = appId
self.apiKey = apiKey
self.domain = domain |
for i in range(int(input())):
array_length = int(input())
array = map(int, input().split())
s = sum(array)
if s < array_length:
print(1)
else:
print(s - array_length)
| for i in range(int(input())):
array_length = int(input())
array = map(int, input().split())
s = sum(array)
if s < array_length:
print(1)
else:
print(s - array_length) |
def _get_value(obj, key):
list_end = key.find("]")
is_list = list_end > 0
if is_list:
list_index = int(key[list_end - 1])
return obj[list_index]
return obj[key]
def find(obj, path):
try:
# Base case
if len(path) == 0:
return obj
key = str(path[0]... | def _get_value(obj, key):
list_end = key.find(']')
is_list = list_end > 0
if is_list:
list_index = int(key[list_end - 1])
return obj[list_index]
return obj[key]
def find(obj, path):
try:
if len(path) == 0:
return obj
key = str(path[0])
rest = path... |
GRAPH = {
"A":["B","D","E"],
"B":["A","C","D"],
"C":["B","G"],
"D":["A","B","E","F"],
"E":["A","D"],
"F":["D"],
"G":["C"]
}
visited_list = [] # an empty list of visited nodes
def dfs(graph, current_vertex, visited):
visited.append(current_vertex)
for vertex in graph[current_vertex]... | graph = {'A': ['B', 'D', 'E'], 'B': ['A', 'C', 'D'], 'C': ['B', 'G'], 'D': ['A', 'B', 'E', 'F'], 'E': ['A', 'D'], 'F': ['D'], 'G': ['C']}
visited_list = []
def dfs(graph, current_vertex, visited):
visited.append(current_vertex)
for vertex in graph[current_vertex]:
if vertex not in visited:
... |
class Solution:
def minCostClimbingStairs(self, cost):
dp = [0] * (len(cost) + 1)
for i in range(2, len(dp)):
dp[i] = min(dp[i - 2] + cost[i - 2], dp[i - 1] + cost[i - 1])
return dp[-1]
s = Solution()
print(s.minCostClimbingStairs([10, 15, 20]))
print(s.minCostClimbingStairs([1... | class Solution:
def min_cost_climbing_stairs(self, cost):
dp = [0] * (len(cost) + 1)
for i in range(2, len(dp)):
dp[i] = min(dp[i - 2] + cost[i - 2], dp[i - 1] + cost[i - 1])
return dp[-1]
s = solution()
print(s.minCostClimbingStairs([10, 15, 20]))
print(s.minCostClimbingStairs(... |
def save_transcriptions(path, transcriptions):
with open(path, 'w') as f:
for key in transcriptions:
f.write('{} {}\n'.format(key, transcriptions[key]))
def load_transcriptions(path):
transcriptions = {}
with open(path, "r") as f:
for line_no, line in enumerate(f):
... | def save_transcriptions(path, transcriptions):
with open(path, 'w') as f:
for key in transcriptions:
f.write('{} {}\n'.format(key, transcriptions[key]))
def load_transcriptions(path):
transcriptions = {}
with open(path, 'r') as f:
for (line_no, line) in enumerate(f):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.