content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
STATS = [
{
"num_node_expansions": 5758,
"plan_cost": 130,
"plan_length": 130,
"search_time": 10.8434,
"total_time": 11.515
},
{
"num_node_expansions": 9619,
"plan_cost": 127,
"plan_length": 127,
"search_time": 21.8034,
"total_t... | stats = [{'num_node_expansions': 5758, 'plan_cost': 130, 'plan_length': 130, 'search_time': 10.8434, 'total_time': 11.515}, {'num_node_expansions': 9619, 'plan_cost': 127, 'plan_length': 127, 'search_time': 21.8034, 'total_time': 22.4716}, {'num_node_expansions': 5995, 'plan_cost': 107, 'plan_length': 107, 'search_time... |
'''
This program will do the following:
1. Ask for input of the amount of organisms
2. Ask for input of the daily population increase in percent
3. Ask for input of the maximum days the organism multiplies
4. Calculate the total population per day
5. Print the results for each day
'''
# ===Begin Loop
whi... | """
This program will do the following:
1. Ask for input of the amount of organisms
2. Ask for input of the daily population increase in percent
3. Ask for input of the maximum days the organism multiplies
4. Calculate the total population per day
5. Print the results for each day
"""
while True:
organisms = int(in... |
def bool_strings():
bools = []
for b in ['T', 'true', 'True', 'TRUE', 'F', 'false', 'False', 'FALSE']:
bools.append((b.lower().startswith('t'), b))
return bools
def test_bool_scalars(tmp_path, helpers):
helpers.do_test_scalar(tmp_path, bool_strings())
def test_bool_one_d_arrays(tmp_path, help... | def bool_strings():
bools = []
for b in ['T', 'true', 'True', 'TRUE', 'F', 'false', 'False', 'FALSE']:
bools.append((b.lower().startswith('t'), b))
return bools
def test_bool_scalars(tmp_path, helpers):
helpers.do_test_scalar(tmp_path, bool_strings())
def test_bool_one_d_arrays(tmp_path, helpe... |
"""Additional Commandline option for pytest."""
MPI_SESSION_ARGUMENT = "--in_mpi_session"
"""
Argument added to the command line arguments useable with pytest.
/cf :any:`pytest_addoption`
"""
_IN_MPI_SESSION = False
"""Indicates whether the current test is run with the mpi session argument"""
def in_mpi_session():... | """Additional Commandline option for pytest."""
mpi_session_argument = '--in_mpi_session'
'\nArgument added to the command line arguments useable with pytest.\n/cf :any:`pytest_addoption`\n'
_in_mpi_session = False
'Indicates whether the current test is run with the mpi session argument'
def in_mpi_session():
"""
... |
class Solution:
def containsCycle(self, grid: List[List[str]]) -> bool:
rows, cols, visited, directions = len(grid), len(grid[0]), set(), [(0, 1), (1, 0), (0, -1), (-1, 0)]
def dfs(row, col, parentX, parentY, length):
visited.add((row, col))
for dirX, dirY in directi... | class Solution:
def contains_cycle(self, grid: List[List[str]]) -> bool:
(rows, cols, visited, directions) = (len(grid), len(grid[0]), set(), [(0, 1), (1, 0), (0, -1), (-1, 0)])
def dfs(row, col, parentX, parentY, length):
visited.add((row, col))
for (dir_x, dir_y) in direc... |
print(
min(
filter(
lambda x: x % 2 != 0,
map(
int,
input().split()
)
)
)
)
| print(min(filter(lambda x: x % 2 != 0, map(int, input().split())))) |
X = 1
def nester():
X = 2
print(X)
class C:
X = 3
print(X)
def method1(self):
print(X)
print(self.X)
def method2(self):
X = 4
print(X)
self.X = 5
print(self.X)
I = C()
I.method1()
I.method2(... | x = 1
def nester():
x = 2
print(X)
class C:
x = 3
print(X)
def method1(self):
print(X)
print(self.X)
def method2(self):
x = 4
print(X)
self.X = 5
print(self.X)
i = c()
I.method1()
I.method... |
animals = { 'a': ['aardvark'], 'b': ['baboon'], 'c': ['coati']}
animals['d'] = ['donkey']
animals['d'].append('dog')
animals['d'].append('dingo')
"""
def howMany(aDict):
i = 0
result = []
values = aDict.values()
print (values)
for w in values:
result.append(w)
for word in result:
... | animals = {'a': ['aardvark'], 'b': ['baboon'], 'c': ['coati']}
animals['d'] = ['donkey']
animals['d'].append('dog')
animals['d'].append('dingo')
'\ndef howMany(aDict):\n i = 0\n result = []\n values = aDict.values()\n print (values)\n for w in values:\n result.append(w)\n for word in result:\n ... |
#from django import http
# adapted from http://djangosnippets.org/snippets/2472/
class CloudMiddleware(object):
def process_request(self, request):
if 'HTTP_X_FORWARDED_PROTO' in request.META:
if request.META['HTTP_X_FORWARDED_PROTO'] == 'https':
request.is_secure = lambda: Tru... | class Cloudmiddleware(object):
def process_request(self, request):
if 'HTTP_X_FORWARDED_PROTO' in request.META:
if request.META['HTTP_X_FORWARDED_PROTO'] == 'https':
request.is_secure = lambda : True
return None |
'''
A simple script for printing numbers
'''
def func1():
'''
func1 is simple methdo which shows the number which are entered inside.
'''
first_num = 1
second_num = 2
print(first_num)
print(second_num)
func1()
# When we run this program using pylint then we can get our code evaluted.
# I... | """
A simple script for printing numbers
"""
def func1():
"""
func1 is simple methdo which shows the number which are entered inside.
"""
first_num = 1
second_num = 2
print(first_num)
print(second_num)
func1() |
class Solution:
def dfs(self, image: List[List[int]], sr: int, sc: int, newColor: int, DIR: List[List[int]], startColor: int) -> List[List[int]]:
image[sr][sc] = newColor
visited = set()
visited.add((sr,sc))
for direction in DIR:
newRow, newCol = sr + di... | class Solution:
def dfs(self, image: List[List[int]], sr: int, sc: int, newColor: int, DIR: List[List[int]], startColor: int) -> List[List[int]]:
image[sr][sc] = newColor
visited = set()
visited.add((sr, sc))
for direction in DIR:
(new_row, new_col) = (sr + direction[0],... |
# Author : Babu Baskaran
# Date : 05/04/2019 Time : 17:00 pm
# Solution for problem number 1
# taking user input
user1=int (input("Please Enter a Positive Integer : "))
# assigning user input into a variable
start = user1
# set i start value into 1
i = 1
# set value of variable ans to zero
ans = 0
# check the i val... | user1 = int(input('Please Enter a Positive Integer : '))
start = user1
i = 1
ans = 0
while i <= start:
ans = ans + i
i = i + 1
print(ans) |
"""
https://leetcode.com/problems/implement-strstr/
Return the first occurence of needle in haystack, or -1 if not found. Return 0 when needle is an empty string.
haystack and needle are both strings
"""
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if len(needle) == 0:
... | """
https://leetcode.com/problems/implement-strstr/
Return the first occurence of needle in haystack, or -1 if not found. Return 0 when needle is an empty string.
haystack and needle are both strings
"""
class Solution:
def str_str(self, haystack: str, needle: str) -> int:
if len(needle) == 0:
... |
units = {
"DecimalDegrees": "degrees",
"WGS_1984": "WGS84",
"Meters": "meters",
"": "",
"Unknown": "Unknown",
}
| units = {'DecimalDegrees': 'degrees', 'WGS_1984': 'WGS84', 'Meters': 'meters', '': '', 'Unknown': 'Unknown'} |
class CommandResponse(object):
def __init__(self):
self.messages = []
self.named = {}
self.errors = []
def __getitem__(self, name):
return self.get_named_data(name)
@property
def active_user(self):
return self.get_named_data('active_user')
@property
... | class Commandresponse(object):
def __init__(self):
self.messages = []
self.named = {}
self.errors = []
def __getitem__(self, name):
return self.get_named_data(name)
@property
def active_user(self):
return self.get_named_data('active_user')
@property
de... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def findTilt(self, root: TreeNode) -> int:
sum_tree, tilt_tree = self.sum_and_tilt(root)
return tilt_tree
def sum_an... | class Solution:
def find_tilt(self, root: TreeNode) -> int:
(sum_tree, tilt_tree) = self.sum_and_tilt(root)
return tilt_tree
def sum_and_tilt(self, root):
if not root:
return (0, 0)
(sum_left, tilt_left) = self.sum_and_tilt(root.left)
(sum_right, tilt_right)... |
'''
Comparison data as seen here,
http://www.nand2tetris.org/
'''
'''------------------------- Arithmetic gates -------------------------'''
k_halfAdder = [
# [ a, b, ( sum, carry ) ]
[ 0, 0, ( 0, 0 ) ],
[ 0, 1, ( 1, 0 ) ],
[ 1, 0, ( 1, 0 ) ],
[ 1, 1, ( 0, 1 ) ],
]
k_fullAdder = [
# [ a, b, c, ( sum, carry ... | """
Comparison data as seen here,
http://www.nand2tetris.org/
"""
'------------------------- Arithmetic gates -------------------------'
k_half_adder = [[0, 0, (0, 0)], [0, 1, (1, 0)], [1, 0, (1, 0)], [1, 1, (0, 1)]]
k_full_adder = [[0, 0, 0, (0, 0)], [0, 0, 1, (1, 0)], [0, 1, 0, (1, 0)], [0, 1, 1, (0, 1)], [1, 0, 0... |
class QuizBrain:
def __init__(self,question_list):
self.question_number = 0
self.score = 0
self.question_list = question_list
def next_question(self):
self.guess = input(f"Q{self.question_number + 1}: {self.question_list[self.question_number].question} True or False: ")
... | class Quizbrain:
def __init__(self, question_list):
self.question_number = 0
self.score = 0
self.question_list = question_list
def next_question(self):
self.guess = input(f'Q{self.question_number + 1}: {self.question_list[self.question_number].question} True or False: ')
... |
mooniswap_abi = [
{
"inputs": [
{"internalType": "contract IERC20", "name": "_token0", "type": "address"},
{"internalType": "contract IERC20", "name": "_token1", "type": "address"},
{"internalType": "string", "name": "name", "type": "string"},
{"internalType":... | mooniswap_abi = [{'inputs': [{'internalType': 'contract IERC20', 'name': '_token0', 'type': 'address'}, {'internalType': 'contract IERC20', 'name': '_token1', 'type': 'address'}, {'internalType': 'string', 'name': 'name', 'type': 'string'}, {'internalType': 'string', 'name': 'symbol', 'type': 'string'}, {'internalType'... |
msg = None
if msg:
print(msg)
| msg = None
if msg:
print(msg) |
class NoTasksError(Exception):
"""Exception raised when there are no tasks passed"""
pass
class TaskResultKeyAlreadyExists(Exception):
"""Exception raised when two tasks produce same key-ed result"""
pass
class TaskResultObjectMissing(Exception):
"""Exception raised when one or more expected inp... | class Notaskserror(Exception):
"""Exception raised when there are no tasks passed"""
pass
class Taskresultkeyalreadyexists(Exception):
"""Exception raised when two tasks produce same key-ed result"""
pass
class Taskresultobjectmissing(Exception):
"""Exception raised when one or more expected input... |
def counter(c_var):
while True:
try:
c_var = c_var + 1
except KeyboardInterrupt:
print('Counter now at: ' + str(c_var))
def counter_p(c_var):
while True:
c_var = c_var + 1
print(c_var) | def counter(c_var):
while True:
try:
c_var = c_var + 1
except KeyboardInterrupt:
print('Counter now at: ' + str(c_var))
def counter_p(c_var):
while True:
c_var = c_var + 1
print(c_var) |
# Type definiton for (type, data) tuples representing a value
# See http://androidxref.com/9.0.0_r3/xref/frameworks/base/libs/androidfw/include/androidfw/ResourceTypes.h#262
# The 'data' is either 0 or 1, specifying this resource is either
# undefined or empty, respectively.
TYPE_NULL = 0x00
# The 'data' holds a ResTa... | type_null = 0
type_reference = 1
type_attribute = 2
type_string = 3
type_float = 4
type_dimension = 5
type_fraction = 6
type_dynamic_reference = 7
type_dynamic_attribute = 8
type_first_int = 16
type_int_dec = 16
type_int_hex = 17
type_int_boolean = 18
type_first_color_int = 28
type_int_color_argb8 = 28
type_int_color_r... |
words=['Aaron',
'Ab',
'Abba',
'Abbe',
'Abbey',
'Abbie',
'Abbot',
'Abbott',
'Abby',
'Abdel',
'Abdul',
'Abe',
'Abel',
'Abelard',
'Abeu',
'Abey',
'Abie',
'Abner',
'Abraham',
'Abrahan',
'Abram',
'Abramo',
'Abran',
'Ad',
'Adair',
'Adam',
'Adamo',
'Adams',
'Adan',
'Addie',
'Addison',
'Addy',
'Ade',
'Adelbert',
'Adham',
'Adla... | words = ['Aaron', 'Ab', 'Abba', 'Abbe', 'Abbey', 'Abbie', 'Abbot', 'Abbott', 'Abby', 'Abdel', 'Abdul', 'Abe', 'Abel', 'Abelard', 'Abeu', 'Abey', 'Abie', 'Abner', 'Abraham', 'Abrahan', 'Abram', 'Abramo', 'Abran', 'Ad', 'Adair', 'Adam', 'Adamo', 'Adams', 'Adan', 'Addie', 'Addison', 'Addy', 'Ade', 'Adelbert', 'Adham', 'Ad... |
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
pre,cur = 0,1
while cur < len(nums):
if nums[pre] == nums[cur]:
nums.pop(cur)
else:
pre,cur = pre + 1, cu... | class Solution(object):
def remove_duplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
(pre, cur) = (0, 1)
while cur < len(nums):
if nums[pre] == nums[cur]:
nums.pop(cur)
else:
(pre, cur) = (pre + ... |
# by Kami Bigdely
# Extract class
class Actor:
def __init__(self, first_name, last_name, birth_year, movies, email) -> None:
self.first_name = first_name
self.last_name = last_name
self.birth_year = birth_year
self.movies = movies
self.email = email
def send_hiring_... | class Actor:
def __init__(self, first_name, last_name, birth_year, movies, email) -> None:
self.first_name = first_name
self.last_name = last_name
self.birth_year = birth_year
self.movies = movies
self.email = email
def send_hiring_email(self):
print('Email sent... |
#creating a function
def cal(one,two):
three=float(one)-float(two)
print(three)
return
cal(1,4)
| def cal(one, two):
three = float(one) - float(two)
print(three)
return
cal(1, 4) |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def __init__(self):
self.plus1 = 0
def copyTheResults(self, node, result):
while node != None:
result.next = ListNod... | class Solution(object):
def __init__(self):
self.plus1 = 0
def copy_the_results(self, node, result):
while node != None:
result.next = list_node(node.val)
result = result.next
result.next = None
if self.plus1 == 1:
result.val = no... |
class XYZfileWrongFormat(Exception):
pass
class XYZfileDidNotExist(Exception):
pass
| class Xyzfilewrongformat(Exception):
pass
class Xyzfiledidnotexist(Exception):
pass |
def number_length(a: int) -> int:
# your code here
# algorithm
# 1) Will recive an argument called "a" of datatype "int"
# 2) Convert the integer into a string
# 3) Calculate the length of the string
# 4) Return the Length of the string
return len(str(a))
def number_length_two(a: int) -> in... | def number_length(a: int) -> int:
return len(str(a))
def number_length_two(a: int) -> int:
mystring = str(a)
mylength = len(mystring)
return mylength
if __name__ == '__main__':
print('Example:')
print(number_length(10))
assert number_length(10) == 2
assert number_length(0) == 1
asse... |
# URI Online Judge 2152
N = int(input())
for n in range(N):
entrada = [int(i) for i in input().split()]
if entrada[2] == 0: estado = 'fechou'
else: estado = 'abriu'
print('{:02d}:{:02d} - A porta {}!'.format(entrada[0], entrada[1], estado)) | n = int(input())
for n in range(N):
entrada = [int(i) for i in input().split()]
if entrada[2] == 0:
estado = 'fechou'
else:
estado = 'abriu'
print('{:02d}:{:02d} - A porta {}!'.format(entrada[0], entrada[1], estado)) |
# -*- coding: utf-8 -*-
"""
lswifi.ie
~~~~~~~~~
schema definition for information element
"""
class InformationElement:
"""Base class for Information Elements"""
def __init__(
self,
element,
element_id,
element_id_extension=None,
extensible=None,
fragmentable... | """
lswifi.ie
~~~~~~~~~
schema definition for information element
"""
class Informationelement:
"""Base class for Information Elements"""
def __init__(self, element, element_id, element_id_extension=None, extensible=None, fragmentable=None):
self.element = element
self.element_id = element_id... |
# Count and display the number of vowels,
# consonants, uppercase, lowercase characters in string
def countCharacterType(s):
vowels = 0
consonant = 0
lowercase = 0
uppercase = 0
for i in range(0, len(s)):
ch = s[i]
if ((ch >= 'a' and ch <= 'z') or
(ch >= 'A' and ch... | def count_character_type(s):
vowels = 0
consonant = 0
lowercase = 0
uppercase = 0
for i in range(0, len(s)):
ch = s[i]
if ch >= 'a' and ch <= 'z' or (ch >= 'A' and ch <= 'Z'):
if ch.islower():
lowercase += 1
if ch.isupper():
upp... |
class Solution:
def __init__(self, N: int, blacklist: List[int]):
self.validRange = N - len(blacklist)
self.dict = {}
for b in blacklist:
self.dict[b] = -1
for b in blacklist:
if b < self.validRange:
while N - 1 in self.dict:
N -= 1
self.dict[b] = N - 1
... | class Solution:
def __init__(self, N: int, blacklist: List[int]):
self.validRange = N - len(blacklist)
self.dict = {}
for b in blacklist:
self.dict[b] = -1
for b in blacklist:
if b < self.validRange:
while N - 1 in self.dict:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright 2020, Yutong Xie, UIUC.
Iteratively reverse a singly linked list
'''
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object... | """
Copyright 2020, Yutong Xie, UIUC.
Iteratively reverse a singly linked list
"""
class Solution(object):
def reverse_list(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
prev = None
curr = head
while curr:
tmp = curr.next
... |
totalelements=int(input())
numeratorele=[int(ele) for ele in input().split()]
denomele=[int(ele) for ele in input().split()]
resnumerator=0
if len(numeratorele) == len(denomele):
for i in range(totalelements):
cal=numeratorele[i]*denomele[i]
resnumerator+=cal
print(round(resnumerator/sum(denomele)... | totalelements = int(input())
numeratorele = [int(ele) for ele in input().split()]
denomele = [int(ele) for ele in input().split()]
resnumerator = 0
if len(numeratorele) == len(denomele):
for i in range(totalelements):
cal = numeratorele[i] * denomele[i]
resnumerator += cal
print(round(resnumerator /... |
def foo():
'''
>>> from mod import Good as Good
'''
pass # Ignore PyUnusedCodeBear
| def foo():
"""
>>> from mod import Good as Good
"""
pass |
class Node:
def __init__(self):
self.children = {}
self.endOfWord = False
class Trie:
def __init__(self):
"""
Initialize your data structure here.
"""
# Trie intializes with a Node
self.root = Node()
def insert(self, word: str) -> None:
"""
... | class Node:
def __init__(self):
self.children = {}
self.endOfWord = False
class Trie:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = node()
def insert(self, word: str) -> None:
"""
Inserts a word into the trie.... |
#!/usr/bin/env python3
# Conditional statements check for a condition,
# and act accordingly.
# Python uses the `if/elif/else` structure for this.
# Example 1
if 2 > 1:
print("2 greater than 1")
# Example 2
var1 = 1
var2 = 10
if var1 > var2:
print("var1 greater than var2")
else:
print("var2 greater than ... | if 2 > 1:
print('2 greater than 1')
var1 = 1
var2 = 10
if var1 > var2:
print('var1 greater than var2')
else:
print('var2 greater than var1')
value = input('What is the price for that thing?')
value = int(value)
if value < 10:
print("That's great!")
elif 10 <= value <= 20:
print('I would still buy it... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isBalanced(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
def _treeDe... | class Solution(object):
def is_balanced(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
def _tree_depth(node):
if node is None:
return 0
else:
return 1 + max(_tree_depth(node.left), _tree_depth(node.right))
... |
class Rollout:
'''
Usage: rollout = Rollout(state)
'''
def __init__(self, state):
self.state_list = [state]
self.action_list = []
self.reward_list = []
self.act_val_list = []
self.done = False
def append(self, state, action, reward, done, act_val):
... | class Rollout:
"""
Usage: rollout = Rollout(state)
"""
def __init__(self, state):
self.state_list = [state]
self.action_list = []
self.reward_list = []
self.act_val_list = []
self.done = False
def append(self, state, action, reward, done, act_val):
s... |
#!/usr/bin/env python
TEST_PUBLIC_KEY = 5764801
CARD_PUBLIC_KEY = 18499292
DOOR_PUBLIC_KEY = 8790390
def find_loop_size(
target_key,
subject=7,
starting_value=1,
):
value = starting_value
loop_size = 0
while value != target_key:
value = value * subject
value = value % 20201227... | test_public_key = 5764801
card_public_key = 18499292
door_public_key = 8790390
def find_loop_size(target_key, subject=7, starting_value=1):
value = starting_value
loop_size = 0
while value != target_key:
value = value * subject
value = value % 20201227
loop_size += 1
return loop... |
class BaseDerivative:
def __init__(self, config, instance, *args, **kwargs):
self.config = config
self.instance = instance
| class Basederivative:
def __init__(self, config, instance, *args, **kwargs):
self.config = config
self.instance = instance |
# display characters
BLANK_STR = ' '
PLAYER_1_STR = ' X '
PLAYER_2_STR = ' O '
LEFT_PAD_STR = ' '
HORIZ_BOARD_STR = '-'
HORIZ_BOARD_STR_THREE = ''.join(HORIZ_BOARD_STR for x in xrange(3))
VERTICAL_BOARD_STR = '|'
assert len(BLANK_STR) == len(PLAYER_1_STR) == len(PLAYER_2_STR)
def get_board_display(board_state, deb... | blank_str = ' '
player_1_str = ' X '
player_2_str = ' O '
left_pad_str = ' '
horiz_board_str = '-'
horiz_board_str_three = ''.join((HORIZ_BOARD_STR for x in xrange(3)))
vertical_board_str = '|'
assert len(BLANK_STR) == len(PLAYER_1_STR) == len(PLAYER_2_STR)
def get_board_display(board_state, debug_mode=False):
... |
class Solution:
def reorderedPowerOf2(self, N: int) -> bool:
x="".join(i for i in sorted(str(N)))
for i in range(30):
s="".join(i for i in sorted(str(2**i)))
if s==x:
print(s)
return True
return False
| class Solution:
def reordered_power_of2(self, N: int) -> bool:
x = ''.join((i for i in sorted(str(N))))
for i in range(30):
s = ''.join((i for i in sorted(str(2 ** i))))
if s == x:
print(s)
return True
return False |
#-----------------------------------------------------------------------------
# Copyright (c) 2019, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... | hiddenimports = ['pywt._extensions._cwt'] |
def bbox_mk(p1, p2, offset=(0, 0)):
x1 = min(p1[0], p2[0]) - offset[0]
x2 = max(p1[0], p2[0]) + offset[0]
y1 = min(p1[1], p2[1]) - offset[1]
y2 = max(p1[1], p2[1]) + offset[1]
return (x1, y1), (x2, y2)
def bbox_add_point(bbox, p, offset=(0, 0)):
x1 = min(bbox[0][0], p[0] - offset[0])
x2 ... | def bbox_mk(p1, p2, offset=(0, 0)):
x1 = min(p1[0], p2[0]) - offset[0]
x2 = max(p1[0], p2[0]) + offset[0]
y1 = min(p1[1], p2[1]) - offset[1]
y2 = max(p1[1], p2[1]) + offset[1]
return ((x1, y1), (x2, y2))
def bbox_add_point(bbox, p, offset=(0, 0)):
x1 = min(bbox[0][0], p[0] - offset[0])
x2 =... |
#!/usr/bin/python3
def isprime(n):
if n == 1:
return False
for x in range(2, n):
if n % x == 0:
return False
else:
return True
def primes(n = 1):
while(True):
if isprime(n): yield n
n += 1
for n in primes():
if n > 100: break
print(n)
| def isprime(n):
if n == 1:
return False
for x in range(2, n):
if n % x == 0:
return False
else:
return True
def primes(n=1):
while True:
if isprime(n):
yield n
n += 1
for n in primes():
if n > 100:
break
print(n) |
""" This problem was asked by Uber.
Given an array of integers, return a new array such that each element at index i
of the new array is the product of all the numbers in the original array except
the one at i.For example, if our input was [1, 2, 3, 4, 5], the expected output
would be [120, 60, 40, 30, 24]. If our inpu... | """ This problem was asked by Uber.
Given an array of integers, return a new array such that each element at index i
of the new array is the product of all the numbers in the original array except
the one at i.For example, if our input was [1, 2, 3, 4, 5], the expected output
would be [120, 60, 40, 30, 24]. If our inpu... |
#!/usr/bin/env python
class Service(object):
pass
| class Service(object):
pass |
model_params = dict(
image_shape=(1, 256, 256),
n_part_caps=30,
n_obj_caps=16,
scae_regression_params=dict(
is_active=True,
loss='mse',
attention_hp=1,
),
scae_classification_params=dict(
is_active=False,
n_classes=1,
),
pcae_cnn_encoder_params=dic... | model_params = dict(image_shape=(1, 256, 256), n_part_caps=30, n_obj_caps=16, scae_regression_params=dict(is_active=True, loss='mse', attention_hp=1), scae_classification_params=dict(is_active=False, n_classes=1), pcae_cnn_encoder_params=dict(out_channels=[128] * 4, kernel_sizes=[3, 3, 3, 3], strides=[2, 2, 1, 1], acti... |
# -*- coding: utf-8 -*-
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __eq__(self, other):
return (
other is not None and
self.val == other.val and
self.left == other.left and
self.rig... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __eq__(self, other):
return other is not None and self.val == other.val and (self.left == other.left) and (self.right == other.right)
class Solution:
def remove_leaf_nodes(self, roo... |
class Solution:
def longestPalindrome(self, s: str) -> int:
str_dict={}
for each in s:
if each not in str_dict:
str_dict[each]=0
str_dict[each]+=1
result=0
odd=0
for k, v in str_dict.items():
if v%2==0:
resul... | class Solution:
def longest_palindrome(self, s: str) -> int:
str_dict = {}
for each in s:
if each not in str_dict:
str_dict[each] = 0
str_dict[each] += 1
result = 0
odd = 0
for (k, v) in str_dict.items():
if v % 2 == 0:
... |
for desi in Parameters.GetAllDesignPoints():
for message in GetMessages():
if (DateTime.Compare(message.DateTimeStamp, startTime) == 1) and (message.DesignPoint == desi.Name):
desi.Retained = False
break
| for desi in Parameters.GetAllDesignPoints():
for message in get_messages():
if DateTime.Compare(message.DateTimeStamp, startTime) == 1 and message.DesignPoint == desi.Name:
desi.Retained = False
break |
def solve(heads,legs):
for i in range(heads+1):
j=heads-i
if (2*i)+(4*j)==legs:
print (i,j)
return
print("No solution")
#Start writing your code here
#Populate the variables: chicken_count and rabbit_count
# Use the below given print stateme... | def solve(heads, legs):
for i in range(heads + 1):
j = heads - i
if 2 * i + 4 * j == legs:
print(i, j)
return
print('No solution')
solve(38, 131) |
class Controller():
def __init__(self):
self.debugger = None
def get_cmd(self):
pass | class Controller:
def __init__(self):
self.debugger = None
def get_cmd(self):
pass |
class Solution:
def countDigitOne(self, n: int) -> int:
if n <= 0:
return 0
ln = len(str(n))
if ln == 1:
return 1
tmp1 = 10 ** (ln - 1)
firstnum = n // tmp1
fone = n % tmp1 + 1 if firstnum == 1 else tmp1
other = firstnum * (ln - 1) * (t... | class Solution:
def count_digit_one(self, n: int) -> int:
if n <= 0:
return 0
ln = len(str(n))
if ln == 1:
return 1
tmp1 = 10 ** (ln - 1)
firstnum = n // tmp1
fone = n % tmp1 + 1 if firstnum == 1 else tmp1
other = firstnum * (ln - 1) *... |
class PathNameChecker(object):
def check(self, pathname: str):
pass
| class Pathnamechecker(object):
def check(self, pathname: str):
pass |
total = 0
line = input()
while line != "NoMoreMoney":
current = float(line)
if current < 0:
print("Invalid operation!")
break
total += current
print(f"Increase: {current:.2f}")
line = input()
print(f"Total: {total:.2f}")
| total = 0
line = input()
while line != 'NoMoreMoney':
current = float(line)
if current < 0:
print('Invalid operation!')
break
total += current
print(f'Increase: {current:.2f}')
line = input()
print(f'Total: {total:.2f}') |
#
# PySNMP MIB module PAIRGAIN-DSLAM-ALARM-SEVERITY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PAIRGAIN-DSLAM-ALARM-SEVERITY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:36:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, constraints_union, value_range_constraint, value_size_constraint) ... |
"""
In Fractional Knapsack, we can break items for maximizing the total value of knapsack.
This problem in which we can break an item is also called the fractional knapsack problem.
Input:
Items as (value, weight) pairs
arr[] = {{60, 10}, {100, 20}, {120, 30}}
Knapsack Capacity, W = 50;
Output :
Maximum possi... | """
In Fractional Knapsack, we can break items for maximizing the total value of knapsack.
This problem in which we can break an item is also called the fractional knapsack problem.
Input:
Items as (value, weight) pairs
arr[] = {{60, 10}, {100, 20}, {120, 30}}
Knapsack Capacity, W = 50;
Output :
Maximum possi... |
"""
Profile ../profile-datasets-py/standard54lev_co2o3ref/004.py
file automaticaly created by prof_gen.py script
"""
self["ID"] = "../profile-datasets-py/standard54lev_co2o3ref/004.py"
self["Q"] = numpy.array([ 1.39778700e+00, 2.03491300e+00, 2.66180300e+00,
3.22654500e+00, 3.85401500e+00,... | """
Profile ../profile-datasets-py/standard54lev_co2o3ref/004.py
file automaticaly created by prof_gen.py script
"""
self['ID'] = '../profile-datasets-py/standard54lev_co2o3ref/004.py'
self['Q'] = numpy.array([1.397787, 2.034913, 2.661803, 3.226545, 3.854015, 4.340527, 4.691798, 4.887552, 4.96474, 5.0, 5.0,... |
# -*- coding: utf-8 -*-
def main():
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)][::-1]
memo = [0 for _ in range(n + 1)]
for ai in a:
if memo[ai] == 1:
continue
else:
memo[ai] = 1
print(ai)
for index, m in... | def main():
(n, m) = map(int, input().split())
a = [int(input()) for _ in range(m)][::-1]
memo = [0 for _ in range(n + 1)]
for ai in a:
if memo[ai] == 1:
continue
else:
memo[ai] = 1
print(ai)
for (index, m) in enumerate(memo):
if index == 0... |
#!/usr/bin/env python
# Parse key mapping
keymap = {}
with open('reverb.keymap', 'r') as mapping:
content = mapping.read()
for line in content.split("\n"):
if len(line) > 0:
fields = line.split("\t")
keymap[fields[0]] = fields[1] + "\t" + fields[2] + "\t" + fields[3]
# Training data
train = []
wit... | keymap = {}
with open('reverb.keymap', 'r') as mapping:
content = mapping.read()
for line in content.split('\n'):
if len(line) > 0:
fields = line.split('\t')
keymap[fields[0]] = fields[1] + '\t' + fields[2] + '\t' + fields[3]
train = []
with open('reverb_correct_train.keys', 'r')... |
# AUTHOR: Akash Rajak
# Python3 Concept: Matrix Transpose
# GITHUB: https://github.com/akash435
# Add your python3 concept below
def matrix_transpose():
for i in range(len(A)):
for j in range(len(A[0])):
res[i][j] = A[j][i]
A=[]
print("Enter N:")
n = int(input())
print("Enter Matrix A:")
for... | def matrix_transpose():
for i in range(len(A)):
for j in range(len(A[0])):
res[i][j] = A[j][i]
a = []
print('Enter N:')
n = int(input())
print('Enter Matrix A:')
for i in range(0, n):
temp = []
for j in range(0, n):
x = int(input())
temp.append(x)
A.append(temp)
res =... |
first_name = "Bob"
last_name = "Daily"
#first_name[0] = "R"
fixed_first_name = "R" + first_name[-2:]
print(fixed_first_name)
| first_name = 'Bob'
last_name = 'Daily'
fixed_first_name = 'R' + first_name[-2:]
print(fixed_first_name) |
class Solution(object):
def uniquePathsWithObstacles(self, grid):
"""
:type obstacleGrid: List[List[int]]
:rtype: int
"""
m = len(grid)
n = len(grid[0])
dp = [[0 for _ in range(n)] for _ in range(m)]
for i in range(n):
... | class Solution(object):
def unique_paths_with_obstacles(self, grid):
"""
:type obstacleGrid: List[List[int]]
:rtype: int
"""
m = len(grid)
n = len(grid[0])
dp = [[0 for _ in range(n)] for _ in range(m)]
for i in range(n):
if grid[0][i] == ... |
del_items(0x80127F74)
SetType(0x80127F74, "struct Creds CreditsTitle[6]")
del_items(0x8012811C)
SetType(0x8012811C, "struct Creds CreditsSubTitle[28]")
del_items(0x801285B8)
SetType(0x801285B8, "struct Creds CreditsText[35]")
del_items(0x801286D0)
SetType(0x801286D0, "int CreditsTable[224]")
del_items(0x80129900)
SetTy... | del_items(2148695924)
set_type(2148695924, 'struct Creds CreditsTitle[6]')
del_items(2148696348)
set_type(2148696348, 'struct Creds CreditsSubTitle[28]')
del_items(2148697528)
set_type(2148697528, 'struct Creds CreditsText[35]')
del_items(2148697808)
set_type(2148697808, 'int CreditsTable[224]')
del_items(2148702464)
s... |
# MIT OC - CS600 - Introduction to Computer Science and Programming
# Problem Set 1: 3 Simple Problems - Problem 2 Pay off debt in 1 year
# Name: Luke Young
# Collaborators: None
# Time Spent: 01:00 (hr:min)
# 2018 04 22 20:27
# Program: Finding the minimum payment required to pay off the debt
#
# Write a program th... | balance = 0.0
apr = 0.0
balance = float(raw_input('What is your current Balance? '))
apr = float(raw_input('What is the annual interest rate as a decimal? '))
min_pay = 0.0
principle = 0.0
end_balance = 0.0
paid = False
while paid == False:
temp_balance = balance
min_pay += 10
month = 1
for month in ran... |
"""
Othello game written in Python using Textual as TUI in Bash for Linux.
"""
# Setup game
# Ask player name
# Ask white or black
# Initial board
# Check if player can make a move
# Take player input for placing piece
# Check if move is valid input
# Place piece and flip opponents pieces affected
# Update score
# Keep... | """
Othello game written in Python using Textual as TUI in Bash for Linux.
"""
def main():
print('Lets play Tothello')
if __name__ == '__main__':
main() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def get_func(tag):
def func(s):
group = tag, s
return group
return func
| def get_func(tag):
def func(s):
group = (tag, s)
return group
return func |
"""Make an infinite loop.
Write a loop which has no end clause.
Source: programming-idioms.org
"""
# Implementation author: JackStouffer
# Created on 2016-02-18T16:57:59.907374Z
# Last modified on 2016-02-18T16:57:59.907374Z
# Version 1
while True:
pass
| """Make an infinite loop.
Write a loop which has no end clause.
Source: programming-idioms.org
"""
while True:
pass |
# container-service-extension
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
# End point of Vmware Analytics staging server
# TODO() : This URL should reflect production server during release
VAC_URL = "https://vcsa.vmware.com/ph-stg/api/hyper/send/"
# Value of collecto... | vac_url = 'https://vcsa.vmware.com/ph-stg/api/hyper/send/'
collector_id = 'CSE.2_6' |
quit = False
flag = False
while not quit :
num = int(input(""))
if num == 42:
quit = True;
else:
print(num)
| quit = False
flag = False
while not quit:
num = int(input(''))
if num == 42:
quit = True
else:
print(num) |
# -*- coding: utf-8 -*-
'''
File name: code\47smooth_triangular_numbers\sol_581.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #581 :: 47-smooth triangular numbers
#
# For more information see:
# https://projecteuler.net/problem=581
# P... | """
File name: code'smooth_triangular_numbers\\sol_581.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
"""
'\nA number is p-smooth if it has no prime factors larger than p.\nLet T be the sequence of triangular numbers, ie T(n)=n(n+1)/2.\nFind the sum of all indices n such that T(n... |
# throws KeyError
students = {'John': 18, 'Jack': 19}
print(students['Joe'])
# try/catch KeyError
students = {'John': 18, 'Jack': 19}
try:
print(students['Joe'])
except KeyError:
print('you tried to access an entry that does not exists')
| students = {'John': 18, 'Jack': 19}
print(students['Joe'])
students = {'John': 18, 'Jack': 19}
try:
print(students['Joe'])
except KeyError:
print('you tried to access an entry that does not exists') |
"""
Write a function that reverses characters in (possibly nested) parentheses in the input string.
Input strings will always be well-formed with matching ()s.
Example
For inputString = "(bar)", the output should be
reverseInParentheses(inputString) = "rab";
For inputString = "foo(bar)baz", the output should be
reve... | """
Write a function that reverses characters in (possibly nested) parentheses in the input string.
Input strings will always be well-formed with matching ()s.
Example
For inputString = "(bar)", the output should be
reverseInParentheses(inputString) = "rab";
For inputString = "foo(bar)baz", the output should be
reve... |
_base_ = '../_base_/default_runtime.py'
# dataset settings
dataset_type = 'CocoPanopticDataset'
data_root = 'data/coco/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
# file_client_args = dict(backend='disk',)
# file_client_args = dict(
# backend='petrel',
# ... | _base_ = '../_base_/default_runtime.py'
dataset_type = 'CocoPanopticDataset'
data_root = 'data/coco/'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
file_client_args = dict(backend='memcached', server_list_cfg='/mnt/lustre/share/memcached_client/server_list.conf', client_c... |
STATUS_MAPPER = [
"Success",
"Unknown HCI Command",
"Unknown Connection Identifier",
"Hardware Failure",
"Page Timeout",
"Authentication Failure",
"PIN or Key Missing",
"Memory Capacity Exceeded",
"Connection Timeout",
"Connection Limit Exceeded",
"Synchronous Connection Limit to a Device Exceeded... | status_mapper = ['Success', 'Unknown HCI Command', 'Unknown Connection Identifier', 'Hardware Failure', 'Page Timeout', 'Authentication Failure', 'PIN or Key Missing', 'Memory Capacity Exceeded', 'Connection Timeout', 'Connection Limit Exceeded', 'Synchronous Connection Limit to a Device Exceeded', 'ACL Connection Alre... |
# __init__
__version__ = '1.1.0'
| __version__ = '1.1.0' |
def test_get_public_key(cmd, button, model):
pub_key, address = cmd.get_public_key(
bip32_path="44'/5741565'/0'/0'/1'",
network_byte='V',
display=True,
button=button,
model=model
) # type: bytes, bytes
assert len(pub_key) == 32
assert len(address) == 35
| def test_get_public_key(cmd, button, model):
(pub_key, address) = cmd.get_public_key(bip32_path="44'/5741565'/0'/0'/1'", network_byte='V', display=True, button=button, model=model)
assert len(pub_key) == 32
assert len(address) == 35 |
x = [1,2,3]
name = "/tests/fixtures/data/names/{name_id}.txt"
output = "/tests/fixtures/data/salutations/{name_id}-{x}.txt"
def main():
return "Hello {name} for the {x} time!".format(name=name, x=x)
| x = [1, 2, 3]
name = '/tests/fixtures/data/names/{name_id}.txt'
output = '/tests/fixtures/data/salutations/{name_id}-{x}.txt'
def main():
return 'Hello {name} for the {x} time!'.format(name=name, x=x) |
# Skin info and colours
theme_name = "Future Bloo"
theme_author = "Lucas."
theme_version = "1.0"
theme_bio = "Bloo" # A long bio will get cut off, keep it simple.
window_theme = "Black"
button_colour = "black"
attacks_theme = {"background": "Black", "button_colour": ('black', 'cyan')}
banner_size = (600, 100)
banner_p... | theme_name = 'Future Bloo'
theme_author = 'Lucas.'
theme_version = '1.0'
theme_bio = 'Bloo'
window_theme = 'Black'
button_colour = 'black'
attacks_theme = {'background': 'Black', 'button_colour': ('black', 'cyan')}
banner_size = (600, 100)
banner_padding = ((75, 15), 0)
menu1 = 'cyan'
menu2 = 'white'
rtb_icon = b'iVBOR... |
"""
Some functions about numbers
"""
###############################################
def is_number(v):
try:
v = float(v)
return True
except ValueError:
return False
except TypeError:
return False
###############################################
def get_number(v):
defaul... | """
Some functions about numbers
"""
def is_number(v):
try:
v = float(v)
return True
except ValueError:
return False
except TypeError:
return False
def get_number(v):
default_val = None
try:
v = float(v)
return v
except ValueError:
return... |
"""
There is a fence with n posts, each post can be painted with one of the k
colors.
You have to paint all the posts such that no more than two adjacent fence posts
have the same color.
Return the total number of ways you can paint the fence.
Note:
n and k are non-negative integers.
"""
class Solution(object):
... | """
There is a fence with n posts, each post can be painted with one of the k
colors.
You have to paint all the posts such that no more than two adjacent fence posts
have the same color.
Return the total number of ways you can paint the fence.
Note:
n and k are non-negative integers.
"""
class Solution(object):... |
ENTRY_POINT = 'f'
#[PROMPT]
def f(n):
""" Implement the function f that takes n as a parameter,
and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even
or the sum of numbers from 1 to i otherwise.
i starts from 1.
the factorial of i is the mult... | entry_point = 'f'
def f(n):
""" Implement the function f that takes n as a parameter,
and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even
or the sum of numbers from 1 to i otherwise.
i starts from 1.
the factorial of i is the multiplication... |
def fibonacci():
"""generartor of fibonacci numbers"""
a, b, n = 0, 1, 1
yield n, b
while True:
n += 1
a, b = b, b + a
yield n, b
def triangle():
n = 1
while True:
yield n, n * (n + 1) // 2
n += 1
| def fibonacci():
"""generartor of fibonacci numbers"""
(a, b, n) = (0, 1, 1)
yield (n, b)
while True:
n += 1
(a, b) = (b, b + a)
yield (n, b)
def triangle():
n = 1
while True:
yield (n, n * (n + 1) // 2)
n += 1 |
DATA = {
"website": None,
"myspace_name": None,
"last_name": "Bizness",
"reposts_count": 0,
"public_favorites_count": 0,
"followings_count": 2,
"full_name": "Nonya Bizness",
"id": 12345,
"city": "Los Angeles",
"first_name": "Nonya",
"track_count": 123,
"playlist_count": 0... | data = {'website': None, 'myspace_name': None, 'last_name': 'Bizness', 'reposts_count': 0, 'public_favorites_count': 0, 'followings_count': 2, 'full_name': 'Nonya Bizness', 'id': 12345, 'city': 'Los Angeles', 'first_name': 'Nonya', 'track_count': 123, 'playlist_count': 0, 'discogs_name': None, 'followers_count': 54321,... |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftpuntobipuntoleftcomarightigualleftcor1cor2leftmasmenosleftasteriscodivporcentajeleftpotrightumenosumasleftpar1par2leftt_orleftt_andleftdiferenteleftmayormenormayori... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftpuntobipuntoleftcomarightigualleftcor1cor2leftmasmenosleftasteriscodivporcentajeleftpotrightumenosumasleftpar1par2leftt_orleftt_andleftdiferenteleftmayormenormayorimenorirightt_notasterisco bipunto char coma cor1 cor2 decimal diferente diferentede div entero... |
"""
This hard-coded list would need to be maintained differently if/when the
available units, available upgrades or their in-game IDs change.
"""
codeMap = {
"protoss" : {
"ground" : {
4 : "Colossus",
73 : "Zealot",
74 : "Stalker",
... | """
This hard-coded list would need to be maintained differently if/when the
available units, available upgrades or their in-game IDs change.
"""
code_map = {'protoss': {'ground': {4: 'Colossus', 73: 'Zealot', 74: 'Stalker', 75: 'HighTemplar', 76: 'DarkTemplar', 77: 'Sentry', 83: 'Immortal', 84: 'Probe', 141: 'Archon',... |
items = "ABCDE"
pairs = []
for a in range(len(items)):
for b in range(len(items)):
pairs.append((items[a], items[b]))
print(pairs)
ret = [(items[a], items[b]) for a in range(len(items)) for b in range( len(items))]
print(ret)
ret2 = [(x, y) for x in range(2) for y in range(2)]
ret3 = [(x, y) for x in r... | items = 'ABCDE'
pairs = []
for a in range(len(items)):
for b in range(len(items)):
pairs.append((items[a], items[b]))
print(pairs)
ret = [(items[a], items[b]) for a in range(len(items)) for b in range(len(items))]
print(ret)
ret2 = [(x, y) for x in range(2) for y in range(2)]
ret3 = [(x, y) for x in range(2... |
# -*- coding: utf-8 -*-
def skip(model, layer, inputs):
inputs[layer.name] = inputs[layer.input.name]
return model, layer, inputs
| def skip(model, layer, inputs):
inputs[layer.name] = inputs[layer.input.name]
return (model, layer, inputs) |
def fixing_float(size, n_float):
fmt = ".{n}f"
fix = [None]
for i in range(size):
fix.append(fmt.format(n=n_float))
return fix
| def fixing_float(size, n_float):
fmt = '.{n}f'
fix = [None]
for i in range(size):
fix.append(fmt.format(n=n_float))
return fix |
#
# PySNMP MIB module UPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/UPS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:50:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ... |
#
# PySNMP MIB module ELTEX-MES-SNMP-COMMUNITY-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-SNMP-COMMUNITY-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:01:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pyt... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) ... |
def fun(x):
return 2*x
fun(4)
| def fun(x):
return 2 * x
fun(4) |
# Define a class for the maze board
class Maze:
# Initialize number of rows, cols and start position
def __init__(self, rows, cols, start):
self.rows = rows
self.cols = cols
self.i = start[0]
self.j = start[1]
self.start = start
def set(self, rewards, actions):
... | class Maze:
def __init__(self, rows, cols, start):
self.rows = rows
self.cols = cols
self.i = start[0]
self.j = start[1]
self.start = start
def set(self, rewards, actions):
self.rewards = rewards
self.actions = actions
def set_state(self, state):
... |
SUPPORTED_TRANS = {
"height": "h",
"width": "w",
"aspect_ratio": "ar",
"quality": "q",
"crop": "c",
"crop_mode": "cm",
"x": "x",
"y": "y",
"focus": "fo",
"format": "f",
"radius": "r",
"background": "bg",
"border": "bo",
"rotation": "rt",
"blur": "bl",
"nam... | supported_trans = {'height': 'h', 'width': 'w', 'aspect_ratio': 'ar', 'quality': 'q', 'crop': 'c', 'crop_mode': 'cm', 'x': 'x', 'y': 'y', 'focus': 'fo', 'format': 'f', 'radius': 'r', 'background': 'bg', 'border': 'bo', 'rotation': 'rt', 'blur': 'bl', 'named': 'n', 'overlay_image': 'oi', 'overlay_x': 'ox', 'overlay_y': ... |
"""
Datos de entrada
edad_uno-->e1-->int
edad_dos-->e2-->int
edad_tres-->e3-->int
Datos de salida
promedio-->p-->float
"""
#Entradas
e1=int(input("Ingrese la edad de la primera persona: "))
e2=int(input("Ingrese la edad de la segunda persona: "))
e3=int(input("Ingrese la edad de la tercera persona: "))
#Caja negra
p=(e... | """
Datos de entrada
edad_uno-->e1-->int
edad_dos-->e2-->int
edad_tres-->e3-->int
Datos de salida
promedio-->p-->float
"""
e1 = int(input('Ingrese la edad de la primera persona: '))
e2 = int(input('Ingrese la edad de la segunda persona: '))
e3 = int(input('Ingrese la edad de la tercera persona: '))
p = (e1 + e2 + e3) /... |
""" Asked by: Google [Medium].
On our special chessboard, two bishops attack each other if they share the same diagonal.
This includes bishops that have another bishop located between them, i.e. bishops can attack through pieces.
You are given N bishops, represented as (row, column) tuples on a M by M chessboard.
W... | """ Asked by: Google [Medium].
On our special chessboard, two bishops attack each other if they share the same diagonal.
This includes bishops that have another bishop located between them, i.e. bishops can attack through pieces.
You are given N bishops, represented as (row, column) tuples on a M by M chessboard.
W... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.