content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
major = 1
minor = 0
micro = None
pre_release = ".alpha"
post_release = None
dev_release = None
__version__ = '{}'.format(major)
if minor is not None:
__version__ += '.{}'.format(minor)
if micro is not None:
__version__ += '.{}'.format(micro)
if pre_release is not None:
__version__ += '{}'.format(pre_re... | major = 1
minor = 0
micro = None
pre_release = '.alpha'
post_release = None
dev_release = None
__version__ = '{}'.format(major)
if minor is not None:
__version__ += '.{}'.format(minor)
if micro is not None:
__version__ += '.{}'.format(micro)
if pre_release is not None:
__version__ += '{}'.format(pre_release... |
#############################
#PROJECT : ENCODER-DECODER
#Language :English
#basic encode and decode
#Contact me on ;
#Telegram : Zafiyetsiz0
#Instagram : Zafiyetsiz
#Discord : Zafiyetsiz#4172
##############################
print("1-Encoder ; 2-Decoder")
choise=int(input("Please type the number of transacti... | print('1-Encoder ; 2-Decoder')
choise = int(input('Please type the number of transaction you want :'))
print('-----------------------------------------------------------------------------')
if choise == 1:
letters = 'abcdefghijklmnopqrstuvwxyz'
print('key should be between 1-9999 and do not forget it ;')
ke... |
def fib(a,b,n):
if(n==1):
return a
elif(n==2):
return b
else:
return fib(a,b,n-2)+fib(a,b,n-1)*fib(a,b,n-1)
r = input();
r = r.split(' ')
a = int(r[0])
b = int(r[1])
n = int(r[2])
print(fib(a,b,n)) | def fib(a, b, n):
if n == 1:
return a
elif n == 2:
return b
else:
return fib(a, b, n - 2) + fib(a, b, n - 1) * fib(a, b, n - 1)
r = input()
r = r.split(' ')
a = int(r[0])
b = int(r[1])
n = int(r[2])
print(fib(a, b, n)) |
#Actividad 2
a=1+2**-53
print(a)
b=a-1
print(b)
a=1+2**-52
print(a)
b=a-1 | a = 1 + 2 ** (-53)
print(a)
b = a - 1
print(b)
a = 1 + 2 ** (-52)
print(a)
b = a - 1 |
a = [{'001': '001', '002': '002'}]
print(a, type(a))
a = a.__str__()
print(a, type(a))
print(['------------------'])
init_list = [0 for n in range(10)]
init_list2 = [0] * 10
print(init_list)
print(init_list2)
# list - replace
a = ['110', '111', '112', '113']
for i in a:
print(i, a.index(i))
... | a = [{'001': '001', '002': '002'}]
print(a, type(a))
a = a.__str__()
print(a, type(a))
print(['------------------'])
init_list = [0 for n in range(10)]
init_list2 = [0] * 10
print(init_list)
print(init_list2)
a = ['110', '111', '112', '113']
for i in a:
print(i, a.index(i))
if i == '112':
id = a.index(i... |
# Check whether the string is palindrome or not considering
# only Alpha-Numeric Characters ignoring cases
s = input();
t = ''.join([i.lower() if i.isalnum() else '' for i in s])
if t==''.join(reversed(t)): print("It is a Palindrome String")
else: print("It is not a Palindrome String")
| s = input()
t = ''.join([i.lower() if i.isalnum() else '' for i in s])
if t == ''.join(reversed(t)):
print('It is a Palindrome String')
else:
print('It is not a Palindrome String') |
# cannot be changed by user:
coinbaseReward = 5000000000 #50 bitcoins
halvingInterval = 150
maxOutputsPerTx = 1000
scalingUnits = .000001 # units of cap
confirmations = 6
onchainSatoshiMinimum = 100
maxTxPerBlock = 20 # 200 transactions in a block plus coinbase (which is at index 0)
iCoinbasePriv = 100000000 # so... | coinbase_reward = 5000000000
halving_interval = 150
max_outputs_per_tx = 1000
scaling_units = 1e-06
confirmations = 6
onchain_satoshi_minimum = 100
max_tx_per_block = 20
i_coinbase_priv = 100000000
b_coinbase_priv = bytearray(iCoinbasePriv.to_bytes(32, 'big')) |
__all__ = [
'base_controller',
'basic_api_controller',
'advanced_api_controller',
'enterprise_only_controller',
]
| __all__ = ['base_controller', 'basic_api_controller', 'advanced_api_controller', 'enterprise_only_controller'] |
# 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 convertBST(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
prev = 0
def ... | class Solution:
def convert_bst(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
prev = 0
def inorder_traversal(root):
nonlocal prev
if not root:
return
inorder_traversal(root.right)
root.val += prev
prev = root.val
... |
all_boards = {
'sysop': 1,
'vote': 2,
'bbslists': 3,
'notepad': 6,
'Test': 7,
'Dance': 8,
'Board': 9,
'Wisdom': 10,
'Science': 12,
'Linux': 13,
'IBMThinkPad': 14,
'LifeScience': 15,
'BBShelp': 16,
'Mechanics': 17,
'Emprise': 18,
'Philosophy': 20,
'Lite... | all_boards = {'sysop': 1, 'vote': 2, 'bbslists': 3, 'notepad': 6, 'Test': 7, 'Dance': 8, 'Board': 9, 'Wisdom': 10, 'Science': 12, 'Linux': 13, 'IBMThinkPad': 14, 'LifeScience': 15, 'BBShelp': 16, 'Mechanics': 17, 'Emprise': 18, 'Philosophy': 20, 'Literature': 21, 'Triangle': 22, 'GSM': 23, 'CS': 24, 'PKULibrary': 25, '... |
class RequestSourceValidator(object):
REQUIRED_AUTHENTICATIONS = ["manager", "host"]
SUPPORTED_TRANSPORT_METHODS = ['vddk', 'ssh']
def __init__(self, request):
self._request = request
self._errors = []
def validate(self):
for auth in self.REQUIRED_AUTHENTICATIONS:
... | class Requestsourcevalidator(object):
required_authentications = ['manager', 'host']
supported_transport_methods = ['vddk', 'ssh']
def __init__(self, request):
self._request = request
self._errors = []
def validate(self):
for auth in self.REQUIRED_AUTHENTICATIONS:
i... |
string = input()
result = []
for index in range(len(string)):
if string[index].isupper():
result.append(index)
print(result)
| string = input()
result = []
for index in range(len(string)):
if string[index].isupper():
result.append(index)
print(result) |
x = 10
if (x % 2) == 0 and (x % 5) == 0:
print(x)
A1 = "ostrich"
print('o' in A1)
print('r' not in A1)
| x = 10
if x % 2 == 0 and x % 5 == 0:
print(x)
a1 = 'ostrich'
print('o' in A1)
print('r' not in A1) |
class Solution:
def XXX(self, nums: List[int]) -> bool:
length = len(nums)
global tag
tag = False
def dfs(idx):
if idx == length - 1:
global tag
tag = True
return
if idx >= length or nums[idx] < 1:
... | class Solution:
def xxx(self, nums: List[int]) -> bool:
length = len(nums)
global tag
tag = False
def dfs(idx):
if idx == length - 1:
global tag
tag = True
return
if idx >= length or nums[idx] < 1:
... |
# https://www.youtube.com/watch?v=fFVZt-6sgyo
# broute force
def subarraySum(nums, k):
count = 0
for i in range(len(nums)):
sub_sum = 0
for j in range(i, len(nums)):
sub_sum += nums[j]
if sub_sum == k:
count += 1
return count
# sliding window, only... | def subarray_sum(nums, k):
count = 0
for i in range(len(nums)):
sub_sum = 0
for j in range(i, len(nums)):
sub_sum += nums[j]
if sub_sum == k:
count += 1
return count
def subarray_sum(arr, k):
if k < arr[0]:
return 0
(count, sub_sum) = ... |
# -*- coding: utf-8 -*-
'''
Management of Open vSwitch ports.
'''
def __virtual__():
'''
Only make these states available if Open vSwitch module is available.
'''
return 'openvswitch.port_add' in __salt__
def present(name, bridge):
'''
Ensures that the named port exists on bridge, eventually... | """
Management of Open vSwitch ports.
"""
def __virtual__():
"""
Only make these states available if Open vSwitch module is available.
"""
return 'openvswitch.port_add' in __salt__
def present(name, bridge):
"""
Ensures that the named port exists on bridge, eventually creates it.
Args:
... |
# Copyright 2014 Dave Kludt
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | auth_return = {'access': {'token': {'RAX-AUTH:authenticatedBy': ['APIKEY'], 'expires': '2015-06-23T12:44:18.758Z', 'id': '183e2f66535d4e03a04b2a91cf4a4f83', 'tenant': {'id': '123456', 'name': '123456'}}, 'serviceCatalog': [{'endpoints': [{'region': 'IAD', 'publicURL': 'https://cdn5.clouddrive.com/v1/MossoCloudFS_123456... |
'''P36 (**) Determine the prime factors of a given positive integer (2).
Construct a list containing the prime factors and their multiplicity.
Example:
* (prime-factors-mult 315)
((3 2) (5 1) (7 1))'''
base_divident=int(input('Enter number to find prime factors = '))
final_out=[]
original=base_divident #save... | """P36 (**) Determine the prime factors of a given positive integer (2).
Construct a list containing the prime factors and their multiplicity.
Example:
* (prime-factors-mult 315)
((3 2) (5 1) (7 1))"""
base_divident = int(input('Enter number to find prime factors = '))
final_out = []
original = base_divident
def prime... |
# This module contains a function to print Hello, World!
# Prints Hello, World!
def hello():
print("Hello, World!")
| def hello():
print('Hello, World!') |
class Difference:
def __init__(self, a):
self.__elements = a
def computeDifference(self):
result = []
data_len = len(self.__elements)
for i in range(data_len):
for n in range(i, data_len):
if i == n:
continue
x = ... | class Difference:
def __init__(self, a):
self.__elements = a
def compute_difference(self):
result = []
data_len = len(self.__elements)
for i in range(data_len):
for n in range(i, data_len):
if i == n:
continue
x = ... |
# https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii
class Solution:
def minMoves2(self, nums: List[int]) -> int:
nums = sorted(nums)
if len(nums) % 2 == 1:
mid = nums[len(nums) // 2]
else:
mid = (nums[len(nums) // 2] + nums[len(nums) // 2 - 1]) ... | class Solution:
def min_moves2(self, nums: List[int]) -> int:
nums = sorted(nums)
if len(nums) % 2 == 1:
mid = nums[len(nums) // 2]
else:
mid = (nums[len(nums) // 2] + nums[len(nums) // 2 - 1]) // 2
res = 0
for num in nums:
res += abs(num ... |
guests = ["sam","mike","darren"]
for i in range(len(guests)):
print("Hello, "+guests[i].title()+" you are invited to dinner")
print(" ")
print(guests[0]+" cant make it to dinner unfortunately")
guests[0] = "alicia"
for i in range(len(guests)):
print("Hello, "+guests[i].title()+" you are invited to di... | guests = ['sam', 'mike', 'darren']
for i in range(len(guests)):
print('Hello, ' + guests[i].title() + ' you are invited to dinner')
print(' ')
print(guests[0] + ' cant make it to dinner unfortunately')
guests[0] = 'alicia'
for i in range(len(guests)):
print('Hello, ' + guests[i].title() + ' you are invited to d... |
__all__=[
'SG_disease',
'SG_weather',
'MY_dengue',
'MY_malaria',
'BN_disease',
'ID_malaria',
'PH_malaria',
'TH_disease',
'apps_who_int',
'wunderground'
] | __all__ = ['SG_disease', 'SG_weather', 'MY_dengue', 'MY_malaria', 'BN_disease', 'ID_malaria', 'PH_malaria', 'TH_disease', 'apps_who_int', 'wunderground'] |
while True:
usr = input("Enter username: ")
with open("users.txt", "r") as file:
users = file.readlines()
users = [i.strip("\n") for i in users]
if usr in users:
print("Username exists")
continue
else:
print("Username is fine")
break
while Tru... | while True:
usr = input('Enter username: ')
with open('users.txt', 'r') as file:
users = file.readlines()
users = [i.strip('\n') for i in users]
if usr in users:
print('Username exists')
continue
else:
print('Username is fine')
break
while True:
notes ... |
def set_default_values(args, also_hyper_params=True):
# -set default-values for certain arguments based on chosen scenario & experiment
if args.tasks is None:
if args.experiment=='splitMNIST':
args.num_classes = 10
if args.experiment=='splitMNISToneclass':
args.num_class... | def set_default_values(args, also_hyper_params=True):
if args.tasks is None:
if args.experiment == 'splitMNIST':
args.num_classes = 10
if args.experiment == 'splitMNISToneclass':
args.num_classes = 10
elif args.experiment == 'permMNIST':
args.num_classes =... |
# coding: utf-8
class DataBatch:
def __init__(self, mxnet_module):
self._data = []
self._label = []
self.mxnet_module = mxnet_module
def append_data(self, new_data):
self._data.append(self.__as_ndarray(new_data))
def append_label(self, new_label):
self._label.appe... | class Databatch:
def __init__(self, mxnet_module):
self._data = []
self._label = []
self.mxnet_module = mxnet_module
def append_data(self, new_data):
self._data.append(self.__as_ndarray(new_data))
def append_label(self, new_label):
self._label.append(self.__as_ndar... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def maxLevelSum(self, root: TreeNode) -> int:
if root is None:
return 0
result, current = [], [root]
... | class Solution:
def max_level_sum(self, root: TreeNode) -> int:
if root is None:
return 0
(result, current) = ([], [root])
while current:
(next_level, vals) = ([], [])
for node in current:
vals.append(node.val)
if node.left... |
class Registry(dict):
def __init__(self, *args, **kwargs):
super(Registry, self).__init__(*args, **kwargs)
def register(self, module_name):
def register_fn(module):
assert module_name not in self
self[module_name] = module
return module
return regist... | class Registry(dict):
def __init__(self, *args, **kwargs):
super(Registry, self).__init__(*args, **kwargs)
def register(self, module_name):
def register_fn(module):
assert module_name not in self
self[module_name] = module
return module
return regis... |
def findCandidate(A):
maj_index = 0
count = 1
for i in range(len(A)):
if A[maj_index] == A[i]: count += 1
else: count -= 1
if count == 0: maj_index, count = i, 1
return A[maj_index]
def isMajority(A, cand, k):
count = 0
for i in range(len(A)):
if A[i] == ... | def find_candidate(A):
maj_index = 0
count = 1
for i in range(len(A)):
if A[maj_index] == A[i]:
count += 1
else:
count -= 1
if count == 0:
(maj_index, count) = (i, 1)
return A[maj_index]
def is_majority(A, cand, k):
count = 0
for i in ... |
# unihernandez22
# https://atcoder.jp/contests/abc159/tasks/abc159_a
# math
print(sum(map(lambda i: int(i)*(int(i)-1)//2, input().split())))
| print(sum(map(lambda i: int(i) * (int(i) - 1) // 2, input().split()))) |
# define a function that display the output heading
def output_heading():
print('Programmer: Emily')
print('Course: COSC146')
print('Lab#: 0')
print('Due Date: 02-19-2019')
#define a function that takes a number and returns that number + 10
def plus10(value):
... | def output_heading():
print('Programmer: Emily')
print('Course: COSC146')
print('Lab#: 0')
print('Due Date: 02-19-2019')
def plus10(value):
value = value + 10
return value
output_heading()
print(plus10(1000))
def sumoftwo(x, y):
return x + y
print(su... |
class Codec:
url_list = []
def encode(self, longUrl):
self.url_list.append(longUrl)
return len(self.url_list) - 1
def decode(self, shortUrl):
return self.url_list[shortUrl]
if __name__ == '__main__':
codec = Codec()
print(codec.decode(codec.encode('xxxxx')))
print(c... | class Codec:
url_list = []
def encode(self, longUrl):
self.url_list.append(longUrl)
return len(self.url_list) - 1
def decode(self, shortUrl):
return self.url_list[shortUrl]
if __name__ == '__main__':
codec = codec()
print(codec.decode(codec.encode('xxxxx')))
print(codec... |
class BaseEndpoint():
def __repr__(self):
return f'<metrics.tools Endpoint [{self.endpoint}]>'
if __name__ == '__main__':
pass | class Baseendpoint:
def __repr__(self):
return f'<metrics.tools Endpoint [{self.endpoint}]>'
if __name__ == '__main__':
pass |
s = input()
start = s.find('A')
stop = s.rfind('Z')
print(stop - start + 1)
| s = input()
start = s.find('A')
stop = s.rfind('Z')
print(stop - start + 1) |
# ~autogen spec_version
spec_version = "spec: 0.9.3-pre-r2, kernel: v3.16.7-ckt16-7-ev3dev-ev3"
# ~autogen
| spec_version = 'spec: 0.9.3-pre-r2, kernel: v3.16.7-ckt16-7-ev3dev-ev3' |
def sol():
N = int(input())
string = input()
count = 0
while N > 0:
count += int(string[N - 1])
N -= 1
print(count)
if __name__ == "__main__":
sol()
| def sol():
n = int(input())
string = input()
count = 0
while N > 0:
count += int(string[N - 1])
n -= 1
print(count)
if __name__ == '__main__':
sol() |
# list
a = 'orange'
print(a[::-1])
print(a[1:4:2])
b = [1,2,3,34,5, 1]
print(b.count(1))
| a = 'orange'
print(a[::-1])
print(a[1:4:2])
b = [1, 2, 3, 34, 5, 1]
print(b.count(1)) |
N = int(input())
A, B = map(int, input().split())
counts = [0, 0, 0]
P = map(int, input().split())
for p in P:
if p <= A:
counts[0] += 1
elif p <= B:
counts[1] += 1
else:
counts[2] += 1
print(min(counts))
| n = int(input())
(a, b) = map(int, input().split())
counts = [0, 0, 0]
p = map(int, input().split())
for p in P:
if p <= A:
counts[0] += 1
elif p <= B:
counts[1] += 1
else:
counts[2] += 1
print(min(counts)) |
#!/bin/python3
print("Status: 200")
print("Content-Type: text/plain")
print()
print("Hello World!")
| print('Status: 200')
print('Content-Type: text/plain')
print()
print('Hello World!') |
color = {
"black":(0, 0, 0, 255), "white":(255, 255, 255, 255),
"red":(255, 0, 0, 255), "green":(0, 255, 0, 255),
"blue":(0, 0, 255, 255), "yellow":(255, 255, 0, 255),
"cyan":(0, 255, 255, 255), "magenta":(255, 0, 255, 255),
"silver":(192, 192, 192, 255), "gray":(128, 128, 128, 255),
"maroon":(1... | color = {'black': (0, 0, 0, 255), 'white': (255, 255, 255, 255), 'red': (255, 0, 0, 255), 'green': (0, 255, 0, 255), 'blue': (0, 0, 255, 255), 'yellow': (255, 255, 0, 255), 'cyan': (0, 255, 255, 255), 'magenta': (255, 0, 255, 255), 'silver': (192, 192, 192, 255), 'gray': (128, 128, 128, 255), 'maroon': (128, 0, 0, 255)... |
_base_ = [
'../_base_/models/fast_scnn.py', '../_base_/datasets/pascal_escroom.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
# Re-config the data sampler.
data = dict(samples_per_gpu=2, workers_per_gpu=4)
# Re-config the optimizer.
optimizer = dict(type='SGD', lr=0.12, momentum... | _base_ = ['../_base_/models/fast_scnn.py', '../_base_/datasets/pascal_escroom.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py']
data = dict(samples_per_gpu=2, workers_per_gpu=4)
optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-05)
checkpoint_config = dict(by_epoch=False, in... |
NBA_GAME_TIME = 48
def nba_extrap(points_per_game: float, minutes_per_game: float) -> float:
if minutes_per_game < 0.001:
return 0.0
else:
return round(points_per_game/minutes_per_game * NBA_GAME_TIME, 1) | nba_game_time = 48
def nba_extrap(points_per_game: float, minutes_per_game: float) -> float:
if minutes_per_game < 0.001:
return 0.0
else:
return round(points_per_game / minutes_per_game * NBA_GAME_TIME, 1) |
#!/usr/bin/env python3
# Common physical "constants"
# Universal gas constant (J/K/mol)
R_gas = 8.3144598
# "Standard gravity": rate of gravitational acceleration at Earth's surface (m/s2)
g0 = 9.80665
# Avogadro's number (molec/mol)
avog = 6.022140857e23
# Molar mass of dry air (g/mol)
MW_air = 28.97
# Radius o... | r_gas = 8.3144598
g0 = 9.80665
avog = 6.022140857e+23
mw_air = 28.97
r_earth = 6375000.0 |
def check_palindrome(str):
return str == str[::-1]
print(check_palindrome('palpa'))
print(check_palindrome('radar')) | def check_palindrome(str):
return str == str[::-1]
print(check_palindrome('palpa'))
print(check_palindrome('radar')) |
def write(_text):
return 0
def flush():
pass
def _emit_ansi_escape(_=''):
def inner(_=None):
pass
return inner
clear_line = _emit_ansi_escape()
clear_end = _emit_ansi_escape()
hide_cursor = _emit_ansi_escape()
show_cursor = _emit_ansi_escape()
factory_cursor_up = lambda _: _emit_ansi_esca... | def write(_text):
return 0
def flush():
pass
def _emit_ansi_escape(_=''):
def inner(_=None):
pass
return inner
clear_line = _emit_ansi_escape()
clear_end = _emit_ansi_escape()
hide_cursor = _emit_ansi_escape()
show_cursor = _emit_ansi_escape()
factory_cursor_up = lambda _: _emit_ansi_escape()... |
fibona = 89
anterior = 34
while fibona > 0:
print(fibona)
fibona -= anterior
anterior = fibona - anterior
if fibona == 0:
print(fibona) | fibona = 89
anterior = 34
while fibona > 0:
print(fibona)
fibona -= anterior
anterior = fibona - anterior
if fibona == 0:
print(fibona) |
def search(blocking, requester, task, keyword, tty_mode):
# the result of the task the hub thread submitted to us
# will not be available right now
task.set_async()
blocking.search_image(requester, task.return_result, keyword, tty_mode)
| def search(blocking, requester, task, keyword, tty_mode):
task.set_async()
blocking.search_image(requester, task.return_result, keyword, tty_mode) |
class Solution:
def getRow(self, rowIndex: int) -> List[int]:
n=rowIndex
if n==0:
return [1]
if n==1:
return [1,1]
arr=[[1],[1,1]]
k=1
for i in range(2,n+1):
arr.append([])
arr[i].append(1)
for j in range(1,k... | class Solution:
def get_row(self, rowIndex: int) -> List[int]:
n = rowIndex
if n == 0:
return [1]
if n == 1:
return [1, 1]
arr = [[1], [1, 1]]
k = 1
for i in range(2, n + 1):
arr.append([])
arr[i].append(1)
... |
def kangaroo(x1, v1, x2, v2):
while (True):
if (x2 > x1 and v2 >= v1) or (x2 < x1 and v2 <= v1):
print('NO')
return 'NO'
x1 += v1
x2 += v2
if x1 == x2:
print('YES')
return 'YES' | def kangaroo(x1, v1, x2, v2):
while True:
if x2 > x1 and v2 >= v1 or (x2 < x1 and v2 <= v1):
print('NO')
return 'NO'
x1 += v1
x2 += v2
if x1 == x2:
print('YES')
return 'YES' |
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
nums.sort()
result = float("inf")
for i in range(len(nums) - 2):
l, r = i + 1, len(nums) - 1
while l < r:
s = nums[i] + nums[l] + nums[r]
if s == target:
... | class Solution:
def three_sum_closest(self, nums: List[int], target: int) -> int:
nums.sort()
result = float('inf')
for i in range(len(nums) - 2):
(l, r) = (i + 1, len(nums) - 1)
while l < r:
s = nums[i] + nums[l] + nums[r]
if s == tar... |
print("Hours in a year =")
print(24*365)
print("Minutes in a decade =")
print(60*24*365*10)
print("My age in seconds =")
print((365*27+6+2+31+30+31+30+16)*24*1440)
print("Andreea's age =")
print(48618000/(365*24*1440))
print("?!")
print(1<<2)
# ** = ^
# << = bitshift
# % = modulus
print('Hello world')
print('')
p... | print('Hours in a year =')
print(24 * 365)
print('Minutes in a decade =')
print(60 * 24 * 365 * 10)
print('My age in seconds =')
print((365 * 27 + 6 + 2 + 31 + 30 + 31 + 30 + 16) * 24 * 1440)
print("Andreea's age =")
print(48618000 / (365 * 24 * 1440))
print('?!')
print(1 << 2)
print('Hello world')
print('')
print('Goo... |
terminalfont = {
"width": 6,
"height": 8,
"start": 32,
"end": 127,
"data": bytearray([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x5F, 0x06, 0x00,
0x00, 0x07, 0x03, 0x00, 0x07, 0x03,
0x00, 0x24, 0x7E, 0x24, 0x7E, 0x24,
0x00, 0x24, 0x2B, 0x6A, 0x12, 0x00,
0x00, 0x63, 0x13, 0x08, 0x64, 0x63,
0x00, 0x36, 0x49,... | terminalfont = {'width': 6, 'height': 8, 'start': 32, 'end': 127, 'data': bytearray([0, 0, 0, 0, 0, 0, 0, 0, 6, 95, 6, 0, 0, 7, 3, 0, 7, 3, 0, 36, 126, 36, 126, 36, 0, 36, 43, 106, 18, 0, 0, 99, 19, 8, 100, 99, 0, 54, 73, 86, 32, 80, 0, 0, 7, 3, 0, 0, 0, 0, 62, 65, 0, 0, 0, 0, 65, 62, 0, 0, 0, 8, 62, 28, 62, 8, 0, 8, 8... |
# Einfache Rechenoperationen
# Addition und Subtraktion
1 + 2
1 - 2
# Multiplikation und Division
1 * 2
1 / 2
# Rechenregeln
(1 + 2) * 3
1 + 2 * 3
print("Hello World!") | 1 + 2
1 - 2
1 * 2
1 / 2
(1 + 2) * 3
1 + 2 * 3
print('Hello World!') |
def build_model_filters(model, query, field):
filters = []
if query:
# The field exists as an exposed column
if model.__mapper__.has_property(field):
filters.append(getattr(model, field).like("%{}%".format(query)))
return filters
| def build_model_filters(model, query, field):
filters = []
if query:
if model.__mapper__.has_property(field):
filters.append(getattr(model, field).like('%{}%'.format(query)))
return filters |
count=0
num=336
for i in range(2,num+1):
while num%i==0:
num=num//i
if i == 2:
count=count+1
print(count)
'''
num=32546845
count=0
while num>0:
digit=num%10
num=num//10
if digit%2==0:
count=count+1
print(count)
'''
'''
count=0
for i in range(1,101):
while i%5==... | count = 0
num = 336
for i in range(2, num + 1):
while num % i == 0:
num = num // i
if i == 2:
count = count + 1
print(count)
'\nnum=32546845\ncount=0\nwhile num>0:\n digit=num%10\n num=num//10\n if digit%2==0:\n count=count+1\nprint(count)\n'
'\ncount=0\nfor i in range(1,... |
n=int(input())
for i in range(n):
D = dict()
for j in range(ord('a'),ord('z')+1):
D[j] = 0
a=input()
a=a.lower()
for j in a:
if ord('a') <= ord(j) <=ord('z'):
D[ord(j)] += 1
num = min(D.values())
print("Case {}:".format(i+1),end=" ")
if num == 0:
... | n = int(input())
for i in range(n):
d = dict()
for j in range(ord('a'), ord('z') + 1):
D[j] = 0
a = input()
a = a.lower()
for j in a:
if ord('a') <= ord(j) <= ord('z'):
D[ord(j)] += 1
num = min(D.values())
print('Case {}:'.format(i + 1), end=' ')
if num == 0:
... |
GAME_RESET = "on_reset"
GOAL_SCORED = "on_goal_scored"
START_PENALTY = "on_penalty_start"
END_PENALTY = "on_penalty_end"
| game_reset = 'on_reset'
goal_scored = 'on_goal_scored'
start_penalty = 'on_penalty_start'
end_penalty = 'on_penalty_end' |
array = [1,2,3,4]
result = [24,12,8,6]
def product_except_itself_2(nums):
output = []
L = []
R = []
temp = 1
for x in nums:
L.append(temp)
temp = temp * x
temp = 1
for y in nums[::-1]:
R.append(temp)
temp = temp * y
for i in range(len(R)):
ou... | array = [1, 2, 3, 4]
result = [24, 12, 8, 6]
def product_except_itself_2(nums):
output = []
l = []
r = []
temp = 1
for x in nums:
L.append(temp)
temp = temp * x
temp = 1
for y in nums[::-1]:
R.append(temp)
temp = temp * y
for i in range(len(R)):
o... |
# UUU F CUU L AUU I GUU V
# UUC F CUC L AUC I GUC V
# UUA L CUA L AUA I GUA V
# UUG L CUG L AUG M GUG V
# UCU S CCU P ACU T GCU A
# UCC S CCC P ACC T GCC A
# UCA S CCA P ACA T GCA A
# UCG S CCG P ACG T ... | lookup = {'UUU': 'F', 'CUU': 'L', 'AUU': 'I', 'GUU': 'V', 'UUC': 'F', 'CUC': 'L', 'AUC': 'I', 'GUC': 'V', 'UUA': 'L', 'CUA': 'L', 'AUA': 'I', 'GUA': 'V', 'UUG': 'L', 'CUG': 'L', 'AUG': 'M', 'GUG': 'V', 'UCU': 'S', 'CCU': 'P', 'ACU': 'T', 'GCU': 'A', 'UCC': 'S', 'CCC': 'P', 'ACC': 'T', 'GCC': 'A', 'UCA': 'S', 'CCA': 'P'... |
DB_PATH = 'assets/survey_data.db'
REVIEWS_PATH = 'static/files/reviews.csv'
QUESTIONS_PATH = 'static/files/questions.csv'
USER_TABLE = 'users'
STMT_USER_TABLE = f'''CREATE TABLE IF NOT EXISTS {USER_TABLE}
(netid int PRIMARY KEY, age int, internet_use int)'''
REVIEWS_TABLE = 'reviews'
STMT_REVIEWS_TA... | db_path = 'assets/survey_data.db'
reviews_path = 'static/files/reviews.csv'
questions_path = 'static/files/questions.csv'
user_table = 'users'
stmt_user_table = f'CREATE TABLE IF NOT EXISTS {USER_TABLE}\n (netid int PRIMARY KEY, age int, internet_use int)'
reviews_table = 'reviews'
stmt_reviews_table = f... |
# 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 isBalanced(self, root: TreeNode) -> bool:
if self.height(root) is None:
return False... | class Solution:
def is_balanced(self, root: TreeNode) -> bool:
if self.height(root) is None:
return False
else:
return True
def height(self, node):
if node is None:
return 0
left = self.height(node.left)
right = self.height(node.right... |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def cloc():
http_archive(
name="cloc" ,
build_file="//bazel/deps/cloc:build.BUILD" ,
sha256="da1a0de6d8ce2f4e80fa7... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def cloc():
http_archive(name='cloc', build_file='//bazel/deps/cloc:build.BUILD', sha256='da1a0de6d8ce2f4e80fa7554cf605f86d97d761b4ffd647df9b01c4658107dba', strip_prefix='cloc-90070481081b6decd9446d57a35176da3a6d8fbc', urls=['https://github.com/U... |
valid_names = ["Danilo", "Daniel", "Dani"]
class NameError(Exception): pass
def handler(event, context):
name = event.get("name",None)
if name:
if name in valid_names:
return event
else:
raise NameError("WrongName")
else:
raise NameError("NoName")
| valid_names = ['Danilo', 'Daniel', 'Dani']
class Nameerror(Exception):
pass
def handler(event, context):
name = event.get('name', None)
if name:
if name in valid_names:
return event
else:
raise name_error('WrongName')
else:
raise name_error('NoName') |
class SparseTable:
def __init__(self,array,func):
self.array = array
self.func = func
self._log = self._logPreprocess()
self.sparseTable = self._preprocess()
def _logPreprocess(self):
n = len(self.array);
_log = [0] * (n+1)
for i in range(2,n+1):
_log[i] = _log[n//2] + 1
return _log
def _pre... | class Sparsetable:
def __init__(self, array, func):
self.array = array
self.func = func
self._log = self._logPreprocess()
self.sparseTable = self._preprocess()
def _log_preprocess(self):
n = len(self.array)
_log = [0] * (n + 1)
for i in range(2, n + 1):
... |
class SampleNotMatchedError(Exception):
pass
class InvalidRangeError(Exception):
pass
| class Samplenotmatchederror(Exception):
pass
class Invalidrangeerror(Exception):
pass |
cat=int(input("Ingrese la categoria del trbajdor: "))
suel=int(input("Ingrese el sueldo bruto del trabajador: "))
if(cat==1):
suelt1=suel* 0.10
suelt= suelt1+suel
print("Categoria: " +str(cat))
print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP")
elif(cat==2):
suelt1=suel* 0.15
... | cat = int(input('Ingrese la categoria del trbajdor: '))
suel = int(input('Ingrese el sueldo bruto del trabajador: '))
if cat == 1:
suelt1 = suel * 0.1
suelt = suelt1 + suel
print('Categoria: ' + str(cat))
print('Susueldo bruto con aumento es de: {:.0f}'.format(suelt), ' COP')
elif cat == 2:
suelt1 =... |
Train_0 = ['P26', 'P183', 'P89', 'P123', 'P61', 'P112', 'P63', 'P184', 'P100', 'P11', 'P111', 'P28', 'P192', 'P35',
'P27', 'P113', 'P33', 'P17', 'P126', 'P176', 'P46', 'P44', 'P137', 'P13', 'P74', 'P134', 'P128', 'P0',
'P157', 'P161', 'P163', 'P38', 'P190', 'P12', 'P115', 'P122', 'P144', 'P15', 'P... | train_0 = ['P26', 'P183', 'P89', 'P123', 'P61', 'P112', 'P63', 'P184', 'P100', 'P11', 'P111', 'P28', 'P192', 'P35', 'P27', 'P113', 'P33', 'P17', 'P126', 'P176', 'P46', 'P44', 'P137', 'P13', 'P74', 'P134', 'P128', 'P0', 'P157', 'P161', 'P163', 'P38', 'P190', 'P12', 'P115', 'P122', 'P144', 'P15', 'P154', 'P48', 'P187', '... |
def registry_metaclass(storage):
class RegistryMeta(type):
def __init__(cls, name, bases, attrs):
super(RegistryMeta, cls).__init__(name, bases, attrs)
id = getattr(cls, 'id', None)
if not id:
return
if id in storage:
raise Ke... | def registry_metaclass(storage):
class Registrymeta(type):
def __init__(cls, name, bases, attrs):
super(RegistryMeta, cls).__init__(name, bases, attrs)
id = getattr(cls, 'id', None)
if not id:
return
if id in storage:
raise ke... |
class Solution:
def findSubstringInWraproundString(self, p):
res, l = {i: 1 for i in p}, 1
for i, j in zip(p, p[1:]):
l = l + 1 if (ord(j) - ord(i)) % 26 == 1 else 1
res[j] = max(res[j], l)
return sum(res.values()) | class Solution:
def find_substring_in_wrapround_string(self, p):
(res, l) = ({i: 1 for i in p}, 1)
for (i, j) in zip(p, p[1:]):
l = l + 1 if (ord(j) - ord(i)) % 26 == 1 else 1
res[j] = max(res[j], l)
return sum(res.values()) |
def return_decoded_value(value):
if type(value) is bytes:
value = value.decode('utf-8')
elif type(value) is not str:
value = value.decode("ascii", "ignore")
else:
value = value
return value.strip('\r\n')
| def return_decoded_value(value):
if type(value) is bytes:
value = value.decode('utf-8')
elif type(value) is not str:
value = value.decode('ascii', 'ignore')
else:
value = value
return value.strip('\r\n') |
f=open("input.txt")
Input = f.read().split("\n")
f.close()
x=0
y=0
count=0
while(y < len(Input)):
count += Input[y][x%len(Input[0])] == "#"
x += 3
y += 1
print(count)
| f = open('input.txt')
input = f.read().split('\n')
f.close()
x = 0
y = 0
count = 0
while y < len(Input):
count += Input[y][x % len(Input[0])] == '#'
x += 3
y += 1
print(count) |
# https://www.codewars.com/kata/52fba66badcd10859f00097e
def disemvowel(str):
return "".join(filter(lambda c: c not in "aeiouAEIOU", str))
print(disemvowel("This website is for losers LOL!"))
| def disemvowel(str):
return ''.join(filter(lambda c: c not in 'aeiouAEIOU', str))
print(disemvowel('This website is for losers LOL!')) |
def doSomethingWithString(str):
print(" Input is "+str, end = '\n')
split = str.split(" ")
print(split)
split.pop(2)
print(split)
def secondFun():
s = [10,20]
x = [20,30]
return s, x
x = 10
y = 11.2
dict = {1:'Alfa', 2:'Beta'}
k = "A sample approach"
doSomethingWithString(k)
x, y = s... | def do_something_with_string(str):
print(' Input is ' + str, end='\n')
split = str.split(' ')
print(split)
split.pop(2)
print(split)
def second_fun():
s = [10, 20]
x = [20, 30]
return (s, x)
x = 10
y = 11.2
dict = {1: 'Alfa', 2: 'Beta'}
k = 'A sample approach'
do_something_with_string(k... |
# If you want to print something customized in your terminal
# Use my custom color and fonts styles in order to print wyw
# Refer to it with this kind of formation and formulation:
# Example:
# customization.color.BOLD + "String" + customization.color.END
class Colors:
# String to purple color
PURPLE = '\033[9... | class Colors:
purple = '\x1b[95m'
cyan = '\x1b[96m'
darkcyan = '\x1b[36m'
blue = '\x1b[94m'
green = '\x1b[92m'
yellow = '\x1b[93m'
red = '\x1b[91m'
bold = '\x1b[1m'
underline = '\x1b[4m'
end = '\x1b[0m' |
with open('DOCKER_VERSION') as f:
version = f.read()
with open('DOCKER_VERSION', 'w') as f:
major, minor, patch = version.split('.')
patch = int(patch) + 1
f.write('{}.{}.{}\n'.format(major, minor, patch))
| with open('DOCKER_VERSION') as f:
version = f.read()
with open('DOCKER_VERSION', 'w') as f:
(major, minor, patch) = version.split('.')
patch = int(patch) + 1
f.write('{}.{}.{}\n'.format(major, minor, patch)) |
'''
Created on Feb 8, 2017
@author: PJ
'''
class TempRetrofillSrFromOfficialResults:
def populate_sr(self, **kargs):
return kargs
def save_sr(self, score_result_type, match, team, **kargs):
sr_search = score_result_type.objects.filter(match=match, team=team)
if len(sr_search) == 0... | """
Created on Feb 8, 2017
@author: PJ
"""
class Tempretrofillsrfromofficialresults:
def populate_sr(self, **kargs):
return kargs
def save_sr(self, score_result_type, match, team, **kargs):
sr_search = score_result_type.objects.filter(match=match, team=team)
if len(sr_search) == 0:
... |
lista = []
pares = []
impar = []
for i in range(20):
lista.append(int(input("Digite um numero: ")))
for i in lista:
if i % 2 == 0:
pares.append(i)
else:
impar.append(i)
print(f"Lista = {lista}")
print(f"Pares = {pares}")
print(f"impar = {impar}") | lista = []
pares = []
impar = []
for i in range(20):
lista.append(int(input('Digite um numero: ')))
for i in lista:
if i % 2 == 0:
pares.append(i)
else:
impar.append(i)
print(f'Lista = {lista}')
print(f'Pares = {pares}')
print(f'impar = {impar}') |
#list of group members
#MATSIKO BRUNO 2020/BSE/165/PS
#DAVID NYAMUTALE 2020/BSE/057/PS
#MAWANDA DENNIS 2020/BSE/155/PS
#AKANDWANAHO NICKSON 2020/BSE/006/PS
# strt with an empty list
list_of_items_to_capture = []
#create a loop for capturing values
random_number = 1
while random_number == 1:
inputedV... | list_of_items_to_capture = []
random_number = 1
while random_number == 1:
inputed_value = input('enter values, else enter done\n')
if len(inputedValue) == 0:
print('bad data')
elif inputedValue.lower() == 'done':
random_number = 2
else:
try:
inputed_value = float(inp... |
class TrieNode:
def __init__(self):
self.val = None
self.children = [None] * 26
class MapSum:
def __init__(self):
self.root = TrieNode()
def insert(self, key: str, val: int) -> None:
p = self.root
for c in key:
offset_c = ord(c) - 97
... | class Trienode:
def __init__(self):
self.val = None
self.children = [None] * 26
class Mapsum:
def __init__(self):
self.root = trie_node()
def insert(self, key: str, val: int) -> None:
p = self.root
for c in key:
offset_c = ord(c) - 97
if no... |
# Created from ttf-fonts/Entypo.otf with freetype-generator.
# freetype-generator created by Meurisse D ( MCHobby.be ).
Entypo_23 = {
'width' : 0x16,
'height' : 0x17,
33:( 0x800000, 0x980000, 0xbc0000, 0xbe0000, 0xbe0000, 0xbc0000, 0xbc0000, 0x9c0000, 0x9e0000, 0x8f0000, 0x8f8000, 0x87c600, 0x83ef00, 0x81ff80, 0x807f8... | entypo_23 = {'width': 22, 'height': 23, 33: (8388608, 9961472, 12320768, 12451840, 12451840, 12320768, 12320768, 10223616, 10354688, 9371648, 9404416, 8898048, 8646400, 8519552, 8421248, 8404864, 8392448, 8388608), 34: (12582904, 16777212, 16252956, 16252956, 16252956, 13107228, 13107228, 16252956, 16252956, 16252956, ... |
def value_matcher(value):
if value.type.tag == "rat64": return Rat64Printer(value)
return None
class Rat64Printer(object):
def __init__(self, value):
self.value = value
def to_string(self):
numerator = self.value["numerator"]
denominator = self.value["denominator"]
return str(numerator) + "/" +... | def value_matcher(value):
if value.type.tag == 'rat64':
return rat64_printer(value)
return None
class Rat64Printer(object):
def __init__(self, value):
self.value = value
def to_string(self):
numerator = self.value['numerator']
denominator = self.value['denominator']
... |
def fn():
print('Generate cache')
cache = {}
def get_from_cache(key):
res = cache.get(key)
if res:
print('From cache')
return res
else:
print('Calculate and save')
res = 'value ' + str(key)
cache[key] = res
return get_fr... | def fn():
print('Generate cache')
cache = {}
def get_from_cache(key):
res = cache.get(key)
if res:
print('From cache')
return res
else:
print('Calculate and save')
res = 'value ' + str(key)
cache[key] = res
return get_f... |
def __get_ints(line: str) -> list[int]:
strings = line.strip().split(' ')
return list(map(lambda x: int(x), strings))
def read_case_from_file(file_path: str) -> tuple[list[int], list[int]]:
with open(file_path, 'r') as file:
lines = file.readlines()
assert len(lines) == 4
ranks = ... | def __get_ints(line: str) -> list[int]:
strings = line.strip().split(' ')
return list(map(lambda x: int(x), strings))
def read_case_from_file(file_path: str) -> tuple[list[int], list[int]]:
with open(file_path, 'r') as file:
lines = file.readlines()
assert len(lines) == 4
ranks = __... |
#
# PySNMP MIB module CMM4-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CMM4-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18: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, 09:23:1... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ... |
# ----------------------------------------------------------------------------
# Copyright (c) 2022, Franck Lejzerowicz.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------... | __version__ = '2.0' |
''' Creating a class
Created with the keyword class followed by a name,
Common practice is to make the names Pascal Casing: Example
''' | """ Creating a class
Created with the keyword class followed by a name,
Common practice is to make the names Pascal Casing: Example
""" |
__all__ = [
"accuracy",
"confusion_matrix",
"multi_class_acc",
"top_k_svm",
"microf1",
"macrof1",
]
| __all__ = ['accuracy', 'confusion_matrix', 'multi_class_acc', 'top_k_svm', 'microf1', 'macrof1'] |
def add_native_methods(clazz):
def init__java_lang_String__boolean__(a0, a1):
raise NotImplementedError()
def indicateMechs____():
raise NotImplementedError()
def inquireNamesForMech____(a0):
raise NotImplementedError()
def releaseName__long__(a0, a1):
raise NotImpleme... | def add_native_methods(clazz):
def init__java_lang__string__boolean__(a0, a1):
raise not_implemented_error()
def indicate_mechs____():
raise not_implemented_error()
def inquire_names_for_mech____(a0):
raise not_implemented_error()
def release_name__long__(a0, a1):
rai... |
class PyVeeException(Exception):
pass
class InvalidAddressException(PyVeeException):
pass
class InvalidParameterException(PyVeeException):
pass
class MissingPrivateKeyException(PyVeeException):
pass
class MissingPublicKeyException(PyVeeException):
pass
class MissingAddressException(PyVeeEx... | class Pyveeexception(Exception):
pass
class Invalidaddressexception(PyVeeException):
pass
class Invalidparameterexception(PyVeeException):
pass
class Missingprivatekeyexception(PyVeeException):
pass
class Missingpublickeyexception(PyVeeException):
pass
class Missingaddressexception(PyVeeExcepti... |
# test builtin type
print(type(int))
try:
type()
except TypeError:
print('TypeError')
try:
type(1, 2)
except TypeError:
print('TypeError')
# second arg should be a tuple
try:
type('abc', None, None)
except TypeError:
print('TypeError')
# third arg should be a dict
try:
type('abc', (), N... | print(type(int))
try:
type()
except TypeError:
print('TypeError')
try:
type(1, 2)
except TypeError:
print('TypeError')
try:
type('abc', None, None)
except TypeError:
print('TypeError')
try:
type('abc', (), None)
except TypeError:
print('TypeError')
try:
type('abc', (1,), {})
except T... |
indexes = [(row, col) for row in range(5) for col in range(5)]
class Board:
def __init__(self, board: list[list[tuple[int, bool]]]) -> None:
self.board = board
self.done = False
def set(self, n: int):
if self.done:
return True
for row, col in indexes:
... | indexes = [(row, col) for row in range(5) for col in range(5)]
class Board:
def __init__(self, board: list[list[tuple[int, bool]]]) -> None:
self.board = board
self.done = False
def set(self, n: int):
if self.done:
return True
for (row, col) in indexes:
... |
#annapolis
latitude = 38.9784
# longitude = -76.4922
longitude = 283.5078
height = 13 | latitude = 38.9784
longitude = 283.5078
height = 13 |
# C++ implementation to convert the
# given BST to Min Heap
# structure of a node of BST
class Node:
# Constructor to create a new node
def __init__(self, data):
self.data = data
self.left = None
self.right = None
# function for the inorder traversal
# of the tree so as to store the node
# values in 'arr' in... | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def inorder_traversal(root, arr):
if root == None:
return
inorder_traversal(root.left, arr)
arr.append(root.data)
inorder_traversal(root.right, arr)
def bst_to_min_heap(root, ... |
#!/usr/bin/env python
# coding: utf-8
# In[34]:
def test():
print
test()
class Testing:
def test():
print("hello")
Testing.test()
a = bool(input("enter the value: "))
if (a==False):
print("Please enter some input")
print(a)
# scope of variables
# In[ ]:
| def test():
print
test()
class Testing:
def test():
print('hello')
Testing.test()
a = bool(input('enter the value: '))
if a == False:
print('Please enter some input')
print(a) |
frase = input("Dime una frase: ")
letra = input("Dime una letra que quieres que te busque: ")
index = 0
contador = 0
while(index < len(frase)):
if(frase[index].lower() == letra.lower()):
contador += 1
index += 1
print(f"La letra {letra} aparece {contador} veces") | frase = input('Dime una frase: ')
letra = input('Dime una letra que quieres que te busque: ')
index = 0
contador = 0
while index < len(frase):
if frase[index].lower() == letra.lower():
contador += 1
index += 1
print(f'La letra {letra} aparece {contador} veces') |
line = input()
a, b = line.split()
a = int(a)
b = int(b)
maxi = max(a, b)
if a <= 0 and b <= 0:
print('Not a moose')
elif a == b:
print(f'Even {a + b}')
elif a != b:
print(f'Odd {maxi + maxi}')
| line = input()
(a, b) = line.split()
a = int(a)
b = int(b)
maxi = max(a, b)
if a <= 0 and b <= 0:
print('Not a moose')
elif a == b:
print(f'Even {a + b}')
elif a != b:
print(f'Odd {maxi + maxi}') |
localDockerIPP = {
"sites": [
{"site": "Local_IPP",
"auth": {"channel": None},
"execution": {
"executor": "ipp",
"container": {
"type": "docker",
"image": "parslbase_v0.1",
},
"provider": "local",
... | local_docker_ipp = {'sites': [{'site': 'Local_IPP', 'auth': {'channel': None}, 'execution': {'executor': 'ipp', 'container': {'type': 'docker', 'image': 'parslbase_v0.1'}, 'provider': 'local', 'block': {'initBlocks': 2}}}], 'globals': {'lazyErrors': True}}
local_simple_ipp = {'sites': [{'site': 'Local_IPP', 'auth': {'c... |
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
res = []
num_set = set(nums)
for i in range(1,len(nums)+1):
if i not in num_set:
res.append(i)
return res
| class Solution:
def find_disappeared_numbers(self, nums: List[int]) -> List[int]:
res = []
num_set = set(nums)
for i in range(1, len(nums) + 1):
if i not in num_set:
res.append(i)
return res |
#create a program that asks the user submit text repeatedly
#The program will exit when user submit CLOSE
#print the output as text file
with open('./96_file/96_file.txt', 'w') as file:
while True:
user_input = input('Enter anything (to quite- type CLOSE) : ');
if user_input == 'CLOSE':
... | with open('./96_file/96_file.txt', 'w') as file:
while True:
user_input = input('Enter anything (to quite- type CLOSE) : ')
if user_input == 'CLOSE':
break
else:
file.write(user_input + '\n') |
class AllowSenderError(Exception):
pass
class AllowAuthError(Exception):
pass
class NotEnoughPoint(Exception):
pass
class AligoError(Exception):
pass
| class Allowsendererror(Exception):
pass
class Allowautherror(Exception):
pass
class Notenoughpoint(Exception):
pass
class Aligoerror(Exception):
pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.