content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
a + b
c - d
e * f
g / h
i % j
k // l
m ** n
o | p
q & r
s ^ t
u << v
w >> x
| a + b
c - d
e * f
g / h
i % j
k // l
m ** n
o | p
q & r
s ^ t
u << v
w >> x |
def _1():
for row in range(7):
for col in range(7):
if (col==3 or row==6) or (row<3 and row+col==2):
print("*",end="")
else:
print(end=" ")
print()
| def _1():
for row in range(7):
for col in range(7):
if (col == 3 or row == 6) or (row < 3 and row + col == 2):
print('*', end='')
else:
print(end=' ')
print() |
CACHEDOPS = "cachedoperations"
SLICEBUILDERS = "slicebuilders"
GENERIC = "slicebuilder"
SUBPOPULATION = "subpopulation"
ATTACK = "attack"
AUGMENTATION = "augmentation"
TRANSFORMATION = "transformation"
CURATION = "curated"
| cachedops = 'cachedoperations'
slicebuilders = 'slicebuilders'
generic = 'slicebuilder'
subpopulation = 'subpopulation'
attack = 'attack'
augmentation = 'augmentation'
transformation = 'transformation'
curation = 'curated' |
BINANCE_SUPPORTED_QUOTE_ASSET = {
'BTC',
'ETH',
'USDT',
'BNB'
}
class SupportedQuoteAsset:
@staticmethod
def getQuoteAsset(symbol, supportedAssetMap):
for val in supportedAssetMap:
if symbol.endswith(val):
return val
return None | binance_supported_quote_asset = {'BTC', 'ETH', 'USDT', 'BNB'}
class Supportedquoteasset:
@staticmethod
def get_quote_asset(symbol, supportedAssetMap):
for val in supportedAssetMap:
if symbol.endswith(val):
return val
return None |
names:{
"000000": "Black",
"000080": "Navy Blue",
"0000C8": "Dark Blue",
"0000FF": "Blue",
"000741": "Stratos",
"001B1C": "Swamp",
"002387": "Resolution Blue",
"002900": "Deep Fir",
"002E20": "Burnham",
"002FA7": "International Klein Blue",
"003153": "Prussian Blue",
"003366": "Midnight Blue",
"003399": "Smalt",
"00353... | names: {'000000': 'Black', '000080': 'Navy Blue', '0000C8': 'Dark Blue', '0000FF': 'Blue', '000741': 'Stratos', '001B1C': 'Swamp', '002387': 'Resolution Blue', '002900': 'Deep Fir', '002E20': 'Burnham', '002FA7': 'International Klein Blue', '003153': 'Prussian Blue', '003366': 'Midnight Blue', '003399': 'Smalt', '00353... |
###### Config for test
###: Variables
ggtrace_cpu = [
"data/formatted/", # pd.readfilepath
[1], # usecols trong pd
False, # multi_output
None, # output_idx
"cpu/", # path_save_result
]
ggtrace_ram = [
"data/formatted/",... | ggtrace_cpu = ['data/formatted/', [1], False, None, 'cpu/']
ggtrace_ram = ['data/formatted/', [2], False, None, 'ram/']
ggtrace_multi_cpu = ['data/formatted/', [1, 2], False, 0, 'multi_cpu/']
ggtrace_multi_ram = ['data/formatted/', [1, 2], False, 1, 'multi_ram/']
giang1 = ['data/formatted/giang/', [3], False, None, 'gi... |
competitor1 = int(input())
competitor2 = int(input())
competitor3 = int(input())
sum_sec = competitor1 + competitor2 + competitor3
minutes = sum_sec // 60
sec = sum_sec % 60
if sec < 10:
print(f"{minutes}:0{sec}")
else:
print(f"{minutes}:{sec}") | competitor1 = int(input())
competitor2 = int(input())
competitor3 = int(input())
sum_sec = competitor1 + competitor2 + competitor3
minutes = sum_sec // 60
sec = sum_sec % 60
if sec < 10:
print(f'{minutes}:0{sec}')
else:
print(f'{minutes}:{sec}') |
class Solution:
def toLowerCase(self, string):
return string.lower()
| class Solution:
def to_lower_case(self, string):
return string.lower() |
# Rouge Highlighter token test - Generic Traceback
def test():
print(unknown_test_var)
test()
| def test():
print(unknown_test_var)
test() |
# err_raise.py
def foo(s):
n = int(s)
if n == 0:
raise ValueError('invalid value: %s' % s)
return 10 / n
def bar():
try:
foo('0')
except ValueError as e:
print('ValueError!')
bar()
| def foo(s):
n = int(s)
if n == 0:
raise value_error('invalid value: %s' % s)
return 10 / n
def bar():
try:
foo('0')
except ValueError as e:
print('ValueError!')
bar() |
# -*- coding: utf-8 -*-
# @Time: 2020/4/13 18:49
# @Author: GraceKoo
# @File: 96_unique-binary-search-trees.py
# @Desc: https://leetcode-cn.com/problems/unique-binary-search-trees/
class Solution:
def numTrees(self, n: int) -> int:
if n < 0:
return 0
dp = [0 for _ in range(n + 1)]
... | class Solution:
def num_trees(self, n: int) -> int:
if n < 0:
return 0
dp = [0 for _ in range(n + 1)]
dp[0] = 1
dp[1] = 1
for i in range(2, n + 1):
for j in range(i):
dp[i] += dp[j] * dp[i - j - 1]
return dp[-1]
so = solution()... |
class Load:
elapsedTime = 0
powerUsage = 0.0
csvName = ""
id = 0
isBackgroundLoad = None
def __init__(self, elapsed_time, power_usage, csv_path):
self.elapsedTime = int(elapsed_time)
self.powerUsage = float(power_usage)
self.csvName = csv_path.split("\\")[-1] # csvNa... | class Load:
elapsed_time = 0
power_usage = 0.0
csv_name = ''
id = 0
is_background_load = None
def __init__(self, elapsed_time, power_usage, csv_path):
self.elapsedTime = int(elapsed_time)
self.powerUsage = float(power_usage)
self.csvName = csv_path.split('\\')[-1]
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2019 Dontnod Entertainment
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use,... | """ Nimp subcommands declarations """
__all__ = ['build', 'check', 'commandlet', 'dev', 'download_fileset', 'fileset', 'p4', 'package', 'run', 'symbol_server', 'update_symbol_server', 'upload', 'upload_fileset'] |
def count1(x):
count = 0
for i in range(len(x)):
if x[i:i + 2] == 'ba':
count += 1
return count
def main():
print(count1('baba'))
print(count1('aba'))
print(count1('baaabab'))
print(count1('abc'))
print(count1('goodbye'))
print(count1('a'))
print(count1('ba'... | def count1(x):
count = 0
for i in range(len(x)):
if x[i:i + 2] == 'ba':
count += 1
return count
def main():
print(count1('baba'))
print(count1('aba'))
print(count1('baaabab'))
print(count1('abc'))
print(count1('goodbye'))
print(count1('a'))
print(count1('ba')... |
_SERVICES = ["xcube_gen", "xcube_serve", "xcube_geodb"]
def get_services():
return _SERVICES
| _services = ['xcube_gen', 'xcube_serve', 'xcube_geodb']
def get_services():
return _SERVICES |
def min_fee(print_page_list):
sum_ = 0
prev = 0
for i in sorted(print_page_list):
sum_ += (prev + i)
prev += i
return sum_
if __name__ == "__main__":
print(min_fee([6, 11, 4, 1]))
print(min_fee([3, 2, 1]))
print(min_fee([3, 1, 4, 3, 2]))
print(min_fee([8, 4, 2, 3, 9, 23... | def min_fee(print_page_list):
sum_ = 0
prev = 0
for i in sorted(print_page_list):
sum_ += prev + i
prev += i
return sum_
if __name__ == '__main__':
print(min_fee([6, 11, 4, 1]))
print(min_fee([3, 2, 1]))
print(min_fee([3, 1, 4, 3, 2]))
print(min_fee([8, 4, 2, 3, 9, 23, 6,... |
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
NUMBER_OF_POINTS = 4
POINT_WIDTH = 4.0
CIRCLE_BORDER_WIDTH = 1
SWEEP_LINE_OFFSET = 0.001 | screen_width = 640
screen_height = 480
number_of_points = 4
point_width = 4.0
circle_border_width = 1
sweep_line_offset = 0.001 |
'''
The array-form of an integer num is an array representing its digits in left to right order.
For example, for num = 1321, the array form is [1,3,2,1].
Given num, the array-form of an integer, and an integer k, return the array-form of the integer num + k.
Example 1:
Input: num = [1,2,0,0], k = 34
Output: [1,2... | """
The array-form of an integer num is an array representing its digits in left to right order.
For example, for num = 1321, the array form is [1,3,2,1].
Given num, the array-form of an integer, and an integer k, return the array-form of the integer num + k.
Example 1:
Input: num = [1,2,0,0], k = 34
Output: [1,2... |
def convert_sample_to_shot_coQA(sample, with_knowledge=None):
prefix = f"{sample['meta']}\n"
for turn in sample["dialogue"]:
prefix += f"Q: {turn[0]}" +"\n"
if turn[1] == "":
prefix += f"A:"
return prefix
else:
prefix += f"A: {turn[1]}" +"\n"
re... | def convert_sample_to_shot_co_qa(sample, with_knowledge=None):
prefix = f"{sample['meta']}\n"
for turn in sample['dialogue']:
prefix += f'Q: {turn[0]}' + '\n'
if turn[1] == '':
prefix += f'A:'
return prefix
else:
prefix += f'A: {turn[1]}' + '\n'
re... |
class File:
def criar(nomeArquivo):
nomeArquivo = input('NOME DO ARQUIVO= ')
arquivo = open(nomeArquivo,'x')
arquivo.close
def escrever(texto):
nomeArquivo = input('NOME DO ARQUIVO= ')
arquivo = open(nomeArquivo,'w')
file = File()
file.criar()
file.escrever(input()) | class File:
def criar(nomeArquivo):
nome_arquivo = input('NOME DO ARQUIVO= ')
arquivo = open(nomeArquivo, 'x')
arquivo.close
def escrever(texto):
nome_arquivo = input('NOME DO ARQUIVO= ')
arquivo = open(nomeArquivo, 'w')
file = file()
file.criar()
file.escrever(input()) |
def count_sevens(*args):
return args.count(7)
nums = [90,1,35,67,89,20,3,1,2,3,4,5,6,9,34,46,57,68,79,12,23,34,55,1,90,54,34,76,8,23,34,45,56,67,78,12,23,34,45,56,67,768,23,4,5,6,7,8,9,12,34,14,15,16,17,11,7,11,8,4,6,2,5,8,7,10,12,13,14,15,7,8,7,7,345,23,34,45,56,67,1,7,3,6,7,2,3,4,5,6,7,8,9,8,7,6,5,4,2,1,2,3,4,5,... | def count_sevens(*args):
return args.count(7)
nums = [90, 1, 35, 67, 89, 20, 3, 1, 2, 3, 4, 5, 6, 9, 34, 46, 57, 68, 79, 12, 23, 34, 55, 1, 90, 54, 34, 76, 8, 23, 34, 45, 56, 67, 78, 12, 23, 34, 45, 56, 67, 768, 23, 4, 5, 6, 7, 8, 9, 12, 34, 14, 15, 16, 17, 11, 7, 11, 8, 4, 6, 2, 5, 8, 7, 10, 12, 13, 14, 15, 7, 8, ... |
class WebSocketDefine:
# Uri = "wss://dstream.binance.com/ws"
# testnet
Uri = "wss://dstream.binancefuture.com/ws"
# testnet new spec
# Uri = "wss://sdstream.binancefuture.com/ws"
class RestApiDefine:
# Url = "https://dapi.binance.com"
# testnet
Url = "https://testnet.binanc... | class Websocketdefine:
uri = 'wss://dstream.binancefuture.com/ws'
class Restapidefine:
url = 'https://testnet.binancefuture.com' |
class NullLogger:
level_name = None
def remove(self, handler_id=None): # pragma: no cover
pass
def add(self, sink, **kwargs): # pragma: no cover
pass
def disable(self, name): # pragma: no cover
pass
def enable(self, name): # pragma: no cover
pass
def crit... | class Nulllogger:
level_name = None
def remove(self, handler_id=None):
pass
def add(self, sink, **kwargs):
pass
def disable(self, name):
pass
def enable(self, name):
pass
def critical(self, __message, *args, **kwargs):
pass
def debug(self, __mess... |
# ------------------------------------------------------------------------------
# CONFIG (Change propriately)
# ------------------------------------------------------------------------------
# Required
token = "please input"
post_channel_id = "please input"
target_days = 1 # The target range is ... | token = 'please input'
post_channel_id = 'please input'
target_days = 1
target_hours = 0
target_minutes = 0
tz_hours = +9
tz_name = 'JST'
exclude_channel_id = ['if needed, please input']
exclude_users_id = ['if needed, please input']
exclude_message_subtype = ['if needed, please input'] |
def facto(a):
fact=1
while(a>0):
fact*=a
a-=1
return fact
| def facto(a):
fact = 1
while a > 0:
fact *= a
a -= 1
return fact |
def is_prime(n: int) -> bool:
if n < 2:
return False
elif n == 2:
return True
for i in range(2, n):
if n % i == 0:
return False
return True
if __name__ == '__main__':
m = int(input())
n = int(input())
prime_sum = 0
prime_min = None
for i in rang... | def is_prime(n: int) -> bool:
if n < 2:
return False
elif n == 2:
return True
for i in range(2, n):
if n % i == 0:
return False
return True
if __name__ == '__main__':
m = int(input())
n = int(input())
prime_sum = 0
prime_min = None
for i in range(m... |
# Define variables a and b. Read values a and b from console and calculate:
# a + b
# a - b
# a * b
# a / b
# a**b.
# Output obtained results.
a = int(input("Enter the first number : "))
b = int(input("Enter the second number : "))
print(a + b)
print(a - b)
print(a * b)
print(a / b)
print(a**b)
print(a%b)
print(a... | a = int(input('Enter the first number : '))
b = int(input('Enter the second number : '))
print(a + b)
print(a - b)
print(a * b)
print(a / b)
print(a ** b)
print(a % b)
print(a // b)
print(a ** b ** a) |
def validate_pin(pin):
if pin.isdigit() and (len(str(pin)) == 4 or len(str(pin)) == 6):
return True
else:
return False; | def validate_pin(pin):
if pin.isdigit() and (len(str(pin)) == 4 or len(str(pin)) == 6):
return True
else:
return False |
class FizzBuzz():
fizz, buzz = 'Fizz', 'Buzz'
@staticmethod
def is_mod_three_true(number):
return number % 3 == 0
@staticmethod
def is_mod_five_true(number):
return number % 5 == 0
def is_mod_three_and_five_true(self, number):
return self.is_mod_five_true(number) and s... | class Fizzbuzz:
(fizz, buzz) = ('Fizz', 'Buzz')
@staticmethod
def is_mod_three_true(number):
return number % 3 == 0
@staticmethod
def is_mod_five_true(number):
return number % 5 == 0
def is_mod_three_and_five_true(self, number):
return self.is_mod_five_true(number) and... |
# https://leetcode.com/problems/find-pivot-index
class Solution:
def pivotIndex(self, nums):
if not nums:
return -1
l_sum = 0
r_sum = sum(nums) - nums[0]
if l_sum == r_sum:
return 0
for i in range(1, len(nums)):
r_sum -= nums[i]
... | class Solution:
def pivot_index(self, nums):
if not nums:
return -1
l_sum = 0
r_sum = sum(nums) - nums[0]
if l_sum == r_sum:
return 0
for i in range(1, len(nums)):
r_sum -= nums[i]
l_sum += nums[i - 1]
if r_sum == l... |
DATABASE_ENGINE = 'sqlite3'
INSTALLED_APPS = 'yui_loader',
MIDDLEWARE_CLASSES = 'yui_loader.middleware.YUIIncludeMiddleware',
ROOT_URLCONF = 'yui_loader.tests.urls'
YUI_INCLUDE_BASE = '/js/yui/'
| database_engine = 'sqlite3'
installed_apps = ('yui_loader',)
middleware_classes = ('yui_loader.middleware.YUIIncludeMiddleware',)
root_urlconf = 'yui_loader.tests.urls'
yui_include_base = '/js/yui/' |
params = {
# Train
"n_epochs": 200,
"learning_rate": 1e-4,
"adam_beta_1": 0.9,
"adam_beta_2": 0.999,
"adam_epsilon": 1e-8,
"clip_grad_value": 5.0,
"evaluate_span": 50,
"checkpoint_span": 50,
# Early-stopping
"no_improve_epochs": 50,
# Model
"model": "model-mod-8",
... | params = {'n_epochs': 200, 'learning_rate': 0.0001, 'adam_beta_1': 0.9, 'adam_beta_2': 0.999, 'adam_epsilon': 1e-08, 'clip_grad_value': 5.0, 'evaluate_span': 50, 'checkpoint_span': 50, 'no_improve_epochs': 50, 'model': 'model-mod-8', 'n_rnn_layers': 1, 'n_rnn_units': 128, 'sampling_rate': 100.0, 'input_size': 3000, 'n_... |
name = "ping"
def ping():
print("pong!")
| name = 'ping'
def ping():
print('pong!') |
'''
Problem Statement : Lapindromes
Link : https://www.codechef.com/LRNDSA01/problems/LAPIN
score : accepted
'''
for _ in range(int(input())):
string = input()
mid = len(string)//2
first_half = None
second_half = None
if len(string)%2==0:
first_half = string[:mid]
second_... | """
Problem Statement : Lapindromes
Link : https://www.codechef.com/LRNDSA01/problems/LAPIN
score : accepted
"""
for _ in range(int(input())):
string = input()
mid = len(string) // 2
first_half = None
second_half = None
if len(string) % 2 == 0:
first_half = string[:mid]
s... |
pid_yaw = rm_ctrl.PIDCtrl()
pid_pitch = rm_ctrl.PIDCtrl()
person_info = None
def start():
global person_info
global pid_yaw
global pid_pitch
global pit_chassis
robot_ctrl.set_mode(rm_define.robot_mode_chassis_follow)
# Enable person detection
vision_ctrl.enable_detection(rm_define.vision_d... | pid_yaw = rm_ctrl.PIDCtrl()
pid_pitch = rm_ctrl.PIDCtrl()
person_info = None
def start():
global person_info
global pid_yaw
global pid_pitch
global pit_chassis
robot_ctrl.set_mode(rm_define.robot_mode_chassis_follow)
vision_ctrl.enable_detection(rm_define.vision_detection_people)
chassis_ct... |
n, x, y = map(int, input().split())
a = list(map(int, input().split()))
for d, ad in enumerate(a):
inf = ad + 1
l = max(0, d - x)
l_min = min(a[l:d]) if l < d else inf
r = min(n - 1, d + y)
r_min = min(a[d + 1: r + 1]) if d < r else inf
if ad < min(l_min, r_min):
print(d + 1)
... | (n, x, y) = map(int, input().split())
a = list(map(int, input().split()))
for (d, ad) in enumerate(a):
inf = ad + 1
l = max(0, d - x)
l_min = min(a[l:d]) if l < d else inf
r = min(n - 1, d + y)
r_min = min(a[d + 1:r + 1]) if d < r else inf
if ad < min(l_min, r_min):
print(d + 1)
... |
PATH_DATA = "data/"
URI_CSV = f"{PATH_DATA}Dades_meteorol_giques_de_la_XEMA.csv"
URI_DELTA = f"{PATH_DATA}weather_data.delta"
URI_DELTA_PART = f"{PATH_DATA}weather_data_partition.delta"
URI_STATIONS = f"{PATH_DATA}Metadades_estacions_meteorol_giques_autom_tiques.csv"
URI_VARS = f"{PATH_DATA}Metadades_variables_meteo... | path_data = 'data/'
uri_csv = f'{PATH_DATA}Dades_meteorol_giques_de_la_XEMA.csv'
uri_delta = f'{PATH_DATA}weather_data.delta'
uri_delta_part = f'{PATH_DATA}weather_data_partition.delta'
uri_stations = f'{PATH_DATA}Metadades_estacions_meteorol_giques_autom_tiques.csv'
uri_vars = f'{PATH_DATA}Metadades_variables_meteorol... |
MAX_DEPTH = 40
def gcd(a, b):
while b != 0:
t = b
b = a % b
a = t
return a
def play(a, b, turn_a, depth):
if depth == 0 or (a == 1 or b == 1):
if a == 1 and b == 1:
return 0
else:
if a == 1:
r = 2
elif b == 1:
... | max_depth = 40
def gcd(a, b):
while b != 0:
t = b
b = a % b
a = t
return a
def play(a, b, turn_a, depth):
if depth == 0 or (a == 1 or b == 1):
if a == 1 and b == 1:
return 0
else:
if a == 1:
r = 2
elif b == 1:
... |
#SQL Server details
SQL_HOST = 'localhost'
SQL_USERNAME = 'root'
SQL_PASSWORD = ''
#Mongo Server details
MONGO_HOST = 'localhost'
#Cache details - whether to call a URL once an ingestion script is finished
RESET_CACHE = False
RESET_CACHE_URL = 'http://example.com/visualization_reload/'
#Fab - configuration for deployin... | sql_host = 'localhost'
sql_username = 'root'
sql_password = ''
mongo_host = 'localhost'
reset_cache = False
reset_cache_url = 'http://example.com/visualization_reload/'
fab_hosts = []
fab_github_url = 'https://github.com/UQ-UQx/optimus_ingestor.git'
fab_remote_path = '/file/to/your/deployment/location'
ignore_services ... |
def info():
print("Library By : Nishant Singh\n")
def show():
print("Hello Guys !!\n Its a sample fun() for Suprath Technologies.\n")
| def info():
print('Library By : Nishant Singh\n')
def show():
print('Hello Guys !!\n Its a sample fun() for Suprath Technologies.\n') |
MYSQL_SERVER=""
MYSQL_USER=""
MYSQL_PASS=""
MYSQL_DB=""
UPLOAD_REQUEST_URL=""
| mysql_server = ''
mysql_user = ''
mysql_pass = ''
mysql_db = ''
upload_request_url = '' |
# -*- coding: utf-8 -*-
__author__ = 'Erik Castro'
__email__ = 'erik@erikcastro.net'
__version__ = '0.1.0'
| __author__ = 'Erik Castro'
__email__ = 'erik@erikcastro.net'
__version__ = '0.1.0' |
numbers = [12, 4, 9, 10, 7]
total = 0
for num in numbers:
total = total + num
print("total: {}".format(total))
avg = total / len(numbers)
print("average: {}".format(avg))
| numbers = [12, 4, 9, 10, 7]
total = 0
for num in numbers:
total = total + num
print('total: {}'.format(total))
avg = total / len(numbers)
print('average: {}'.format(avg)) |
# 029 - Write a Python program to print out a set containing all the colors from color_list_1 which are not present in color_list_2.
colorInfo_1 = {
"White", "Black", "Red",
}
colorInfo_2 = {
"Red", "Green",
}
print(colorInfo_1 - colorInfo_2) | color_info_1 = {'White', 'Black', 'Red'}
color_info_2 = {'Red', 'Green'}
print(colorInfo_1 - colorInfo_2) |
class Tag(object):
def __init__(self, name, action):
self.name = name
self.action = action
| class Tag(object):
def __init__(self, name, action):
self.name = name
self.action = action |
class Conta():
def __init__(self,name,id,balance):
self.name = name
self.id = id
self.balance = balance
self.extract_list = []
def trasnfer(self, value):
self.balance-=value
self.extract_list.append(['trasnfer', value])
def deposit(self,value):
self... | class Conta:
def __init__(self, name, id, balance):
self.name = name
self.id = id
self.balance = balance
self.extract_list = []
def trasnfer(self, value):
self.balance -= value
self.extract_list.append(['trasnfer', value])
def deposit(self, value):
... |
def get_IoU(confusion_matrix, label):
assert (
label > 0 and label < 7
), f"The given label {label} has to be between 1 and 6."
if confusion_matrix[label - 1, :].sum() == 0:
return None
# There are -1 everywhere since "Unclassified" is not counted.
return confusion_matrix[label - 1... | def get__io_u(confusion_matrix, label):
assert label > 0 and label < 7, f'The given label {label} has to be between 1 and 6.'
if confusion_matrix[label - 1, :].sum() == 0:
return None
return confusion_matrix[label - 1, label - 1] / (confusion_matrix[label - 1, :].sum() + confusion_matrix[:, label - ... |
set1 = {10, 20, 30, 40, 50}
set2 = {30, 40, 50, 60, 70}
set3 = set1.union(set2)
print(set3)
# set3 = {70, 40, 10, 50, 20, 60, 30}
# set1 y set2 se mantienen igual | set1 = {10, 20, 30, 40, 50}
set2 = {30, 40, 50, 60, 70}
set3 = set1.union(set2)
print(set3) |
def oriNumb(ori):
if(ori=='r'):
return 0
elif(ori=='d'):
return 1
elif(ori=='l'):
return 2
elif(ori=='u'):
return 3
def numbOri(numb):
if(numb==0):
return 'r'
elif(numb==1):
return 'd'
elif(numb==2):
return 'l'
elif(numb=... | def ori_numb(ori):
if ori == 'r':
return 0
elif ori == 'd':
return 1
elif ori == 'l':
return 2
elif ori == 'u':
return 3
def numb_ori(numb):
if numb == 0:
return 'r'
elif numb == 1:
return 'd'
elif numb == 2:
return 'l'
elif numb =... |
mult_dict = {}
pow_dict = {}
def solution(n, m):
mult_dict[(m, m)] = 1
for i in range(1, m+1):
mult_dict[(m, m-i)] = mult_dict[(m, m-i+1)] * (m-i+1) % 1000000007
for i in range(m+1, 2*n-m+1):
mult_dict[(i, m)] = mult_dict[(i-1, m)] * i % 1000000007
mult_dict[(2*n-m, 2*n-m)] = 1
for... | mult_dict = {}
pow_dict = {}
def solution(n, m):
mult_dict[m, m] = 1
for i in range(1, m + 1):
mult_dict[m, m - i] = mult_dict[m, m - i + 1] * (m - i + 1) % 1000000007
for i in range(m + 1, 2 * n - m + 1):
mult_dict[i, m] = mult_dict[i - 1, m] * i % 1000000007
mult_dict[2 * n - m, 2 * n... |
def odd_or_even(number: int):
if (number % 2) == 0:
return "Even"
else:
return "Odd"
if __name__ == "__main__":
while True:
number = int(input("Number: "))
print(odd_or_even(number))
| def odd_or_even(number: int):
if number % 2 == 0:
return 'Even'
else:
return 'Odd'
if __name__ == '__main__':
while True:
number = int(input('Number: '))
print(odd_or_even(number)) |
#
# PySNMP MIB module HH3C-L2ISOLATE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-L2ISOLATE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:27:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ... |
class Solution:
# @param {integer} numRows
# @return {integer[][]}
def getRow(self, numRows):
return self.generateResult(numRows+1)
def generateResult(self, numRows):
if numRows == 0:
return []
if numRows == 1:
return [1]
... | class Solution:
def get_row(self, numRows):
return self.generateResult(numRows + 1)
def generate_result(self, numRows):
if numRows == 0:
return []
if numRows == 1:
return [1]
elif numRows == 2:
return [1, 1]
else:
result =... |
##
print("Hello Kimbo!")
| print('Hello Kimbo!') |
# The "real" article entry point
# Maybe this has external (AWS) dependencies)
class Article:
def __init__(self):
pass
def get_article(self, idx):
return {
"id": idx,
"title": "The real title"
} | class Article:
def __init__(self):
pass
def get_article(self, idx):
return {'id': idx, 'title': 'The real title'} |
def test_passwd_file(host):
passwd = host.file("/etc/passwd")
assert passwd.contains("root")
assert passwd.user == "root"
assert passwd.group == "root"
assert passwd.mode == 0o644
def test_nginx_config_file(host):
nginx = host.run("sudo nginx -t")
assert nginx.succeedd | def test_passwd_file(host):
passwd = host.file('/etc/passwd')
assert passwd.contains('root')
assert passwd.user == 'root'
assert passwd.group == 'root'
assert passwd.mode == 420
def test_nginx_config_file(host):
nginx = host.run('sudo nginx -t')
assert nginx.succeedd |
def summation(num):
if num == 0:
return 0
return num + summation(num - 1)
def summation1(num):
return sum(range(num + 1))
# Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) ... | def summation(num):
if num == 0:
return 0
return num + summation(num - 1)
def summation1(num):
return sum(range(num + 1)) |
# Autogenerated file for Dot Matrix
# Add missing from ... import const
_JD_SERVICE_CLASS_DOT_MATRIX = const(0x110d154b)
_JD_DOT_MATRIX_VARIANT_LED = const(0x1)
_JD_DOT_MATRIX_VARIANT_BRAILLE = const(0x2)
_JD_DOT_MATRIX_REG_DOTS = const(JD_REG_VALUE)
_JD_DOT_MATRIX_REG_BRIGHTNESS = const(JD_REG_INTENSITY)
_JD_DOT_MATRI... | _jd_service_class_dot_matrix = const(286070091)
_jd_dot_matrix_variant_led = const(1)
_jd_dot_matrix_variant_braille = const(2)
_jd_dot_matrix_reg_dots = const(JD_REG_VALUE)
_jd_dot_matrix_reg_brightness = const(JD_REG_INTENSITY)
_jd_dot_matrix_reg_rows = const(385)
_jd_dot_matrix_reg_columns = const(386)
_jd_dot_matri... |
'''
File name: p3_utils.py
Author:
Date:
'''
| """
File name: p3_utils.py
Author:
Date:
""" |
# Generate the Fibonacci list, stopping at given value
def maxFibonacciValue(n):
fib = [1, 2]
for i in range(2, int(n)):
if(fib[i-1] + fib[i-2] > int(n)):
break
else:
fib.append(fib[i-1] + fib[i-2])
return fib
# Calculate even-valued sum
def evenFibonacciNumbers(n):
... | def max_fibonacci_value(n):
fib = [1, 2]
for i in range(2, int(n)):
if fib[i - 1] + fib[i - 2] > int(n):
break
else:
fib.append(fib[i - 1] + fib[i - 2])
return fib
def even_fibonacci_numbers(n):
sum = 0
for value in max_fibonacci_value(n):
if value % ... |
S = ["nwc10_hallway", "nwc1003b_danino", "nwc10", "nwc10m", "nwc8", "nwc7", "nwc4",
"outOfLab", "nwc1008", "nwc1006", "nwc1007", "nwc1009", "nwc1010", "nwc1003g",
"nwc1003g_a", "nwc1003g_b", "nwc1003g_c", "nwc1003b_a", "nwc1003b_b", "nwc1003b_c",
"nwc1003b_t", "nwc1003a", "nwc1003b", "nwc1001l", "nwc1000m_a1", "n... | s = ['nwc10_hallway', 'nwc1003b_danino', 'nwc10', 'nwc10m', 'nwc8', 'nwc7', 'nwc4', 'outOfLab', 'nwc1008', 'nwc1006', 'nwc1007', 'nwc1009', 'nwc1010', 'nwc1003g', 'nwc1003g_a', 'nwc1003g_b', 'nwc1003g_c', 'nwc1003b_a', 'nwc1003b_b', 'nwc1003b_c', 'nwc1003b_t', 'nwc1003a', 'nwc1003b', 'nwc1001l', 'nwc1000m_a1', 'nwc1000... |
class Support(Object):
def __init__(self, name, ux = 1, uy = 1, uz = 1, rx = 1, ry = 1, rz = 1):
self.name = name
self.ux = ux
self.uy = uy
self.uz = uz
self.rx = rx
self.ry = ry
self.rz = rz
| class Support(Object):
def __init__(self, name, ux=1, uy=1, uz=1, rx=1, ry=1, rz=1):
self.name = name
self.ux = ux
self.uy = uy
self.uz = uz
self.rx = rx
self.ry = ry
self.rz = rz |
def display(p):
L=[]
s=""
for i in range (0,9):
if(i>=(9-p)):
L.append("|---------|")
#print" ".join(map(str,L[i]))
else:
L.append('| |')
#s+=" ".join(map(str,L[i]))
L.append("-----------")
#s+=" ".join(map(... | def display(p):
l = []
s = ''
for i in range(0, 9):
if i >= 9 - p:
L.append('|---------|')
else:
L.append('| |')
L.append('-----------')
return L
def bucket(n):
print('>>>>Enter 1 to fill the bucket A \nEnter 2 to fill the bucket B \nEnter 3 to fi... |
#!/usr/bin/env python
# coding: utf-8
# This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges).
# # Solution Notebook
# ## Problem: Given a magazine, see if a ransom note could have been writte... | class Solution(object):
def match_note_to_magazine(self, ransom_note, magazine):
if ransom_note is None or magazine is None:
raise type_error('ransom_note or magazine cannot be None')
seen_chars = {}
for char in magazine:
if char in seen_chars:
seen_c... |
# Modify the code inside this loop to stop when i is greater than zero and exactly divisible by 11
for i in range(0, 100, 7):
print(i)
if i > 0 and i % 11 == 0:
break
| for i in range(0, 100, 7):
print(i)
if i > 0 and i % 11 == 0:
break |
# We are given an array A of size n that is sorted in ascending order, containing different
# natural numbers in pairs. Find algorithm that checks if there is such an index i that A[i] == i.
# What will change if the numbers are integers, not necessarily natural numbers?
# Natural numbers
def is_index_equal_to_numb... | def is_index_equal_to_number_natural(T):
if T[0] == 0:
return True
else:
return False
def is_index_equal_to_number_integer(T):
start = 0
end = len(T) - 1
while start <= end:
mid = (start + end) // 2
if T[mid] == mid:
return True
elif T[mid] > mid:... |
class Solution:
def jump(self, nums: List[int]) -> int:
n, start, end, ans, amax = len(nums)-1, 0, 0, 0, 0
while True:
for i in range(end, start-1, -1):
if i >= n:
return ans
amax = max(amax, i+nums[i])
... | class Solution:
def jump(self, nums: List[int]) -> int:
(n, start, end, ans, amax) = (len(nums) - 1, 0, 0, 0, 0)
while True:
for i in range(end, start - 1, -1):
if i >= n:
return ans
amax = max(amax, i + nums[i])
start = en... |
with open('input/day6.txt', 'r', encoding='utf8') as file:
fish_list = [int(value) for value in file.read().split(',')]
population = [0,0,0,0,0,0,0,0,0]
for fish in fish_list:
population[fish] += 1
for day in range(1, 257):
population = population[1:] + population[:1]
population[6] += population[8]
... | with open('input/day6.txt', 'r', encoding='utf8') as file:
fish_list = [int(value) for value in file.read().split(',')]
population = [0, 0, 0, 0, 0, 0, 0, 0, 0]
for fish in fish_list:
population[fish] += 1
for day in range(1, 257):
population = population[1:] + population[:1]
population[6] += population... |
name0_0_1_1_0_2_0 = None
name0_0_1_1_0_2_1 = None
name0_0_1_1_0_2_2 = None
name0_0_1_1_0_2_3 = None
name0_0_1_1_0_2_4 = None | name0_0_1_1_0_2_0 = None
name0_0_1_1_0_2_1 = None
name0_0_1_1_0_2_2 = None
name0_0_1_1_0_2_3 = None
name0_0_1_1_0_2_4 = None |
names = ['Christopher', 'Susan']
scores = []
scores.append(98)
scores.append(99)
print(names)
print(scores)
| names = ['Christopher', 'Susan']
scores = []
scores.append(98)
scores.append(99)
print(names)
print(scores) |
# Copyright 2017 BBVA
#
# 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, softwar... | class Apitesterror(Exception):
pass
class Apitestmissingdataerror(Exception):
pass
class Apitestinvalidformaterror(Exception):
pass
class Apitestvalueerror(ValueError):
pass
class Apitesttypeerror(TypeError):
pass
class Apitestunknowntypeerror(TypeError):
pass
class Apitestconnectionerror(... |
'''
pattern
Enter number of rows: 5
54321
4321
321
21
1
'''
print('pattern: ')
number_row=int(input('Enter number of rows: '))
for row in range(number_row,0,-1):
for column in range(row,number_row):
print(' ',end=' ')
for column in range(row,0,-1):
if column < 10:
print(f'0{column}'... | """
pattern
Enter number of rows: 5
54321
4321
321
21
1
"""
print('pattern: ')
number_row = int(input('Enter number of rows: '))
for row in range(number_row, 0, -1):
for column in range(row, number_row):
print(' ', end=' ')
for column in range(row, 0, -1):
if column < 10:
... |
num1 = 00
num2 = 200
for n in range(num1, num2 + 1):
if n > 1:
for i in range(2, n):
if (n % i) == 0:
break
else:
print(n) | num1 = 0
num2 = 200
for n in range(num1, num2 + 1):
if n > 1:
for i in range(2, n):
if n % i == 0:
break
else:
print(n) |
# This program displays property taxes.
TAX_FACTOR = 0.0065
print('Enter the property lot number')
print('or enter 0 to end.')
lot = int(input('Lot number: '))
while lot != 0:
value = float(input('Enter the property value: '))
tax = value * TAX_FACTOR
print('Property tax: $', format(tax, ',.2f'), sep='... | tax_factor = 0.0065
print('Enter the property lot number')
print('or enter 0 to end.')
lot = int(input('Lot number: '))
while lot != 0:
value = float(input('Enter the property value: '))
tax = value * TAX_FACTOR
print('Property tax: $', format(tax, ',.2f'), sep='')
print('Enter the next lot number or')
... |
def bingo_sort(L):
minValue = min(L)
maxValue = max(L)
bingo = minValue
next_bingo = maxValue
nextIndex = 0
while bingo < maxValue:
startPosition = nextIndex
for i in range(startPosition, len(L)):
if L[i] == bingo: L[i], L[nextIndex] = L[nextIndex], L[i] ; nextIndex +... | def bingo_sort(L):
min_value = min(L)
max_value = max(L)
bingo = minValue
next_bingo = maxValue
next_index = 0
while bingo < maxValue:
start_position = nextIndex
for i in range(startPosition, len(L)):
if L[i] == bingo:
(L[i], L[nextIndex]) = (L[nextInd... |
# You are given two integer arrays nums1 and nums2 both of unique elements,
# where nums1 is a subset of nums2.
# Find all the next greater numbers for nums1's elements in the corresponding
# places of nums2.
# The Next Greater Number of a number x in nums1 is the first greater number to
# its right in nums2. If it d... | class Solution_1:
def next_greater_element(nums1, nums2):
if not nums1 or not nums2:
return []
map1 = {}
stack = [nums2[0]]
for ind in range(1, len(nums2)):
while stack and nums2[ind] > stack[-1]:
map1[stack.pop()] = nums2[ind]
sta... |
#encoding:utf-8
subreddit = 'arabfunny'
t_channel = '@r_Arabfunny'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'arabfunny'
t_channel = '@r_Arabfunny'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
#!/usr/local/bin/python2
arquivo = open('pessoas.csv')
for registro in arquivo:
print('nome: {}, idade: {}'.format(*registro.split(',')))
arquivo.close()
print("ola mundo") | arquivo = open('pessoas.csv')
for registro in arquivo:
print('nome: {}, idade: {}'.format(*registro.split(',')))
arquivo.close()
print('ola mundo') |
# Combination Sum III
'''
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.
Note:
All numbers will be positive integers.
The solution set must not contain duplicate combinations.
Example 1:
... | """
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.
Note:
All numbers will be positive integers.
The solution set must not contain duplicate combinations.
Example 1:
Input: k = 3, n = 7
Out... |
class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
ransomNote = sorted(ransomNote)
magazine = sorted(magazine)
i = j = 0
while i < len(ransomNote) and j < len(magazine):
if ransomNote[i] == magazine[j]:
i += 1
elif ... | class Solution:
def can_construct(self, ransomNote: str, magazine: str) -> bool:
ransom_note = sorted(ransomNote)
magazine = sorted(magazine)
i = j = 0
while i < len(ransomNote) and j < len(magazine):
if ransomNote[i] == magazine[j]:
i += 1
el... |
# File: P (Python 2.4)
protectedStates = [
'Injured']
overrideStates = [
'ThrownInJail']
| protected_states = ['Injured']
override_states = ['ThrownInJail'] |
print("You will meet two people - one is the sweet shop owner who wants to steal the password so he can keep the sweets.")
print()
playername=input("What is your name? ")
print("Welcome "+ playername)
| print('You will meet two people - one is the sweet shop owner who wants to steal the password so he can keep the sweets.')
print()
playername = input('What is your name? ')
print('Welcome ' + playername) |
# https://leetcode.com/problems/next-greater-node-in-linked-list/discuss/265508/JavaC%2B%2BPython-Next-Greater-Element
class Solution:
def nextLargerNodes(self, head):
res, stack = [], []
while head:
while stack and stack[-1][1] < head.val:
res[stack.pop()[0]] = head.val
... | class Solution:
def next_larger_nodes(self, head):
(res, stack) = ([], [])
while head:
while stack and stack[-1][1] < head.val:
res[stack.pop()[0]] = head.val
stack.append([len(res), head.val])
res.append(0)
head = head.next
re... |
message = "Hello Python world!"
print(message)
message = "Hello Python Crash Course world!"
print(message)
mesage = "Hello Python Crash Course reader!"
print(mesage)
| message = 'Hello Python world!'
print(message)
message = 'Hello Python Crash Course world!'
print(message)
mesage = 'Hello Python Crash Course reader!'
print(mesage) |
n = int(input())
l = list(map(int, input().split()))
flag = 0
for i in range(1,max(l)+1):
for j in range(n):
if i>l[j]:
l[j] = 0
for j in range(n-1):
if l[j] == l[j+1]==0 or l[n-1]==0 or l[0] == 0:
flag = 1
break
if flag == 1:
break
if n==1:
pr... | n = int(input())
l = list(map(int, input().split()))
flag = 0
for i in range(1, max(l) + 1):
for j in range(n):
if i > l[j]:
l[j] = 0
for j in range(n - 1):
if l[j] == l[j + 1] == 0 or l[n - 1] == 0 or l[0] == 0:
flag = 1
break
if flag == 1:
break
... |
# NPTEL WEEK 3 PROGRAMMING ASSIGNMENT
def ascending(l):
if len(l)==0:
return(True)
for i in range(len(l)-1,0,-1):
if l[i]<l[i-1]:
return(False)
return(True)
#print(ascending([2,3,4,5,1]))
#print(ascending([1,2,3,4,5,5]))
def valley(l):
if len(l)<3:
r... | def ascending(l):
if len(l) == 0:
return True
for i in range(len(l) - 1, 0, -1):
if l[i] < l[i - 1]:
return False
return True
def valley(l):
if len(l) < 3:
return False
for i in range(0, len(l), 1):
if i == len(l) - 1:
return False
if ... |
def single_number(arr):
arr.sort()
idx = 0
while idx < len(arr):
try:
if arr[idx] != arr[idx + 1]:
return arr[idx]
except IndexError:
return arr[idx]
idx += 2
| def single_number(arr):
arr.sort()
idx = 0
while idx < len(arr):
try:
if arr[idx] != arr[idx + 1]:
return arr[idx]
except IndexError:
return arr[idx]
idx += 2 |
# interp.py
'''
Interpreter Project
===================
This is an interpreter than can run wabbit programs directly from the
generated IR code.
To run a program use::
bash % python3 -m wabbit.interp someprogram.wb
'''
| """
Interpreter Project
===================
This is an interpreter than can run wabbit programs directly from the
generated IR code.
To run a program use::
bash % python3 -m wabbit.interp someprogram.wb
""" |
cityFile = open("Lecture5_NumpyMatplotScipy/ornek.txt")
cityArr = cityFile.read().split("\n")
cityDict = {}
for line in cityArr:
info = line.split(",")
cityName = info[0]
day = int(info[1])
rainfall = float(info[2])
if cityName in cityDict.keys():
days = cityDict[cityName]
days[... | city_file = open('Lecture5_NumpyMatplotScipy/ornek.txt')
city_arr = cityFile.read().split('\n')
city_dict = {}
for line in cityArr:
info = line.split(',')
city_name = info[0]
day = int(info[1])
rainfall = float(info[2])
if cityName in cityDict.keys():
days = cityDict[cityName]
days[d... |
def print_keyword_args(**kwargs):
print('\n')
for key, value in kwargs.items():
print(f'{key} = {value}')
third = kwargs.get('third', None)
if third != None:
print('third arg =', third)
print_keyword_args(first='a')
print_keyword_args(first='b', second='c')
print_keyword_args(first='d', second='e',... | def print_keyword_args(**kwargs):
print('\n')
for (key, value) in kwargs.items():
print(f'{key} = {value}')
third = kwargs.get('third', None)
if third != None:
print('third arg =', third)
print_keyword_args(first='a')
print_keyword_args(first='b', second='c')
print_keyword_args(first='d'... |
class ShylockAsyncBackend:
@staticmethod
def _check():
raise NotImplementedError()
async def acquire(self, name: str, block: bool = True):
raise NotImplementedError()
async def release(self, name: str):
raise NotImplementedError()
class ShylockSyncBackend:
@s... | class Shylockasyncbackend:
@staticmethod
def _check():
raise not_implemented_error()
async def acquire(self, name: str, block: bool=True):
raise not_implemented_error()
async def release(self, name: str):
raise not_implemented_error()
class Shylocksyncbackend:
@staticmet... |
class Solution:
# O(n) time | O(1) space
def minStartValue(self, nums: List[int]) -> int:
minSum, currentSum = nums[0], 0
for num in nums:
currentSum += num
minSum = min(minSum, currentSum)
if minSum < 0:
return abs(minSum) + 1
else:
... | class Solution:
def min_start_value(self, nums: List[int]) -> int:
(min_sum, current_sum) = (nums[0], 0)
for num in nums:
current_sum += num
min_sum = min(minSum, currentSum)
if minSum < 0:
return abs(minSum) + 1
else:
return 1 |
class TrieNode(object):
def __init__(self):
self.children = {}
self.is_word = False
class Trie(object):
def __init__(self):
self.root = TrieNode()
def insert(self, word):
curr = self.root
for letter in word:
if word in curr.children:
... | class Trienode(object):
def __init__(self):
self.children = {}
self.is_word = False
class Trie(object):
def __init__(self):
self.root = trie_node()
def insert(self, word):
curr = self.root
for letter in word:
if word in curr.children:
c... |
foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item']
print(foo[:3])
# difference?
print(foo[0:3])
print(foo[2:])
print(foo[1:-1]) | foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item']
print(foo[:3])
print(foo[0:3])
print(foo[2:])
print(foo[1:-1]) |
# -*- coding: utf-8 -*-
config_page_name = {
'zh': {
'wikipedia': '',
}
}
| config_page_name = {'zh': {'wikipedia': ''}} |
class Result:
def __init__(self, id = None, success = None, message = None, url = None, data = None) -> None:
self.id = id
self.success = success
self.message = message
self.url = url
self.data = data
def to_json(self):
json_data = None
if (self.data and... | class Result:
def __init__(self, id=None, success=None, message=None, url=None, data=None) -> None:
self.id = id
self.success = success
self.message = message
self.url = url
self.data = data
def to_json(self):
json_data = None
if self.data and hasattr(se... |
def solution(arr):
size = 0
value = 0
for i in range(len(arr)):
if size == 0:
value = arr[i]
size += 1
else:
if value != arr[i] and size != 0:
size -= 1
else:
size += 1
leader = value
if arr.count(leader)... | def solution(arr):
size = 0
value = 0
for i in range(len(arr)):
if size == 0:
value = arr[i]
size += 1
elif value != arr[i] and size != 0:
size -= 1
else:
size += 1
leader = value
if arr.count(leader) <= len(arr) // 2:
r... |
def memory(x):
x = [i for i in range(x)]
return -1
def time(x):
# recursive function to find xth fibonacci number
if x < 3:
return 1
return time(x-1) + time(x-2)
def error(x=None):
# error function
return "a" / 2
def return_check(*args, **kwagrs):
# args and kwargs function... | def memory(x):
x = [i for i in range(x)]
return -1
def time(x):
if x < 3:
return 1
return time(x - 1) + time(x - 2)
def error(x=None):
return 'a' / 2
def return_check(*args, **kwagrs):
return list(args) + list(kwagrs.values()) |
class User:
user_budget = ""
travel_budget, food_budget, stay_budget = 500, 100, 400
travel_preference = False
stay_preference = False
food_preference = False
origin_city = ""
start_date = ""
return_date = ""
def __init__(self, origin_city, start_date, return_date, user_budget):
... | class User:
user_budget = ''
(travel_budget, food_budget, stay_budget) = (500, 100, 400)
travel_preference = False
stay_preference = False
food_preference = False
origin_city = ''
start_date = ''
return_date = ''
def __init__(self, origin_city, start_date, return_date, user_budget):... |
#
# PySNMP MIB module HUAWEI-LswQos-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-LswQos-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:34:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.