content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
'''
test cases and facts for unit tests
'''
# list for testing fibonacci output
fib_list = [
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597,
2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418,
317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465,
... | """
test cases and facts for unit tests
"""
fib_list = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../../build/common_untrusted.gypi',
],
'conditions': [
['disable_nacl==0 and dis... | {'variables': {'chromium_code': 1}, 'includes': ['../../build/common_untrusted.gypi'], 'conditions': [['disable_nacl==0 and disable_nacl_untrusted==0', {'targets': [{'target_name': 'sandbox_linux_nacl_nonsfi', 'type': 'none', 'variables': {'nacl_untrusted_build': 1, 'nlib_target': 'libsandbox_linux_nacl_nonsfi.a', 'bui... |
# Given two integers representing the numerator and denominator of a fraction,
# return the fraction in string format.
# If the fractional part is repeating, enclose the repeating part in parentheses.
class Solution:
# @return a string
def fractionToDecimal(self, numerator, denominator):
(integer, rem... | class Solution:
def fraction_to_decimal(self, numerator, denominator):
(integer, remainder) = divmod(numerator, denominator)
if remainder == 0:
return str(integer)
else:
return str(integer) + '.' + self.tenths(remainder, denominator, '')
def tenths(self, numerat... |
credentials = dict(
email = '',
password = '',
telegram_api_token = '__telegram_api_token__',
telegram_userid = '__telegram_userid__'
)
| credentials = dict(email='', password='', telegram_api_token='__telegram_api_token__', telegram_userid='__telegram_userid__') |
"""
A Python 3 library for the analysis of data produced by AMIGA's Halo Finder (AHF).
For more information visit https://github.com/BenDavisonPetch/ahfhalotools
Usage and Examples
------------------
The majority of analysis is done via the ahfhalotools.objects.Cluster class. For
examples on usage, there are example ... | """
A Python 3 library for the analysis of data produced by AMIGA's Halo Finder (AHF).
For more information visit https://github.com/BenDavisonPetch/ahfhalotools
Usage and Examples
------------------
The majority of analysis is done via the ahfhalotools.objects.Cluster class. For
examples on usage, there are example ... |
with open("0404.csv", 'r', encoding='utf-8') as f:
lines = f.readlines()
new_Json = {}
hospital_Json = {}
hospital_Json['date'] = '0404'
school_list = []
for line in lines:
#print(len(line))
if len(line)<=1:
continue
lineList = line.split(",")
doc = ... | with open('0404.csv', 'r', encoding='utf-8') as f:
lines = f.readlines()
new__json = {}
hospital__json = {}
hospital_Json['date'] = '0404'
school_list = []
for line in lines:
if len(line) <= 1:
continue
line_list = line.split(',')
doc = {}
doc['Suburb'... |
"""
constants used throughout the application/
"""
ESC_KEY = 27
CHAR_Q = ord('q')
EXIT_KEYS = [ESC_KEY, CHAR_Q]
# Data fetch interval time.
REFRESH_INTERVAL = 1.5
"""
Describes the way screen should be divides. There
may be a better way to do this, but this works fine
for the current application since all boxes are ... | """
constants used throughout the application/
"""
esc_key = 27
char_q = ord('q')
exit_keys = [ESC_KEY, CHAR_Q]
refresh_interval = 1.5
'\nDescribes the way screen should be divides. There\nmay be a better way to do this, but this works fine\nfor the current application since all boxes are uniform.\n\n{\n NUM_APPLICATI... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2021, Cisco Systems
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r"""
---
module: sda_host_onboarding_access_point
short_description: Manage SdaHostOnboardingAccessPoint objects of Sda
descriptio... | documentation = "\n---\nmodule: sda_host_onboarding_access_point\nshort_description: Manage SdaHostOnboardingAccessPoint objects of Sda\ndescription:\n- Delete Port assignment for access point in SDA Fabric.\n- Get Port assignment for access point in SDA Fabric.\n- Add Port assignment for access point in SDA Fabric.\nv... |
num = int(input())
def f(n):
if n <= 0:
return 0
return f(n-1) + n
print(f(num))
| num = int(input())
def f(n):
if n <= 0:
return 0
return f(n - 1) + n
print(f(num)) |
all_heroes = {}
n = int(input())
max_hp = 100
max_mp = 200
for _ in range(n):
info = input().split(" ")
name = info[0]
hp = int(info[1])
mp = int(info[2])
# collect info in dict
if name not in all_heroes:
all_heroes[name] = {}
all_heroes[name]["hit points"] = hp
all_he... | all_heroes = {}
n = int(input())
max_hp = 100
max_mp = 200
for _ in range(n):
info = input().split(' ')
name = info[0]
hp = int(info[1])
mp = int(info[2])
if name not in all_heroes:
all_heroes[name] = {}
all_heroes[name]['hit points'] = hp
all_heroes[name]['mana points'] = mp... |
# -*- coding: utf-8 -*-
pytest_plugins = [
u'ckan.tests.pytest_ckan.ckan_setup',
u'ckan.tests.pytest_ckan.fixtures',
u'ckanext.harvest.tests.fixtures',
]
| pytest_plugins = [u'ckan.tests.pytest_ckan.ckan_setup', u'ckan.tests.pytest_ckan.fixtures', u'ckanext.harvest.tests.fixtures'] |
#!/usr/bin/env python3
# import numpy as np
# import time
class AIDASim:
def __init__(self):
self.ke = 5.4 # l/hr
self.k1 = 0.025 # /hr
self.k2 = 1.25 # /hr
self.Ibasal = 10 # mU/l
self.Km = 10 # mmol/l
self.GI = 0.54 # mmol/hr/kg
se... | class Aidasim:
def __init__(self):
self.ke = 5.4
self.k1 = 0.025
self.k2 = 1.25
self.Ibasal = 10
self.Km = 10
self.GI = 0.54
self.GX = 5.3
self.c = 0.015
self.kgabs = 1
self.Vmaxge = 120
self.VI = 0.142
self.Vg = 0.22
... |
# -*- coding:utf-8 -*-
class Solution:
stack1 = []
stack2 = []
def push(self, node):
# write code here
self.stack1.append(node)
def pop(self):
# return xx
if len(self.stack2)==0:
while len(self.stack1)!=0:
self.stack2.append(self.stack1[-1])
... | class Solution:
stack1 = []
stack2 = []
def push(self, node):
self.stack1.append(node)
def pop(self):
if len(self.stack2) == 0:
while len(self.stack1) != 0:
self.stack2.append(self.stack1[-1])
self.stack1.pop()
xx = self.stack2[-1]
... |
def validate_columns(table_catalog, column_family_id, keys, values_batch):
columns = table_catalog["column_families"][column_family_id]["columns"].keys()
row_key_identifiers = table_catalog["row_key_identifiers"]
unregisterd_keys = set(keys) - (set(row_key_identifiers) | set(columns))
if unregisterd_ke... | def validate_columns(table_catalog, column_family_id, keys, values_batch):
columns = table_catalog['column_families'][column_family_id]['columns'].keys()
row_key_identifiers = table_catalog['row_key_identifiers']
unregisterd_keys = set(keys) - (set(row_key_identifiers) | set(columns))
if unregisterd_key... |
#Given an integer n, return 1 - n in lexicographical order.
#
#For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9].
#
#Please optimize your algorithm to use less time and space. The input size may be as large as 5,000,000.
class Solution(object):
def lexicalOrder(self, n):
"""
:type n: int
:rtype: Li... | class Solution(object):
def lexical_order(self, n):
"""
:type n: int
:rtype: List[int]
"""
result = []
stack = []
x = 1
while x <= n:
stack.append(x)
result.append(x)
x *= 10
while stack:
y = stack.pop()
... |
""" Asked by: Twitter
Implement an autocomplete system. That is, given a query string s and a set of all possible query strings,
return all strings in the set that have s as a prefix.
For example, given the query string de and the set of strings [dog, deer, deal], return [deer, deal].
Hint: Try preprocessing the dicti... | """ Asked by: Twitter
Implement an autocomplete system. That is, given a query string s and a set of all possible query strings,
return all strings in the set that have s as a prefix.
For example, given the query string de and the set of strings [dog, deer, deal], return [deer, deal].
Hint: Try preprocessing the dicti... |
#!/usr/bin/env python3
# -*- coidng=utf-8 -*-
'''
learn MOEA/D
'''
def main():
pass
if __name__ == '__main__':
main() | """
learn MOEA/D
"""
def main():
pass
if __name__ == '__main__':
main() |
def displayPermuation(s):
return displayPermuationHelper("", s)
def displayPermuationHelper(s1, s2):
if len(s2) == 0:
print (s1)
for i in range(len(s2)):
displayPermuationHelper(s1 + s2[i], s2[0: i] + s2[i + 1 : ])
def main():
str = input("Please enter a string: ").replace(' ', '')
... | def display_permuation(s):
return display_permuation_helper('', s)
def display_permuation_helper(s1, s2):
if len(s2) == 0:
print(s1)
for i in range(len(s2)):
display_permuation_helper(s1 + s2[i], s2[0:i] + s2[i + 1:])
def main():
str = input('Please enter a string: ').replace(' ', '')
... |
"""
Settings for app
"""
READONLY_MODEL = {
'NAME': 'readonly_model',
'META_ATTR': 'read_only_model',
'DATABASE_ROUTER': 'readonly_model.dbrouters.ReadOnlyModelRouter'
}
| """
Settings for app
"""
readonly_model = {'NAME': 'readonly_model', 'META_ATTR': 'read_only_model', 'DATABASE_ROUTER': 'readonly_model.dbrouters.ReadOnlyModelRouter'} |
Version = "{{VERSION}}"
if __name__ == "__main__":
print(Version)
| version = '{{VERSION}}'
if __name__ == '__main__':
print(Version) |
# Problem URL: https://leetcode.com/problems/4sum/
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
solution = set()
nums.sort()
if len(nums) < 4:
return []
for i in range(len(nums)-3):
for j in range(... | class Solution:
def four_sum(self, nums: List[int], target: int) -> List[List[int]]:
solution = set()
nums.sort()
if len(nums) < 4:
return []
for i in range(len(nums) - 3):
for j in range(i + 1, len(nums) - 2):
p = j + 1
q = le... |
class Cursor:
def __init__(self, wnd):
self.wnd = wnd
self.pos = 0
self.preferred_col = 0
self.preferred_linecol = 0
self.last_screenpos = (-1, -1)
def refresh(self, top=None, middle=None, bottom=None,
align_always=False):
self.pos, y, x = self.w... | class Cursor:
def __init__(self, wnd):
self.wnd = wnd
self.pos = 0
self.preferred_col = 0
self.preferred_linecol = 0
self.last_screenpos = (-1, -1)
def refresh(self, top=None, middle=None, bottom=None, align_always=False):
(self.pos, y, x) = self.wnd.locate_curs... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 5 17:15:00 2018
@author: User
"""
## find max list 07_04
#
#testList = [-2,1,-3,4,-1,2,1,-5,4]
#aList = [-1,2,-5,1]
##aList = [1, 2, 3]
#
#def maxSum(lst, left, right):
# leftSum = 0
# rightSum = 0
# maxLeft = 0
# maxRight = 0
#
# middl... | """
Created on Fri Jan 5 17:15:00 2018
@author: User
"""
test_list = [1, -2, 3, 6, -3, -1, 6, -5]
def max_list(lst, start, end):
(max_left, max_right) = (0, 0)
(left_sum, right_sum) = (0, 0)
middle = (start + end) // 2
if start == end:
return max(lst[start], 0)
max_leftlist = max_list(lst... |
### Types to hold CTR's data
class catboost_model_ctr(object):
def __init__(self, base_hash, base_ctr_type, target_border_idx, prior_num, prior_denom, shift, scale):
self.base_hash = base_hash
self.base_ctr_type = base_ctr_type
self.target_border_idx = target_border_idx
self.prior_n... | class Catboost_Model_Ctr(object):
def __init__(self, base_hash, base_ctr_type, target_border_idx, prior_num, prior_denom, shift, scale):
self.base_hash = base_hash
self.base_ctr_type = base_ctr_type
self.target_border_idx = target_border_idx
self.prior_num = prior_num
self.p... |
def solve(a, b):
larger = max(a, b)
return larger
def main():
a, b = map(int, input().strip().split())
a, b = int(str(a)[::-1]), int(str(b)[::-1])
return solve(a, b)
if __name__ == "__main__":
print(main()) | def solve(a, b):
larger = max(a, b)
return larger
def main():
(a, b) = map(int, input().strip().split())
(a, b) = (int(str(a)[::-1]), int(str(b)[::-1]))
return solve(a, b)
if __name__ == '__main__':
print(main()) |
"""
"""
encrypted_message=""
def convert_text(x):
"""
convert letters in text into the coresspoding alphabetic order
"""
l = list()
x = x.lower()
for i in x:
num = ord(i) - ord("a") + 1
l.append(num)
return l
def cal_occurence(correspoding_text_number_list):
"""
... | """
"""
encrypted_message = ''
def convert_text(x):
"""
convert letters in text into the coresspoding alphabetic order
"""
l = list()
x = x.lower()
for i in x:
num = ord(i) - ord('a') + 1
l.append(num)
return l
def cal_occurence(correspoding_text_number_list):
"""
c... |
if __name__ == '__main__':
samples = [
[0, 0, 2, 'EA'],
[1, 'QRI', 0, 4, 'RRQR'],
[1, 'QFT', 1, 'QF', 7, 'FAQFDFQ'],
[1, 'EEZ', 1, 'QE', 7, 'QEEEERA'],
[0, 1, 'QW', 2, 'QW']
]
for sample in samples:
haha
| if __name__ == '__main__':
samples = [[0, 0, 2, 'EA'], [1, 'QRI', 0, 4, 'RRQR'], [1, 'QFT', 1, 'QF', 7, 'FAQFDFQ'], [1, 'EEZ', 1, 'QE', 7, 'QEEEERA'], [0, 1, 'QW', 2, 'QW']]
for sample in samples:
haha |
# Copyright 2021 Robert Grimm
#
# 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,... | """Liberate your posts from Facebook"""
__version__ = '0.9.0'
__all__ = ['cli', 'error', 'ingest', 'logger', 'model', 'serde', 'validator'] |
LOG_FILE_NAME = "logs/log.txt"
SUCESS_FILE_NAME = "logs/success.txt"
FAIL_FILE_NAME = "logs/fail.txt"
EXCEPTION_FILE_NAME = "logs/exception.txt"
ALL_PATHS = [LOG_FILE_NAME, SUCESS_FILE_NAME, FAIL_FILE_NAME, EXCEPTION_FILE_NAME] | log_file_name = 'logs/log.txt'
sucess_file_name = 'logs/success.txt'
fail_file_name = 'logs/fail.txt'
exception_file_name = 'logs/exception.txt'
all_paths = [LOG_FILE_NAME, SUCESS_FILE_NAME, FAIL_FILE_NAME, EXCEPTION_FILE_NAME] |
day = ["saturday", "sunday", "monday", "tuesday", "wednesday", "thursday", "friday"]
for _ in range(int(input())):
a = [x for x in input().split()]
# gap = abs(d[a[0]] - d[a[1]]) + 1
l,r = int(a[2]),int(a[3])
c,d = 0,0
for i in range(len(day)):
if(a[0] == day[i]): c = i
if(a[1] == day[i]): d = i
if(c == d):g... | day = ['saturday', 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday']
for _ in range(int(input())):
a = [x for x in input().split()]
(l, r) = (int(a[2]), int(a[3]))
(c, d) = (0, 0)
for i in range(len(day)):
if a[0] == day[i]:
c = i
if a[1] == day[i]:
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Jeremy Parks
# Note: Requires Python 3.3.x or higher
desc = "Animate Weapon target"
# types intended for this is "animate melee" and "animate range"
# Base type : settings pair
items = {
"0 animate melee white 4x1": {"other": ["Class Dagger \"One Hand\" Stave \"Two... | desc = 'Animate Weapon target'
items = {'0 animate melee white 4x1': {'other': ['Class Dagger "One Hand" Stave "Two Hand" Sceptre Claws', 'Rarity Normal', 'Height 4', 'Width 1'], 'type': 'animate melee b'}, '0 animate range white 4x1': {'other': ['Class Wand Bow', 'Rarity Normal', 'Height 4', 'Width 1'], 'type': 'ignor... |
class Solution:
def buildtree(self, preorder, inorder):
if inorder:
root_index = inorder.index(preorder.pop(0))
root = TreeNode(inorder[root_index])
root.left = self.buildtree(preorder, inorder[:root_index])
rootright = self.buildtree(preorder, inorder[root_in... | class Solution:
def buildtree(self, preorder, inorder):
if inorder:
root_index = inorder.index(preorder.pop(0))
root = tree_node(inorder[root_index])
root.left = self.buildtree(preorder, inorder[:root_index])
rootright = self.buildtree(preorder, inorder[root_... |
# b_flow
# Flow constraint vector
__all__ = ["b_flow"]
def b_flow(a_vertices):
# b_flow
#
# Construct flow constraint vector
# (vector of size |V| x 1 representing the sum of flow for each vertex.
# Having removed source and drain nodes. Now require:
# L nodes = -1
# R nodes = +1
# A... | __all__ = ['b_flow']
def b_flow(a_vertices):
b = []
l_cells = sum((1 for x in a_vertices if 'L' in x))
r_cells = sum((1 for x in a_vertices if 'R' in x))
for node in a_vertices:
if 'L' in node:
b.append(-1)
elif 'R' in node:
b.append(1)
elif 'A' in node:
... |
"""
There is a road consisting of N segments, numbered from 0 to N-1, represented by a string S.
Segment S[K] of the road may contain a pothole, denoted by a single uppercase "x" character, or may be a good segment without any potholes, denoted by a single dot,".".
For example, string".X. .X" means that there are two... | """
There is a road consisting of N segments, numbered from 0 to N-1, represented by a string S.
Segment S[K] of the road may contain a pothole, denoted by a single uppercase "x" character, or may be a good segment without any potholes, denoted by a single dot,".".
For example, string".X. .X" means that there are two... |
class Employee:
raise_amt = 1.04
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + last + "@compani.com"
def fullname(self):
return f"{self.first} {self.last}"
def add_raise(self):
self.pay ... | class Employee:
raise_amt = 1.04
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + last + '@compani.com'
def fullname(self):
return f'{self.first} {self.last}'
def add_raise(self):
self.pay = i... |
n = int(input())
while(n != 0):
jogadas = list(map(int, input().split()))
contMary = contJonh = 0
for i in range(len(jogadas)):
if(jogadas[i] == 0):
contMary = contMary + 1
else:
contJonh = contJonh + 1
print("Mary won {} times and John won {} times".form... | n = int(input())
while n != 0:
jogadas = list(map(int, input().split()))
cont_mary = cont_jonh = 0
for i in range(len(jogadas)):
if jogadas[i] == 0:
cont_mary = contMary + 1
else:
cont_jonh = contJonh + 1
print('Mary won {} times and John won {} times'.format(cont... |
def lowestCommonAncestor(self, root, p, q):
if root in (None, p, q): return root
left = self.lowestCommonAncestor(root.left, p, q)
right = self.lowestCommonAncestor(root.right, p, q)
return root if left and right else left or right | def lowest_common_ancestor(self, root, p, q):
if root in (None, p, q):
return root
left = self.lowestCommonAncestor(root.left, p, q)
right = self.lowestCommonAncestor(root.right, p, q)
return root if left and right else left or right |
class Ordenation:
def selection_sort(self, lista):
fim = len(lista)
for i in range(fim-1):
# Inicialmente, o menor elemento ja visto e o i-esimo
posicao_do_menor = i
for j in range(i+1, fim):
if lista[j] < lista[posicao_do_menor]:
... | class Ordenation:
def selection_sort(self, lista):
fim = len(lista)
for i in range(fim - 1):
posicao_do_menor = i
for j in range(i + 1, fim):
if lista[j] < lista[posicao_do_menor]:
posicao_do_menor = j
(lista[i], lista[posicao_... |
class heap(list):
"""docstring for heap"""
def __init__(self, heap_size):
super(heap, self).__init__()
self.heap_size = heap_size
def parent(i):
return ((i+1) / 2) - 1
def left(i):
return 2*i+1
def right(i):
return 2*i+2
def max_heapify(A, i):
while i < A.heap_size:
l = left(i)
r = left(i)
largest =... | class Heap(list):
"""docstring for heap"""
def __init__(self, heap_size):
super(heap, self).__init__()
self.heap_size = heap_size
def parent(i):
return (i + 1) / 2 - 1
def left(i):
return 2 * i + 1
def right(i):
return 2 * i + 2
def max_heapify(A, i):
while i < A.heap_size:
... |
def minimumMovement(obstacleLanes):
# Write your code here
pass
minimumMovement([2, 3, 2, 1, 3, 1]) # 2
minimumMovement([2, 1, 3, 3, 3, 1]) # 2
minimumMovement([3, 2, 2, 1, 2, 1]) # 1 | def minimum_movement(obstacleLanes):
pass
minimum_movement([2, 3, 2, 1, 3, 1])
minimum_movement([2, 1, 3, 3, 3, 1])
minimum_movement([3, 2, 2, 1, 2, 1]) |
class MyList(list):
def append(self, *args):
self.extend(args)
m = MyList()
m.append(0)
m.append(1,2,3,4,5,6)
print(m)
class MyList1(list):
def sort(self):
return 'eae vey? ta afim de ordenar?'
l = [4,1,78,34,4,9]
'''l.sort()
print(l)'''
lista = MyList1()
print(lista.sort())
| class Mylist(list):
def append(self, *args):
self.extend(args)
m = my_list()
m.append(0)
m.append(1, 2, 3, 4, 5, 6)
print(m)
class Mylist1(list):
def sort(self):
return 'eae vey? ta afim de ordenar?'
l = [4, 1, 78, 34, 4, 9]
'l.sort()\nprint(l)'
lista = my_list1()
print(lista.sort()) |
"""
Fibonacci number sequence problem, find the nearest Fibonacci number
"""
def fibs():
a, b = 0, 1
yield a
yield b
while True:
a, b = b, a + b
yield b
def nearestFib(n):
"""If n is fibo num return True and n
Otherwiise return False and nearest Fibo"""
for fib in fi... | """
Fibonacci number sequence problem, find the nearest Fibonacci number
"""
def fibs():
(a, b) = (0, 1)
yield a
yield b
while True:
(a, b) = (b, a + b)
yield b
def nearest_fib(n):
"""If n is fibo num return True and n
Otherwiise return False and nearest Fibo"""
for fib... |
n1 = input('Digite algo:')
print('isnumeric:', n1.isnumeric())
print('isalpha:', n1.isalpha())
print('islower:', n1.islower())
print('isalnum:', n1.isalnum())
| n1 = input('Digite algo:')
print('isnumeric:', n1.isnumeric())
print('isalpha:', n1.isalpha())
print('islower:', n1.islower())
print('isalnum:', n1.isalnum()) |
#===============================================================
# DMXIS Macro (c) 2010 db audioware limited
#===============================================================
RgbColour(75,0,130)
| rgb_colour(75, 0, 130) |
def calc_result(home, away):
if home < away:
return 'lose'
elif home > away:
return 'win'
else:
return 'draw'
def calc_bet_result(
home_score, away_score,
home_bet, away_bet,
shootout_winner=None,
shootout_bet=None,
):
if home_score == home_bet a... | def calc_result(home, away):
if home < away:
return 'lose'
elif home > away:
return 'win'
else:
return 'draw'
def calc_bet_result(home_score, away_score, home_bet, away_bet, shootout_winner=None, shootout_bet=None):
if home_score == home_bet and away_score == away_bet:
s... |
#: Okay
GLOBAL_UPPER_CASE = 0
#: N816
mixedCase = 0
#: N816:1:1
mixed_Case = 0
#: Okay
_C = 0
#: Okay
__D = 0
#: N816
__mC = 0
#: N816
__mC__ = 0
#: Okay
__C6__ = 0
#: Okay
C6 = 0
#: Okay
C_6 = 0.
#: Okay(--ignore-names=mixedCase)
mixedCase = 0
| global_upper_case = 0
mixed_case = 0
mixed__case = 0
_c = 0
__d = 0
__m_c = 0
__m_c__ = 0
__c6__ = 0
c6 = 0
c_6 = 0.0
mixed_case = 0 |
def sumOfNumbers(n):
if n <= 1:
return n
else:
return n + sumOfNumbers(n-1)
print(sumOfNumbers(10)) | def sum_of_numbers(n):
if n <= 1:
return n
else:
return n + sum_of_numbers(n - 1)
print(sum_of_numbers(10)) |
WIDTH = 32
HEIGHT = 32
FIRST = 0x20
LAST = 0x7f
_font =\
b'\x00\x4a\x5a\x0e\x4d\x57\x52\x46\x51\x48\x52\x54\x53\x48\x52'\
b'\x46\x20\x52\x52\x48\x52\x4e\x20\x52\x52\x59\x51\x5a\x52\x5b'\
b'\x53\x5a\x52\x59\x15\x49\x5b\x4e\x46\x4d\x47\x4d\x4d\x20\x52'\
b'\x4e\x47\x4d\x4d\x20\x52\x4e\x46\x4f\x47\x4d\x4d\x20\x52\x57'\
b'... | width = 32
height = 32
first = 32
last = 127
_font = b'\x00JZ\x0eMWRFQHRTSHRF RRHRN RRYQZR[SZRY\x15I[NFMGMM RNGMM RNFOGMM RWFVGVM RWGVM RWFXGVM\x0bH]SBLb RYBRb RLOZO RKUYU)H\\PBP_ RTBT_ RXIWJXKYJYIWGTFPFMGKIKKLMMNOOUQWRYT RKKMMONUPWQXRYTYXWZT[P[MZKXKWLVMWLX\x1fF^[FI[ RNFPHPJOLMMKMIKIIJGLFNFPGSHVHYG[F RWTUUTWTYV[X[ZZ[X[... |
"""
UCL Academic Modelling Project
Fast Code Processing
"""
STUDENT_TYPES = {
'A': "Campus-based, numeric mark scheme",
'B': "Campus-based, non-numeric mark scheme",
'C': "Distance learner, numeric mark scheme",
'D': "Distance learner, non-numeric mark scheme",
'E': "MBBS Resit"
}
c... | """
UCL Academic Modelling Project
Fast Code Processing
"""
student_types = {'A': 'Campus-based, numeric mark scheme', 'B': 'Campus-based, non-numeric mark scheme', 'C': 'Distance learner, numeric mark scheme', 'D': 'Distance learner, non-numeric mark scheme', 'E': 'MBBS Resit'}
class Invalidampcodeexception(Exception... |
# encoding: UTF-8
RISK_MANAGER = u'Risk Manager'
RISK_MANAGER_STOP = u'RM Stop'
RISK_MANAGER_RUNNING = u'RM Running'
CLEAR_ORDER_FLOW_COUNT = u'Clear Flow Count'
CLEAR_TOTAL_FILL_COUNT = u'Clear Fill Count'
SAVE_SETTING = u'Save Setting'
WORKING_STATUS = u'Working Status'
ORDER_FLOW_LIMIT = u'Flow Limit'
ORDER_FLOW_... | risk_manager = u'Risk Manager'
risk_manager_stop = u'RM Stop'
risk_manager_running = u'RM Running'
clear_order_flow_count = u'Clear Flow Count'
clear_total_fill_count = u'Clear Fill Count'
save_setting = u'Save Setting'
working_status = u'Working Status'
order_flow_limit = u'Flow Limit'
order_flow_clear = u'Flow Clear(... |
# lst = [1, 2, 3, 4, 6, 9]
# integ = 15
# result = []
# if len(lst) < 2:
# raise ValueError
# for i in lst:
# for j in lst:
# if i + j == integ:
# result.append([i, j])
# if len(result) != 0:
# print(result)
# lst = [1, 2, 3, 4, 6, 9]
# integ = 15
# result = []
# if... | def cari_pasangan(lst, integ):
result = []
if len(lst) < 2:
raise ValueError
for i in lst:
for j in lst:
if i + j == integ and [j, i] not in result:
result.append([i, j])
if len(result) != 0:
return result
print(cari_pasangan([1, 2, 3, 4, 5], 7)) |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE I... | def w_count(name, text):
result = dict()
c_values = dict()
for c in name.lower().replace(' ', ''):
if c not in c_values:
result[c] = 0
c_values[c] = 0
c_values[c] = (c_values[c] + 1) * 2
for k in c_values:
result[k] = calculate(k, c_values[k], text.split()... |
class SqlQueries:
staging_songs_table_create = ("""
CREATE TABLE IF NOT EXISTS staging_songs (
num_songs int4,
artist_id varchar(256),
artist_name varchar(256),
artist_latitude numeric(18,0),
artist_longitude numeric(18,0),
artist_locat... | class Sqlqueries:
staging_songs_table_create = '\n CREATE TABLE IF NOT EXISTS staging_songs (\n num_songs int4,\n artist_id varchar(256),\n artist_name varchar(256),\n artist_latitude numeric(18,0),\n artist_longitude numeric(18,0),\n artist_l... |
#
# PySNMP MIB module CODIMA-EXPRESS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CODIMA-EXPRESS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:25:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, single_value_constraint, value_range_constraint, constraints_intersection) ... |
class Solution:
def peakIndexInMountainArray(self, arr: List[int]) -> int:
if not arr or len(arr) < 3:
return
start, end = 0, len(arr) - 1
while start + 1 < end:
mid = (start + end) // 2
if arr[mid] > arr[mid - 1]:
start =... | class Solution:
def peak_index_in_mountain_array(self, arr: List[int]) -> int:
if not arr or len(arr) < 3:
return
(start, end) = (0, len(arr) - 1)
while start + 1 < end:
mid = (start + end) // 2
if arr[mid] > arr[mid - 1]:
start = mid
... |
#!/usr/bin/env qork
img = "player.png"
camera.mode = "3D"
camera.z = 1
p = add(img)
level = add("map.png", scale=25, pos=-Z * 10)
nodes = [None] * 4
nodes[0] = p.add(img, scale=0.25, pos=(-0.5, 0.5, 0.1))
nodes[1] = p.add(img, scale=0.25, pos=(0.5, -0.5, 0.1))
nodes[2] = p.add(img, scale=0.25, pos=(-0.5, -0.5, 0.1... | img = 'player.png'
camera.mode = '3D'
camera.z = 1
p = add(img)
level = add('map.png', scale=25, pos=-Z * 10)
nodes = [None] * 4
nodes[0] = p.add(img, scale=0.25, pos=(-0.5, 0.5, 0.1))
nodes[1] = p.add(img, scale=0.25, pos=(0.5, -0.5, 0.1))
nodes[2] = p.add(img, scale=0.25, pos=(-0.5, -0.5, 0.1))
nodes[3] = p.add(img, ... |
"""
Comprehensions - constructs that allow sequences to be built
from other sequences
Three types -
List Comprehensions
Dictionary Comprehensions
Set Comprehensions
"""
# List Comprehensions
# variable = [out_exp for out_exp in input_list if out_exp == 2]
multiples = [i for i in range(30) if i % 3 is 0]
print(m... | """
Comprehensions - constructs that allow sequences to be built
from other sequences
Three types -
List Comprehensions
Dictionary Comprehensions
Set Comprehensions
"""
multiples = [i for i in range(30) if i % 3 is 0]
print(multiples)
squared = [x ** 2 for x in range(10)]
mcase = {'a': 10, 'b': 34, 'A': 7, 'Z': 3... |
#!/usr/bin/python
table_cols = 9
table_rows = 9
list_size = 9
with open("vimwiki.snippets", "w") as file:
# generate tables
for i in range(1, table_cols+1):
for j in range(1, table_rows+1):
file.write("snippet table{}x{} \"table{}x{}\" A\n".format(i, j, i, j))
for k in range... | table_cols = 9
table_rows = 9
list_size = 9
with open('vimwiki.snippets', 'w') as file:
for i in range(1, table_cols + 1):
for j in range(1, table_rows + 1):
file.write('snippet table{}x{} "table{}x{}" A\n'.format(i, j, i, j))
for k in range(0, i):
file.write('|')
... |
# -*- coding: utf-8 -*-
def main():
h, w = map(int, input().split())
grids = [list(input()) for _ in range(h)]
up = [[1 for __ in range(w)] for _ in range(h)]
down = [[1 for __ in range(w)] for _ in range(h)]
left = [[1 for __ in range(w)] for _ in range(h)]
right = [[1 for __ in rang... | def main():
(h, w) = map(int, input().split())
grids = [list(input()) for _ in range(h)]
up = [[1 for __ in range(w)] for _ in range(h)]
down = [[1 for __ in range(w)] for _ in range(h)]
left = [[1 for __ in range(w)] for _ in range(h)]
right = [[1 for __ in range(w)] for _ in range(h)]
ans ... |
def solution(nums):
setNums = set(nums)
if len(setNums) > (len(nums) // 2): return len(nums) // 2
return len(setNums)
# print(solution([3,1,2,3]))
# print(solution([3,3,3,2,2,4]))
print(solution([3, 3, 3, 2, 2, 2]))
| def solution(nums):
set_nums = set(nums)
if len(setNums) > len(nums) // 2:
return len(nums) // 2
return len(setNums)
print(solution([3, 3, 3, 2, 2, 2])) |
def test1():
for i in range(2):
print('+' + str(i))
yield str(i)
for a in test1():
print("-" + a)
for a in list(test1()):
print('-' + a) | def test1():
for i in range(2):
print('+' + str(i))
yield str(i)
for a in test1():
print('-' + a)
for a in list(test1()):
print('-' + a) |
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation, obj[3]: Distance
# {"feature": "Coupon", "instances": 51, "metric_value": 0.9975, "depth": 1}
if obj[0]>1:
# {"feature": "Education", "instances": 37, "metric_value": 0.9353, "depth": 2}
if obj[1]>0:
# {"feature": "Occupation", "ins... | def find_decision(obj):
if obj[0] > 1:
if obj[1] > 0:
if obj[2] <= 20:
if obj[3] <= 2:
return 'True'
elif obj[3] > 2:
return 'True'
else:
return 'True'
elif obj[2] > 20:
... |
# -*- coding: utf-8 -*-
"""
Auth* related model.
This is where the models used by the authentication stack are defined.
It's perfectly fine to re-use this definition in the redrugs application,
though.
"""
| """
Auth* related model.
This is where the models used by the authentication stack are defined.
It's perfectly fine to re-use this definition in the redrugs application,
though.
""" |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, Brian Scholer <@briantist>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r'''
---
module: win_psrepository_copy
short_description: Copies registered PSRepositories to other user profiles
ver... | documentation = '\n---\nmodule: win_psrepository_copy\nshort_description: Copies registered PSRepositories to other user profiles\nversion_added: \'1.3.0\'\ndescription:\n - Copies specified registered PSRepositories to other user profiles on the system.\n - Can include the C(Default) profile so that new users start ... |
# -*- coding: utf-8 -*-
__version__ = '4.4.0'
__description__ = """Sequoia Python Client SDK"""
__url__ = "https://github.com/pikselpalette/sequoia-python-client-sdk"
__author__ = 'Piksel'
| __version__ = '4.4.0'
__description__ = 'Sequoia Python Client SDK'
__url__ = 'https://github.com/pikselpalette/sequoia-python-client-sdk'
__author__ = 'Piksel' |
class MockupSpineLog(object):
def debug(self, message, *args):
pass
class MockupSpine(object):
def __init__(self):
self.queryHandlers = {}
self.commandHandlers = {}
self.eventHandlers = {}
self.events={}
self.log = MockupSpineLog()
def register_query_handler... | class Mockupspinelog(object):
def debug(self, message, *args):
pass
class Mockupspine(object):
def __init__(self):
self.queryHandlers = {}
self.commandHandlers = {}
self.eventHandlers = {}
self.events = {}
self.log = mockup_spine_log()
def register_query_h... |
class BaseError(Exception):
"""Base error class"""
pass
class UtilError(BaseError):
"""Base util error class"""
pass
class CCMAPIError(UtilError):
"""Raised when a ccm_api returned status is not `ok`"""
pass | class Baseerror(Exception):
"""Base error class"""
pass
class Utilerror(BaseError):
"""Base util error class"""
pass
class Ccmapierror(UtilError):
"""Raised when a ccm_api returned status is not `ok`"""
pass |
def interchange(array,k):
low,high,n = 0, len(array)-1,len(array)
x = min(k,n-k)
for i in range(x):
array[low],array[high] = array[high],array[low]
low +=1
high -= 1
def rotateArray(array,k):
for i in range(k):
temp = array[0]
for j in range(len(array)-1):
... | def interchange(array, k):
(low, high, n) = (0, len(array) - 1, len(array))
x = min(k, n - k)
for i in range(x):
(array[low], array[high]) = (array[high], array[low])
low += 1
high -= 1
def rotate_array(array, k):
for i in range(k):
temp = array[0]
for j in range... |
class TestClass:
def test_deepsegmenter(self):
"""here is my test code
https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test
"""
# no test now
assert True
| class Testclass:
def test_deepsegmenter(self):
"""here is my test code
https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test
"""
assert True |
"""
RISC-V disassemble helper
(c) 2019 The Bonfire Project
License: See LICENSE
"""
abi_regnames = ( "zero","ra","sp","gp","tp","t0","t1","t2","s0","s1","a0","a1","a2","a3","a4","a5", \
"a6","a7","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","t3","t4","t5","t6")
def abi_name(x):
return ab... | """
RISC-V disassemble helper
(c) 2019 The Bonfire Project
License: See LICENSE
"""
abi_regnames = ('zero', 'ra', 'sp', 'gp', 'tp', 't0', 't1', 't2', 's0', 's1', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 's10', 's11', 't3', 't4', 't5', 't6')
def abi_name(x):
r... |
class Record():
def __init__(self, record_id, parent_id):
self.record_id = record_id
self.parent_id = parent_id
class Node():
def __init__(self, node_id):
self.node_id = node_id
self.children = []
def BuildTree(records):
root = None
records.sort(key=lambda x: x.record... | class Record:
def __init__(self, record_id, parent_id):
self.record_id = record_id
self.parent_id = parent_id
class Node:
def __init__(self, node_id):
self.node_id = node_id
self.children = []
def build_tree(records):
root = None
records.sort(key=lambda x: x.record_id... |
def restrict_level(mobs, level):
for mob, priority in mobs:
if level < mob.level:
continue
yield (mob, priority)
def restrict_terrain(mobs, terrain):
for mob, priority in mobs:
if terrain not in mob.terrains:
continue
yield (mob, priority)
def restri... | def restrict_level(mobs, level):
for (mob, priority) in mobs:
if level < mob.level:
continue
yield (mob, priority)
def restrict_terrain(mobs, terrain):
for (mob, priority) in mobs:
if terrain not in mob.terrains:
continue
yield (mob, priority)
def restri... |
# noinspection PyBroadException
def computegrade(score):
try:
score = float(input("Enter the score"))
if score >= 0.9:
print("Grade A")
elif score >= 0.8:
print("Grade B")
elif score >= 0.7:
print("Grade C")
elif score >= 0.6:
p... | def computegrade(score):
try:
score = float(input('Enter the score'))
if score >= 0.9:
print('Grade A')
elif score >= 0.8:
print('Grade B')
elif score >= 0.7:
print('Grade C')
elif score >= 0.6:
print('Grade D')
elif sco... |
""" LOL! I need = (One; Javascript) ~please . bin/djet.lang:print
:Note! 13; Street, Lulin10, Sofia; Boril B. Boyanov; (13 = Streetno); ...
([&1] -> Small Addreess) ~please Nigga, Im :l33t{wracker, hacker, physici\
an & physicist} """
| """ LOL! I need = (One; Javascript) ~please . bin/djet.lang:print
:Note! 13; Street, Lulin10, Sofia; Boril B. Boyanov; (13 = Streetno); ...
([&1] -> Small Addreess) ~please Nigga, Im :l33t{wracker, hacker, physici an & physicist} """ |
# __init__.py
# Copyright 2021 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Access Berkeley DB database of chess games using berkeleydb package.
This interface can be used if the berkeleydb package is installed.
berkeleydb is available as a source package, from PyPI for example.
Follow the instructions to bu... | """Access Berkeley DB database of chess games using berkeleydb package.
This interface can be used if the berkeleydb package is installed.
berkeleydb is available as a source package, from PyPI for example.
Follow the instructions to build and install berkeleydb. This includes
installing Berkeley DB.
""" |
"""Shared modules for template-based document generation.
This is how the file generation from a yWriter project is generally done:
The write method runs through all chapters, scenes, and world building
elements, such as characters, locations ans items, and fills templates.
The package's README file contains ... | """Shared modules for template-based document generation.
This is how the file generation from a yWriter project is generally done:
The write method runs through all chapters, scenes, and world building
elements, such as characters, locations ans items, and fills templates.
The package's README file contains a list... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | {'name': 'libro_compras', 'summary': '\n Libro de Compras\n ', 'description': '\n Libro de Compras\n ', 'author': 'Softw & Hardw Solutions SSH', 'website': 'https://solutionssh.com/', 'category': 'Contabilidad', 'version': '0.1', 'depends': ['base', 'account'], 'data': ['views/wizard_libro_compr... |
cases = int(input())
for case in range(cases):
k,p = [int(x) for x in input().split(' ')]
print(k,int(p+(p*(p+1))/2))
| cases = int(input())
for case in range(cases):
(k, p) = [int(x) for x in input().split(' ')]
print(k, int(p + p * (p + 1) / 2)) |
test_cases = int(input().strip())
def get_days_of_month(month):
if month == 2:
return 28
if month in [1, 3, 5, 7, 8, 10, 12]:
return 31
return 30
for i in range(1, test_cases + 1):
month1, day1, month2, day2 = map(int, input().strip().split())
if month1 == month2:
print(... | test_cases = int(input().strip())
def get_days_of_month(month):
if month == 2:
return 28
if month in [1, 3, 5, 7, 8, 10, 12]:
return 31
return 30
for i in range(1, test_cases + 1):
(month1, day1, month2, day2) = map(int, input().strip().split())
if month1 == month2:
print('#... |
#
# PySNMP MIB module CISCO-DOT11-QOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-QOS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:38:30 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, constraints_union, single_value_constraint, value_size_constraint) ... |
def fibonacci(n):
a = 1
b = 1
while b <= n:
yield b
a, b = b, a + b
print("Numbers:", list(fibonacci(40)))
print("Sum:", sum(filter(lambda x: x % 2 == 0, fibonacci(4e6)))) | def fibonacci(n):
a = 1
b = 1
while b <= n:
yield b
(a, b) = (b, a + b)
print('Numbers:', list(fibonacci(40)))
print('Sum:', sum(filter(lambda x: x % 2 == 0, fibonacci(4000000.0)))) |
class NeureCtr:
def __init__(self, content_label):
self._uuid = content_label
self._relevants = {}
@property
def uuid(self):
return self._uuid
@property
def relevants(self):
return self._relevants
@relevants.setter
def relevants(self, value):
if valu... | class Neurectr:
def __init__(self, content_label):
self._uuid = content_label
self._relevants = {}
@property
def uuid(self):
return self._uuid
@property
def relevants(self):
return self._relevants
@relevants.setter
def relevants(self, value):
if va... |
def boxplot(x_data, y_data, base_color="#539caf", median_color="#297083", x_label="", y_label="", title=""):
_, ax = plt.subplots()
# Draw boxplots, specifying desired style
ax.boxplot(y_data
# patch_artist must be True to control box fill
, patch_artist = True
... | def boxplot(x_data, y_data, base_color='#539caf', median_color='#297083', x_label='', y_label='', title=''):
(_, ax) = plt.subplots()
ax.boxplot(y_data, patch_artist=True, medianprops={'color': median_color}, boxprops={'color': base_color, 'facecolor': base_color}, whiskerprops={'color': base_color}, capprops={... |
# -*- coding: utf-8 -*-
def get_lam_list(self, is_int_to_ext=True):
"""Returns the ordered list of lamination of the machine
Parameters
----------
self : MachineUD
MachineUD object
is_int_to_ext : bool
true to order the list from the inner lamination to the extrenal one
Retur... | def get_lam_list(self, is_int_to_ext=True):
"""Returns the ordered list of lamination of the machine
Parameters
----------
self : MachineUD
MachineUD object
is_int_to_ext : bool
true to order the list from the inner lamination to the extrenal one
Returns
-------
lam_lis... |
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': 'Hello from Lambda!'
}
| def lambda_handler(event, context):
return {'statusCode': 200, 'body': 'Hello from Lambda!'} |
#
# PySNMP MIB module WLSX-SYSTEMEXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WLSX-SYSTEMEXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:30:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (wlsx_enterprise_mib_modules,) = mibBuilder.importSymbols('ARUBA-MIB', 'wlsxEnterpriseMibModules')
(aruba_switch_role, aruba_active_state, aruba_card_type) = mibBuilder.importSymbols('ARUBA-TC', 'ArubaSwitchRole', 'ArubaActiveState', 'ArubaCardType')
(object_identifier, integer, octet_string) = mibBuilder.importSymbols... |
with open('input', 'r') as f:
lengths = [ord(x) for x in f.read()] + [17, 31, 73, 47, 23]
inp = [x for x in range(0, 256)]
curr_position = 0
skip_size = 0
for i in range(64):
for length in lengths:
start_sublist = []
if curr_position + length >= len(inp):
start_sublist = inp[0:curr_... | with open('input', 'r') as f:
lengths = [ord(x) for x in f.read()] + [17, 31, 73, 47, 23]
inp = [x for x in range(0, 256)]
curr_position = 0
skip_size = 0
for i in range(64):
for length in lengths:
start_sublist = []
if curr_position + length >= len(inp):
start_sublist = inp[0:curr_p... |
products = {'gucci boots': 10000, 'channel': 20000, 'adidas boots': 8000,
'nike sport-suit': 23000, 'gucci sport-suit': 24000,
'Lonsdale suit': 8000, 'nike boots': 9000,
'dior chest': 10000, 'raben waist': 15000,
'wedding dress': 500000}
user = 'user'
password = 'user123... | products = {'gucci boots': 10000, 'channel': 20000, 'adidas boots': 8000, 'nike sport-suit': 23000, 'gucci sport-suit': 24000, 'Lonsdale suit': 8000, 'nike boots': 9000, 'dior chest': 10000, 'raben waist': 15000, 'wedding dress': 500000}
user = 'user'
password = 'user123456'
def check_login(login, password):
if le... |
def l1_norm(lst):
"""
Calculates the l1 norm of a list of numbers
"""
return sum([abs(x) for x in lst])
def l2_norm(lst):
"""
Calculates the l2 norm of a list of numbers
"""
return sum([x*x for x in lst])
def linf_norm(lst):
"""
Calculates the l_infinity norm of a list of n... | def l1_norm(lst):
"""
Calculates the l1 norm of a list of numbers
"""
return sum([abs(x) for x in lst])
def l2_norm(lst):
"""
Calculates the l2 norm of a list of numbers
"""
return sum([x * x for x in lst])
def linf_norm(lst):
"""
Calculates the l_infinity norm of a list of num... |
#!/usr/bin/env python
__author__ = "bt3"
class Queue(object):
def __init__(self):
self.in_stack = []
self.out_stack = []
def _transfer(self):
while self.in_stack:
self.out_stack.append(self.in_stack.pop())
def enqueue(self, item):
return self.in_stack.append... | __author__ = 'bt3'
class Queue(object):
def __init__(self):
self.in_stack = []
self.out_stack = []
def _transfer(self):
while self.in_stack:
self.out_stack.append(self.in_stack.pop())
def enqueue(self, item):
return self.in_stack.append(item)
def dequeue(... |
print("----------------------------------------------")
print(" Even/Odd Number Identifier")
print("----------------------------------------------")
play_again = 'Y'
while play_again == 'Y':
user_num = input("Enter any whole number: ")
user_int = int(user_num)
if user_int % 2 == 0:
print("... | print('----------------------------------------------')
print(' Even/Odd Number Identifier')
print('----------------------------------------------')
play_again = 'Y'
while play_again == 'Y':
user_num = input('Enter any whole number: ')
user_int = int(user_num)
if user_int % 2 == 0:
print('Th... |
# 1. Exemplo de um trecho de codigo sem o uso da interupcao de repeticoes.
num = soma = 0
while num != 90:
num = int(input("Digite um numero: "))
soma += num
soma -= 90
print(f"A soma dos valores e' igual a {soma}.")
print("FIM!")
# 2. Com a interupcao de repeticoes while.
n = s = 0
while True:
n = int(inp... | num = soma = 0
while num != 90:
num = int(input('Digite um numero: '))
soma += num
soma -= 90
print(f"A soma dos valores e' igual a {soma}.")
print('FIM!')
n = s = 0
while True:
n = int(input('Digite um numero: '))
if n == 90:
break
s += n
print(f"A soma dos valores e' igual a: {s}.")
print(... |
M_PI = 3.14159265358979323846
EPSILON = 1.0e-38
MAX_TRANSIENTS = 4
BASE_N = 44 # The base number of segments of tract. | m_pi = 3.141592653589793
epsilon = 1e-38
max_transients = 4
base_n = 44 |
#!/usr/bin/env python3
# Create a function named remove_middle which has three parameters named
# lst, start, and end. The function should return a list where all elements
# in lst with an index between start and end(inclusive) have been removed.
def remove_middle(lst, start, end):
return lst[:start] + lst[end+1:]
... | def remove_middle(lst, start, end):
return lst[:start] + lst[end + 1:]
print(remove_middle([9, 7, 3, 10, 2, 4], 1, 2)) |
user_input = input("Type a two digit number: ")
first_digit = user_input[0]
second_digit = user_input[1]
print(int(first_digit) + int(second_digit)) | user_input = input('Type a two digit number: ')
first_digit = user_input[0]
second_digit = user_input[1]
print(int(first_digit) + int(second_digit)) |
__program__ = "config"
__version__ = "0.1.0"
__author__ = "Darcy Jones"
__date__ = "30 December 2014"
__author_email__ = "darcy.ab.jones@gmail.com"
__license__ = """
##############################################################################
Copyright (C) 2014 Darcy Jones
This program is free software: yo... | __program__ = 'config'
__version__ = '0.1.0'
__author__ = 'Darcy Jones'
__date__ = '30 December 2014'
__author_email__ = 'darcy.ab.jones@gmail.com'
__license__ = '\n##############################################################################\n\n Copyright (C) 2014 Darcy Jones\n\n This program is free software:... |
"""
Python makes performing file I/O simple. Take a look
at how to read and write to files here:
https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files
"""
# Open up the "foo.txt" file (which already exists) for reading
# Print all the contents of the file, then close the file
# YOUR CODE HER... | """
Python makes performing file I/O simple. Take a look
at how to read and write to files here:
https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files
""" |
"""
List of variables common to every workflow, that can change the result in multiple workflows
"""
# Table Names
COMPANY_TABLE = "companies"
COMPANY_USERS_TABLE = "company_users"
SURVEYS_REPLIES_TABLE = "survey_replies"
COMPANIES_TABLE = 'companies'
SURVEYS_QUESTIONS_TABLE = 'survey_questions'
SURVEYS_ITERATIONS_TAB... | """
List of variables common to every workflow, that can change the result in multiple workflows
"""
company_table = 'companies'
company_users_table = 'company_users'
surveys_replies_table = 'survey_replies'
companies_table = 'companies'
surveys_questions_table = 'survey_questions'
surveys_iterations_table = 'survey_it... |
def steps(number):
'''
The Collatz Conjecture or 3x+1 problem.
Given a number n, return the number of steps required to reach 1.
:param number:
:return:
'''
# The Collatz Conjecture is only concerned with strictly positive integers,
# so your solution should raise a ValueError with a me... | def steps(number):
"""
The Collatz Conjecture or 3x+1 problem.
Given a number n, return the number of steps required to reach 1.
:param number:
:return:
"""
if number <= 0:
raise value_error('.+')
steps_total = 0
while number != 1:
if number % 2 == 0:
numb... |
class Word:
def __init__(self):
self.hanzi = ''
self.pinyin = ''
self.english = ''
self.strokes = []
self.mnemonics = ''
self.audio = ''
self.notes = ''
def __str__(self):
format_str = '{} ({}) - {}\n'
return format_str.format(self.hanzi, ... | class Word:
def __init__(self):
self.hanzi = ''
self.pinyin = ''
self.english = ''
self.strokes = []
self.mnemonics = ''
self.audio = ''
self.notes = ''
def __str__(self):
format_str = '{} ({}) - {}\n'
return format_str.format(self.hanzi,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.