content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
numbers = [3, 5, 7, 9, 4, 8, 15, 16, 23, 42]
is_there_any_odd_number = False
is_odd = lambda num: num % 2 == 1
def fun(num):
print(f"fun({num})")
return num % 2 == 1
for num in numbers:
if is_odd(num):
is_there_any_odd_number = True
break
print(is_there_any_odd_number)
# print(any(map(... | numbers = [3, 5, 7, 9, 4, 8, 15, 16, 23, 42]
is_there_any_odd_number = False
is_odd = lambda num: num % 2 == 1
def fun(num):
print(f'fun({num})')
return num % 2 == 1
for num in numbers:
if is_odd(num):
is_there_any_odd_number = True
break
print(is_there_any_odd_number)
print(all(map(fun, nu... |
def bfs(graph, source, target):
visited = {k: False for k in graph}
distance = {k: 1000000 for k in graph}
queue = []
visited[source] = True
distance[source] = 0
queue.append(source)
while queue:
node = queue.pop(0)
for n in graph[node]:
if not visited[n]:
... | def bfs(graph, source, target):
visited = {k: False for k in graph}
distance = {k: 1000000 for k in graph}
queue = []
visited[source] = True
distance[source] = 0
queue.append(source)
while queue:
node = queue.pop(0)
for n in graph[node]:
if not visited[n]:
... |
_base_ = [
# '../_base_/models/deeplabv3plus_r18-d8.py',
'../_base_/models/deeplabv3plus_r50-d8.py',
'../_base_/datasets/boulderset.py',
'../_base_/default_runtime.py',
'../_base_/schedules/schedule_40k.py'
]
norm_cfg = dict(type='BN', requires_grad=True)
num_classes = 3
model = dict(
pretraine... | _base_ = ['../_base_/models/deeplabv3plus_r50-d8.py', '../_base_/datasets/boulderset.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py']
norm_cfg = dict(type='BN', requires_grad=True)
num_classes = 3
model = dict(pretrained='torchvision://resnet18', backbone=dict(type='ResNet', depth=18, norm_cf... |
PARAMETERS = {
# Input params
"training_data_patterns": [
"data/tfrecord_v2/20180101.gz"
],
"evaluation_data_patterns":[
"data/tfrecord_v2/20180101.gz"
],
# Training data loader properties
"buffer_size": 10000,
"num_parsing_threads": 16,
"num_parallel_readers": 4,
... | parameters = {'training_data_patterns': ['data/tfrecord_v2/20180101.gz'], 'evaluation_data_patterns': ['data/tfrecord_v2/20180101.gz'], 'buffer_size': 10000, 'num_parsing_threads': 16, 'num_parallel_readers': 4, 'prefetch_buffer_size': 1, 'compression_type': 'GZIP', 'initializer_gain': 1.0, 'hidden_size': 32, 'num_hidd... |
class Solution:
def FindGreatestSumOfSubArray(self, array):
if not array:
return 0
cur_sum, max_sum = array[0], array[0]
for i in range(1, len(array)):
cur_sum = array[i] if cur_sum <= 0 else cur_sum + array[i]
max_sum = cur_sum if cur_sum > max_sum else... | class Solution:
def find_greatest_sum_of_sub_array(self, array):
if not array:
return 0
(cur_sum, max_sum) = (array[0], array[0])
for i in range(1, len(array)):
cur_sum = array[i] if cur_sum <= 0 else cur_sum + array[i]
max_sum = cur_sum if cur_sum > max_... |
def main():
# get
sales = get_sales()
advanced_pay = get_advanced_pay()
rate = determined_comm_rate(sales)
# calc
pay = sales * rate - advanced_pay
# print
print("The pay is $", format(pay, ",.2f"), sep='')
return
def get_sales():
return float(input("Sales: $"))
def determined_... | def main():
sales = get_sales()
advanced_pay = get_advanced_pay()
rate = determined_comm_rate(sales)
pay = sales * rate - advanced_pay
print('The pay is $', format(pay, ',.2f'), sep='')
return
def get_sales():
return float(input('Sales: $'))
def determined_comm_rate(sales):
if sales < ... |
Dataset_Path = dict(
CULane = "/home/lion/Dataset/CULane/data/CULane",
Tusimple = "/home/lion/Dataset/tusimple"
)
| dataset__path = dict(CULane='/home/lion/Dataset/CULane/data/CULane', Tusimple='/home/lion/Dataset/tusimple') |
for _ in range(int(input())):
n, k = map(int, input().split())
p = [0] + list(map(int, input().split()))
visited = [False] * (n + 1)
cycles = []
for i in range(1, n + 1):
cycle = []
while not visited[i]:
visited[i] = True
cycle += i,
i = p[i]
... | for _ in range(int(input())):
(n, k) = map(int, input().split())
p = [0] + list(map(int, input().split()))
visited = [False] * (n + 1)
cycles = []
for i in range(1, n + 1):
cycle = []
while not visited[i]:
visited[i] = True
cycle += (i,)
i = p[i]
... |
def f(x = True):
'whether x is a correct word or not'
if x:
print('x is a correct word')
print('OK')
f()
f(False)
def g(x, y = True):
"x and y both correct words or not"
if y:
print(x, 'and y both correct')
print(x,'is OK')
g(68)
g(68, False) | def f(x=True):
"""whether x is a correct word or not"""
if x:
print('x is a correct word')
print('OK')
f()
f(False)
def g(x, y=True):
"""x and y both correct words or not"""
if y:
print(x, 'and y both correct')
print(x, 'is OK')
g(68)
g(68, False) |
user = "user_name_here"
password = "password_here"
host = "host_here"
app_name = "discogs app name here"
user_token = "discogs app token here"
| user = 'user_name_here'
password = 'password_here'
host = 'host_here'
app_name = 'discogs app name here'
user_token = 'discogs app token here' |
#!/usr/bin/env python3
dictionary = { #defines dictionary data structure
"class" : "Astr 119",
"prof" : "Brant",
"awesomeness" : 10
}
print(type(dictionary)); #prints the data type of dictionary
course = dictionary["class"]; #obtains a value from a key in dictionary
print(course); #prints the val... | dictionary = {'class': 'Astr 119', 'prof': 'Brant', 'awesomeness': 10}
print(type(dictionary))
course = dictionary['class']
print(course)
dictionary['awesomeness'] += 1
print(dictionary)
for x in dictionary.keys():
print(x, dictionary[x]) |
f = open("crime.csv", "r")
print("beep")
print(f.readline())
print(f.readline())
f.close() | f = open('crime.csv', 'r')
print('beep')
print(f.readline())
print(f.readline())
f.close() |
#program to calculate the maximum profit from selling and buying values of stock..
def buy_and_sell(stock_price):
max_profit_val, current_max_val = 0, 0
for price in reversed(stock_price):
current_max_val = max(current_max_val, price)
potential_profit = current_... | def buy_and_sell(stock_price):
(max_profit_val, current_max_val) = (0, 0)
for price in reversed(stock_price):
current_max_val = max(current_max_val, price)
potential_profit = current_max_val - price
max_profit_val = max(potential_profit, max_profit_val)
return max_profit_val
print(bu... |
class Solution:
def findMin(self, nums: List[int]) -> int:
val = sys.maxsize
for i in nums:
if i < val:
val = i
return val
| class Solution:
def find_min(self, nums: List[int]) -> int:
val = sys.maxsize
for i in nums:
if i < val:
val = i
return val |
# @Author : Wang Xiaoqiang
# @GitHub : https://github.com/rzjing
# @Time : 2020-01-06 15:59
# @File : gun.py
# gunicorn configuration file
bind = '0.0.0.0:5000'
loglevel = 'info'
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %(L)s'
reload = True
if __name__ == '__main... | bind = '0.0.0.0:5000'
loglevel = 'info'
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %(L)s'
reload = True
if __name__ == '__main__':
pass |
liste = [5, 12, 7, 54, 4, 19, 23]
classeur = {
'positif':[],
'negatif': []
} | liste = [5, 12, 7, 54, 4, 19, 23]
classeur = {'positif': [], 'negatif': []} |
def inputs():
a = int(input())
return a
def body(a):
if a <= 2:
print("NO")
elif a % 2 == 0:
print("YES")
else:
print("NO")
def main():
a = inputs()
body(a)
if __name__ == "__main__":
main() | def inputs():
a = int(input())
return a
def body(a):
if a <= 2:
print('NO')
elif a % 2 == 0:
print('YES')
else:
print('NO')
def main():
a = inputs()
body(a)
if __name__ == '__main__':
main() |
class ShippingCubes:
def minimalCost(self, N):
m = 600
for i in xrange(1, 200):
for j in xrange(1, i + 1):
for k in xrange(1, j + 1):
if i * j * k == N:
m = min(m, i + j + k)
return m
| class Shippingcubes:
def minimal_cost(self, N):
m = 600
for i in xrange(1, 200):
for j in xrange(1, i + 1):
for k in xrange(1, j + 1):
if i * j * k == N:
m = min(m, i + j + k)
return m |
def tem_match(origin_test, origin_template):
test = []
for i in origin_test:
tem_test = []
for index, j in enumerate(i[1]):
j.insert(0, i[0][index])
tem_test.append(j)
test.append([i[0], tem_test])
tem_template = {}
for i in origin_template:
tem_... | def tem_match(origin_test, origin_template):
test = []
for i in origin_test:
tem_test = []
for (index, j) in enumerate(i[1]):
j.insert(0, i[0][index])
tem_test.append(j)
test.append([i[0], tem_test])
tem_template = {}
for i in origin_template:
tem_... |
n = int(input())
for i in range(0,10000,1):
if i % n == 2:
print(i) | n = int(input())
for i in range(0, 10000, 1):
if i % n == 2:
print(i) |
def get_config():
conf = {
# Change it to necessary directory
'workdir': 'dataset/cr_data/',
'PAD': 0,
'BOS': 1,
'EOS': 2,
'UNK': 3,
'train_qt': 'sql.train.qt.pkl',
'train_code': 'sql.train.code.pkl',
# parameters
'qt_len': 20,
... | def get_config():
conf = {'workdir': 'dataset/cr_data/', 'PAD': 0, 'BOS': 1, 'EOS': 2, 'UNK': 3, 'train_qt': 'sql.train.qt.pkl', 'train_code': 'sql.train.code.pkl', 'qt_len': 20, 'code_len': 120, 'qt_n_words': 7775, 'code_n_words': 7726, 'vocab_qt': 'sql.qt.vocab.pkl', 'vocab_code': 'sql.code.vocab.pkl', 'checkpoin... |
def get_urls(*args, **kwargs):
return {
'http://docutils.sourceforge.net/RELEASE-NOTES.txt'
}, set()
| def get_urls(*args, **kwargs):
return ({'http://docutils.sourceforge.net/RELEASE-NOTES.txt'}, set()) |
#
# PySNMP MIB module G6-FACTORY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/G6-FACTORY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:04:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ... |
#! /usr/bin/env python
def is_num_palindrome(num):
# Skip single-digit inputs
if num // 10 == 0:
return False
temp = num
reversed_num = 0
while temp != 0:
reversed_num = (reversed_num * 10) + (temp % 10)
print(f'Reverse number: {reversed_num}')
temp = temp // 10
... | def is_num_palindrome(num):
if num // 10 == 0:
return False
temp = num
reversed_num = 0
while temp != 0:
reversed_num = reversed_num * 10 + temp % 10
print(f'Reverse number: {reversed_num}')
temp = temp // 10
print(f'Temp number: {temp}')
if num == reversed_nu... |
#!/usr/bin/python
# ==============================================================================
# Author: Tao Li (taoli@ucsd.edu)
# Date: May 5, 2015
# Question: 122-Best-Time-to-Buy-and-Sell-Stock-II
# Link: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
# ==============================... | class Solution:
def max_profit(self, prices):
if len(prices) <= 1:
return 0
total = 0
for i in range(len(prices) - 1):
total += prices[i + 1] - prices[i] if prices[i + 1] - prices[i] > 0 else 0
return total |
# Refer: https://codeforces.com/contest/1538/problem/B
def distribute_candies(arr, n):
s = sum(arr)
if s % n != 0:
return -1
avg = s // n
cnt = 0
for c in arr:
if c > avg:
cnt += 1
return cnt
if __name__ == "__main__":
t = int(input())
i = 0
while i < ... | def distribute_candies(arr, n):
s = sum(arr)
if s % n != 0:
return -1
avg = s // n
cnt = 0
for c in arr:
if c > avg:
cnt += 1
return cnt
if __name__ == '__main__':
t = int(input())
i = 0
while i < t:
n = int(input())
arr = list(map(int, inp... |
# Scrapy settings for sephora project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://docs.scrapy.org/en/latest/topics/settings.html
# https://docs.scrapy.org/en/latest/topics/downloader-middleware... | bot_name = 'sephora'
spider_modules = ['sephora.spiders']
newspider_module = 'sephora.spiders'
user_agent = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.362... |
_base_ = './van_small_8xb128_fp16_ep300.py'
# model settings
model = dict(
backbone=dict(arch='large', drop_path_rate=0.2),
)
| _base_ = './van_small_8xb128_fp16_ep300.py'
model = dict(backbone=dict(arch='large', drop_path_rate=0.2)) |
#!/usr/bin/python
REGISTER_USER = "RegisterUser"
CURRENT_MEDS = "CurrentRx"
DOSAGE_REMINDER = "DosageReminder"
REFILL_REMINDER = "RefillReminder" | register_user = 'RegisterUser'
current_meds = 'CurrentRx'
dosage_reminder = 'DosageReminder'
refill_reminder = 'RefillReminder' |
if __name__ == "__main__":
s = 'Hello from Python!'
words = s.split(' ')
print(words)
for w in words:
print(w)
for ch in s:
print(ch) | if __name__ == '__main__':
s = 'Hello from Python!'
words = s.split(' ')
print(words)
for w in words:
print(w)
for ch in s:
print(ch) |
def sequentialSearch(n, array, x):
if x >= n: return None
location = 0
while (location < n and array[location] != x): location += 1
return location
| def sequential_search(n, array, x):
if x >= n:
return None
location = 0
while location < n and array[location] != x:
location += 1
return location |
MICROBIT = "micro:bit"
# string arguments for constructor
BLANK_5X5 = "00000:00000:00000:00000:00000:"
# pre-defined image patterns
IMAGE_PATTERNS = {
"HEART": "09090:99999:99999:09990:00900:",
"HEART_SMALL": "00000:09090:09990:00900:00000:",
"HAPPY": "00000:09090:00000:90009:09990:",
"SMILE": "00000:... | microbit = 'micro:bit'
blank_5_x5 = '00000:00000:00000:00000:00000:'
image_patterns = {'HEART': '09090:99999:99999:09990:00900:', 'HEART_SMALL': '00000:09090:09990:00900:00000:', 'HAPPY': '00000:09090:00000:90009:09990:', 'SMILE': '00000:00000:00000:90009:09990:', 'SAD': '00000:09090:00000:09990:90009:', 'CONFUSED': '0... |
class Solution:
def maximumUniqueSubarray(self, nums: List[int]) -> int:
result, currentSum, hashSet, start = 0, 0, set(), 0
for end in range(len(nums)):
while nums[end] in hashSet:
hashSet.remove(nums[start])
currentSum -= nums[start]
star... | class Solution:
def maximum_unique_subarray(self, nums: List[int]) -> int:
(result, current_sum, hash_set, start) = (0, 0, set(), 0)
for end in range(len(nums)):
while nums[end] in hashSet:
hashSet.remove(nums[start])
current_sum -= nums[start]
... |
class Solution:
def specialArray(self, nums):
length = len(nums)
rng = range(length)
# Start from end. (todo, try starting from beginning)
for i in range(1, length+1):
# keep track of matches (>= i)
match = 0
for idx in rng:
n = num... | class Solution:
def special_array(self, nums):
length = len(nums)
rng = range(length)
for i in range(1, length + 1):
match = 0
for idx in rng:
n = nums[idx]
if n >= i:
match = match + 1
if match ... |
numbers = [300, 2, 12, 44, 1, 1, 4, 10, 7, 1, 78, 123, 55]
result = [el for num, el in enumerate(numbers) if numbers[num - 1] < numbers[num]]
print(result) | numbers = [300, 2, 12, 44, 1, 1, 4, 10, 7, 1, 78, 123, 55]
result = [el for (num, el) in enumerate(numbers) if numbers[num - 1] < numbers[num]]
print(result) |
# Create a word-count method
# Function that returns number of words in a string
def count_words(string):
# Split the string into words
words = string.split()
# Return the number of words
return len(words)
# Create a new feature word_count
ted['word_count'] = ted['transcript'].apply(count_words)
# ... | def count_words(string):
words = string.split()
return len(words)
ted['word_count'] = ted['transcript'].apply(count_words)
print(ted['word_count'].mean()) |
class DiskError(RuntimeError):
pass
class SaveError(DiskError):
pass
class LoadError(DiskError):
pass
class RenameError(DiskError):
pass
class PathDoesNotExistError(DiskError):
pass
class PathExistsError(DiskError):
pass
class NotAFileError(FileNotFoundError):
pass
class DirectoryNotFoundError(NotA... | class Diskerror(RuntimeError):
pass
class Saveerror(DiskError):
pass
class Loaderror(DiskError):
pass
class Renameerror(DiskError):
pass
class Pathdoesnotexisterror(DiskError):
pass
class Pathexistserror(DiskError):
pass
class Notafileerror(FileNotFoundError):
pass
class Directorynotf... |
RECOGNIZE = {
" | | ": '1',
" _ _||_ ": '2',
" _ _| _| ": '3',
" |_| | ": '4',
" _ |_ _| ": '5',
" _ |_ |_| ": '6',
" _ | | ": '7',
" _ |_||_| ": '8',
" _ |_| _| ": '9',
" _ | ||_| ": '0',
}
def convert(input_grid):
if input_grid == [] or ... | recognize = {' | | ': '1', ' _ _||_ ': '2', ' _ _| _| ': '3', ' |_| | ': '4', ' _ |_ _| ': '5', ' _ |_ |_| ': '6', ' _ | | ': '7', ' _ |_||_| ': '8', ' _ |_| _| ': '9', ' _ | ||_| ': '0'}
def convert(input_grid):
if input_grid == [] or len(input_grid) % 4 != 0:
raise valu... |
def foo(**args):
pass
a = {}
b = {}
foo(**a)
| def foo(**args):
pass
a = {}
b = {}
foo(**a) |
class Shield:
def __init__(self):
self.water_level = 0
self.switch_state = 0
def tick(self, water_level, switch_state, action):
return action
| class Shield:
def __init__(self):
self.water_level = 0
self.switch_state = 0
def tick(self, water_level, switch_state, action):
return action |
# 1046. Last Stone Weight - LeetCode Contest
# https://leetcode.com/contest/weekly-contest-137/problems/last-stone-weight/
class Solution:
def lastStoneWeight(self, stones) -> int:
stones = sorted(stones,reverse=True)
while len(stones) > 1:
first_stone = stones.pop(0)
second... | class Solution:
def last_stone_weight(self, stones) -> int:
stones = sorted(stones, reverse=True)
while len(stones) > 1:
first_stone = stones.pop(0)
second_stone = stones.pop(0)
if first_stone > second_stone:
remains = first_stone - second_stone
... |
#!/usr/bin/python
# tuple_one.py
print ((3 + 7))
print ((3 + 7, ))
| print(3 + 7)
print((3 + 7,)) |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | pretrained_models = {'panns_cnn6-32k': {'url': 'https://paddlespeech.bj.bcebos.com/cls/inference_model/panns_cnn6_static.tar.gz', 'md5': 'da087c31046d23281d8ec5188c1967da', 'cfg_path': 'panns.yaml', 'model_path': 'inference.pdmodel', 'params_path': 'inference.pdiparams', 'label_file': 'audioset_labels.txt'}, 'panns_cnn... |
class Solution:
def maxDistance(self, position: List[int], m: int) -> int:
self.position = sorted(position)
low, high = 0, self.position[-1] - self.position[0]
while low <= high:
mid = (high+low) // 2
if self.check(self.position, m, mid):
low = mid + 1... | class Solution:
def max_distance(self, position: List[int], m: int) -> int:
self.position = sorted(position)
(low, high) = (0, self.position[-1] - self.position[0])
while low <= high:
mid = (high + low) // 2
if self.check(self.position, m, mid):
low =... |
l = int(input())
ar = input().split()
for size in range(l):
ar[size] = int(ar[size])
def shift(plist, index):
temp = plist[index]
if plist[index-1] > plist[index]:
plist[index] = plist[index-1]
plist[index-1] = temp
if index - 2 == -1:
pass
else:
... | l = int(input())
ar = input().split()
for size in range(l):
ar[size] = int(ar[size])
def shift(plist, index):
temp = plist[index]
if plist[index - 1] > plist[index]:
plist[index] = plist[index - 1]
plist[index - 1] = temp
if index - 2 == -1:
pass
else:
... |
SERPRO_API_GATEWAY = "https://apigateway.serpro.gov.br"
SERPRO_PUBLIC_JWKS = "https://d-biodata.estaleiro.serpro.gov.br/api/v1/jwks"
AUTHENTICATE_ENDPOINT = "/token"
# biodata endpoints
BIODATA_TOKEN_ENDPOINT = "/biodata/v1/token"
JWT_AUDIENCE = '35284162000183'
| serpro_api_gateway = 'https://apigateway.serpro.gov.br'
serpro_public_jwks = 'https://d-biodata.estaleiro.serpro.gov.br/api/v1/jwks'
authenticate_endpoint = '/token'
biodata_token_endpoint = '/biodata/v1/token'
jwt_audience = '35284162000183' |
def div(a, b):
if(b != 0):
return a/b
else:
print("cannot divide by 0")
return
def add(a,b):
return a+b | def div(a, b):
if b != 0:
return a / b
else:
print('cannot divide by 0')
return
def add(a, b):
return a + b |
class Graph(object):
def __init__(self, n):
self._n = n
| class Graph(object):
def __init__(self, n):
self._n = n |
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
def base64_to_base10(s):
return sum(ALPHABET.index(j)*64**i for i,j in enumerate(s[::-1]))
| alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
def base64_to_base10(s):
return sum((ALPHABET.index(j) * 64 ** i for (i, j) in enumerate(s[::-1]))) |
class Solution:
def numIdenticalPairs(self, nums: List[int]) -> int:
#create counter
visited = {}
counter = 0
#loop through nums
for i in nums:
if i in visited:
counter += visited[i]
visited[i] += 1
... | class Solution:
def num_identical_pairs(self, nums: List[int]) -> int:
visited = {}
counter = 0
for i in nums:
if i in visited:
counter += visited[i]
visited[i] += 1
else:
visited[i] = 1
return counter |
n= int(input())
line1 = sum([int(i) for i in input().split()])
line2 = sum([int(i) for i in input().split()])
line3 = sum([int(i) for i in input().split()])
first = line1-line2
second = line2-line3
print(first)
print(second)
| n = int(input())
line1 = sum([int(i) for i in input().split()])
line2 = sum([int(i) for i in input().split()])
line3 = sum([int(i) for i in input().split()])
first = line1 - line2
second = line2 - line3
print(first)
print(second) |
#!/usr/bin/env python3
#Create and print string
people = "sapiens, erectus, neanderthalensis"
print(people)
#Split the string into individual words
species = people.split(', ')
print(species)
#Sort alphabetically
print(sorted(species))
#Sort be length of string and print
print(sorted(species,key=len))
| people = 'sapiens, erectus, neanderthalensis'
print(people)
species = people.split(', ')
print(species)
print(sorted(species))
print(sorted(species, key=len)) |
y = int(input("Digite um numero: "))
x = int(input("Digite um numero: "))
linha = 1
coluna = 1
while linha <= x:
while coluna <= y:
print(linha * coluna, end="\t")
coluna += 1
linha += 1
print()
coluna = 1
| y = int(input('Digite um numero: '))
x = int(input('Digite um numero: '))
linha = 1
coluna = 1
while linha <= x:
while coluna <= y:
print(linha * coluna, end='\t')
coluna += 1
linha += 1
print()
coluna = 1 |
class DataGeneratorCfg:
n_samples = 300
centers = [[-1, 0.5], [1, 0], [1,1]]
cluster_std = 0.5
random_state = None
class APCfg:
n_iterations = 300
damping = 0.8
preference = -50 #'MEDIAN', 'MINIMUM' or a value
class MainCfg:
generate_new_data=True # Saves it to data folde... | class Datageneratorcfg:
n_samples = 300
centers = [[-1, 0.5], [1, 0], [1, 1]]
cluster_std = 0.5
random_state = None
class Apcfg:
n_iterations = 300
damping = 0.8
preference = -50
class Maincfg:
generate_new_data = True
show_iterations = False
outfilename = 'output/result.png'
... |
"Implementing stack using python lists"
class UnderFlowError(Exception):
pass
class OverFlowError(Exception):
pass
class Stack:
def __init__(self, max_size):
self.s = []
self.top = -1
self.max_size = max_size
@property
def stack_empty(self):
return self.top == ... | """Implementing stack using python lists"""
class Underflowerror(Exception):
pass
class Overflowerror(Exception):
pass
class Stack:
def __init__(self, max_size):
self.s = []
self.top = -1
self.max_size = max_size
@property
def stack_empty(self):
return self.top =... |
# output: ok
a, b, c, d, e, f = 1000, 1000, 1000, 1000, 1000, 1000
g, h, i, j, k, l = 2, 1000, 1000, 1000, 1000, 1000
a = a + 1
b = b - 2
c = c * 3
d = d / 4
e = e // 5
f = f % 6
g = g ** 7
h = h << 8
i = i >> 9
j = j & 10
k = k ^ 11
l = l | 12
assert a == 1001
assert b == 998
assert c == 3000
assert d == 250
assert... | (a, b, c, d, e, f) = (1000, 1000, 1000, 1000, 1000, 1000)
(g, h, i, j, k, l) = (2, 1000, 1000, 1000, 1000, 1000)
a = a + 1
b = b - 2
c = c * 3
d = d / 4
e = e // 5
f = f % 6
g = g ** 7
h = h << 8
i = i >> 9
j = j & 10
k = k ^ 11
l = l | 12
assert a == 1001
assert b == 998
assert c == 3000
assert d == 250
assert e == 20... |
'''
Description : Data Structure Using String Method
Function Date : 07 Feb 2021
Function Author : Prasad Dangare
Input : str
Output : str
'''
# This is a string object
name = 'prasad'
if name.startswith('pra'):
print ('Yes, the string starts with "pra"')
if ... | """
Description : Data Structure Using String Method
Function Date : 07 Feb 2021
Function Author : Prasad Dangare
Input : str
Output : str
"""
name = 'prasad'
if name.startswith('pra'):
print('Yes, the string starts with "pra"')
if 'a' in name:
print('Yes, it contains the st... |
class Utilities:
@staticmethod
def get_longest(words):
longest = ""
for word in words:
if len(word) > len(longest):
longest = word
Utilities.log(longest)
return longest
@staticmethod
def log(word):
print("Logging: " + word)
| class Utilities:
@staticmethod
def get_longest(words):
longest = ''
for word in words:
if len(word) > len(longest):
longest = word
Utilities.log(longest)
return longest
@staticmethod
def log(word):
print('Logging: ' + word) |
data = {
4 : [2, 0, 3, 1],
5 : [3, 0, 2, 4, 1],
6 : [3, 0, 4, 1, 5, 2],
7 : [4, 0, 5, 3, 1, 6, 2],
8 : [2, 4, 1, 7, 0, 6, 3, 5],
9 : [3, 1, 4, 7, 0, 2, 5, 8, 6],
10 : [8, 4, 0, 7, 3, 1, 6, 9, 5, 2],
11 : [5, 7, 0, 3, 8, 2, 9, 6, 10, 1, 4],
12 : [7, 10, 0, 2, 8, 5, 3, 1, 9, 11, 6, 4],... | data = {4: [2, 0, 3, 1], 5: [3, 0, 2, 4, 1], 6: [3, 0, 4, 1, 5, 2], 7: [4, 0, 5, 3, 1, 6, 2], 8: [2, 4, 1, 7, 0, 6, 3, 5], 9: [3, 1, 4, 7, 0, 2, 5, 8, 6], 10: [8, 4, 0, 7, 3, 1, 6, 9, 5, 2], 11: [5, 7, 0, 3, 8, 2, 9, 6, 10, 1, 4], 12: [7, 10, 0, 2, 8, 5, 3, 1, 9, 11, 6, 4], 13: [7, 5, 2, 9, 12, 0, 4, 10, 1, 6, 11, 3, 8... |
{
"targets": [
{
"target_name": "clang_indexer",
"sources": [
"addon.cc"
],
"include_dirs": [
"<!(node -e \"require('nan')\")",
"/Users/vincentrouille/Dev/MicroStep/llvm/tools/clang/include"
],
"link_settings": {
"libraries": ["/Users/vincentroui... | {'targets': [{'target_name': 'clang_indexer', 'sources': ['addon.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")', '/Users/vincentrouille/Dev/MicroStep/llvm/tools/clang/include'], 'link_settings': {'libraries': ['/Users/vincentrouille/Dev/MicroStep/llvm/build-release/lib/libclang.dylib', '-Wl,-rpath ./']}, 'cfla... |
class FileHandler:
def get_data(self, path: str):
contents = []
try:
with open(path, 'r') as x:
content = x.read().strip()
contents = list(map(int, content.split(' ')))
except FileNotFoundError:
if path:
print(f"File at loca... | class Filehandler:
def get_data(self, path: str):
contents = []
try:
with open(path, 'r') as x:
content = x.read().strip()
contents = list(map(int, content.split(' ')))
except FileNotFoundError:
if path:
print(f"File at loc... |
'''
import random
## random choice will choose 1 option from the list
randnum = random.choice(['True', 'False'])
print(randnum)
'''
class Enemy:
def __init__(self):
pass
self.health = health
self.attack = attack
def health(self):
pass
def attack(self):
pass
class Player(Enemy):
d... | """
import random
## random choice will choose 1 option from the list
randnum = random.choice(['True', 'False'])
print(randnum)
"""
class Enemy:
def __init__(self):
pass
self.health = health
self.attack = attack
def health(self):
pass
def attack(self):
pass
cl... |
ids = [
"elrond",
"gandalf",
"galadriel",
"celeborn",
"aragorn",
"arwen",
"glorfindel",
"legolas",
"thorin",
"balin",
"gloin",
"gimli",
"denethor",
"boromir",
"faramir",
"theoden",
"eomer",
"eowyn",
"bilbo",
"frodo",
"sam",
"pipin",... | ids = ['elrond', 'gandalf', 'galadriel', 'celeborn', 'aragorn', 'arwen', 'glorfindel', 'legolas', 'thorin', 'balin', 'gloin', 'gimli', 'denethor', 'boromir', 'faramir', 'theoden', 'eomer', 'eowyn', 'bilbo', 'frodo', 'sam', 'pipin', 'merry', 'sauron', 'mordu', 'witchking', 'nazgul', 'azog', 'ugluk', 'mauhur', 'shagrat',... |
#Author: ahmelq - github.com/ahmedelq/
#License: MIT
#this is a solution of https://old.reddit.com/r/dailyprogrammer/comments/aphavc/20190211_challenge_375_easy_print_a_new_number_by/
# -- coding: utf-8 --
def exoticNum(n):
return ''.join([
str(int(num) + 1)
for num in list(str(n))])
i... | def exotic_num(n):
return ''.join([str(int(num) + 1) for num in list(str(n))])
if __name__ == '__main__':
print(exotic_num(998)) |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
class BaseAnonymizor(object):
'''BaseType for anonymizers of the *data-migrator*.
Instantiate the anonymizer and definition and call the instantiation at
translation time.
Implement the :meth:`~.__call__` method to implement your specific anonymizor.
... | class Baseanonymizor(object):
"""BaseType for anonymizers of the *data-migrator*.
Instantiate the anonymizer and definition and call the instantiation at
translation time.
Implement the :meth:`~.__call__` method to implement your specific anonymizor.
"""
def __call__(self, v):
"""out... |
# -*- coding: utf-8 -*-
def test_chat_delete(slack_time):
assert slack_time.chat.delete
def test_chat_delete_scheduled_message(slack_time):
assert slack_time.chat.delete_scheduled_message
def test_chat_get_permalink(slack_time):
assert slack_time.chat.get_permalink
def test_chat_me_message(slack_tim... | def test_chat_delete(slack_time):
assert slack_time.chat.delete
def test_chat_delete_scheduled_message(slack_time):
assert slack_time.chat.delete_scheduled_message
def test_chat_get_permalink(slack_time):
assert slack_time.chat.get_permalink
def test_chat_me_message(slack_time):
assert slack_time.cha... |
for _ in range(int(input())):
n = int(input())
s = input()
count_prev = 0
count = 0
changes = 0
for i in s:
if i == "(":
count -= 1
else:
count += 1
if count>0 and count>count_prev:
#print(i, count)
changes += 1
... | for _ in range(int(input())):
n = int(input())
s = input()
count_prev = 0
count = 0
changes = 0
for i in s:
if i == '(':
count -= 1
else:
count += 1
if count > 0 and count > count_prev:
changes += 1
count_prev = count
pr... |
a='platzi'
a=list(a) #Convierto a lista, porque una lista si se puede modificar
a[0]='c' #Realizo el cambio que necesito
a=''.join(a) #Concateno para obtener nuevamente el string
print(a)
| a = 'platzi'
a = list(a)
a[0] = 'c'
a = ''.join(a)
print(a) |
var1 = [0,1,2,3,4,5]
for x in var1:
var1[x] = x*x
for x in "123456":
print(x)
#While loop
someval = 1
while someval<1000:
someval *= 2 | var1 = [0, 1, 2, 3, 4, 5]
for x in var1:
var1[x] = x * x
for x in '123456':
print(x)
someval = 1
while someval < 1000:
someval *= 2 |
class Rod:
def __init__(self, length, boost_begin, boost_count, ang_acc):
self.length = length
self.boost_begin = boost_begin
self.boost_count = boost_count
self.ang_acc = ang_acc
self.ang_vel = 0
self.ang_pos = 0
| class Rod:
def __init__(self, length, boost_begin, boost_count, ang_acc):
self.length = length
self.boost_begin = boost_begin
self.boost_count = boost_count
self.ang_acc = ang_acc
self.ang_vel = 0
self.ang_pos = 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
QSDsan: Quantitative Sustainable Design for sanitation and resource recovery systems
This module is developed by:
Yalin Li <zoe.yalin.li@gmail.com>
This module is under the University of Illinois/NCSA Open Source License.
Please refer to https://github.com/QSD-G... | """
QSDsan: Quantitative Sustainable Design for sanitation and resource recovery systems
This module is developed by:
Yalin Li <zoe.yalin.li@gmail.com>
This module is under the University of Illinois/NCSA Open Source License.
Please refer to https://github.com/QSD-Group/QSDsan/blob/master/LICENSE.txt
for license ... |
class SingleNode:
def __init__(self, key, next=None):
self.key = key
self.next = None
def __repr__(self):
return f"Node: key={self.key}, next={self.next.key if self.next is not None else None}"
class SinglyLinkedList:
def __init__(self):
self.sentinel = SingleNode(None)
... | class Singlenode:
def __init__(self, key, next=None):
self.key = key
self.next = None
def __repr__(self):
return f'Node: key={self.key}, next={(self.next.key if self.next is not None else None)}'
class Singlylinkedlist:
def __init__(self):
self.sentinel = single_node(None... |
# Your code here
s=str(input())
n=len(s)
for i in range(n):
print(s[0],end="")
| s = str(input())
n = len(s)
for i in range(n):
print(s[0], end='') |
# from Attributes_and_Methods.movie_world_02E.project.customer import Customer
# from Attributes_and_Methods.movie_world_02E.project.dvd import DVD
class MovieWorld:
def __init__(self, name: str):
self.name = name
self.customers = []
self.dvds = []
@staticmethod
def dvd_capacity()... | class Movieworld:
def __init__(self, name: str):
self.name = name
self.customers = []
self.dvds = []
@staticmethod
def dvd_capacity():
return 15
@staticmethod
def customer_capacity():
return 10
def add_customer(self, customer):
if len(self.cust... |
print("Welcome to Python Prizza Deliveries!")
size = input("What size pirzza do you want? S, M, L \n")
add_pepperoni = input("Do you want pepperoni? Y or N \n")
extra_cheese = input("Do you want extra cheese? Y or N \n")
bill = 0
if size=="S" | "s":
bill += 15
if add_pepperoni == "Y":
bill +... | print('Welcome to Python Prizza Deliveries!')
size = input('What size pirzza do you want? S, M, L \n')
add_pepperoni = input('Do you want pepperoni? Y or N \n')
extra_cheese = input('Do you want extra cheese? Y or N \n')
bill = 0
if size == 'S' | 's':
bill += 15
if add_pepperoni == 'Y':
bill += 2
elif s... |
class Solution:
def nextGreaterElement(self, nums1, nums2):
# Write your code here
answer = {}
stack = []
for x in nums2:
while stack and stack[-1] < x:
answer[stack[-1]] = x
del stack[-1]
stack.append(x)
for x in stack... | class Solution:
def next_greater_element(self, nums1, nums2):
answer = {}
stack = []
for x in nums2:
while stack and stack[-1] < x:
answer[stack[-1]] = x
del stack[-1]
stack.append(x)
for x in stack:
answer[x] = -1
... |
def move_disk(fp,tp):
print("moving disk from",fp,"to",tp)
def move_tower(heigth,from_pole,to_pole,with_pole):
if heigth>=1:
move_tower(heigth-1,from_pole, with_pole, to_pole)
move_disk(from_pole,to_pole)
move_tower(heigth-1,with_pole,to_pole,from_pole)
def move_disk(fp,tp):
print("m... | def move_disk(fp, tp):
print('moving disk from', fp, 'to', tp)
def move_tower(heigth, from_pole, to_pole, with_pole):
if heigth >= 1:
move_tower(heigth - 1, from_pole, with_pole, to_pole)
move_disk(from_pole, to_pole)
move_tower(heigth - 1, with_pole, to_pole, from_pole)
def move_disk(... |
## Beginner Series #3 Sum of Numbers
## 7 kyu
## https://www.codewars.com/kata/55f2b110f61eb01779000053
def get_sum(a,b):
if a == b:
return a
elif a < b:
return sum([i for i in range(a, b+1)])
elif b < a:
return sum([i for i in range(b, a+1)]) | def get_sum(a, b):
if a == b:
return a
elif a < b:
return sum([i for i in range(a, b + 1)])
elif b < a:
return sum([i for i in range(b, a + 1)]) |
load(":repositories.bzl", "csharp_repos")
# NOTE: THE RULES IN THIS FILE ARE KEPT FOR BACKWARDS COMPATIBILITY ONLY.
# Please use the rules in repositories.bzl
def csharp_proto_compile(**kwargs):
print("Import of rules in deps.bzl is deprecated, please use repositories.bzl")
csharp_repos(**kwargs)
def c... | load(':repositories.bzl', 'csharp_repos')
def csharp_proto_compile(**kwargs):
print('Import of rules in deps.bzl is deprecated, please use repositories.bzl')
csharp_repos(**kwargs)
def csharp_grpc_compile(**kwargs):
print('Import of rules in deps.bzl is deprecated, please use repositories.bzl')
csharp... |
def count():
x=1
while x<10000:
yield x
x+=1
for x in count():
print(x) | def count():
x = 1
while x < 10000:
yield x
x += 1
for x in count():
print(x) |
#sorted(iterable, key=key, reverse=reverse)
# List
x = ['q', 'w', 'r', 'e', 't', 'y']
print (sorted(x))
# Tuple
x = ('q', 'w', 'e', 'r', 't', 'y')
print (sorted(x))
# String-sorted based on ASCII translations
x = "python"
print (sorted(x))
# Dictionary
x = {'q':1, 'w':2, 'e':3, 'r':4,... | x = ['q', 'w', 'r', 'e', 't', 'y']
print(sorted(x))
x = ('q', 'w', 'e', 'r', 't', 'y')
print(sorted(x))
x = 'python'
print(sorted(x))
x = {'q': 1, 'w': 2, 'e': 3, 'r': 4, 't': 5, 'y': 6}
print(sorted(x))
x = {'q', 'w', 'e', 'r', 't', 'y'}
print(sorted(x))
x = frozenset(('q', 'w', 'e', 'r', 't', 'y'))
print(sorted(x))
l... |
# python 3
# (C) Simon Gawlik
# started 8/1/2015
n = 20 #232792560
primes = []
non_primes = []
# find prime numbers up to n
def primes_lt_n (n):
for num in range (2, n + 1):
is_prime = True
for i in range (2, num):
if num % i == 0:
is_prime = False
if i... | n = 20
primes = []
non_primes = []
def primes_lt_n(n):
for num in range(2, n + 1):
is_prime = True
for i in range(2, num):
if num % i == 0:
is_prime = False
if is_prime:
primes.append(num)
else:
non_primes.append(num)
primes_lt_n(n... |
ages = [34, 87, 35, 31, 19, 44, 16]
odds = [age for age in ages if age % 2 == 1]
print(odds)
friends = ['Rolf', 'james', 'Sam', 'alex', 'Louise']
guests = ['jose', 'benjamin', 'Mark', 'Alex', 'Sophie', 'michelle', 'rolf']
lower_case_friends = [friend.lower() for friend in friends]
lower_case_guests = [guest.lower()... | ages = [34, 87, 35, 31, 19, 44, 16]
odds = [age for age in ages if age % 2 == 1]
print(odds)
friends = ['Rolf', 'james', 'Sam', 'alex', 'Louise']
guests = ['jose', 'benjamin', 'Mark', 'Alex', 'Sophie', 'michelle', 'rolf']
lower_case_friends = [friend.lower() for friend in friends]
lower_case_guests = [guest.lower() for... |
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of web_readonly_bypass,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# web_readonly_bypass is free software:
# you can redistribute it and/or m... | {'name': 'Read Only ByPass', 'version': '8.0.1.0.1', 'author': 'ACSONE SA/NV, Odoo Community Association (OCA)', 'maintainer': 'ACSONE SA/NV,Odoo Community Association (OCA)', 'website': 'http://www.acsone.eu', 'category': 'Technical Settings', 'depends': ['web'], 'summary': 'Allow to save onchange modifications to rea... |
#
# PySNMP MIB module POLICY-BASED-MANAGEMENT-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/POLICY-BASED-MANAGEMENT-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:23:59 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, ... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ... |
#!/usr/bin/env python3
def reverse(input: str) -> str:
if len(input) < 2:
return input
return input[-1] + reverse(input[1:-1]) + input[0]
def reverse_iter(input: str) -> str:
ret = ""
for i in range(len(input)):
ret += input[len(input)-1-i]
return ret
if __name__ == '__main__... | def reverse(input: str) -> str:
if len(input) < 2:
return input
return input[-1] + reverse(input[1:-1]) + input[0]
def reverse_iter(input: str) -> str:
ret = ''
for i in range(len(input)):
ret += input[len(input) - 1 - i]
return ret
if __name__ == '__main__':
string = input('Str... |
#cubes
list = []
for number in range(1,11):
list.append(number**3)
for number in list:
print(number)
| list = []
for number in range(1, 11):
list.append(number ** 3)
for number in list:
print(number) |
class decorate:
def __init__(self, arg1=None, arg2=None):
self.arg1 = arg1
self.arg2 = arg2
def __call__(self, method):
def wrapper():
print('ARG1 = %s, ARG2 = %s' % ( str(self.arg1), str(self.arg2)) )
method()
return wrapper
@decorate('the decoration... | class Decorate:
def __init__(self, arg1=None, arg2=None):
self.arg1 = arg1
self.arg2 = arg2
def __call__(self, method):
def wrapper():
print('ARG1 = %s, ARG2 = %s' % (str(self.arg1), str(self.arg2)))
method()
return wrapper
@decorate('the decoration', ... |
def Typename(name):
class TypeN(type):
def __repr__(cls):
return name
return TypeN
| def typename(name):
class Typen(type):
def __repr__(cls):
return name
return TypeN |
# https://leetcode.com/problems/maximum-number-of-balls-in-a-box
def get_box(ball):
count = 0
while ball > 0:
count += ball % 10
ball //= 10
return count
def count_balls(low_limit, high_limit):
hash_counter = {}
for ball in range(low_limit, high_limit + 1):
... | def get_box(ball):
count = 0
while ball > 0:
count += ball % 10
ball //= 10
return count
def count_balls(low_limit, high_limit):
hash_counter = {}
for ball in range(low_limit, high_limit + 1):
box = get_box(ball)
if box in hash_counter:
hash_counter[box] ... |
def removeDuplicates(nums):
if not nums:
return 0
slow = 1
for fast in range(1, len(nums)):
if nums[fast] != nums[slow-1]:
nums[slow] = nums[fast]
slow += 1
return slow
if __name__ == '__main__':
print(removeDuplicates([0,0,1,1,1,2,2,3,3,4]))
print(rem... | def remove_duplicates(nums):
if not nums:
return 0
slow = 1
for fast in range(1, len(nums)):
if nums[fast] != nums[slow - 1]:
nums[slow] = nums[fast]
slow += 1
return slow
if __name__ == '__main__':
print(remove_duplicates([0, 0, 1, 1, 1, 2, 2, 3, 3, 4]))
... |
# Magnum IO Developer Environment container recipe
Stage0 += comment('GENERATED FILE, DO NOT EDIT')
Stage0 += baseimage(image='nvcr.io/nvidia/cuda:11.4.0-devel-ubuntu20.04')
# GDS 1.0 is part of the CUDA base image
Stage0 += nsight_systems(cli=True, version='2021.2.1')
Stage0 += mlnx_ofed(version='5.3-1.0.0.1')
Stag... | stage0 += comment('GENERATED FILE, DO NOT EDIT')
stage0 += baseimage(image='nvcr.io/nvidia/cuda:11.4.0-devel-ubuntu20.04')
stage0 += nsight_systems(cli=True, version='2021.2.1')
stage0 += mlnx_ofed(version='5.3-1.0.0.1')
stage0 += gdrcopy(ldconfig=True, version='2.2')
stage0 += ucx(version='1.10.1', cuda=True, gdrcopy=... |
class IterationTimeoutError(Exception):
pass
class AlreadyRunningError(Exception):
pass
class TimeoutError(Exception):
pass
class MissingCredentialsError(Exception):
pass
class IncompleteCredentialsError(Exception):
pass
class FileNotFoundError(Exception):
pass
| class Iterationtimeouterror(Exception):
pass
class Alreadyrunningerror(Exception):
pass
class Timeouterror(Exception):
pass
class Missingcredentialserror(Exception):
pass
class Incompletecredentialserror(Exception):
pass
class Filenotfounderror(Exception):
pass |
class Solution(object):
def isValid(self, s):
stack = []
for word in s:
#print word
if word == "{" or word == "[" or word == "(":
stack.append(word)
elif word == "}" or word == "]"or word == ")":
if len(stack)==0:
... | class Solution(object):
def is_valid(self, s):
stack = []
for word in s:
if word == '{' or word == '[' or word == '(':
stack.append(word)
elif word == '}' or word == ']' or word == ')':
if len(stack) == 0:
return False
... |
# -*- coding: utf-8 -*-
'''
Management of Gitlab resources
==============================
:depends: - python-gitlab Python module
:configuration: See :py:mod:`salt.modules.gitlab` for setup instructions.
Enforce the project/repository
------------------------------
.. code-block:: yaml
gitlab_project:
g... | """
Management of Gitlab resources
==============================
:depends: - python-gitlab Python module
:configuration: See :py:mod:`salt.modules.gitlab` for setup instructions.
Enforce the project/repository
------------------------------
.. code-block:: yaml
gitlab_project:
gitlab.project_present:
... |
#
# PySNMP MIB module CISCO-LWAPP-MESH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-MESH-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:48:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = "NUM PAL\n lista : '[' conteudo ']'\n\n conteudo :\n | elementos\n\n elementos : elem\n | elem ',' elementos\n\n elem : NUM\n ... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = "NUM PAL\n lista : '[' conteudo ']'\n\n conteudo :\n | elementos\n\n elementos : elem\n | elem ',' elementos\n\n elem : NUM\n | PAL\n | lista\n\n "
_lr_action_items = {'[': ([0, 2, 10], [2, 2, 2]), '$end': (... |
numberMap = {}
maxValueKey= None
with open('data.txt', 'r') as data :
for line in data :
number = int(line)
value = None
if number in numberMap :
value = numberMap[number] + 1
else :
value = 1
numberMap[number] = value
if maxValueKey == None... | number_map = {}
max_value_key = None
with open('data.txt', 'r') as data:
for line in data:
number = int(line)
value = None
if number in numberMap:
value = numberMap[number] + 1
else:
value = 1
numberMap[number] = value
if maxValueKey == None or... |
class Elasticity(object):
def __init__(self, young_module, contraction, temperature):
self.__temperature = temperature
self.__contraction = contraction
self.__young_module = young_module
def get_temperature(self):
return self.__temperature
def get_contraction(self):
... | class Elasticity(object):
def __init__(self, young_module, contraction, temperature):
self.__temperature = temperature
self.__contraction = contraction
self.__young_module = young_module
def get_temperature(self):
return self.__temperature
def get_contraction(self):
... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class CircularLinkedList:
def __init__(self):
self.head = None
def print_list(self):
cur = self.head
while cur:
print(cur.data)
cur=cur.next
if cur == self... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Circularlinkedlist:
def __init__(self):
self.head = None
def print_list(self):
cur = self.head
while cur:
print(cur.data)
cur = cur.next
if cur == sel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.