content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
option='y'
while option=='y':
print("Enter the number whose factorial to find")
num=int(input())
fac=1
while(num!=1):
fac=fac*num
num=num-1
print("Factorial is "+str(fac))
print("Do you want to continue?(y/n)")
option=input()
print('Thank you for using this program... | option = 'y'
while option == 'y':
print('Enter the number whose factorial to find')
num = int(input())
fac = 1
while num != 1:
fac = fac * num
num = num - 1
print('Factorial is ' + str(fac))
print('Do you want to continue?(y/n)')
option = input()
print('Thank you for using th... |
def poly(a, x):
val = 0
for ai in reversed(a):
val *= x
val += ai
return val
def diff(a):
return [a[i + 1] * (i + 1) for i in range(len(a) - 1)]
def divroot(a, x0):
b, a[-1] = a[-1], 0
for i in reversed(range(len(a) - 1)):
a[i], b = a[i + 1] * x0 + b, a[i]
a.p... | def poly(a, x):
val = 0
for ai in reversed(a):
val *= x
val += ai
return val
def diff(a):
return [a[i + 1] * (i + 1) for i in range(len(a) - 1)]
def divroot(a, x0):
(b, a[-1]) = (a[-1], 0)
for i in reversed(range(len(a) - 1)):
(a[i], b) = (a[i + 1] * x0 + b, a[i])
... |
tickers = [
'aapl',
'tsla',
]
| tickers = ['aapl', 'tsla'] |
LAMBDA_232 = 4.934E-11#Amelin and Zaitsev, 2002.
# LAMBDA_232 = 4.9475E-11 #old value, used in isoplot
ERR_LAMBDA_232 = 0.015E-11#Amelin and Zaitsev, 2002.
LAMBDA_235 = 9.8485E-10
#ERR_LAMBDA_235 =
LAMBDA_238 = 1.55125E-10
#ERR_LAMBDA_238 =
U238_U235 = 137.817 #https://doi.org/10.1016/j.gca.2018.06.014
# U238_U235 =... | lambda_232 = 4.934e-11
err_lambda_232 = 1.5e-13
lambda_235 = 9.8485e-10
lambda_238 = 1.55125e-10
u238_u235 = 137.817
err_u238_u235 = 0.031
lambdas = [LAMBDA_238, LAMBDA_235, LAMBDA_232]
isotope_ratios = ['U238_Pb206', 'U235_Pb207', 'Th232_Pb208', 'Pb206_Pb207']
minerals = ['zircon', 'baddeleyite', 'perovskite', 'monazi... |
# Bar chart
# a graph that represents the category of data with rectangular bars with lengths and heights that are proportional
# to the values which they represent.
# Can be vertical or horizontal. Can also be grouped.
# matplotlib
fig, ax = plt.subplots(1, figsize=(24,14))
plt.bar(wrestling_count.index, wrestling_... | (fig, ax) = plt.subplots(1, figsize=(24, 14))
plt.bar(wrestling_count.index, wrestling_count.ID, width=0.9, color='xkcd:plum', edgecolor='ivory', linewidth=0, hatch='-')
plt.setp(ax.get_xticklabels(), rotation=45, ha='right', rotation_mode='anchor')
plt.title('\nHUNGARIAN WRESTLERS\n', fontsize=55, loc='left')
ax.tick_... |
{
"targets": [
{
"target_name": "gles3",
"sources": [ "src/node-gles3.cpp" ],
'include_dirs': [
'src', 'src/include'
],
'cflags':[],
'conditions': [
['OS=="mac"',
{
'libraries': [
'-lGLEW',
'-framework OpenGL'
... | {'targets': [{'target_name': 'gles3', 'sources': ['src/node-gles3.cpp'], 'include_dirs': ['src', 'src/include'], 'cflags': [], 'conditions': [['OS=="mac"', {'libraries': ['-lGLEW', '-framework OpenGL'], 'include_dirs': ['./node_modules/native-graphics-deps/include'], 'library_dirs': ['../node_modules/native-graphics-de... |
'''
Created on 7 jan. 2013
@author: sander
'''
# The following Key ID values are defined by this specification as used
# in any packet type that references a Key ID field:
#
# Name Number Defined in
#-----------------------------------------------
# None 0 n/a
# ... | """
Created on 7 jan. 2013
@author: sander
"""
key_id_none = 0
key_id_hmac_sha_1_96 = 1
key_id_hmac_sha_256_128 = 2 |
#!/usr/bin/python3
# ref: https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange#Cryptographic_explanation
# ref: https://en.wikipedia.org/wiki/RSA_(cryptosystem)
shared_modulus = 23
shared_base = 5
print("shared modulus: %s" % shared_modulus)
print("shared base: %s" % shared_base)
print("-"*40)
alice_sec... | shared_modulus = 23
shared_base = 5
print('shared modulus: %s' % shared_modulus)
print('shared base: %s' % shared_base)
print('-' * 40)
alice_secret = 4
bob_secret = 3
print("alice's secret key: %s" % alice_secret)
print("bob's secret key: %s" % bob_secret)
print('-' * 40)
a = shared_base ** alice_secret % shared_modul... |
#!/usr/bin/env python
# @Time : 2019-06-03
# @Author : hongshu
BUFF_SIZE = 32 * 1024
| buff_size = 32 * 1024 |
# from functools import wraps
# def debugMethod(func, cls=None):
# '''decorator for debugging passed function'''
# @wraps(func)
# def wrapper(*args, **kwargs):
# print({
# 'class': cls, # class object, not string
# 'method': func.__qualname__, # method name, string
# ... | class Meta(type):
def __getattribute__(self, name):
print({'action': 'get', 'attr': name})
return object.__getattribute__(self, name)
class A(object, metaclass=Meta):
def add(self, x, y):
return x + y
def mul(self, x, y):
return x * y
a = a()
a.x = 200 |
class NCBaseError(Exception):
def __init__(self, message) -> None:
super(NCBaseError, self).__init__(message)
class DataTypeMismatchError(Exception):
def __init__(self, provided_data, place:str=None, required_data_type:str=None) -> None:
message = f"{provided_data} datatype isn't supported for... | class Ncbaseerror(Exception):
def __init__(self, message) -> None:
super(NCBaseError, self).__init__(message)
class Datatypemismatcherror(Exception):
def __init__(self, provided_data, place: str=None, required_data_type: str=None) -> None:
message = f"{provided_data} datatype isn't supported ... |
class Node:
def __init__(self, data):
self.data= data
self.previous= None
self.next= None
class DoublyLinkedList:
def __init__(self):
self.head= None
def create_list(self, arr):
start= self.head
n= len(arr)
temp= st... | class Node:
def __init__(self, data):
self.data = data
self.previous = None
self.next = None
class Doublylinkedlist:
def __init__(self):
self.head = None
def create_list(self, arr):
start = self.head
n = len(arr)
temp = start
i = 0
... |
# The ranges below are as specified in the Yellow Paper.
# Note: range(s, e) excludes e, hence the +1
valid_opcodes = [
*range(0x00, 0x0b + 1),
*range(0x10, 0x1d + 1),
0x20,
*range(0x30, 0x3f + 1),
*range(0x40, 0x48 + 1),
*range(0x50, 0x5b + 1),
*range(0x60, 0x6f + 1),
*range(0x70, 0x7f ... | valid_opcodes = [*range(0, 11 + 1), *range(16, 29 + 1), 32, *range(48, 63 + 1), *range(64, 72 + 1), *range(80, 91 + 1), *range(96, 111 + 1), *range(112, 127 + 1), *range(128, 143 + 1), *range(144, 159 + 1), *range(160, 164 + 1), *range(240, 245 + 1), 250, 253, 254, 255]
terminating_opcodes = [0, 243, 253, 254, 255]
imm... |
QUESTIONS = {
'a1': {
'Q': 'What is the chemical symbol for gold?',
'A': 'au'
},
'a2': {
'Q': '',
'A': ''
},
'a3': {
'Q': '',
'A': ''
},
'a4': {
'Q': '',
'A': ''
},
'b1': {
'Q': '',
'A'... | questions = {'a1': {'Q': 'What is the chemical symbol for gold?', 'A': 'au'}, 'a2': {'Q': '', 'A': ''}, 'a3': {'Q': '', 'A': ''}, 'a4': {'Q': '', 'A': ''}, 'b1': {'Q': '', 'A': ''}, 'b2': {'Q': '', 'A': ''}, 'b3': {'Q': '', 'A': ''}, 'b4': {'Q': '', 'A': ''}, 'c1': {'Q': '', 'A': ''}, 'c2': {'Q': '', 'A': ''}, 'c3': {'... |
#!/usr/bin/python3
'''
Collects Weather Forecast by Indian Meterological Department, by parsing webpages :)
'''
__version__ = '0.2.0'
__author__ = 'Anjan Roy<anjanroy@yandex.com>'
| """
Collects Weather Forecast by Indian Meterological Department, by parsing webpages :)
"""
__version__ = '0.2.0'
__author__ = 'Anjan Roy<anjanroy@yandex.com>' |
# Contains all the basic info about awards
class Award:
count = 0
def __init__(self, url, number, name, type, application, restrictions, renewable, value, due, description,
sequence):
self.url = url
self.number = number
self.name = name
self.type = type
self.application = applica... | class Award:
count = 0
def __init__(self, url, number, name, type, application, restrictions, renewable, value, due, description, sequence):
self.url = url
self.number = number
self.name = name
self.type = type
self.application = application
self.restrictions = r... |
class Solution:
def dailyTemperatures(self, T: List[int]) -> List[int]:
warmer_day = [0]*len(T)
recent_day = [2**31-1]*101
MAXLEN = 30000
for i in range(len(T)-1, -1, -1):
minday = 2**31-1
for warmer_temp in range(T[i]+1, 101):
if recent_day[wa... | class Solution:
def daily_temperatures(self, T: List[int]) -> List[int]:
warmer_day = [0] * len(T)
recent_day = [2 ** 31 - 1] * 101
maxlen = 30000
for i in range(len(T) - 1, -1, -1):
minday = 2 ** 31 - 1
for warmer_temp in range(T[i] + 1, 101):
... |
# encoding: utf-8
class Animals(object):
def __init__(self, sound):
self.sound = sound
def speak(self):
return self.sound | class Animals(object):
def __init__(self, sound):
self.sound = sound
def speak(self):
return self.sound |
# Copyright 2021 Nokia
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
class ApiVersion(object):
def __init__(self, group: str, version: str):
self.group = group
self.version = version
class Kind(ApiVersion):
def __init__(self, group: str, version: str, kind... | class Apiversion(object):
def __init__(self, group: str, version: str):
self.group = group
self.version = version
class Kind(ApiVersion):
def __init__(self, group: str, version: str, kind: str):
super().__init__(group, version)
self.kind = kind
class Resource(ApiVersion):
... |
_base_ = '../cascade_rcnn/cascade_mask_rcnn_r50_fpn_mstrain_3x_coco.py'
model = dict(
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=8,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=Fa... | _base_ = '../cascade_rcnn/cascade_mask_rcnn_r50_fpn_mstrain_3x_coco.py'
model = dict(backbone=dict(type='ResNeXt', depth=101, groups=32, base_width=8, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=False), style='pytorch', init_cfg=dict(type='Pretrained', checkpoint='ope... |
def find_missing(S):
if len(S) > 0:
m = max(S)
vals = [ 0 for i in range(m)]
for x in S:
if x < 0:
print("Warning {} is <0. Ignoring it.".format(x))
else:
vals[x-1] += 1
return [x+1 for x in range(m) if vals[x] == 0]
else:
... | def find_missing(S):
if len(S) > 0:
m = max(S)
vals = [0 for i in range(m)]
for x in S:
if x < 0:
print('Warning {} is <0. Ignoring it.'.format(x))
else:
vals[x - 1] += 1
return [x + 1 for x in range(m) if vals[x] == 0]
else... |
def solution(inpnum):
upnum = int(str(9)*inpnum)
lownum = int(str(1)+(str(0)*(inpnum-1)))
ansnum = None
for i in range(upnum,lownum,-1):
if len(str(i))==len(set(str(i))):
if 2**(i-1)%i==1:
ansnum = i
break
return ansnum
| def solution(inpnum):
upnum = int(str(9) * inpnum)
lownum = int(str(1) + str(0) * (inpnum - 1))
ansnum = None
for i in range(upnum, lownum, -1):
if len(str(i)) == len(set(str(i))):
if 2 ** (i - 1) % i == 1:
ansnum = i
break
return ansnum |
class Solution:
def toHex(self, num: int) -> str:
if num == 0:
return '0'
chars, result = '0123456789abcdef', []
if num < 0:
num += (1 << 32)
while num > 0:
result.insert(0, chars[num % 16])
num //= 16
return ''.join(result) | class Solution:
def to_hex(self, num: int) -> str:
if num == 0:
return '0'
(chars, result) = ('0123456789abcdef', [])
if num < 0:
num += 1 << 32
while num > 0:
result.insert(0, chars[num % 16])
num //= 16
return ''.join(result) |
# Space: O(1)
# Time: O(n)
# 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 diameterOfBinaryTree(self, root):
self.res = 0
self.dfs(ro... | class Solution:
def diameter_of_binary_tree(self, root):
self.res = 0
self.dfs(root)
return self.res
def dfs(self, root):
if root is None:
return 0
(left, right) = (0, 0)
if root.left:
left = self.dfs(root.left) + 1
if root.right:... |
try:
n = int(input("Enter number"))
print(n*n)
except:
print("Non integer entered")
| try:
n = int(input('Enter number'))
print(n * n)
except:
print('Non integer entered') |
height = int(input())
for i in range(0,height+1):
for j in range(0,i+1):
if(j == i):
print(i,end=" ")
else:
print("*",end=" ")
print()
# Sample Input :- 5
# Output :-
# 0
# * 1
# * * 2
# * * * 3
# * * * * 4
# * * * * * 5
| height = int(input())
for i in range(0, height + 1):
for j in range(0, i + 1):
if j == i:
print(i, end=' ')
else:
print('*', end=' ')
print() |
statement_one = False
statement_two = True
credits = 120
gpa = 1.8
if not credits >= 120:
print('You do not have enough credits to graduate.')
if not gpa >= 2.0:
print('Your GPA is not high enough to graduate.')
if not (credits >= 120) and not (gpa >= 2.0):
print('You do not meet either require... | statement_one = False
statement_two = True
credits = 120
gpa = 1.8
if not credits >= 120:
print('You do not have enough credits to graduate.')
if not gpa >= 2.0:
print('Your GPA is not high enough to graduate.')
if not credits >= 120 and (not gpa >= 2.0):
print('You do not meet either requirement to graduat... |
LOCALHOST_EQUIVALENTS = frozenset((
'localhost',
'127.0.0.1',
'0.0.0.0',
'0:0:0:0:0:0:0:0',
'0:0:0:0:0:0:0:1',
'::1',
'::',
))
| localhost_equivalents = frozenset(('localhost', '127.0.0.1', '0.0.0.0', '0:0:0:0:0:0:0:0', '0:0:0:0:0:0:0:1', '::1', '::')) |
count = int(input())
for i in range(count):
print("@"*(count*5))
for i in range(count*3):
print("@"*(count)," "*(count*3),"@"*(count),sep="")
for i in range(count):
print("@"*(count*5)) | count = int(input())
for i in range(count):
print('@' * (count * 5))
for i in range(count * 3):
print('@' * count, ' ' * (count * 3), '@' * count, sep='')
for i in range(count):
print('@' * (count * 5)) |
a = input("Enter some list of numbers =")
for i in a:
print(i)
print(type(a))
| a = input('Enter some list of numbers =')
for i in a:
print(i)
print(type(a)) |
# Cache bitcode
CACHE = False
# Save object file for module
ASM = False
# Write LLVM dump to file
DUMP = True
# Enable AST debugging dump
DEBUG = True
# Write dump files to same directory as module?
# if False, this will write all dumps to one "debug" file in the main dir
DUMP_TO_DIR = False
| cache = False
asm = False
dump = True
debug = True
dump_to_dir = False |
'''
Common settings for using in a project scope
'''
MODEL_ZIP_FILE_NAME_ENV_VAR = 'TF_AWS_MODEL_ZIP_FILE_NAME'
MODEL_PROTOBUF_FILE_NAME_ENV_VAR = 'TF_AWS_MODEL_PROTOBUF_FILE_NAME'
S3_MODEL_BUCKET_NAME_ENV_VAR = 'TF_AWS_S3_MODEL_BUCKET_NAME'
| """
Common settings for using in a project scope
"""
model_zip_file_name_env_var = 'TF_AWS_MODEL_ZIP_FILE_NAME'
model_protobuf_file_name_env_var = 'TF_AWS_MODEL_PROTOBUF_FILE_NAME'
s3_model_bucket_name_env_var = 'TF_AWS_S3_MODEL_BUCKET_NAME' |
expected_output = {
'pid': 'CISCO3945-CHASSIS',
'os': 'ios',
'platform': 'c3900',
'version': '15.0(1)M7',
} | expected_output = {'pid': 'CISCO3945-CHASSIS', 'os': 'ios', 'platform': 'c3900', 'version': '15.0(1)M7'} |
class RobertException(Exception):
def __init__(self, message: str = None):
message = 'An fatal error has occurred' if message is None else message
super().__init__(message)
class LanguageNotSupported(RobertException):
def __init__(self):
super().__init__('That language is not supported'... | class Robertexception(Exception):
def __init__(self, message: str=None):
message = 'An fatal error has occurred' if message is None else message
super().__init__(message)
class Languagenotsupported(RobertException):
def __init__(self):
super().__init__('That language is not supported'... |
# TODO: Use these simplified dataclasses once support for Python 3.6 is
# dropped. Meanwhile we'll use the "polyfill" classes defined below.
#
# from dataclasses import dataclass, field
#
# @dataclass
# class Client:
# user_id: str
# user_type: str = field(default="client", init=False)
#
#
# @dataclass
# class ... | class Client:
user_id: str
user_type: str
def __init__(self, user_id):
self.user_id = user_id
self.user_type = 'client'
class Team:
user_id: str
user_type: str
def __init__(self, user_id):
self.user_id = user_id
self.user_type = 'team'
class User:
user_id:... |
add = 3+2
print (add)
subtract = 3-2
print (subtract)
multiply = 3*2
print (multiply)
division = 3/2
print (division)
modulus = 3%2
print (modulus)
lessThan = 3<2
print (lessThan)
greaterThan = 3>2
print(greaterThan)
equals = 3==3
print (equals)
logicalAnd = (2==2) and (3==3) and (4==4)
print (logicalAnd)
logi... | add = 3 + 2
print(add)
subtract = 3 - 2
print(subtract)
multiply = 3 * 2
print(multiply)
division = 3 / 2
print(division)
modulus = 3 % 2
print(modulus)
less_than = 3 < 2
print(lessThan)
greater_than = 3 > 2
print(greaterThan)
equals = 3 == 3
print(equals)
logical_and = 2 == 2 and 3 == 3 and (4 == 4)
print(logicalAnd)
... |
#!/usr/bin/env python3
#variable delaration
names = []
address = []
age = []
institute = []
dept = []
print('------+++++++Welcome to student info software+++++++------\n')
names.insert(0, input('Enter your Full name: '))
address.insert(0, input('Enter your Address: '))
age.insert(0, input('Enter your Ag... | names = []
address = []
age = []
institute = []
dept = []
print('------+++++++Welcome to student info software+++++++------\n')
names.insert(0, input('Enter your Full name: '))
address.insert(0, input('Enter your Address: '))
age.insert(0, input('Enter your Age: '))
institute.insert(0, input('Enter your School: '))
dep... |
def valid_palindrome(str):
left, right = 0, len(str) - 1
while left < right:
if not str[left].isalnum():
left += 1
elif not str[right].isalnum():
right -= 1
else:
if str[left].lower() != str[right].lower():
print('False')
... | def valid_palindrome(str):
(left, right) = (0, len(str) - 1)
while left < right:
if not str[left].isalnum():
left += 1
elif not str[right].isalnum():
right -= 1
elif str[left].lower() != str[right].lower():
print('False')
return False
... |
{
4 : {
"operator" : "aggregation",
"numgroups" : 1000000
}
}
| {4: {'operator': 'aggregation', 'numgroups': 1000000}} |
def get_numbers_between(set_a, set_b):
numbers_between = 0
for candidate in range(1, 101):
found = True
for item in set_a:
if candidate % item:
found = False
break
if not found:
continue
for item in set_b:
if... | def get_numbers_between(set_a, set_b):
numbers_between = 0
for candidate in range(1, 101):
found = True
for item in set_a:
if candidate % item:
found = False
break
if not found:
continue
for item in set_b:
if ite... |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def python_dependencies_early():
http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def python_dependencies_early():
http_archive(name='rules_python', url='https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz', sha256='aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161') |
# Pow(x, n): https://leetcode.com/problems/powx-n/
# Implement pow(x, n), which calculates x raised to the power n (i.e., xn).
# This problem is pretty straight forward we simply iterate over the n times
# multiplying the input every time. The only tricky thing is that if we have
# a negative number we need to make s... | class Solution:
def my_pow(self, x: float, n: int) -> float:
if n == 0:
return 1.0
if x == 0:
return 0
if n < 0:
x = 1 / x
n *= -1
result = 1
for _ in range(n):
result *= x
return result
def my_pow_opti... |
# User input
num1=float(input("Enter the 1st number: "))
num2=float(input("Enter your 2nd number: "))
# Operations the program should perform
sum = num1 + num2
difference = num1 - num2
product = num1 * num2
divide = num1 / num2
modulus = num1 % num2
# Computer output
print(sum)
print(difference)
print(product)
print(... | num1 = float(input('Enter the 1st number: '))
num2 = float(input('Enter your 2nd number: '))
sum = num1 + num2
difference = num1 - num2
product = num1 * num2
divide = num1 / num2
modulus = num1 % num2
print(sum)
print(difference)
print(product)
print(divide)
print(modulus) |
def main():
print("Iterative:")
print("n=0 ->", fibonacci_iterative(0))
print("n=1 ->", fibonacci_iterative(1))
print("n=6 ->", fibonacci_iterative(6))
print()
print("Recursive:")
print("n=0 ->", fibonacci_recursive(0))
print("n=1 ->", fibonacci_recursive(1))
print("n=6 ->", fibonacc... | def main():
print('Iterative:')
print('n=0 ->', fibonacci_iterative(0))
print('n=1 ->', fibonacci_iterative(1))
print('n=6 ->', fibonacci_iterative(6))
print()
print('Recursive:')
print('n=0 ->', fibonacci_recursive(0))
print('n=1 ->', fibonacci_recursive(1))
print('n=6 ->', fibonacc... |
wanted_income = float(input())
total_income = 0
cocktail = input()
while cocktail != "Party!":
order = int(input())
cocktail_price = len(cocktail)
cocktail_price = order * cocktail_price
if cocktail_price % 2 != 0:
discount = cocktail_price - (cocktail_price * 0.25)
total_income +=... | wanted_income = float(input())
total_income = 0
cocktail = input()
while cocktail != 'Party!':
order = int(input())
cocktail_price = len(cocktail)
cocktail_price = order * cocktail_price
if cocktail_price % 2 != 0:
discount = cocktail_price - cocktail_price * 0.25
total_income += discoun... |
#!/usr/bin/env python3
strings = [
"sszojmmrrkwuftyv",
"isaljhemltsdzlum",
"fujcyucsrxgatisb",
"qiqqlmcgnhzparyg",
"oijbmduquhfactbc",
"jqzuvtggpdqcekgk",
"zwqadogmpjmmxijf",
"uilzxjythsqhwndh",
"gtssqejjknzkkpvw",
"wrggegukhhatygfi",
"vhtcgqzerxonhsye",
"tedlwzdjfppbmtd... | strings = ['sszojmmrrkwuftyv', 'isaljhemltsdzlum', 'fujcyucsrxgatisb', 'qiqqlmcgnhzparyg', 'oijbmduquhfactbc', 'jqzuvtggpdqcekgk', 'zwqadogmpjmmxijf', 'uilzxjythsqhwndh', 'gtssqejjknzkkpvw', 'wrggegukhhatygfi', 'vhtcgqzerxonhsye', 'tedlwzdjfppbmtdx', 'iuvrelxiapllaxbg', 'feybgiimfthtplui', 'qxmmcnirvkzfrjwd', 'vfarmlti... |
minha_matriz1 = [[1], [2], [3]]
minha_matriz2 = [[1, 2, 3], [4, 5, 6]]
def imprime_matriz(matriz):
for i in matriz:
linha = ''
for j in i:
linha += str(j)
print(" ".join(linha), end="")
print()
# imprime_matriz(minha_matriz1)
# imprime_matriz(minha_matriz2)
| minha_matriz1 = [[1], [2], [3]]
minha_matriz2 = [[1, 2, 3], [4, 5, 6]]
def imprime_matriz(matriz):
for i in matriz:
linha = ''
for j in i:
linha += str(j)
print(' '.join(linha), end='')
print() |
def get_column(game, col_num):
''' Get the columns '''
col = col_num
result = []
for i in range(0, 3):
temp = game[i]
result.append(temp[col])
return result
def print_odd_cubes_to_number(number):
''' Print odds and their cubes '''
if number < 1:
print('ER... | def get_column(game, col_num):
""" Get the columns """
col = col_num
result = []
for i in range(0, 3):
temp = game[i]
result.append(temp[col])
return result
def print_odd_cubes_to_number(number):
""" Print odds and their cubes """
if number < 1:
print('ERROR: number ... |
class Transformer(object):
mappings = {}
value_mappings_functions = {}
def __init__(self, initial_data):
self.initial_data = initial_data
def transform_dict(self, obj: dict):
result = {}
for k, v in obj.items():
if k in self.mappings.keys():
if k in ... | class Transformer(object):
mappings = {}
value_mappings_functions = {}
def __init__(self, initial_data):
self.initial_data = initial_data
def transform_dict(self, obj: dict):
result = {}
for (k, v) in obj.items():
if k in self.mappings.keys():
if k i... |
# Main driver file for user input and displaying
# Also checks legal moves and keep a move log
class GameState():
def __init__(self):
# Initial board state
# Board is 8x8 2d list with each element having 2 characters
# First character represents the color: w = white & b = black
# Se... | class Gamestate:
def __init__(self):
self.board = [['bR', 'bN', 'bB', 'bQ', 'bK', 'bB', 'bN', 'bR'], ['bp', 'bp', 'bp', 'bp', 'bp', 'bp', 'bp', 'bp'], ['--', '--', '--', '--', '--', '--', '--', '--'], ['--', '--', '--', '--', '--', '--', '--', '--'], ['--', '--', '--', '--', '--', '--', '--', '--'], ['--',... |
def aumentar(preco,taxa):
res = preco * (1 + taxa)
return res
def diminuir(preco,taxa):
res = preco * (1 - taxa)
return res
def dobro(preco):
res = preco * 2
return res
def metade(preco):
res = preco/2
return res
| def aumentar(preco, taxa):
res = preco * (1 + taxa)
return res
def diminuir(preco, taxa):
res = preco * (1 - taxa)
return res
def dobro(preco):
res = preco * 2
return res
def metade(preco):
res = preco / 2
return res |
def ps(uid='-1',det='default',suffix='default',shift=.5,logplot='off',figure_number=999):
'''
function to determine statistic on line profile (assumes either peak or erf-profile)\n
calling sequence: uid='-1',det='default',suffix='default',shift=.5)\n
det='default' -> get detector from metadata, otherwis... | def ps(uid='-1', det='default', suffix='default', shift=0.5, logplot='off', figure_number=999):
"""
function to determine statistic on line profile (assumes either peak or erf-profile)
calling sequence: uid='-1',det='default',suffix='default',shift=.5)
det='default' -> get detector from metadata, othe... |
# Copyright (c) Ville de Montreal. All rights reserved.
# Licensed under the MIT license.
# See LICENSE file in the project root for full license information.
CITYSCAPE_LABELS = [
('unlabeled', 0, 0, 0, 0),
('ego vehicle', 1, 0, 0, 0),
('rectification border', 2, 0, 0, 0),
('out of roi', 3, 0, 0, 0),
... | cityscape_labels = [('unlabeled', 0, 0, 0, 0), ('ego vehicle', 1, 0, 0, 0), ('rectification border', 2, 0, 0, 0), ('out of roi', 3, 0, 0, 0), ('static', 4, 0, 0, 0), ('dynamic', 5, 111, 74, 0), ('ground', 6, 81, 0, 81), ('road', 7, 128, 64, 128), ('sidewalk', 8, 244, 35, 232), ('parking', 9, 250, 170, 160), ('rail trac... |
email = input()
while True:
commands = input().split()
command = commands[0]
if command == "Complete":
break
if command == "Make":
case = commands[1]
if case == "Upper":
email = email.upper()
elif case == "Lower":
email = email.lower()
pr... | email = input()
while True:
commands = input().split()
command = commands[0]
if command == 'Complete':
break
if command == 'Make':
case = commands[1]
if case == 'Upper':
email = email.upper()
elif case == 'Lower':
email = email.lower()
prin... |
#tuples are immutable like strings
eggs = ('hello', 42, 0.5)
eggs[0]
'hello'
eggs[1:3]
(42, 0.5)
print(len(eggs))
type(('hello',)) #class 'tuple'
type(('hello')) #class 'str'
#Converting Types with the list() and tuple() Functions
tuple(['cat', 'dog', 5]) #('cat', 'dog', 5)
list(('cat', 'dog', 5)) ... | eggs = ('hello', 42, 0.5)
eggs[0]
'hello'
eggs[1:3]
(42, 0.5)
print(len(eggs))
type(('hello',))
type('hello')
tuple(['cat', 'dog', 5])
list(('cat', 'dog', 5))
list('hello') |
#!/usr/bin/python
class Problem7:
'''
10001st prime
Problem 7
104743
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
'''
def solution(self):
primes = []
nextPrime = 2
for i ... | class Problem7:
"""
10001st prime
Problem 7
104743
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
"""
def solution(self):
primes = []
next_prime = 2
for i in range(10001):
... |
class Solution:
# Top Down DP (Accepted), O(n^2) time, O(1) space
def minimumTotal(self, triangle: List[List[int]]) -> int:
for i in range(1, len(triangle)):
row = triangle[i]
row[0] += triangle[i-1][0]
row[-1] += triangle[i-1][-1]
for j in range(1, len(ro... | class Solution:
def minimum_total(self, triangle: List[List[int]]) -> int:
for i in range(1, len(triangle)):
row = triangle[i]
row[0] += triangle[i - 1][0]
row[-1] += triangle[i - 1][-1]
for j in range(1, len(row) - 1):
row[j] += min(triangle[... |
#! /usr/bin/env python
#Asking for input until a list of 10 integers given
while True:
num = input("Enter a list of 10 integers separated by a ',' : ").split(',')
l = len(num)
try:
for i in range(l):
num[i] = int(num[i])
p = (l==10)
if p:
break
except:
... | while True:
num = input("Enter a list of 10 integers separated by a ',' : ").split(',')
l = len(num)
try:
for i in range(l):
num[i] = int(num[i])
p = l == 10
if p:
break
except:
continue
prime_num = []
for x in num:
if x > 1:
for i in r... |
#!/usr/bin/env python3
# Lists
# Create a list
list_1 = [] # Creates an empty list using parantheses
list_2 = list() # Creates an empty list using the list() builtin
# Lists can accomodate different/multiple data types
list_2 = [1, 2, 3]
list_3 = ["a", "b", "c"]
list_4 = ["a", "hello", 1, "5"]
# Lists can accomod... | list_1 = []
list_2 = list()
list_2 = [1, 2, 3]
list_3 = ['a', 'b', 'c']
list_4 = ['a', 'hello', 1, '5']
list_5 = [[1, 2, 3], [5, 6, 1]]
list_6 = list_5.__add__(list_4)
print(list_6)
print(dir())
list_copy_1 = list_4
print(id(list_copy_1))
print(id(list_4))
list_copy_1 is list_4
list_copy_2 = list_4[:]
print(id(list_cop... |
class File:
def __init__(self, name: str, mode: str):
self.file = open(name, mode)
def write(self, line: str):
self.file.write(line + "\n")
def write_dict(self, dict):
for key, val in dict.items():
self.write(f"{key}: {val}")
def close(self):
self.file.clos... | class File:
def __init__(self, name: str, mode: str):
self.file = open(name, mode)
def write(self, line: str):
self.file.write(line + '\n')
def write_dict(self, dict):
for (key, val) in dict.items():
self.write(f'{key}: {val}')
def close(self):
self.file.c... |
query_set = [
"SELECT subscriber.s_id, subscriber.sub_nbr, \
subscriber.bit_1, subscriber.bit_2, subscriber.bit_3, subscriber.bit_4, subscriber.bit_5, subscriber.bit_6, subscriber.bit_7, \
subscriber.bit_8, subscriber.bit_9, subscriber.bit_10, \
subscriber.hex... | query_set = ['SELECT subscriber.s_id, subscriber.sub_nbr, subscriber.bit_1, subscriber.bit_2, subscriber.bit_3, subscriber.bit_4, subscriber.bit_5, subscriber.bit_6, subscriber.bit_7, subscriber.bit_8, subscriber.bit_9, subscriber.bit_10, subscriber.hex_1, subscriber.hex_2, ... |
## https://leetcode.com/problems/find-all-duplicates-in-an-array/
## pretty simple solution -- use a set to keep track of the numbers
## that have already appeared (because lookup time is O(1) given
## the implementation in python via a hash table). Gives me an O(N)
## runtime
## runetime is 79th percentile; memory... | class Solution:
def find_duplicates(self, nums: List[int]) -> List[int]:
already_appeared = set([])
twice = []
while len(nums):
n = nums.pop()
if n in already_appeared:
twice.append(n)
else:
already_appeared.add(n)
... |
world_cities = ['Dubai', 'New Orleans', 'Santorini', 'Gaza', 'Seoul']
print('***********')
print(world_cities)
print('***********')
print(sorted(world_cities))
print('***********')
print(world_cities)
print('***********')
print(sorted(world_cities, reverse=True))
print('***********')
print(world_cities)
print('********... | world_cities = ['Dubai', 'New Orleans', 'Santorini', 'Gaza', 'Seoul']
print('***********')
print(world_cities)
print('***********')
print(sorted(world_cities))
print('***********')
print(world_cities)
print('***********')
print(sorted(world_cities, reverse=True))
print('***********')
print(world_cities)
print('********... |
# Given a non-negative integer num, return the number of steps to reduce it to zero.
# If the current number is even, you have to divide it by 2,
# otherwise, you have to subtract 1 from it.
def count_steps(num):
steps = 0
while num != 0:
if num % 2 == 1:
num -= 1
else:
... | def count_steps(num):
steps = 0
while num != 0:
if num % 2 == 1:
num -= 1
else:
num /= 2
steps += 1
return steps |
# https://leetcode.com/problems/is-subsequence/
class Solution:
def isSubsequence(self, s: str, t: str) -> bool:
if len(s) == 0:
return True
sIndex = 0
for tIndex, tChar in enumerate(t):
if s[sIndex] == tChar:
sIndex += 1
... | class Solution:
def is_subsequence(self, s: str, t: str) -> bool:
if len(s) == 0:
return True
s_index = 0
for (t_index, t_char) in enumerate(t):
if s[sIndex] == tChar:
s_index += 1
if sIndex == len(s):
return True
r... |
#
# PySNMP MIB module H3C-FTM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-FTM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:09:18 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, 0... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ... |
# Row-by-column representation of the board
BOARD_SIZE = 6, 7
# Define size of each cell in the GUI of the game
CELL_SIZE = 100
# Define radius of dot
RADIUS = (CELL_SIZE // 2) - 5
# Define size of GUI screen
GUI_SIZE = (BOARD_SIZE[0] + 1) * CELL_SIZE, (BOARD_SIZE[1]) * CELL_SIZE
# Define various colors used on the GUI... | board_size = (6, 7)
cell_size = 100
radius = CELL_SIZE // 2 - 5
gui_size = ((BOARD_SIZE[0] + 1) * CELL_SIZE, BOARD_SIZE[1] * CELL_SIZE)
red = (255, 0, 0)
blue = (0, 0, 255)
black = (0, 0, 0)
white = (255, 255, 255)
yellow = (255, 255, 0)
human_player = 0
q_robot = 1
random_robot = 2
mini_max_robot = 3
reward_win = 1
re... |
'''This tnsertion sort algorithm
which is shown in most websites
and books, is slower than another
insertion sort algorithm.'''
def insertion_sort_slow(arr):
for i in range(1, len(arr)):
key = arr[i]
j = i-1
while j >= 0 and key < arr[j]:
arr[j + 1] = arr[j]
j -=... | """This tnsertion sort algorithm
which is shown in most websites
and books, is slower than another
insertion sort algorithm."""
def insertion_sort_slow(arr):
for i in range(1, len(arr)):
key = arr[i]
j = i - 1
while j >= 0 and key < arr[j]:
arr[j + 1] = arr[j]
... |
# Solution for the problem "Cats and a mouse"
# https://www.hackerrank.com/challenges/cats-and-a-mouse/problem
# Number of test cases
numQueries = int(input())
# Running the queries
for queryIndex in range(0, numQueries):
# Locations of Cat A, Cat B and mouse
locCatA, locCatB, locMouse = map(int, input().stri... | num_queries = int(input())
for query_index in range(0, numQueries):
(loc_cat_a, loc_cat_b, loc_mouse) = map(int, input().strip().split(' '))
dist_cat_a = abs(locCatA - locMouse)
dist_cat_b = abs(locCatB - locMouse)
if distCatA == distCatB:
print('Mouse C')
elif distCatA < distCatB:
p... |
# configuration for building the network
y_dim = 6
tr_dim = 7
ir_dim = 10
latent_dim = 128
z_dim = 128
batch_size = 128
lr = 0.0002
beta1 = 0.5
# configuration for the supervisor
logdir = "./log"
sampledir = "./example"
max_steps = 30000
sample_every_n_steps = 100
summary_every_n_steps = 1
save_model_secs = 120
checkp... | y_dim = 6
tr_dim = 7
ir_dim = 10
latent_dim = 128
z_dim = 128
batch_size = 128
lr = 0.0002
beta1 = 0.5
logdir = './log'
sampledir = './example'
max_steps = 30000
sample_every_n_steps = 100
summary_every_n_steps = 1
save_model_secs = 120
checkpoint_basename = 'layout'
checkpoint_dir = './checkpoints'
filenamequeue = './... |
N = int(input())
s = [input() for _ in range(N)]
for y in range(N):
for x in range(N):
print(s[N - 1 - x][y], end='')
print('')
| n = int(input())
s = [input() for _ in range(N)]
for y in range(N):
for x in range(N):
print(s[N - 1 - x][y], end='')
print('') |
S = input()
def check_even(stri):
if len(stri) % 2 !=0:
return False
else:
half = int(len(stri)/2)
if stri[:half] == stri[half:]:
return True
else:
return False
for i in range(len(S)):
if check_even(S[:-(i+1)]):
print(len(S)-(i+1))
... | s = input()
def check_even(stri):
if len(stri) % 2 != 0:
return False
else:
half = int(len(stri) / 2)
if stri[:half] == stri[half:]:
return True
else:
return False
for i in range(len(S)):
if check_even(S[:-(i + 1)]):
print(len(S) - (i + 1))
... |
N = int(input("Cuantos digitos quiere ingresar? "))
lista = []
lista2 = []
for i in range(N):
lista.append(int(input("Digite un numero: ")))
print("Su lista es: ", lista)
for i in range(N):
lista2.append(1*(lista[i]+1))
print("La segunda lista es: ", lista2) | n = int(input('Cuantos digitos quiere ingresar? '))
lista = []
lista2 = []
for i in range(N):
lista.append(int(input('Digite un numero: ')))
print('Su lista es: ', lista)
for i in range(N):
lista2.append(1 * (lista[i] + 1))
print('La segunda lista es: ', lista2) |
# @dependency 001-main/002-createrepository.py
frontend.json(
"repositories",
expect={ "repositories": [critic_json] })
frontend.json(
"repositories/1",
expect=critic_json)
frontend.json(
"repositories",
params={ "name": "critic" },
expect=critic_json)
frontend.json(
"repositories/47... | frontend.json('repositories', expect={'repositories': [critic_json]})
frontend.json('repositories/1', expect=critic_json)
frontend.json('repositories', params={'name': 'critic'}, expect=critic_json)
frontend.json('repositories/4711', expect={'error': {'title': 'No such resource', 'message': 'Resource not found: Invalid... |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
# Copyright (C) 2020 Daniel Rodriguez
# Use of this source code is governed by the MIT License
###############################################################################... | __all__ = ['SEED_AVG', 'SEED_LAST', 'SEED_SUM', 'SEED_NONE', 'SEED_ZERO', 'SEED_ZFILL', '_INCPERIOD', '_DECPERIOD', '_MINIDX', '_SERIES', '_MPSERIES', '_SETVAL', '_MPSETVAL']
seed_avg = 0
seed_last = 1
seed_sum = 2
seed_none = 4
seed_zero = 5
seed_zfill = 6
def _incperiod(x, p=1):
"""
Forces an increase `p` in... |
##Patterns: E0103
def test():
while True:
break
##Err: E0103
break
for letter in 'Python':
if letter == 'h':
continue
##Err: E0103
continue
| def test():
while True:
break
break
for letter in 'Python':
if letter == 'h':
continue
continue |
def checkio(f, g):
def call(function, *args, **kwargs):
try: return function(*args, **kwargs)
except Exception: return None
def h(*args, **kwargs):
value_f, value_g = call(f, *args, **kwargs), call(g, *args, **kwargs)
status = ""
if (value_f is None and value_g... | def checkio(f, g):
def call(function, *args, **kwargs):
try:
return function(*args, **kwargs)
except Exception:
return None
def h(*args, **kwargs):
(value_f, value_g) = (call(f, *args, **kwargs), call(g, *args, **kwargs))
status = ''
if value_f i... |
# --------------
# Code starts here
class_1 = ['Geoffrey Hinton' , 'Andrew Ng' , 'Sebastian Raschka' , 'Yoshua Bengio']
class_2 = ['Hilary Mason' , 'Carla Gentry' , 'Corinna Cortes']
new_class = class_1+class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(... | class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
courses = {'Math': 65, 'English... |
N = int(input())
a,b = 1,1
print(0,end=' ')
for i in range(1,N-1):
if i != N:
print(a,end=' ')
a,b = b,a+b
print(a,end='\n') | n = int(input())
(a, b) = (1, 1)
print(0, end=' ')
for i in range(1, N - 1):
if i != N:
print(a, end=' ')
(a, b) = (b, a + b)
print(a, end='\n') |
# This is a dummy file to allow the automatic loading of modules without error on none.
def setup(robot_config):
return
def say(*args):
return
def mute():
return
def unmute():
return
def volume(level):
return | def setup(robot_config):
return
def say(*args):
return
def mute():
return
def unmute():
return
def volume(level):
return |
class FeeValidator:
def __init__(self, specifier) -> None:
super().__init__()
self.specifier = specifier
def validate(self, fee):
failed=False
try:
if fee != 0 and not 1 <= fee <= 100:
failed=True
except TypeError:
failed=True
... | class Feevalidator:
def __init__(self, specifier) -> None:
super().__init__()
self.specifier = specifier
def validate(self, fee):
failed = False
try:
if fee != 0 and (not 1 <= fee <= 100):
failed = True
except TypeError:
failed = ... |
INSERT_ONE_BY_BYTE = "insert_one_by_byte"
INSERT_ONE_BY_PATH = "insert_one_by_path"
INSERT_MANY_BY_BYTE = "insert_many_by_byte"
INSERT_MANY_BY_DIR = "insert_many_by_dir"
INSERT_MANY_BY_PATHS = "insert_many_by_paths"
DELETE_ONE_BY_ID = "delete_one_by_id"
DELETE_MANY_BY_IDS = "delete_many_by_ids"
DELETE_ALL = "delete_al... | insert_one_by_byte = 'insert_one_by_byte'
insert_one_by_path = 'insert_one_by_path'
insert_many_by_byte = 'insert_many_by_byte'
insert_many_by_dir = 'insert_many_by_dir'
insert_many_by_paths = 'insert_many_by_paths'
delete_one_by_id = 'delete_one_by_id'
delete_many_by_ids = 'delete_many_by_ids'
delete_all = 'delete_all... |
lista = []
lista_par = []
lista_impar = []
while True:
n = (int(input('Digite os numeros: ')))
lista.append(n)
if n % 2 == 0:
lista_par.append(n)
else:
lista_impar.append(n)
res = str(input('Quer continuar [S/N] : '))
if res in 'Nn':
break
print(f'O numeros da... | lista = []
lista_par = []
lista_impar = []
while True:
n = int(input('Digite os numeros: '))
lista.append(n)
if n % 2 == 0:
lista_par.append(n)
else:
lista_impar.append(n)
res = str(input('Quer continuar [S/N] : '))
if res in 'Nn':
break
print(f'O numeros da lista fora : ... |
test = [11.0, "Alice has a cat", 12, 4, "5"]
print("len(test) = " + str(len(test)))
print("test[1] = " + str(test[1]))
print("test[3:6] = " + str(test[3:6]))
print("test[1:6:2] = " + str(test[1:6:2]))
print("test[:6] = " + str(test[:6]))
print("test[-2] = " + str(test[-2]))
test.append(121)
test2 = test + [1, 2, 3... | test = [11.0, 'Alice has a cat', 12, 4, '5']
print('len(test) = ' + str(len(test)))
print('test[1] = ' + str(test[1]))
print('test[3:6] = ' + str(test[3:6]))
print('test[1:6:2] = ' + str(test[1:6:2]))
print('test[:6] = ' + str(test[:6]))
print('test[-2] = ' + str(test[-2]))
test.append(121)
test2 = test + [1, 2, 3]
pri... |
class dotStringProperty_t(object):
# no doc
aName=None
aValueString=None
FatherId=None
ValueStringIteration=None
| class Dotstringproperty_T(object):
a_name = None
a_value_string = None
father_id = None
value_string_iteration = None |
# pylint: disable=missing-function-docstring, missing-module-docstring/
@toto # pylint: disable=undefined-variable
def f():
pass
| @toto
def f():
pass |
x = 50
def func(x):
print('x is',x)
x = 2
print('Changed local x to',x)
func(x)
print('x is still',x) | x = 50
def func(x):
print('x is', x)
x = 2
print('Changed local x to', x)
func(x)
print('x is still', x) |
class Node():
def __init__(self, value="", frequency=0.0):
self.frequency = frequency
self.value = value
self.children = {}
self.stop = False
def __getitem__(self, key):
if key in self.children:
return self.children[key]
return None
def __set... | class Node:
def __init__(self, value='', frequency=0.0):
self.frequency = frequency
self.value = value
self.children = {}
self.stop = False
def __getitem__(self, key):
if key in self.children:
return self.children[key]
return None
def __setitem_... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"PairwiseDistance": "00_distance.ipynb",
"pairwise_dist_gram": "00_distance.ipynb",
"stackoverflow_pairwise_distance": "00_distance.ipynb",
"PairwiseDistance.stackoverflow_pairwise_... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'PairwiseDistance': '00_distance.ipynb', 'pairwise_dist_gram': '00_distance.ipynb', 'stackoverflow_pairwise_distance': '00_distance.ipynb', 'PairwiseDistance.stackoverflow_pairwise_distance': '00_distance.ipynb', 'torch_pairwise_distance': '00_dista... |
class AppUserProfile:
types = {
'username': str,
'password': str
}
def __init__(self):
self.username = None # str
self.password = None # str
| class Appuserprofile:
types = {'username': str, 'password': str}
def __init__(self):
self.username = None
self.password = None |
class Container:
def __init__(self, container=None):
if container == None or type(container) != dict:
self._container = dict()
else:
self._container = container
def __iter__(self):
return iter(self._container.items())
def addObject(self, name, object_:ob... | class Container:
def __init__(self, container=None):
if container == None or type(container) != dict:
self._container = dict()
else:
self._container = container
def __iter__(self):
return iter(self._container.items())
def add_object(self, name, object_: obj... |
class AcousticParam(object):
def __init__(
self,
sampling_rate: int = 24000,
pad_second: float = 0,
threshold_db: float = None,
frame_period: int = 5,
order: int = 8,
alpha: float = 0.466,
f0_floor: float = 71,
... | class Acousticparam(object):
def __init__(self, sampling_rate: int=24000, pad_second: float=0, threshold_db: float=None, frame_period: int=5, order: int=8, alpha: float=0.466, f0_floor: float=71, f0_ceil: float=800, fft_length: int=1024, dtype: str='float32') -> None:
self.sampling_rate = sampling_rate
... |
def get_headers(text):
list_a = text.split("\n")[1:]
list_headers = []
for i in list_a:
if not i:
break
list_headers.append(i.split(": "))
return dict(list_headers)
| def get_headers(text):
list_a = text.split('\n')[1:]
list_headers = []
for i in list_a:
if not i:
break
list_headers.append(i.split(': '))
return dict(list_headers) |
#WAP to find, a given number is prime or not
num = int(input("enter number"))
if num>1:
#check for factors
for i in range(2,num):
if(num / i) == 0:
print(num," is not prime number")
break
else:
print(num," is not a prime number") | num = int(input('enter number'))
if num > 1:
for i in range(2, num):
if num / i == 0:
print(num, ' is not prime number')
break
else:
print(num, ' is not a prime number') |
def Scenario_Generation():
# first restricting the data to April 2020 when we are predicting six weeks out from april 2020
popularity_germany = np.load("./popularity_germany.npy")
popularity_germany = np.copy(popularity_germany[:,0:63,:]) # april 20th is the 63rd index in the popularity number
#... | def scenario__generation():
popularity_germany = np.load('./popularity_germany.npy')
popularity_germany = np.copy(popularity_germany[:, 0:63, :])
one = np.multiply(np.ones((16, 42, 6)), popularity_germany[:, 62:63, :])
popularity_germany = np.append(popularity_germany, one, axis=1)
bus_movement = np... |
# loendur dictionary
counter_dict = {}
# loe failist ridade kaupa ja loendab dictionarisse erinevad nimed
with open('/Users/mikksillaste/Downloads/aima-python/nameslist.txt') as f:
line = f.readline()
while line:
line = line.strip()
if line in counter_dict:
counter_dict[line] += 1
... | counter_dict = {}
with open('/Users/mikksillaste/Downloads/aima-python/nameslist.txt') as f:
line = f.readline()
while line:
line = line.strip()
if line in counter_dict:
counter_dict[line] += 1
else:
counter_dict[line] = 1
line = f.readline()
counter_dict2... |
def eight_is_great(a, b):
if a == 8 or b == 8:
print(":)")
elif (a + b) == 8:
print(":)")
else:
print(":(")
| def eight_is_great(a, b):
if a == 8 or b == 8:
print(':)')
elif a + b == 8:
print(':)')
else:
print(':(') |
#ChangeRenderSetting.py
##This only use in the maya software render , not in arnold
#Three main Node of Maya Render:
# ->defaultRenderGlobals, defaultRenderQuality and defaultResolution
# ->those are separate nodes in maya
'''
import maya.cmds as cmds
#Function : getRenderGlobals()
#Usage : get the Value of Rend... | """
import maya.cmds as cmds
#Function : getRenderGlobals()
#Usage : get the Value of Render Globals and print it
def getRenderGlobals() :
render_glob = "defaultRenderGlobals"
list_Attr = cmds.listAttr(render_glob,r = True,s = True)
#loop the list
print 'defaultRenderSetting As follows :'
for at... |
x = int(input())
y = int(input())
if (2 * y + 1 - x) % (y - x + 1) == 0:
print("YES")
else:
print("NO")
| x = int(input())
y = int(input())
if (2 * y + 1 - x) % (y - x + 1) == 0:
print('YES')
else:
print('NO') |
class Solution:
def longestPalindrome(self, s: str) -> str:
result = ''
pal_s = set(s)
if len(pal_s) == 1:
return s
for ind_c in range(len(s)):
pal = ''
ind_l = ind_c
ind_r = ind_c + 1
while ind_l > -1 and ind_r < len(s):
... | class Solution:
def longest_palindrome(self, s: str) -> str:
result = ''
pal_s = set(s)
if len(pal_s) == 1:
return s
for ind_c in range(len(s)):
pal = ''
ind_l = ind_c
ind_r = ind_c + 1
while ind_l > -1 and ind_r < len(s):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.