content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
array=list(map(int,input().split()))
print('Your Array :',array)
for i in range(0,len(array)-1):
if(array[i+1]<array[i]):
temp=array[i+1]
j=i
while(temp<array[j] and j>=0):
array[j+1]=array[j]
j-=1
array[j+1]=temp
print('Sorted Array : ',array) | array = list(map(int, input().split()))
print('Your Array :', array)
for i in range(0, len(array) - 1):
if array[i + 1] < array[i]:
temp = array[i + 1]
j = i
while temp < array[j] and j >= 0:
array[j + 1] = array[j]
j -= 1
array[j + 1] = temp
print('Sorted Arr... |
ENDINGS = ['.', '!', '?', ';']
def count_sentences(text):
text = text.strip()
if len(text) == 0:
return 0
split_result = None
for ending in ENDINGS:
separator = f'{ending} '
if split_result is None:
split_result = text.split(separator)
else:
split_result = [y for x in split_result for y in x.spli... | endings = ['.', '!', '?', ';']
def count_sentences(text):
text = text.strip()
if len(text) == 0:
return 0
split_result = None
for ending in ENDINGS:
separator = f'{ending} '
if split_result is None:
split_result = text.split(separator)
else:
split... |
'''
Get an undefined numbers of values and put them in a list.
In the end, show all the unique values in ascendent order.
'''
values = []
while True:
number = int(input('Choose a number: '))
if number not in values:
print(f'\033[32mAdd the number {number} to the list.\033[m')
values.ap... | """
Get an undefined numbers of values and put them in a list.
In the end, show all the unique values in ascendent order.
"""
values = []
while True:
number = int(input('Choose a number: '))
if number not in values:
print(f'\x1b[32mAdd the number {number} to the list.\x1b[m')
values.appe... |
VOWELS = { c for c in "aeouiAEOUI" }
def swap_vowel_case_char(c :str) -> str:
return c.swapcase() if c in VOWELS else c
def swap_vowel_case(st: str) -> str:
return "".join(swap_vowel_case_char(c) for c in st)
| vowels = {c for c in 'aeouiAEOUI'}
def swap_vowel_case_char(c: str) -> str:
return c.swapcase() if c in VOWELS else c
def swap_vowel_case(st: str) -> str:
return ''.join((swap_vowel_case_char(c) for c in st)) |
PuzzleInput = "PuzzleInput.txt"
f = open(PuzzleInput)
txt = f.readlines()
sums = []
k=0
for j in range(len(txt)):
for i in range(25):
for k in range(25):
if i == k:
continue
else:
sums.append(int(txt[i])+int(txt[k]))
if int(txt[25])... | puzzle_input = 'PuzzleInput.txt'
f = open(PuzzleInput)
txt = f.readlines()
sums = []
k = 0
for j in range(len(txt)):
for i in range(25):
for k in range(25):
if i == k:
continue
else:
sums.append(int(txt[i]) + int(txt[k]))
if int(txt[25]) in sums:
... |
if __name__ == '__main__':
# Creating a tuple
x = ()
x = (1, )
print(type(x))
x = (1)
print(type(x))
x = (1, 2, 3, "Apple", True, 4.0)
x = ((1, 2, 3), (4, 5, 6))
#Accessing Tuple
x = (1, 2, 3, "Apple", True, (7, 7, 7), 4.0)
print(x[3])
print(x[-2])
print(x[1:2])... | if __name__ == '__main__':
x = ()
x = (1,)
print(type(x))
x = 1
print(type(x))
x = (1, 2, 3, 'Apple', True, 4.0)
x = ((1, 2, 3), (4, 5, 6))
x = (1, 2, 3, 'Apple', True, (7, 7, 7), 4.0)
print(x[3])
print(x[-2])
print(x[1:2])
print(x[1:3])
print(x[::2])
(_, _, _, _,... |
#
# @lc app=leetcode id=108 lang=python3
#
# [108] Convert Sorted Array to Binary Search Tree
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution... | class Solution:
def sorted_array_to_bst(self, nums: List[int]) -> TreeNode:
def helper(left, right):
if left > right:
return None
p = (left + right) // 2
root = tree_node(nums[p])
root.left = helper(left, p - 1)
root.right = helpe... |
class DecorationRepository:
def __init__(self):
self.decorations = []
@staticmethod
def get_obj_by_type(objects, obj_type):
result = [obj for obj in objects if obj.__class__.__name__ == obj_type]
return result
def add(self, decoration):
self.decorations.append(decoratio... | class Decorationrepository:
def __init__(self):
self.decorations = []
@staticmethod
def get_obj_by_type(objects, obj_type):
result = [obj for obj in objects if obj.__class__.__name__ == obj_type]
return result
def add(self, decoration):
self.decorations.append(decorati... |
class NotValidAttributeException(Exception):
def __init__(self, message, errors):
super(NotValidAttributeException, self).__init__(message)
self.errors = errors
class NoReportFoundException(Exception):
def __init__(self, message, errors):
super(NoReportFoundException, self... | class Notvalidattributeexception(Exception):
def __init__(self, message, errors):
super(NotValidAttributeException, self).__init__(message)
self.errors = errors
class Noreportfoundexception(Exception):
def __init__(self, message, errors):
super(NoReportFoundException, self).__init__(m... |
n = int (input('Enter a number for prime number series : '))
for i in range(2,n):
for j in range(2,i):
if i % j == 0:
print(i,"is not a prime number because",j,"*",i//j,"=",i)
break
else:
print(i,"is a prime number") | n = int(input('Enter a number for prime number series : '))
for i in range(2, n):
for j in range(2, i):
if i % j == 0:
print(i, 'is not a prime number because', j, '*', i // j, '=', i)
break
else:
print(i, 'is a prime number') |
class Solution:
def threeSumClosest(self, num, target):
num = sorted(num)
best_sum = num[0] + num[1] + num[2]
for i in range(len(num)):
j = i + 1
k = len(num) - 1
while j < k:
current_sum = num[i] + num[j] + num[k]
... | class Solution:
def three_sum_closest(self, num, target):
num = sorted(num)
best_sum = num[0] + num[1] + num[2]
for i in range(len(num)):
j = i + 1
k = len(num) - 1
while j < k:
current_sum = num[i] + num[j] + num[k]
if cur... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#======================================================================
# Code for solving day 8 of AoC 2018
#======================================================================
VERBOSE = True
#------------------------------------------------------------------
#-----... | verbose = True
def load_input(filename):
with open(filename, 'r') as f:
content = f.read()
return content.strip()
def part_one():
print('Performing part one.')
my_input = load_input('puzzle_input_day_8.txt')
print('Answer for part one: %d')
def part_two():
print('Performing part two.'... |
flag=[0]*35
box = [
253, 194, 15, 13, 82,
129, 244, 80, 193, 233,
36, 54, 199, 69, 219,
74, 136, 6, 190, 144,
68, 57, 156, 153, 240,
65, 95, 135, 61, 179,
159, 183, 182, 130, 107]
target = [
174, 178, 102, 127, 22,
245, 143, 226, 245, 131,
65, 105, 135, 48, 94,
21, 185, 188, 225, 211,
116, 11,... | flag = [0] * 35
box = [253, 194, 15, 13, 82, 129, 244, 80, 193, 233, 36, 54, 199, 69, 219, 74, 136, 6, 190, 144, 68, 57, 156, 153, 240, 65, 95, 135, 61, 179, 159, 183, 182, 130, 107]
target = [174, 178, 102, 127, 22, 245, 143, 226, 245, 131, 65, 105, 135, 48, 94, 21, 185, 188, 225, 211, 116, 11, 178, 184, 248, 18, 47, ... |
class Solution:
def isPowerOfTwo(self, n: int) -> bool:
i = 0
while 2**i <n:
i+=1
if 2**i==n:
return True
return False | class Solution:
def is_power_of_two(self, n: int) -> bool:
i = 0
while 2 ** i < n:
i += 1
if 2 ** i == n:
return True
return False |
def feast(beast, dish):
x = len(beast)
y = len(dish)
if beast[0] == dish[0]:
if beast[x-1] == dish[y-1]:
return True
else:
return False
else:
return False
def feast1(beast, dish):
return beast[0]==dish[0] and dish[-1]==beast[-1] | def feast(beast, dish):
x = len(beast)
y = len(dish)
if beast[0] == dish[0]:
if beast[x - 1] == dish[y - 1]:
return True
else:
return False
else:
return False
def feast1(beast, dish):
return beast[0] == dish[0] and dish[-1] == beast[-1] |
#Dictionary is key value pairs.
d1 = {}
print(type(d1))
d2 ={ "Jiggu":"Burger", "Rohan":"Fish", "Ravi":"Roti"}
#print(d2["Jiggu"]) case sensitive,tell about there syn...
#we can make dictionary inside a dictionary
d3 = {"Jiggu":"Burger", "Rohan":"Fish", "Ravi":"Roti",
"Pagal":{"B":"Oats","L": "Rice","D":"C... | d1 = {}
print(type(d1))
d2 = {'Jiggu': 'Burger', 'Rohan': 'Fish', 'Ravi': 'Roti'}
d3 = {'Jiggu': 'Burger', 'Rohan': 'Fish', 'Ravi': 'Roti', 'Pagal': {'B': 'Oats', 'L': 'Rice', 'D': 'Chicken'}}
'\nd3["Ankit"] = "Junk Food"\nd3[3453] = "Kabab"\ndel d3[3453]\n'
print(d3.get('Jiggu')) |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def isValidBST(root):
arr = []
def inOrderTraversal(root):
if not root: return
if root.left: inOrderTraversal(root.left)
arr.append(root.val)
if root.right: inOrde... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def is_valid_bst(root):
arr = []
def in_order_traversal(root):
if not root:
return
if root.left:
in_order_traversal(root.left)
arr.append(root.val... |
#!/usr/bin/env python
def simple_generator():
yield 1
yield 2
yield 3
simple_generator()
print(simple_generator)
print(simple_generator()) | def simple_generator():
yield 1
yield 2
yield 3
simple_generator()
print(simple_generator)
print(simple_generator()) |
#
# PySNMP MIB module HH3C-VOICE-IF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-VOICE-IF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:30:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint) ... |
# Python3 Finding Lowest Common Ancestor in Binary Tree ----> O(N)
def find_lca_bt(root, n1, n2):
if not root:
return None
left_lca = find_lca_bt(root.left, n1, n2)
right_lca = find_lca_bt(root.right, n1, n2)
if left_lca and right_lca:
return root
return left_lca if left_lca else right_lca
# Python3 Findi... | def find_lca_bt(root, n1, n2):
if not root:
return None
left_lca = find_lca_bt(root.left, n1, n2)
right_lca = find_lca_bt(root.right, n1, n2)
if left_lca and right_lca:
return root
return left_lca if left_lca else right_lca
def find_lca_bst(root, n1, n2):
if not root:
re... |
class DF_Filter(dict):
'''
store and format query where clause
'''
def __init__(self,filter_value={}):
self['filter_list'] = []
def add(self,val):
self['filter_list'].append(val)
return self
def getFilter(self):
if len(self['filter_list'])==0:
ms... | class Df_Filter(dict):
"""
store and format query where clause
"""
def __init__(self, filter_value={}):
self['filter_list'] = []
def add(self, val):
self['filter_list'].append(val)
return self
def get_filter(self):
if len(self['filter_list']) == 0:
... |
def my_count(lst, e):
res = 0
if type(lst) == list:
res = lst.count(e)
return res
print(my_count([1, 2, 3, 4, 3, 2, 1], 3))
print(my_count([1, 2, 3], 4))
print(my_count((2, 3, 5), 3)) | def my_count(lst, e):
res = 0
if type(lst) == list:
res = lst.count(e)
return res
print(my_count([1, 2, 3, 4, 3, 2, 1], 3))
print(my_count([1, 2, 3], 4))
print(my_count((2, 3, 5), 3)) |
def mdc(x1, x2):
while x1%x2 != 0:
nx1 = x1
nx2 = x2
# Trocando os valores de variavel
x1 = nx2
x2 = nx1 % nx2 # x2 recebe o resto da divisao entre nx1 e nx2
return x2
class Fracao:
def __init__(self, numerador, denominador):
self.num = numerador
sel... | def mdc(x1, x2):
while x1 % x2 != 0:
nx1 = x1
nx2 = x2
x1 = nx2
x2 = nx1 % nx2
return x2
class Fracao:
def __init__(self, numerador, denominador):
self.num = numerador
self.den = denominador
def __str__(self):
return str(self.num) + '/' + str(se... |
# ============================================================================#
# author : louis TOMCZYK
# goal : Definition of personalized Mathematics Basics functions
# ============================================================================#
# version : 0.0.1 - 2021 09 27 - derivati... | def derivative(Y, dx):
d_ydx = []
for k in range(len(Y) - 1):
dYdx.append((Y[k + 1] - Y[k]) / dx)
return dYdx
def average(arr, n):
end = n * int(len(arr) / n)
return np.mean(arr[:end].reshape(-1, n), 1)
def moving_average(List, N_samples):
return np.convolve(List, np.ones(N_samples), '... |
def Bonjour(name):
print(f"Bonjour, {name} comment allez vous ?")
Bonjour("wassila")
| def bonjour(name):
print(f'Bonjour, {name} comment allez vous ?')
bonjour('wassila') |
# test async with, escaped by a break
class AContext:
async def __aenter__(self):
print('enter')
return 1
async def __aexit__(self, exc_type, exc, tb):
print('exit', exc_type, exc)
async def f1():
while 1:
async with AContext():
print('body')
break
... | class Acontext:
async def __aenter__(self):
print('enter')
return 1
async def __aexit__(self, exc_type, exc, tb):
print('exit', exc_type, exc)
async def f1():
while 1:
async with a_context():
print('body')
break
print('no 1')
pri... |
file_name = 'words_ex1~' # <= Error file name
try:
content = open(file_name, 'r', encoding='utf-8')
for line in content:
print(line)
except IOError as io_err:
print(io_err) # Output the exception message
# [Errno 2] No such file or directory: 'words_ex1~'
# You can use 'with' statement
with op... | file_name = 'words_ex1~'
try:
content = open(file_name, 'r', encoding='utf-8')
for line in content:
print(line)
except IOError as io_err:
print(io_err)
with open(file_name, 'r', encoding='utf-8') as content:
for line in content:
print(line) |
def product_sans_n(nums):
if nums.count(0)>=2:
return [0]*len(nums)
elif nums.count(0)==1:
temp=[0]*len(nums)
temp[nums.index(0)]=product(nums)
return temp
res=product(nums)
return [res//i for i in nums]
def product(arr):
total=1
for i in arr:
if i==0:
... | def product_sans_n(nums):
if nums.count(0) >= 2:
return [0] * len(nums)
elif nums.count(0) == 1:
temp = [0] * len(nums)
temp[nums.index(0)] = product(nums)
return temp
res = product(nums)
return [res // i for i in nums]
def product(arr):
total = 1
for i in arr:
... |
# Event: LCCS Python Fundamental Skills Workshop
# Date: Dec 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Purpose: Dictionary Programming Exercises 7.1
# Q1(e) solution
car = dict( {
'reg': "131 CN 6439",
'make': "Audi",
'model' : "A6",
'year' : 2013,
'kms' : 52... | car = dict({'reg': '131 CN 6439', 'make': 'Audi', 'model': 'A6', 'year': 2013, 'kms': 52739, 'colour': 'Silver', 'diesel': True})
print(car['make'])
print(car['colour'][0])
print(car['reg'][4:5]) |
n = int(input())
continents = {}
for i in range(n):
str = input().split(' ')
if str[0] in continents:
if str[1] in continents[str[0]]:
continents[str[0]][str[1]].append(str[2])
else:
continents[str[0]][str[1]] = [str[2]]
else:
continents[str[0]] = {
... | n = int(input())
continents = {}
for i in range(n):
str = input().split(' ')
if str[0] in continents:
if str[1] in continents[str[0]]:
continents[str[0]][str[1]].append(str[2])
else:
continents[str[0]][str[1]] = [str[2]]
else:
continents[str[0]] = {str[1]: [st... |
#! /usr/bin/python3
vorname = "Joe"
nachname = "Biden"
print("{0} {1} is elected!".format(vorname, nachname))
print("Hallo World!")
| vorname = 'Joe'
nachname = 'Biden'
print('{0} {1} is elected!'.format(vorname, nachname))
print('Hallo World!') |
class Node:
def __init__(self, valor):
self.valor = valor
self.hijo_izquierdo = None
self.hijo_derecho = None
self.altura = 0
class AVLTree:
def __init__(self):
self.raiz = None
def add(self, valor):
self.raiz = self._add(valor, self.raiz)
... | class Node:
def __init__(self, valor):
self.valor = valor
self.hijo_izquierdo = None
self.hijo_derecho = None
self.altura = 0
class Avltree:
def __init__(self):
self.raiz = None
def add(self, valor):
self.raiz = self._add(valor, self.raiz)
def _add(se... |
p = 196732205348849427366498732223276547339
secret = REDACTED
def calc_root(num, mod, n):
f = GF(mod)
temp = f(num)
return temp.nth_root(n)
def gen_v_list(primelist, p, secret):
a = []
for prime in primelist:
a.append(calc_root(prime, p, secret))
return a
def decodeInt(i, primelist):
... | p = 196732205348849427366498732223276547339
secret = REDACTED
def calc_root(num, mod, n):
f = gf(mod)
temp = f(num)
return temp.nth_root(n)
def gen_v_list(primelist, p, secret):
a = []
for prime in primelist:
a.append(calc_root(prime, p, secret))
return a
def decode_int(i, primelist):... |
#2
total=0
for number in range(1, 10 + 1):
print(number)
total = total + number
print(total)
#3
def add_numbers (x,y):
for number in range (x,y):
print (number)
tot= total+number
print(total)
add_numbers(10,45)
#4
def jamie_1(x,y):
total=0
for jamie in range(x,y+1):
print(... | total = 0
for number in range(1, 10 + 1):
print(number)
total = total + number
print(total)
def add_numbers(x, y):
for number in range(x, y):
print(number)
tot = total + number
print(total)
add_numbers(10, 45)
def jamie_1(x, y):
total = 0
for jamie in range(x, y + 1):
print... |
product_map = { 1: 'Original 1000',
3: 'Color 650',
10: 'White 800 (Low Voltage)',
11: 'White 800 (High Voltage)',
18: 'White 900 BR30 (Low Voltage)',
20: 'Color 1000 BR30',
22: 'Color 1000',
27: 'LIFX A19',
28: 'LIFX BR30',
29: 'LIFX+ A19',
30: 'LIFX+ BR30',
31: 'LIFX Z',
... | product_map = {1: 'Original 1000', 3: 'Color 650', 10: 'White 800 (Low Voltage)', 11: 'White 800 (High Voltage)', 18: 'White 900 BR30 (Low Voltage)', 20: 'Color 1000 BR30', 22: 'Color 1000', 27: 'LIFX A19', 28: 'LIFX BR30', 29: 'LIFX+ A19', 30: 'LIFX+ BR30', 31: 'LIFX Z', 32: 'LIFX Z 2', 36: 'LIFX Downlight', 37: 'LIFX... |
x,y,z=0,1,0
print(x,',',y,end="")
for i in range(1,49):
z=x+y
print(',',z,end="")
x=y
y=z
| (x, y, z) = (0, 1, 0)
print(x, ',', y, end='')
for i in range(1, 49):
z = x + y
print(',', z, end='')
x = y
y = z |
def first_last(full_name):
first_name = ''
last_name = ''
has_been_a_space = False
for letter in full_name:
if letter == ' ':
has_been_a_space = True
elif has_been_a_space:
last_name = last_name + letter
else:
first_name = first_name + letter
... | def first_last(full_name):
first_name = ''
last_name = ''
has_been_a_space = False
for letter in full_name:
if letter == ' ':
has_been_a_space = True
elif has_been_a_space:
last_name = last_name + letter
else:
first_name = first_name + letter
... |
class Solution:
def word_pattern(self, pattern: str, str: str) -> bool:
words = str.split(" ")
return len(pattern) == len(words) and len(set(pattern)) == len(set(words)) == len(set(zip(pattern, words)))
| class Solution:
def word_pattern(self, pattern: str, str: str) -> bool:
words = str.split(' ')
return len(pattern) == len(words) and len(set(pattern)) == len(set(words)) == len(set(zip(pattern, words))) |
print('Hello')
print('World')
# adding a keyword argument will get "Hello World" on the same line.
print('Hello', end=' ')
print('World')
# the "end=' '" adds a single space character at the end of Hello starts the next print right next ot it
print('cat', 'dog', 'mouse')
#the above will have a single spac... | print('Hello')
print('World')
print('Hello', end=' ')
print('World')
print('cat', 'dog', 'mouse')
print('cat', 'dog', 'mouse', sep='ABC') |
#
# PySNMP MIB module ASCEND-MIBINET-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBINET-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:27:29 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration')
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_unio... |
def main():
s = input("")
x = s.isdigit()
print(x, end="")
main()
| def main():
s = input('')
x = s.isdigit()
print(x, end='')
main() |
# 1. Two Sum
class Solution:
# Approach 1 : Naive
def twoSum1(self, nums, target):
for i in range(len(nums)-1):
for j in range(i+1, len(nums)):
if nums[i]+nums[j] == target:
return [i, j]
return None
# Approach 2: Two-pass Hash Table
d... | class Solution:
def two_sum1(self, nums, target):
for i in range(len(nums) - 1):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return [i, j]
return None
def two_sum2(self, nums, target):
foo = {}
for (i, j) in ... |
class Node:
pass
class Edge:
pass
class Graph:
pass
| class Node:
pass
class Edge:
pass
class Graph:
pass |
def highest_product_of_3(list_of_ints):
# initialize lowest to the minimum of the first two integers
lowest = min(list_of_ints[0], list_of_ints[1])
# initialize highest to the maximum of the first two integers
highest = max(list_of_ints[0], list_of_ints[1])
# initialize lowest_product_of_two and hi... | def highest_product_of_3(list_of_ints):
lowest = min(list_of_ints[0], list_of_ints[1])
highest = max(list_of_ints[0], list_of_ints[1])
(lowest_product_of_two, highest_product_of_two) = (list_of_ints[0] * list_of_ints[1], list_of_ints[0] * list_of_ints[1])
highest_product_of_three = list_of_ints[0] * lis... |
ll = [1, 2, 3]
def increment(x):
print(f'Old value: {x}')
return x + 1
print(map(increment, ll))
for x in map(increment, ll):
print(x)
iter = map(increment, ll)
| ll = [1, 2, 3]
def increment(x):
print(f'Old value: {x}')
return x + 1
print(map(increment, ll))
for x in map(increment, ll):
print(x)
iter = map(increment, ll) |
class MessageTypes:
InstrumentStateChange = 505
ClassStateChange = 516
Mail = 523
IndicativeMatchingPrice = 530
Collars = 537
SessionTimetable = 539
StartReferential = 550
EndReferential = 551
Referential = 556
ShortSaleChange = 560
SessionSummary = 561
GenericMessage = 592
OpenPosition = 59... | class Messagetypes:
instrument_state_change = 505
class_state_change = 516
mail = 523
indicative_matching_price = 530
collars = 537
session_timetable = 539
start_referential = 550
end_referential = 551
referential = 556
short_sale_change = 560
session_summary = 561
generi... |
# -*- coding: utf-8 -*-
# Scrapy settings for newblogs project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'newblogs'
SPIDER_MODULES = ['newblogs.spiders']
N... | bot_name = 'newblogs'
spider_modules = ['newblogs.spiders']
newspider_module = 'newblogs.spiders'
item_pipelines = {'newblogs.pipelines.NormalPipeline': 1, 'newblogs.pipelines.SaveDbPipeline': 2} |
route = [(1, -1), (1, 1), (1, -1), (-1, 1), (-1, 1), (1, -1), (1, -1), (1, 1), (-1, -1), (1, 1), (1, -1), (-1, 1), (1, -1), (-1, 1), (-1, 1), (-1, -1), (1, -1), (1, 1), (-1, -1), (1, -1), (1, -1), (1, 1), (1, -1), (-1, 1), (-1, 1), (-1, 1), (-1, -1), (1, -1), (1, -1), (1, 1), (-1, -1), (1, 1), (1, -1), (1, -1), (-1, -1... | route = [(1, -1), (1, 1), (1, -1), (-1, 1), (-1, 1), (1, -1), (1, -1), (1, 1), (-1, -1), (1, 1), (1, -1), (-1, 1), (1, -1), (-1, 1), (-1, 1), (-1, -1), (1, -1), (1, 1), (-1, -1), (1, -1), (1, -1), (1, 1), (1, -1), (-1, 1), (-1, 1), (-1, 1), (-1, -1), (1, -1), (1, -1), (1, 1), (-1, -1), (1, 1), (1, -1), (1, -1), (-1, -1... |
lista = [['edu', 'joao', 'luizr'], ['maria', ' aline', 'joana'],['helena', 'ed', 'lu']]
enumerada = list(enumerate(lista))
print(enumerada[1][1][2][0]) | lista = [['edu', 'joao', 'luizr'], ['maria', ' aline', 'joana'], ['helena', 'ed', 'lu']]
enumerada = list(enumerate(lista))
print(enumerada[1][1][2][0]) |
numbers = [
386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918,
237,
412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379,
843, 831, 445, 742, 717, 958,743, 527
]
for number in numbers:
if ... | numbers = [386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958, 743, 527]
for number in numbers:
if number is 237:
p... |
# Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.
class Solution:
def toLowerCase(self, str):
res = []
for char in str:
if ord(char) >= 65 and ord(char) <= 90:
res += chr(ord(char) + 32)
# res +=... | class Solution:
def to_lower_case(self, str):
res = []
for char in str:
if ord(char) >= 65 and ord(char) <= 90:
res += chr(ord(char) + 32)
else:
res += char
return ''.join(res)
s = solution().toLowerCase('HELwwLO')
print(s) |
def foo():
if 1:
if 2:
pass
| def foo():
if 1:
if 2:
pass |
SQL_INIT_TABLES_AND_TRIGGERS = '''
CREATE TABLE consumers
(
component TEXT NOT NULL,
subcomponent TEXT NOT NULL,
host TEXT NOT NULL,
itype TEXT NOT NULL,
iprimary TEXT NOT NULL,
isecondary TEXT NOT NULL,
itertiary TEXT NOT NULL,
optional BOOLEAN NO... | sql_init_tables_and_triggers = '\n CREATE TABLE consumers\n (\n component TEXT NOT NULL,\n subcomponent TEXT NOT NULL,\n host TEXT NOT NULL,\n itype TEXT NOT NULL,\n iprimary TEXT NOT NULL,\n isecondary TEXT NOT NULL,\n itertiary TEXT NOT NULL,\n optional BO... |
__project__ = 'OCRErrorCorrectpy3'
__author__ = 'jcavalie'
__email__ = "Jcavalieri8619@gmail.com"
__date__ = '10/25/14'
EpsilonTransition = None
TransitionWeight = None
outputsModel=None
NUM_PARTITIONS=None
EM_STEP=True
| __project__ = 'OCRErrorCorrectpy3'
__author__ = 'jcavalie'
__email__ = 'Jcavalieri8619@gmail.com'
__date__ = '10/25/14'
epsilon_transition = None
transition_weight = None
outputs_model = None
num_partitions = None
em_step = True |
def test_get_page_hierarchy_as_xml():
given_pages('PageOne', 'PageOne.ChildOne', 'PageTwo')
when_request_is_issued('root', 'type:pages')
then_response_should_be_xml()
def test_get_page_hierarchy_has_right_tags():
given_pages('PageOne', 'PageOne.ChildOne', 'PageTwo')
when_request_is_issued('root'... | def test_get_page_hierarchy_as_xml():
given_pages('PageOne', 'PageOne.ChildOne', 'PageTwo')
when_request_is_issued('root', 'type:pages')
then_response_should_be_xml()
def test_get_page_hierarchy_has_right_tags():
given_pages('PageOne', 'PageOne.ChildOne', 'PageTwo')
when_request_is_issued('root', '... |
def new_file(filename, content):
with open(filename, 'w+') as f:
f.write(content)
print('Created at', filename)
| def new_file(filename, content):
with open(filename, 'w+') as f:
f.write(content)
print('Created at', filename) |
####################################################
# Block
########################
blocks_head = []
class Block:
name = "Block"
tag = "div"
content_seperator = ""
allows_nesting = True
def __init__(self, parent):
self.parent = parent
self.parent.add(self) if parent else None
... | blocks_head = []
class Block:
name = 'Block'
tag = 'div'
content_seperator = ''
allows_nesting = True
def __init__(self, parent):
self.parent = parent
self.parent.add(self) if parent else None
self.content = []
def add(self, x):
self.content.append(x)
def ... |
test = { 'name': 'q4c',
'points': 1,
'suites': [ { 'cases': [ {'code': ">>> is_valid_november_2020_sweden('Sweden', '2020-11-04')\nTrue", 'hidden': False, 'locked': False},
{'code': ">>> not is_valid_november_2020_sweden('sweden', '2020-11-04')\nTrue", 'hidden': False,... | test = {'name': 'q4c', 'points': 1, 'suites': [{'cases': [{'code': ">>> is_valid_november_2020_sweden('Sweden', '2020-11-04')\nTrue", 'hidden': False, 'locked': False}, {'code': ">>> not is_valid_november_2020_sweden('sweden', '2020-11-04')\nTrue", 'hidden': False, 'locked': False}, {'code': ">>> not is_valid_november_... |
class complex:
def __init__(self, real, img):
self.real = real
self.img = img
def add(self, b):
res = complex(0,0)
res.real = self.real + b.real
res.img = self.img + b.img
return res
def display(self):
if self.img>=0:
print("{} + i{}".format(self.real, self.img))
if self.img<0:
print("{} -... | class Complex:
def __init__(self, real, img):
self.real = real
self.img = img
def add(self, b):
res = complex(0, 0)
res.real = self.real + b.real
res.img = self.img + b.img
return res
def display(self):
if self.img >= 0:
print('{} + i{}'... |
#1st method
sq1 = []
for x in range(10):
sq1.append(x**2)
print("sq1 = ", sq1)
# 2nd method
sq2 = [x**2 for x in range(10)]
print("sq2 = ", sq2)
sq3 = [(x,y) for x in [1,2,3] for y in [3,1,4] if x!=y]
print("sq3 = ", sq3)
vec = [-4, -2, 0, 2, 4]
print("x*2", [x*2 for x in vec])
print("x if x>0", [x for x in ve... | sq1 = []
for x in range(10):
sq1.append(x ** 2)
print('sq1 = ', sq1)
sq2 = [x ** 2 for x in range(10)]
print('sq2 = ', sq2)
sq3 = [(x, y) for x in [1, 2, 3] for y in [3, 1, 4] if x != y]
print('sq3 = ', sq3)
vec = [-4, -2, 0, 2, 4]
print('x*2', [x * 2 for x in vec])
print('x if x>0', [x for x in vec if x >= 0])
pri... |
# module trackmod.namereg
class NameRegistry(object):
class AllRegistered(object):
terminal = True
def register(self, names):
return
def __contains__(self, name):
return True
all_registered = AllRegistered()
class AllFound(object):
def __init__(... | class Nameregistry(object):
class Allregistered(object):
terminal = True
def register(self, names):
return
def __contains__(self, name):
return True
all_registered = all_registered()
class Allfound(object):
def __init__(self, value):
s... |
BOP_CONFIG = dict()
BOP_CONFIG['hb'] = dict(
input_resize=(640, 480),
urdf_ds_name='hb',
obj_ds_name='hb',
train_pbr_ds_name=['hb.pbr'],
inference_ds_name=['hb.bop19'],
test_ds_name=[],
)
BOP_CONFIG['icbin'] = dict(
input_resize=(640, 480),
urdf_ds_name='icbin',
obj_ds_name='icbin',... | bop_config = dict()
BOP_CONFIG['hb'] = dict(input_resize=(640, 480), urdf_ds_name='hb', obj_ds_name='hb', train_pbr_ds_name=['hb.pbr'], inference_ds_name=['hb.bop19'], test_ds_name=[])
BOP_CONFIG['icbin'] = dict(input_resize=(640, 480), urdf_ds_name='icbin', obj_ds_name='icbin', train_pbr_ds_name=['icbin.pbr'], inferen... |
class MixUp:
def __init__(self):
pass
class CutMix:
def __init__(self):
pass
| class Mixup:
def __init__(self):
pass
class Cutmix:
def __init__(self):
pass |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def calc_diameter(self, diameter, node):
if node:
l_height = calc_diameter(node.left)
... | class Solution:
def calc_diameter(self, diameter, node):
if node:
l_height = calc_diameter(node.left)
r_height = calc_diameter(node.right)
diameter[0] = max(diameter[0], l_height + r_height + 1)
return 1 + max(l_height, r_height)
return 0
def dia... |
class C:
def f(self, x):
pass
def g(self):
def f(x): #gets ignored by pytype but fixer sees it, generates warning (FIXME?)
return 1
return f
| class C:
def f(self, x):
pass
def g(self):
def f(x):
return 1
return f |
var1 = 10
var2 = 15
var3 = 12.6
print (var1, var2, var3)
A = 89
B = 56
Addition = A + B
print (Addition)
A = 89
B = 56
Substraction = A - B
print (Substraction)
#type function
#variable
#operands
#operator
f = 9/5*+32
print (float(f))
#type function
#variable
#operands
#operator
c = 5*32/9
print (float(c)) | var1 = 10
var2 = 15
var3 = 12.6
print(var1, var2, var3)
a = 89
b = 56
addition = A + B
print(Addition)
a = 89
b = 56
substraction = A - B
print(Substraction)
f = 9 / 5 * +32
print(float(f))
c = 5 * 32 / 9
print(float(c)) |
expected_output = {
"main": {
"chassis": {
"name": {
"descr": "A901-6CZ-FT-A Chassis",
"name": "A901-6CZ-FT-A Chassis",
"pid": "A901-6CZ-FT-A",
"sn": "CAT2342U1S6",
"vid": "V04 "
}
}
},
"s... | expected_output = {'main': {'chassis': {'name': {'descr': 'A901-6CZ-FT-A Chassis', 'name': 'A901-6CZ-FT-A Chassis', 'pid': 'A901-6CZ-FT-A', 'sn': 'CAT2342U1S6', 'vid': 'V04 '}}}, 'slot': {'0': {'rp': {'A901-6CZ-FT-A Chassis': {'descr': 'A901-6CZ-FT-A Chassis', 'name': 'A901-6CZ-FT-A Chassis', 'pid': 'A901-6CZ-FT-A', 's... |
class Clock:
def __init__(self, hour, minute):
self.hour = (hour + (minute // 60)) % 24
self.minute = minute % 60
def __repr__(self):
return "{:02d}:{:02d}".format(self.hour, self.minute)
def __eq__(self, other):
return self.hour == other.hour and self.minute == other.minut... | class Clock:
def __init__(self, hour, minute):
self.hour = (hour + minute // 60) % 24
self.minute = minute % 60
def __repr__(self):
return '{:02d}:{:02d}'.format(self.hour, self.minute)
def __eq__(self, other):
return self.hour == other.hour and self.minute == other.minute... |
{'name': 'Library Management Application',
'description': 'Library books, members and book borrowing.',
'author': 'Daniel Reis',
'depends': ['base'],
'data': [
'security/library_security.xml',
'security/ir.model.access.csv',
'views/library_menu.xml',
'views/book_view.xml',
'views/book_list_templ... | {'name': 'Library Management Application', 'description': 'Library books, members and book borrowing.', 'author': 'Daniel Reis', 'depends': ['base'], 'data': ['security/library_security.xml', 'security/ir.model.access.csv', 'views/library_menu.xml', 'views/book_view.xml', 'views/book_list_template.xml'], 'application':... |
number = int(input('Enter a number: '))
times = int(input('Enter a times: '))
def multiplication(numbers, x):
z = 1
while z <= numbers:
b = '{} x {} = {}'.format(z, x, x * z)
print(b)
z += 1
multiplication(number, times)
| number = int(input('Enter a number: '))
times = int(input('Enter a times: '))
def multiplication(numbers, x):
z = 1
while z <= numbers:
b = '{} x {} = {}'.format(z, x, x * z)
print(b)
z += 1
multiplication(number, times) |
#! python3
# isPhoneNumber.py - Program without regular expressions to find a phone number in text
def isPhoneNumber(text):
if len(text) != 12:
return False
for i in range(0,3):
if not text[i].isdecimal():
return False
if text[3] != '-':
return False
for i in range(4... | def is_phone_number(text):
if len(text) != 12:
return False
for i in range(0, 3):
if not text[i].isdecimal():
return False
if text[3] != '-':
return False
for i in range(4, 7):
if not text[i].isdecimal():
return False
if text[7] != '-':
... |
# -*- coding:utf-8 -*-
def payment(balance, paid):
if balance < paid:
return balance, 0
else:
return paid, balance - paid
if __name__ == '__main__':
balance = float(input("Enter opening balance: "))
paid = float(input("Enter monthly payment: "))
print(" Amount Remaining")
... | def payment(balance, paid):
if balance < paid:
return (balance, 0)
else:
return (paid, balance - paid)
if __name__ == '__main__':
balance = float(input('Enter opening balance: '))
paid = float(input('Enter monthly payment: '))
print(' Amount Remaining')
print('Pymt# Paid ... |
# Title : Lambda example
# Author : Kiran raj R.
# Date : 31:10:2020
def higher_o_func(x, func): return x + func(x)
result1 = higher_o_func(2, lambda x: x * x)
# result1 x = 2, (2*2) + 2, x = 6
result2 = higher_o_func(2, lambda x: x + 3)
# result2 x=2, (2 + 3) + 2, x = 7
result3 = higher_o_func(4, lambda x: x*... | def higher_o_func(x, func):
return x + func(x)
result1 = higher_o_func(2, lambda x: x * x)
result2 = higher_o_func(2, lambda x: x + 3)
result3 = higher_o_func(4, lambda x: x * x)
result4 = higher_o_func(4, lambda x: x + 3)
print(result1, result2)
print(result3, result4)
def add(x, y):
return x + y
result5 = ad... |
class ListTransformer():
def __init__(self, _list):
self._list = _list
@property
def tuple(self):
return tuple(self._list)
| class Listtransformer:
def __init__(self, _list):
self._list = _list
@property
def tuple(self):
return tuple(self._list) |
class Solution:
def slowestKey(self, releaseTimes: List[int], keysPressed: str) -> str:
# Time Complexity: O(N)
# Space Complexity: O(1)
longest = releaseTimes[0]
slowestKey = keysPressed[0]
for i in range(1, len(releaseTimes)):
... | class Solution:
def slowest_key(self, releaseTimes: List[int], keysPressed: str) -> str:
longest = releaseTimes[0]
slowest_key = keysPressed[0]
for i in range(1, len(releaseTimes)):
cur = releaseTimes[i] - releaseTimes[i - 1]
if cur > longest or (cur == longest and k... |
def main():
# Write code here
while True:
N=int(input())
if 1<=N and N<=100:
break
List_elements=[]
List_elements=[int(x) for x in input().split()]
#List_elements.append(element)
List_elements.sort()
print(List_elements)
Absent_students=[]
... | def main():
while True:
n = int(input())
if 1 <= N and N <= 100:
break
list_elements = []
list_elements = [int(x) for x in input().split()]
List_elements.sort()
print(List_elements)
absent_students = []
for i in range(N):
if i + 1 not in List_elements:
... |
def get_gini(loc, sheet):
df = pd.read_excel(loc,sheet_name = sheet)
df_2 = df[['PD','Default']]
gini_df = df_2.sort_values(by=["PD"],ascending=False)
gini_df.reset_index()
D = sum(gini_df['Default'])
N = len(gini_df['Default'])
default = np.array(gini_df.Default)
proxy_data_arr = np.cum... | def get_gini(loc, sheet):
df = pd.read_excel(loc, sheet_name=sheet)
df_2 = df[['PD', 'Default']]
gini_df = df_2.sort_values(by=['PD'], ascending=False)
gini_df.reset_index()
d = sum(gini_df['Default'])
n = len(gini_df['Default'])
default = np.array(gini_df.Default)
proxy_data_arr = np.cu... |
VALID_COLORS = ['blue', 'yellow', 'red']
def print_colors():
while True:
color = input('Enter a color: ').lower()
if color == 'quit':
print('bye')
break
if color not in VALID_COLORS:
print('Not a valid color')
continue
prin... | valid_colors = ['blue', 'yellow', 'red']
def print_colors():
while True:
color = input('Enter a color: ').lower()
if color == 'quit':
print('bye')
break
if color not in VALID_COLORS:
print('Not a valid color')
continue
print(color)
... |
a = int(input())
b = {}
def fab(a):
if a<=1:
return 1
if a in b:
return b[a]
b[a]=fab(a-1)+fab(a-2)
return b[a]
print(fab(a))
print(b)
#1 1 2 3 5 8 13 21 34
| a = int(input())
b = {}
def fab(a):
if a <= 1:
return 1
if a in b:
return b[a]
b[a] = fab(a - 1) + fab(a - 2)
return b[a]
print(fab(a))
print(b) |
def gen():
yield 3 # Like return but one by one
yield 'wow'
yield -1
yield 1.2
x = gen()
print(next(x)) # Use next() function to go one by one
print(next(x))
print(next(x))
print(next(x)) | def gen():
yield 3
yield 'wow'
yield (-1)
yield 1.2
x = gen()
print(next(x))
print(next(x))
print(next(x))
print(next(x)) |
def tokenize(sentence):
return sentence.split(" ")
class InvertedIndex:
def __init__(self):
self.dict = {}
def get_docs_ids(self, token):
if token in self.dict:
return self.dict[token]
else:
return []
def put_token(self, token, doc_i... | def tokenize(sentence):
return sentence.split(' ')
class Invertedindex:
def __init__(self):
self.dict = {}
def get_docs_ids(self, token):
if token in self.dict:
return self.dict[token]
else:
return []
def put_token(self, token, doc_id):
if toke... |
VERSION = "1.1"
SOCKET_PATH = "/tmp/optimus-manager"
SOCKET_TIMEOUT = 1.0
STARTUP_MODE_VAR_PATH = "/var/lib/optimus-manager/startup_mode"
REQUESTED_MODE_VAR_PATH = "/var/lib/optimus-manager/requested_mode"
DPI_VAR_PATH = "/var/lib/optimus-manager/dpi"
TEMP_CONFIG_PATH_VAR_PATH = "/var/lib/optimus-manager/temp_conf_pa... | version = '1.1'
socket_path = '/tmp/optimus-manager'
socket_timeout = 1.0
startup_mode_var_path = '/var/lib/optimus-manager/startup_mode'
requested_mode_var_path = '/var/lib/optimus-manager/requested_mode'
dpi_var_path = '/var/lib/optimus-manager/dpi'
temp_config_path_var_path = '/var/lib/optimus-manager/temp_conf_path... |
'''
Create a customer class
Add a constructor with parameters first, last, and phone_number
Create public attributes for first, last, and phone_number
STUDENT MUST ALSO MODIFY INVOICE CLASS TO USE THIS CLASS
SEE INVOICE file FOR INSTRUCTIONS
'''
class Customer:
def __init__(self, first, last, phone_number):
... | """
Create a customer class
Add a constructor with parameters first, last, and phone_number
Create public attributes for first, last, and phone_number
STUDENT MUST ALSO MODIFY INVOICE CLASS TO USE THIS CLASS
SEE INVOICE file FOR INSTRUCTIONS
"""
class Customer:
def __init__(self, first, last, phone_number):
... |
d=[int(i) for i in input().split()]
s=sum(d)
result=0
if s%len(d)==0:
for i in range(len(d)):
if d[i]<(s//len(d)):
result=result+((s//len(d))-d[i])
print(result,end='')
else:
print('-1',end='') | d = [int(i) for i in input().split()]
s = sum(d)
result = 0
if s % len(d) == 0:
for i in range(len(d)):
if d[i] < s // len(d):
result = result + (s // len(d) - d[i])
print(result, end='')
else:
print('-1', end='') |
N = int(input())
def brute_force(s, remain):
if remain == 0:
print(s)
else:
brute_force(s + "a", remain - 1)
brute_force(s + "b", remain - 1)
brute_force(s + "c", remain - 1)
brute_force("", N)
| n = int(input())
def brute_force(s, remain):
if remain == 0:
print(s)
else:
brute_force(s + 'a', remain - 1)
brute_force(s + 'b', remain - 1)
brute_force(s + 'c', remain - 1)
brute_force('', N) |
class FatalErrorResponse:
def __init__(self, message):
self._message = message
self.result = message
self.id = "error"
def get_audit_text(self):
return 'error = "{0}", (NOT PUBLISHED)'.format(self._message)
| class Fatalerrorresponse:
def __init__(self, message):
self._message = message
self.result = message
self.id = 'error'
def get_audit_text(self):
return 'error = "{0}", (NOT PUBLISHED)'.format(self._message) |
def my_init(shape, dtype=None):
array = np.array([
[0.0, 0.2, 0.0],
[0.0, -0.2, 0.0],
[0.0, 0.0, 0.0],
])
# adds two axis to match the required shape (3,3,1,1)
return np.expand_dims(np.expand_dims(array,-1),-1)
conv_edge = Sequential([
Conv2D(kernel_size=(3,3), filters=1,... | def my_init(shape, dtype=None):
array = np.array([[0.0, 0.2, 0.0], [0.0, -0.2, 0.0], [0.0, 0.0, 0.0]])
return np.expand_dims(np.expand_dims(array, -1), -1)
conv_edge = sequential([conv2_d(kernel_size=(3, 3), filters=1, padding='same', kernel_initializer=my_init, input_shape=(None, None, 1))])
img_in = np.expand... |
banks = [
# bank 0
{
'ram': {
'start': 0xB848,
'end': 0xBFCF
},
'rom': {
'start': 0x3858,
'end': 0x3FDF
},
'offset': 0
},
# bank 1
{
'ram': {
'start': 0xB8CC,
'end': 0xB... | banks = [{'ram': {'start': 47176, 'end': 49103}, 'rom': {'start': 14424, 'end': 16351}, 'offset': 0}, {'ram': {'start': 47308, 'end': 49103}, 'rom': {'start': 30940, 'end': 32735}, 'offset': 0}, {'ram': {'start': 48867, 'end': 49102}, 'rom': {'start': 48883, 'end': 49118}, 'offset': 0}, {'ram': {'start': 40182, 'end': ... |
majors = {
"UND": "Undeclared",
"UNON": "Non Degree",
"ANTH": "Anthropology",
"APPH": "Applied Physics",
"ART": "Art",
"ARTG": "Art And Design: Games And Playable Media",
"ARTH": "See History Of Art And Visual Culture",
"BENG": "Bioengineering",
"BIOC": "Biochemistry And Molecular Biology",
"BINF": "Bioinformatics",
"B... | majors = {'UND': 'Undeclared', 'UNON': 'Non Degree', 'ANTH': 'Anthropology', 'APPH': 'Applied Physics', 'ART': 'Art', 'ARTG': 'Art And Design: Games And Playable Media', 'ARTH': 'See History Of Art And Visual Culture', 'BENG': 'Bioengineering', 'BIOC': 'Biochemistry And Molecular Biology', 'BINF': 'Bioinformatics', 'BI... |
unknown_error = (1000, 'unknown_error', 400)
access_forbidden = (1001, 'access_forbidden', 403)
unimplemented_error = (1002, 'unimplemented_error', 400)
not_found = (1003, 'not_found', 404)
illegal_state = (1004, 'illegal_state', 400)
| unknown_error = (1000, 'unknown_error', 400)
access_forbidden = (1001, 'access_forbidden', 403)
unimplemented_error = (1002, 'unimplemented_error', 400)
not_found = (1003, 'not_found', 404)
illegal_state = (1004, 'illegal_state', 400) |
_base_ = [
'../_base_/models/retinanet_r50_fpn.py',
'../_base_/datasets/waymo_open_2d_detection_f0.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(bbox_head=dict(num_classes=3))
data = dict(samples_per_gpu=4)
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, wei... | _base_ = ['../_base_/models/retinanet_r50_fpn.py', '../_base_/datasets/waymo_open_2d_detection_f0.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py']
model = dict(bbox_head=dict(num_classes=3))
data = dict(samples_per_gpu=4)
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)... |
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | {'variables': {'v8_code': 1, 'generated_file': '<(SHARED_INTERMEDIATE_DIR)/resources.cc'}, 'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'], 'targets': [{'target_name': 'cctest', 'type': 'executable', 'dependencies': ['resources', '../../tools/gyp/v8.gyp:v8_libplatform'], 'include_dirs': ['../..'... |
# -*- coding: UTF-8 -*-
light = input('please input a light')
'''
if light =='red':
print('stop')
else:
if light =='green':
print('GoGoGO')
else:
if light=='yellow':
print('stop or Go fast')
else:
print('Light is bad!!!')
'''
if light == 'red':
print('Stop... | light = input('please input a light')
"\nif light =='red':\n print('stop')\nelse:\n if light =='green':\n print('GoGoGO')\n else:\n if light=='yellow':\n print('stop or Go fast')\n else:\n print('Light is bad!!!')\n"
if light == 'red':
print('Stop')
elif light == ... |
class PluginInterface:
hooks = {}
load = False
defaultState = False
def getAuthor(self) -> str:
return ""
def getCommands(self) -> list:
return [] | class Plugininterface:
hooks = {}
load = False
default_state = False
def get_author(self) -> str:
return ''
def get_commands(self) -> list:
return [] |
def enum(name, *sequential, **named):
values = dict(zip(sequential, range(len(sequential))), **named)
# NOTE: Yes, we *really* want to cast using str() here.
# On Python 2 type() requires a byte string (which is str() on Python 2).
# On Python 3 it does not matter, so we'll use str(), which acts as
... | def enum(name, *sequential, **named):
values = dict(zip(sequential, range(len(sequential))), **named)
return type(str(name), (), values) |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/pnu/catkin_ws/src/darknet_ros/darknet_ros_msgs/msg/BoundingBox.msg;/home/pnu/catkin_ws/src/darknet_ros/darknet_ros_msgs/msg/BoundingBoxes.msg;/home/pnu/catkin_ws/src/darknet_ros/darknet_ros_msgs/msg/ObjectCount.msg;/home/pnu/catkin_ws/devel/shar... | messages_str = '/home/pnu/catkin_ws/src/darknet_ros/darknet_ros_msgs/msg/BoundingBox.msg;/home/pnu/catkin_ws/src/darknet_ros/darknet_ros_msgs/msg/BoundingBoxes.msg;/home/pnu/catkin_ws/src/darknet_ros/darknet_ros_msgs/msg/ObjectCount.msg;/home/pnu/catkin_ws/devel/share/darknet_ros_msgs/msg/CheckForObjectsAction.msg;/hom... |
def arrayMaxConsecutiveSum(inputArray, k):
arr = [sum(inputArray[:k])]
for i in range(1, len(inputArray) - (k - 1)):
arr.append(arr[i - 1] - inputArray[i - 1] + inputArray[i + k - 1])
sort_arr = sorted(arr)
return sort_arr[-1]
| def array_max_consecutive_sum(inputArray, k):
arr = [sum(inputArray[:k])]
for i in range(1, len(inputArray) - (k - 1)):
arr.append(arr[i - 1] - inputArray[i - 1] + inputArray[i + k - 1])
sort_arr = sorted(arr)
return sort_arr[-1] |
# output: ok
input = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
expected = [11, 8, 30, 2.5, 2, 4, 10000000, 20, 2, 2, 14, 15]
def test(v):
v[0] += 1
v[1] -= 2
v[2] *= 3
v[3] /= 4
v[4] //= 5
v[5] %= 6
v[6] **= 7
v[7] <<= 1
v[8] >>= 2
v[9] &= 3
v[10] ^= 4
v[11] |= 5... | input = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
expected = [11, 8, 30, 2.5, 2, 4, 10000000, 20, 2, 2, 14, 15]
def test(v):
v[0] += 1
v[1] -= 2
v[2] *= 3
v[3] /= 4
v[4] //= 5
v[5] %= 6
v[6] **= 7
v[7] <<= 1
v[8] >>= 2
v[9] &= 3
v[10] ^= 4
v[11] |= 5
return v
... |
s = "catsanddog"
wordDict = ["cat", "cats", "and", "sand", "dog"]
s = "pineapplepenapple"
wordDict = ["apple", "pen", "applepen", "pine", "pineapple"]
#s = "ab"
#wordDict = ["a","b"]
#s="aaaaaaa"
#wordDict=["aaaa","aa","a"]
#wordDict=["a","aa","aaaa"]
s="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | s = 'catsanddog'
word_dict = ['cat', 'cats', 'and', 'sand', 'dog']
s = 'pineapplepenapple'
word_dict = ['apple', 'pen', 'applepen', 'pine', 'pineapple']
s = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
word_dict ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Hans-Joachim Kliemeck <git@kliemeck.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported... | ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'core'}
documentation = '\n---\nmodule: win_share\nversion_added: "2.1"\nshort_description: Manage Windows shares\ndescription:\n - Add, modify or remove Windows share and set share permissions.\nrequirements:\n - As this module use... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.