content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Enter your code for "camelCase" here.
def to_camel(ident):
def a(x):
return x
def b(x):
return x[0].upper() + x[1::]
def c():
yield a
while True:
yield b
d = c()
return "".join(d.__next__()(x) for x in ident.split("_"))
| def to_camel(ident):
def a(x):
return x
def b(x):
return x[0].upper() + x[1:]
def c():
yield a
while True:
yield b
d = c()
return ''.join((d.__next__()(x) for x in ident.split('_'))) |
# Write a program that asks the user to input any positive integer
# and outputs the successive values of the following calculation.
# At each step calculate the next value by taking the current value and,
# if it is even, divide it by two, but if it is odd, multiply it by three and add one.
# Have the program end if t... | x = int(input('Enter a positive integer and see what happens: '))
print(x)
while True:
if x % 2 == 0:
x = x // 2
print(x)
else:
x = x * 3 + 1
print(x)
if x == 1:
break |
class ModelPermissionsMixin(object):
"""
Defines the permissions methods that most models need,
:raises NotImplementedError: if they have not been overridden.
"""
@classmethod
def can_create(cls, user_obj):
"""
CreateView needs permissions at class (table) level.
We'll... | class Modelpermissionsmixin(object):
"""
Defines the permissions methods that most models need,
:raises NotImplementedError: if they have not been overridden.
"""
@classmethod
def can_create(cls, user_obj):
"""
CreateView needs permissions at class (table) level.
We'll ... |
class BatmanQuotes(object):
@staticmethod
def get_quote(quotes, hero):
index = int(sorted(hero)[0])
return {'B':'Batman: ','R':'Robin: ','J':'Joker: '}[hero[0]] + quotes[index]
| class Batmanquotes(object):
@staticmethod
def get_quote(quotes, hero):
index = int(sorted(hero)[0])
return {'B': 'Batman: ', 'R': 'Robin: ', 'J': 'Joker: '}[hero[0]] + quotes[index] |
class Node:
starting = True
ending = False
name = ""
weight = [1, 20]
active = True
edge_length = 0
nodes = []
def __init__(self, name, grid, posX, posY, active):
self.name = name # Name of the node
self.grid = grid # Which grid the node will be placed
self.posX = posX # Position X on the grid
s... | class Node:
starting = True
ending = False
name = ''
weight = [1, 20]
active = True
edge_length = 0
nodes = []
def __init__(self, name, grid, posX, posY, active):
self.name = name
self.grid = grid
self.posX = posX
self.posY = posY
self.active = ac... |
#!/usr/bin/env python3
dna = "ATGCAGGGGAAACATGATTCAGGAC"
#Make all lowercase
lowerDNA = dna.lower()
#Replace the complementary ones
complA = lowerDNA.replace('a','T')
complAT = complA.replace('t','A')
complATG = complAT.replace('g','C')
complATGC = complATG.replace('c','G')
#reverse the complement
revDNA = complATG... | dna = 'ATGCAGGGGAAACATGATTCAGGAC'
lower_dna = dna.lower()
compl_a = lowerDNA.replace('a', 'T')
compl_at = complA.replace('t', 'A')
compl_atg = complAT.replace('g', 'C')
compl_atgc = complATG.replace('c', 'G')
rev_dna = complATGC[::-1]
print("Original Sequence\t5'", dna, "5'")
print("Complement\t\t3'", complATGC, "5'")
... |
# with open("ReadMe.txt",'r') as file:
# print(file.read()) # Hello from Python 201
# # Running after adding the second line to the .txt file
# with open("ReadMe.txt",'r') as file:
# print(file.read()) # Hello from Python 201
# # This is a new line
# # Running after adding the se... | with open('ReadMe.txt', 'r') as file:
content = file.read()
print('The content is', content) |
OCTICON_LAW = """
<svg class="octicon octicon-law" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8.75.75a.75.75 0 00-1.5 0V2h-.984c-.305 0-.604.08-.869.23l-1.288.737A.25.25 0 013.984 3H1.75a.75.75 0 000 1.5h.428L.066 9.192a.75.75 0 00.154.838l.53-.53-.53.53... | octicon_law = '\n<svg class="octicon octicon-law" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8.75.75a.75.75 0 00-1.5 0V2h-.984c-.305 0-.604.08-.869.23l-1.288.737A.25.25 0 013.984 3H1.75a.75.75 0 000 1.5h.428L.066 9.192a.75.75 0 00.154.838l.53-.53-.53.53v.... |
__all__ = ['__author__', '__license__', '__version__', '__credits__', '__maintainer__']
__author__ = 'Henrik Nyman'
__license__ = 'MIT'
__version__ = '0.1'
__credits__ = ['Henrik Nyman']
__maintainer__ = 'Henrik Nyman'
| __all__ = ['__author__', '__license__', '__version__', '__credits__', '__maintainer__']
__author__ = 'Henrik Nyman'
__license__ = 'MIT'
__version__ = '0.1'
__credits__ = ['Henrik Nyman']
__maintainer__ = 'Henrik Nyman' |
def projectData(X, U, K):
"""computes the projection of
the normalized inputs X into the reduced dimensional space spanned by
the first K columns of U. It returns the projected examples in Z.
"""
# ====================== YOUR CODE HERE ======================
# Instructions: Compute the projecti... | def project_data(X, U, K):
"""computes the projection of
the normalized inputs X into the reduced dimensional space spanned by
the first K columns of U. It returns the projected examples in Z.
"""
return Z |
def ssort(array):
for i in range(len(array)):
indxMin = i
for j in range(i+1, len(array)):
if array[j] < array[indxMin]:
indxMin = j
tmp = array[indxMin]
array[indxMin] = array[i]
array[i] = tmp
return array
| def ssort(array):
for i in range(len(array)):
indx_min = i
for j in range(i + 1, len(array)):
if array[j] < array[indxMin]:
indx_min = j
tmp = array[indxMin]
array[indxMin] = array[i]
array[i] = tmp
return array |
depl_user = 'darulez'
depl_group = 'docker'
# defaults file for ansible-docker-apps-generator
assembly_path = 'apps-assembly'
apps_path = './apps-universe'
stacks_path = './stacks-universe'
default_docker_network = 'hoa_network'
docker_main_sections = ['docker_from', 'docker_init', 'docker_reqs', 'docker_core', 'docker... | depl_user = 'darulez'
depl_group = 'docker'
assembly_path = 'apps-assembly'
apps_path = './apps-universe'
stacks_path = './stacks-universe'
default_docker_network = 'hoa_network'
docker_main_sections = ['docker_from', 'docker_init', 'docker_reqs', 'docker_core', 'docker_post'] |
class Solution:
def widthOfBinaryTree(self, root):
"""
:type root: TreeNode
:rtype: int
"""
# bfs
# corner case
if root is None:
return 0
queue = list()
queue.append((root, 0))
level = 1
while len(queue) > 0:
... | class Solution:
def width_of_binary_tree(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if root is None:
return 0
queue = list()
queue.append((root, 0))
level = 1
while len(queue) > 0:
length = len(queue)
... |
class TrieNode(object):
__slots__ = ('children', 'isWord')
def __init__(self):
self.children = {}
self.isWord = False
class Trie(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = TrieNode()
def insert(self, word):
"""
Inserts a word into the trie.
:type word:... | class Trienode(object):
__slots__ = ('children', 'isWord')
def __init__(self):
self.children = {}
self.isWord = False
class Trie(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = trie_node()
def insert(self, word):
"""
... |
class FastLabelException(Exception):
def __init__(self, message, errcode):
super(FastLabelException, self).__init__(
"<Response [{}]> {}".format(errcode, message)
)
self.code = errcode
class FastLabelInvalidException(FastLabelException, ValueError):
pass
| class Fastlabelexception(Exception):
def __init__(self, message, errcode):
super(FastLabelException, self).__init__('<Response [{}]> {}'.format(errcode, message))
self.code = errcode
class Fastlabelinvalidexception(FastLabelException, ValueError):
pass |
'''ALUMNA: HUAMANI TACOMA ANDY
EJERCICIO : PAINT DASH GRIDS-DFS-RECURSIVE'''
# DESCRIPCION: IMPLEMENTACION DE DFS-RECURSIVE PARA PINTAR LOS DASH GRIDS DE UNA MATRIZ
def dfs_recursive(matrix, startX, startY, simbVisited, simbPared):
# TABLERO, POSICION INICIALX, POSICION INICIALY, SIMBOLO VISITADO, SIMBOLO PA... | """ALUMNA: HUAMANI TACOMA ANDY
EJERCICIO : PAINT DASH GRIDS-DFS-RECURSIVE"""
def dfs_recursive(matrix, startX, startY, simbVisited, simbPared):
try:
if matrix[startX][startY] != simbPared:
matrix[startX][startY] = simbVisited
else:
print('es pared, no se pude pintar')
... |
__all__ = ["PACK_HEADER_MAX"]
# max scanned length of packet header
PACK_HEADER_MAX = 60
| __all__ = ['PACK_HEADER_MAX']
pack_header_max = 60 |
'''We sort a large sublist of a given list and go on reducing the size of the list until all elements are sorted.'''
def shellSort(input_list):
mid = len(input_list) // 2
while mid > 0:
for i in range(mid, len(input_list)):
temp = input_list[i]
j = i
# Sort t... | """We sort a large sublist of a given list and go on reducing the size of the list until all elements are sorted."""
def shell_sort(input_list):
mid = len(input_list) // 2
while mid > 0:
for i in range(mid, len(input_list)):
temp = input_list[i]
j = i
while j >= mid ... |
"""
PASSENGERS
"""
numPassengers = 2341
passenger_arriving = (
(3, 12, 4, 1, 1, 0, 2, 7, 5, 7, 0, 0), # 0
(4, 12, 2, 2, 4, 0, 2, 5, 3, 3, 2, 0), # 1
(3, 2, 3, 2, 2, 0, 6, 7, 5, 5, 2, 0), # 2
(1, 10, 4, 2, 1, 0, 6, 5, 1, 4, 1, 0), # 3
(3, 3, 2, 5, 4, 0, 9, 6, 7, 3, 5, 0), # 4
(5, 7, 4, 2, 3, 0, 5, 7, 4, 5,... | """
PASSENGERS
"""
num_passengers = 2341
passenger_arriving = ((3, 12, 4, 1, 1, 0, 2, 7, 5, 7, 0, 0), (4, 12, 2, 2, 4, 0, 2, 5, 3, 3, 2, 0), (3, 2, 3, 2, 2, 0, 6, 7, 5, 5, 2, 0), (1, 10, 4, 2, 1, 0, 6, 5, 1, 4, 1, 0), (3, 3, 2, 5, 4, 0, 9, 6, 7, 3, 5, 0), (5, 7, 4, 2, 3, 0, 5, 7, 4, 5, 0, 0), (2, 9, 4, 1, 2, 0, 7, 5, 5... |
"""
Project Euler Problem 12: Highly divisible triangular number
"""
# What is the value of the first triangle number to have over five hundred divisors?
# A simple solution is to not worry about generating primes, and just test odd numbers for divisors
# Since we have to test a lot of numbers, it probably is worth g... | """
Project Euler Problem 12: Highly divisible triangular number
"""
start = 1
number_divisors = 0
i = 0
while number_divisors < 500:
i += 1
powers = []
tri_number = (START + i) * (START + i + 1) / 2
power = 0
while tri_number % 2 == 0:
power += 1
tri_number /= 2
if power > 0:
... |
#
"""Make a function map that works the same way as the built-in map function:"""
def square(n):
return n * n
def map(square, list1):
return [ square(num) for num in list1 ] | """Make a function map that works the same way as the built-in map function:"""
def square(n):
return n * n
def map(square, list1):
return [square(num) for num in list1] |
class Solution:
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
def check(s, t):
word_map = {}
for i, v in enumerate(s):
tmp = word_map.get(t[i])
if tmp is None:
w... | class Solution:
def is_isomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
def check(s, t):
word_map = {}
for (i, v) in enumerate(s):
tmp = word_map.get(t[i])
if tmp is None:
... |
# -*- coding: utf-8 -*-
# see LICENSE.rst
# ----------------------------------------------------------------------------
#
# TITLE : data
# PROJECT : astronat
#
# ----------------------------------------------------------------------------
"""Data Management.
Often data is packaged poorly and it can be difficult t... | """Data Management.
Often data is packaged poorly and it can be difficult to understand how
the data should be read.
DON`T PANIC.
This module provides functions to read the contained data.
Routine Listings
----------------
read_constants
__all_constants__
"""
__author__ = 'Nathaniel Starkman'
__all__ = ['read_consta... |
#Esta es la respuesta del control
def sumarLista(lista, largo):
if (largo == 0):
return 0
else:
return lista[largo - 1] + sumarLista(lista, largo - 1)
def Desglosar(numero:int,lista=[]):
def rev(l):
if len(l) == 0: return []
return [l[-1]] + rev(l[:-1])
if numero==0:
... | def sumar_lista(lista, largo):
if largo == 0:
return 0
else:
return lista[largo - 1] + sumar_lista(lista, largo - 1)
def desglosar(numero: int, lista=[]):
def rev(l):
if len(l) == 0:
return []
return [l[-1]] + rev(l[:-1])
if numero == 0:
reversa = re... |
# Utility functions for incrementing counts in dictionaries or appending to a list of values
def add_to_dict_num(D, k, v=1):
if k in D:
D[k] += v
else:
D[k] = v
def add_to_dict_list(D, k, v):
if k in D:
D[k].append(v)
else:
D[k] = [v]
def report(min_verbosity, *args):
... | def add_to_dict_num(D, k, v=1):
if k in D:
D[k] += v
else:
D[k] = v
def add_to_dict_list(D, k, v):
if k in D:
D[k].append(v)
else:
D[k] = [v]
def report(min_verbosity, *args):
if report.verbosity >= min_verbosity:
print(f'[{report.context}]', *args) |
'''
Created on Mar 19, 2022
@author: mballance
'''
class ActivityBlockMetaT(type):
def __init__(self, name, bases, dct):
pass
def __enter__(self):
print("ActivityBlockMetaT.__enter__")
def __exit__(self, t, v, tb):
pass
| """
Created on Mar 19, 2022
@author: mballance
"""
class Activityblockmetat(type):
def __init__(self, name, bases, dct):
pass
def __enter__(self):
print('ActivityBlockMetaT.__enter__')
def __exit__(self, t, v, tb):
pass |
# -*- coding:utf-8 -*-
class Solution:
def LeftRotateString(self, s, n):
# write code here
if len(s)==0:
return s
s = list(s)
def flip(s,start,end):
for i in range(start,(start+end)//2 + 1):
s[i],s[end-i+start] = s[end - i+start],s[i]
... | class Solution:
def left_rotate_string(self, s, n):
if len(s) == 0:
return s
s = list(s)
def flip(s, start, end):
for i in range(start, (start + end) // 2 + 1):
(s[i], s[end - i + start]) = (s[end - i + start], s[i])
return s
n %=... |
'''
question link- https://leetcode.com/problems/sum-of-all-subset-xor-totals/
Sum of All Subset XOR Totals
Question statement:
The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty.
For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1.
'''
def subse... | """
question link- https://leetcode.com/problems/sum-of-all-subset-xor-totals/
Sum of All Subset XOR Totals
Question statement:
The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty.
For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1.
"""
def subse... |
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
ans = [1]*n
for i in range(1,m):
for j in range(1,n):
ans[j] = ans[j-1] + ans[j]
return ans[-1] if m and n else 0 | class Solution:
def unique_paths(self, m: int, n: int) -> int:
ans = [1] * n
for i in range(1, m):
for j in range(1, n):
ans[j] = ans[j - 1] + ans[j]
return ans[-1] if m and n else 0 |
'''
Write a Python program to compute the sum of all items of a
given array of integers where each integer is multiplied by its
index. Return 0 if there is no number.
Sample Input:
[1,2,3,4]
[-1,-2,-3,-4]
[]
Sample Output:
20
-20
0
'''
def sum_index_multiplier(nums):
# use enumerate to return count and value
... | """
Write a Python program to compute the sum of all items of a
given array of integers where each integer is multiplied by its
index. Return 0 if there is no number.
Sample Input:
[1,2,3,4]
[-1,-2,-3,-4]
[]
Sample Output:
20
-20
0
"""
def sum_index_multiplier(nums):
return sum((j * i for (i, j) in enumerate(nums)... |
class Node:
def __init__(self, data=None):
self.data = data
self.left = None
self.right = None
class BinaryTree:
def __init__(self, root):
self.root = Node(root)
def display(self, start, traversal=""):
if start != None:
traversal += (str(... | class Node:
def __init__(self, data=None):
self.data = data
self.left = None
self.right = None
class Binarytree:
def __init__(self, root):
self.root = node(root)
def display(self, start, traversal=''):
if start != None:
traversal += str(start.data) + '... |
class Solution:
def expandFromMiddle(self, s:str, l:int, r:int):
while (l >= 0 and r < len(s) and s[l] == s[r]):
l -= 1
r += 1
return (r - l - 1)
def longestPalindrome(self, s: str) -> str:
if len(s) < 1: return 0
start = 0
end = 0
... | class Solution:
def expand_from_middle(self, s: str, l: int, r: int):
while l >= 0 and r < len(s) and (s[l] == s[r]):
l -= 1
r += 1
return r - l - 1
def longest_palindrome(self, s: str) -> str:
if len(s) < 1:
return 0
start = 0
end = ... |
class Paddle():
def __init__(self, x1, x2 , y1, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
#private method
def __setPaddleRight(self):
self.x1 = 4
self.x2 = 4
self.y1 = 0
self.y2 = 1
display.set_pixel(self.x1, self.y1, 9)... | class Paddle:
def __init__(self, x1, x2, y1, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
def __set_paddle_right(self):
self.x1 = 4
self.x2 = 4
self.y1 = 0
self.y2 = 1
display.set_pixel(self.x1, self.y1, 9)
display.set... |
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
minBuy = 999999 # probably should use sys.maxint
maxProfits = 0
for i in xrange(len(prices)):
minBuy = min(minBuy, prices[i])
maxP... | class Solution(object):
def max_profit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
min_buy = 999999
max_profits = 0
for i in xrange(len(prices)):
min_buy = min(minBuy, prices[i])
max_profits = max(maxProfits, prices[i] -... |
class Enum(set):
def __getattr__(self, name):
if name in self:
return name
raise AttributeError
def log(message, log_class, log_level):
"""Log information to the console.
If you are angry about having to use Enums instead of typing the classes and levels in, look up how any logg... | class Enum(set):
def __getattr__(self, name):
if name in self:
return name
raise AttributeError
def log(message, log_class, log_level):
"""Log information to the console.
If you are angry about having to use Enums instead of typing the classes and levels in, look up how any log... |
class Solution:
def findContestMatch(self, n):
"""
:type n: int
:rtype: str
"""
ans = list(range(1, n + 1))
while len(ans) > 1:
ans = ["({},{})".format(ans[i], ans[~i]) for i in range(len(ans) // 2)]
return ans[0] | class Solution:
def find_contest_match(self, n):
"""
:type n: int
:rtype: str
"""
ans = list(range(1, n + 1))
while len(ans) > 1:
ans = ['({},{})'.format(ans[i], ans[~i]) for i in range(len(ans) // 2)]
return ans[0] |
N, C, S, *l = map(int, open(0).read().split())
c = 0
S -= 1
ans = 0
for i in l:
ans += c == S
c = (c+i+N)%N
ans += c == S
print(ans) | (n, c, s, *l) = map(int, open(0).read().split())
c = 0
s -= 1
ans = 0
for i in l:
ans += c == S
c = (c + i + N) % N
ans += c == S
print(ans) |
"""Question: https://leetcode.com/problems/palindrome-number/
"""
class Solution:
def isPalindrome(self, x: int) -> bool:
if x < 0:
return False
copy, reverse = x, 0
while copy:
reverse *= 10
reverse += copy % 10
copy = copy // 10
... | """Question: https://leetcode.com/problems/palindrome-number/
"""
class Solution:
def is_palindrome(self, x: int) -> bool:
if x < 0:
return False
(copy, reverse) = (x, 0)
while copy:
reverse *= 10
reverse += copy % 10
copy = copy // 10
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Sandip Dutta
"""
# To implement simple tree algorithms
# DFS on Binary Tree,
# Problem Stateent : sum of all leaf nodes
#number of nodes of tree
n = 10
'''we take starting node to be 0th node'''
''' tree is a directed graph here'''
tree = [[1, 2],#0
... | """
@author: Sandip Dutta
"""
n = 10
'we take starting node to be 0th node'
' tree is a directed graph here'
tree = [[1, 2], [3, 5], [7, 8], [4], [], [6], [], [], [9], []]
visited = [False] * n
def is_leaf_node(neighbour):
"""checks if leaf node or not"""
return not tree[neighbour]
def sum_of_leaf_nodes():
... |
def mensagem(cor='', msg='', firula='', tamanho=0):
if '\n' in msg:
linha = msg.find('\n')
else:
linha = len(msg)
limpa = '\033[m'
if tamanho == 0:
tamanho = firula * (linha + 4)
if firula == '':
print(f'{cor} {msg} {limpa}')
else:
print(f'{cor}{tamanho}... | def mensagem(cor='', msg='', firula='', tamanho=0):
if '\n' in msg:
linha = msg.find('\n')
else:
linha = len(msg)
limpa = '\x1b[m'
if tamanho == 0:
tamanho = firula * (linha + 4)
if firula == '':
print(f'{cor} {msg} {limpa}')
else:
print(f'{cor}{tamanho}... |
'''
Leetcode Problem number 687.
Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root.
The length of path between two nodes is represented by the number of edges between them.
'''
class Solution:
def longestUn... | """
Leetcode Problem number 687.
Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root.
The length of path between two nodes is represented by the number of edges between them.
"""
class Solution:
def longest_univ... |
class Except(Exception):
def __init__(*args, **kwargs):
Exception.__init__(*args, **kwargs)
def CheckExceptions(data):
raise Except(data)
| class Except(Exception):
def __init__(*args, **kwargs):
Exception.__init__(*args, **kwargs)
def check_exceptions(data):
raise except(data) |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 22 19:49:17 2020
@author: matth
"""
def _linprog_highs_doc(c, A_ub=None, b_ub=None, A_eq=None, b_eq=None,
bounds=None, method='highs', callback=None,
maxiter=None, disp=False, presolve=True,
time_limit... | """
Created on Sat Aug 22 19:49:17 2020
@author: matth
"""
def _linprog_highs_doc(c, A_ub=None, b_ub=None, A_eq=None, b_eq=None, bounds=None, method='highs', callback=None, maxiter=None, disp=False, presolve=True, time_limit=None, dual_feasibility_tolerance=None, primal_feasibility_tolerance=None, ipm_optimality_tole... |
"""Devstack environment variables unique to the instructor plugin."""
def plugin_settings(settings):
"""Settings for the instructor plugin."""
# Set this to the dashboard URL in order to display the link from the
# dashboard to the Analytics Dashboard.
settings.ANALYTICS_DASHBOARD_URL = None
| """Devstack environment variables unique to the instructor plugin."""
def plugin_settings(settings):
"""Settings for the instructor plugin."""
settings.ANALYTICS_DASHBOARD_URL = None |
__version__ = '0.54'
class LandDegradationError(Exception):
"""Base class for exceptions in this module."""
def __init__(self, msg=None):
if msg is None:
msg = "An error occurred in the landdegradation module"
super(LandDegradationError, self).__init__(msg)
class GEEError(LandDe... | __version__ = '0.54'
class Landdegradationerror(Exception):
"""Base class for exceptions in this module."""
def __init__(self, msg=None):
if msg is None:
msg = 'An error occurred in the landdegradation module'
super(LandDegradationError, self).__init__(msg)
class Geeerror(LandDegr... |
del_items(0x80145350)
SetType(0x80145350, "void _cd_seek(int sec)")
del_items(0x801453BC)
SetType(0x801453BC, "void init_cdstream(int chunksize, unsigned char *buf, int bufsize)")
del_items(0x801453E4)
SetType(0x801453E4, "void flush_cdstream()")
del_items(0x80145438)
SetType(0x80145438, "void reset_cdstream()")
del_it... | del_items(2148815696)
set_type(2148815696, 'void _cd_seek(int sec)')
del_items(2148815804)
set_type(2148815804, 'void init_cdstream(int chunksize, unsigned char *buf, int bufsize)')
del_items(2148815844)
set_type(2148815844, 'void flush_cdstream()')
del_items(2148815928)
set_type(2148815928, 'void reset_cdstream()')
de... |
# Sets an error rate of %0.025 (1 in 4,000) with a capacity of 5MM items.
# See https://hur.st/bloomfilter/?n=5000000&p=0.00025&m=& for more information
# 5MM was chosen for being a whole number roughly 2x the size of our most dense sparse plugin output in late July 2020.
DEFAULT_ERROR_RATE = 0.00025
DEFAULT_CAPACITY ... | default_error_rate = 0.00025
default_capacity = 5000000
key_prefix = 'fwan_dataset_bf:'
exclusions = ['augeas', 'file_hashes', 'file_tree', 'file_type', 'unpack_report', 'unpack_failed', 'printable_strings']
exclusion_prefixes = ['firmware_cpes', 'sbom', 'similarity_hash'] |
fp = open("./packet.csv", "r")
vals = fp.readlines()
count = 1
pre_val = 0
current = 0
sampling_rate = 31
val_bins = []
for i in range(len(vals)):
pre_val = current
current = int(vals[i])
if current == pre_val:
count = count + 1
else:
count = 1
if count == sampling_rate:
... | fp = open('./packet.csv', 'r')
vals = fp.readlines()
count = 1
pre_val = 0
current = 0
sampling_rate = 31
val_bins = []
for i in range(len(vals)):
pre_val = current
current = int(vals[i])
if current == pre_val:
count = count + 1
else:
count = 1
if count == sampling_rate:
val_... |
'''
Specifies the username and password required to log into the iNaturalist website.
These variables are imported into the 'inaturalist_scraper.py' script
'''
username = 'your_iNaturalist_username_here'
password = 'your_iNaturalist_password_here' | """
Specifies the username and password required to log into the iNaturalist website.
These variables are imported into the 'inaturalist_scraper.py' script
"""
username = 'your_iNaturalist_username_here'
password = 'your_iNaturalist_password_here' |
FRONT_LEFT_WHEEL_TOPIC = "/capo_front_left_wheel_controller/command"
FRONT_RIGHT_WHEEL_TOPIC = "/capo_front_right_wheel_controller/command"
# BACK_RIGHT_WHEEL_TOPIC = "/capo_rear_left_wheel_controller/command",
# BACK_LEFT_WHEEL_TOPIC = "/capo_rear_right_wheel_controller/command"
HEAD_JOINT_TOPIC = "/capo_head_rotatio... | front_left_wheel_topic = '/capo_front_left_wheel_controller/command'
front_right_wheel_topic = '/capo_front_right_wheel_controller/command'
head_joint_topic = '/capo_head_rotation_controller/command'
capo_joint_states = '/joint_states'
topnav_feedback_topic = '/topnav/feedback'
topnav_guidelines_topic = 'topnav/guideli... |
class BasicEnvironment:
"""Object to pass containing data used for solve. Individuals are mapped
to this data upon evaluation. Environments also hold additional evaluation
data."""
def __init__(self, df, _dict=None):
self.df = df
self._dict = _dict
| class Basicenvironment:
"""Object to pass containing data used for solve. Individuals are mapped
to this data upon evaluation. Environments also hold additional evaluation
data."""
def __init__(self, df, _dict=None):
self.df = df
self._dict = _dict |
# -*- coding:utf-8 -*-
pizzas = ['fruit', 'buff', 'milk', 'zhishi', 'little']
# for pizza in pizzas:
# print(pizza)
# print(pizza.title() + ", I like eat !")
# print("I like eat pizza!")
pizzas_bak = pizzas[:]
pizzas.append('chicken')
pizzas_bak.append('dog')
print(pizzas_bak)
print(pizzas) | pizzas = ['fruit', 'buff', 'milk', 'zhishi', 'little']
pizzas_bak = pizzas[:]
pizzas.append('chicken')
pizzas_bak.append('dog')
print(pizzas_bak)
print(pizzas) |
class Solution:
def reformatDate(self, date: str) -> str:
pattern = re.compile(r'[0-9]+')
dateList=date.split(' ')
day=pattern.findall(dateList[0])[0]
monthList=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
month=monthList.index(da... | class Solution:
def reformat_date(self, date: str) -> str:
pattern = re.compile('[0-9]+')
date_list = date.split(' ')
day = pattern.findall(dateList[0])[0]
month_list = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
month = monthList.ind... |
inp = open('input_d24.txt').read().strip().split('\n')
graph = dict()
n = 0
yn = len(inp)
xn = len(inp[0])
poss = '01234567'
def find_n(ton):
for y in range(len(inp)):
for x in range(len(inp[y])):
if inp[y][x] == str(ton):
return (x,y)
def exists(n, found):
for ele in lis... | inp = open('input_d24.txt').read().strip().split('\n')
graph = dict()
n = 0
yn = len(inp)
xn = len(inp[0])
poss = '01234567'
def find_n(ton):
for y in range(len(inp)):
for x in range(len(inp[y])):
if inp[y][x] == str(ton):
return (x, y)
def exists(n, found):
for ele in list... |
array = []
for i in range (16):
# array.append([i,0])
array.append([i,5])
print(array) | array = []
for i in range(16):
array.append([i, 5])
print(array) |
#
# PySNMP MIB module Juniper-PPPOE-PROFILE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-PPPOE-PROFILE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:03:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ... |
class Solution(object):
def isValidSudoku(self, board):
return (self.is_row_valid(board) and
self.is_col_valid(board) and
self.is_square_valid(board))
def is_row_valid(self, board):
for row in board:
if not self.is_unit_valid(row):
... | class Solution(object):
def is_valid_sudoku(self, board):
return self.is_row_valid(board) and self.is_col_valid(board) and self.is_square_valid(board)
def is_row_valid(self, board):
for row in board:
if not self.is_unit_valid(row):
return False
return True
... |
n = int(input())
D = [list(map(int,input().split())) for i in range(n)]
D.sort(key = lambda t: t[0])
S = 0
for i in D:
S += i[1]
S = (S+1)//2
S2 = 0
for i in D:
S2 += i[1]
if S2 >= S:
print(i[0])
break | n = int(input())
d = [list(map(int, input().split())) for i in range(n)]
D.sort(key=lambda t: t[0])
s = 0
for i in D:
s += i[1]
s = (S + 1) // 2
s2 = 0
for i in D:
s2 += i[1]
if S2 >= S:
print(i[0])
break |
#!/usr/local/bin/python3
# Copyright 2019 NineFx Inc.
# Justin Baum
# 20 May 2019
# Precis Code-Generator ReasonML
# https://github.com/NineFX/smeagol/blob/master/spec/code_gen/precis_cp.txt
fp = open('unicodedata.txt', 'r')
ranges = []
line = fp.readline()
prev = ""
start = 0
while line:
if len(line) < 2: break... | fp = open('unicodedata.txt', 'r')
ranges = []
line = fp.readline()
prev = ''
start = 0
while line:
if len(line) < 2:
break
linesplit = line.split(';')
if ', First' in line:
nextline = fp.readline().split(';')
start = int(linesplit[0], 16)
finish = int(nextline[0], 16)
... |
# Public Attributes
class Employee:
def __init__(self, ID, salary):
# all properties are public
self.ID = ID
self.salary = salary
def displayID(self):
print("ID:", self.ID)
Steve = Employee(3789, 2500)
Steve.displayID()
print(Steve.salary) | class Employee:
def __init__(self, ID, salary):
self.ID = ID
self.salary = salary
def display_id(self):
print('ID:', self.ID)
steve = employee(3789, 2500)
Steve.displayID()
print(Steve.salary) |
m: int; n: int; j: int; i: int
m = int(input("Quantas linhas vai ter cada matriz? "))
n = int(input("Quantas colunas vai ter cada matriz? "))
A: [[int]] = [[0 for x in range(n)] for x in range(m)]
B: [[int]] = [[0 for x in range(n)] for x in range(m)]
C: [[int]] = [[0 for x in range(n)] for x in range(m)]
print("Dig... | m: int
n: int
j: int
i: int
m = int(input('Quantas linhas vai ter cada matriz? '))
n = int(input('Quantas colunas vai ter cada matriz? '))
a: [[int]] = [[0 for x in range(n)] for x in range(m)]
b: [[int]] = [[0 for x in range(n)] for x in range(m)]
c: [[int]] = [[0 for x in range(n)] for x in range(m)]
print('Digite os... |
# class Tree:
# def __init__(self, val, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def solve(self, root):
stack = []
stack.append(root)
level = -1
min_sum = float('inf')
l = 0
... | class Solution:
def solve(self, root):
stack = []
stack.append(root)
level = -1
min_sum = float('inf')
l = 0
while stack:
new = []
s = 0
for node in stack:
if node.left:
new.append(node.left)
... |
"""
1. Clarification
2. Possible solutions
- Backtracking
3. Coding
4. Tests
"""
# T=O(sum(feasible solutions' len)), S=O(target)
class Solution:
def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:
if not candidates or target < 1: return []
ans, tmp = [], []
... | """
1. Clarification
2. Possible solutions
- Backtracking
3. Coding
4. Tests
"""
class Solution:
def combination_sum(self, candidates: List[int], target: int) -> List[List[int]]:
if not candidates or target < 1:
return []
(ans, tmp) = ([], [])
def backtrack(idx, Sum):
... |
def ack ( m, n ):
'''
ack: Evaluates Ackermann function with the given arguments
m: Positive integer value
n: Positive integer value
'''
# Guard against error from incorrect input
if n < 0 or (not isinstance(n, int)):
return "Error: n is either negative or not an integer"
if... | def ack(m, n):
"""
ack: Evaluates Ackermann function with the given arguments
m: Positive integer value
n: Positive integer value
"""
if n < 0 or not isinstance(n, int):
return 'Error: n is either negative or not an integer'
if m < 0 or not isinstance(m, int):
return 'Er... |
# Copyright (c) 2021 Ben Maddison. All rights reserved.
#
"""aspa.as_path Module."""
AS_SEQUENCE = 0x0
AS_SET = 0x1
class AsPathSegment(object):
def __init__(self, segment_type, values):
if segment_type not in (AS_SEQUENCE, AS_SET):
raise ValueError(int)
self.type = segment_type
... | """aspa.as_path Module."""
as_sequence = 0
as_set = 1
class Aspathsegment(object):
def __init__(self, segment_type, values):
if segment_type not in (AS_SEQUENCE, AS_SET):
raise value_error(int)
self.type = segment_type
self.values = values
def __repr__(self):
value... |
def love():
lover = 'sure'
lover
| def love():
lover = 'sure'
lover |
""" Parses a Markdown file in the Task.md format.
:params doc:
:returns: a dictionary containing the main fields of the task.
"""
def remove_obsidian_syntax(string):
"Removes Obsidian syntax from a string, namely []'s, [[]]'s and #'s"
pass
def parse_md(filename):
"Parses a markdown file in the Ta... | """ Parses a Markdown file in the Task.md format.
:params doc:
:returns: a dictionary containing the main fields of the task.
"""
def remove_obsidian_syntax(string):
"""Removes Obsidian syntax from a string, namely []'s, [[]]'s and #'s"""
pass
def parse_md(filename):
"""Parses a markdown file in ... |
#
class OtsUtil(object):
STEP_THRESHOLD = 408
step = 0
@staticmethod
def log(msg):
if OtsUtil.step >= OtsUtil.STEP_THRESHOLD:
print(msg) | class Otsutil(object):
step_threshold = 408
step = 0
@staticmethod
def log(msg):
if OtsUtil.step >= OtsUtil.STEP_THRESHOLD:
print(msg) |
#Program to Remove Punctuations From a String
string="Wow! What a beautiful nature!"
new_string=string.replace("!","")
print(new_string)
| string = 'Wow! What a beautiful nature!'
new_string = string.replace('!', '')
print(new_string) |
def condensate_to_gas_equivalence(api, stb):
"Derivation from real gas equation"
Tsc = 519.57 # standard temp in Rankine
psc = 14.7 # standard pressure in psi
R = 10.732
rho_w = 350.16 # water density in lbm/STB
so = 141.5 / (api + 131.5) # so: specific gravity of oil (dimensionless)
Mo = 5854 / (api - 8... | def condensate_to_gas_equivalence(api, stb):
"""Derivation from real gas equation"""
tsc = 519.57
psc = 14.7
r = 10.732
rho_w = 350.16
so = 141.5 / (api + 131.5)
mo = 5854 / (api - 8.811)
n = rho_w * so / Mo
v1stb = n * R * Tsc / psc
v = V1stb * stb
return V
def general_equi... |
def fibonacci():
number = 0
previous_number = 1
while True:
if number == 0:
yield number
number += previous_number
if number == 1:
yield number
number += previous_number
if number == 2:
yield previous_number
if numbe... | def fibonacci():
number = 0
previous_number = 1
while True:
if number == 0:
yield number
number += previous_number
if number == 1:
yield number
number += previous_number
if number == 2:
yield previous_number
if numbe... |
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __repr__(self):
return str(self.data)
def count_unival_trees(root):
if not root:
return 0
elif not root.left and not root.right:
return 1
elif not root.... | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __repr__(self):
return str(self.data)
def count_unival_trees(root):
if not root:
return 0
elif not root.left and (not root.right):
return 1
elif not root.l... |
"""
A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses
strings, and + represents string concatenation. For example, "", "()", "(())()", and "(()(()))" are all valid
parentheses strings.
A valid parentheses string S is primitive if it is nonempty, and there d... | """
A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses
strings, and + represents string concatenation. For example, "", "()", "(())()", and "(()(()))" are all valid
parentheses strings.
A valid parentheses string S is primitive if it is nonempty, and there d... |
# List Operations and Functions
# '+' Operator
print('-----------+ Operator------------')
a = [1,2,3]
b = [4,5,6]
c = a + b
print(c)
print('----------* Operator--------------')
# '*' Operator
a1 = a * 2
print(a1)
print('--------len function----------------')
print(len(a))
print('--------max function----------------')
... | print('-----------+ Operator------------')
a = [1, 2, 3]
b = [4, 5, 6]
c = a + b
print(c)
print('----------* Operator--------------')
a1 = a * 2
print(a1)
print('--------len function----------------')
print(len(a))
print('--------max function----------------')
print(max(a))
print('--------min function----------------')... |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "9de928d7",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import csv\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "8f1478f8",
"metadata": {},
"outputs"... | {'cells': [{'cell_type': 'code', 'execution_count': 1, 'id': '9de928d7', 'metadata': {}, 'outputs': [], 'source': ['import os\n', 'import csv\n', 'import pandas as pd']}, {'cell_type': 'code', 'execution_count': 2, 'id': '8f1478f8', 'metadata': {}, 'outputs': [], 'source': ['#Set Path\n', "pollCSV = os.path.join('Resou... |
"""
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the
diagram below).
The robot can only move either down or right at any point in time. The robot is
trying to reach the bottom-right corner of the grid (marked 'Finish' in the
diagram below).
How many possible unique paths are there?
![... | """
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the
diagram below).
The robot can only move either down or right at any point in time. The robot is
trying to reach the bottom-right corner of the grid (marked 'Finish' in the
diagram below).
How many possible unique paths are there?
![... |
text = input().split(' ')
new_text = ''
for word in text:
if len(word) > 4:
if word[:2] in word[2:]:
word = word[2:]
new_text += ' ' + word
print(new_text[1:]) | text = input().split(' ')
new_text = ''
for word in text:
if len(word) > 4:
if word[:2] in word[2:]:
word = word[2:]
new_text += ' ' + word
print(new_text[1:]) |
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
if len(strs) == 0:
return ""
resLen = 0
while True:
if len(strs[0]) == resLen:
return strs[0]
curChar = strs[0][resLen]
for i in range(1, len(strs)):
... | class Solution:
def longest_common_prefix(self, strs: List[str]) -> str:
if len(strs) == 0:
return ''
res_len = 0
while True:
if len(strs[0]) == resLen:
return strs[0]
cur_char = strs[0][resLen]
for i in range(1, len(strs)):
... |
#!python3
# -*- coding:utf-8 -*-
'''
this code is a sample of code for learn how to use python test modules.
'''
def aaa():
'''
printing tree ! mark.
'''
print("!!!")
def bbb():
'''
printing tree chars.
'''
print("BBB")
def ccc():
'''
printing number with loop.
'... | """
this code is a sample of code for learn how to use python test modules.
"""
def aaa():
"""
printing tree ! mark.
"""
print('!!!')
def bbb():
"""
printing tree chars.
"""
print('BBB')
def ccc():
"""
printing number with loop.
"""
for i in range(5):
pr... |
# Project Framework default is 1 (Model/View/Provider)
# src is source where is the lib folder located
def startmain(src="flutterproject/myapp/lib", pkg="Provider", file="app_widget", home="",
project_framework=1, autoconfigfile=True):
maindart = open(src + "/main.dart", "w")
if project_f... | def startmain(src='flutterproject/myapp/lib', pkg='Provider', file='app_widget', home='', project_framework=1, autoconfigfile=True):
maindart = open(src + '/main.dart', 'w')
if project_framework == 1:
maindart.write("import 'package:flutter/material.dart';\nimport '" + pkg + '/' + file + ".dart';\n\nvoi... |
def max_consecutive_ones(x):
# e.g. x= 95 (1101111)
"""
Steps
1. x & x<<1 --> 1101111 & 1011110 == 1001110
2. x & x<<1 --> 1001110 & 0011100 == 0001100
3. x & x<<1 --> 0001100 & 0011000 == 0001000
4. x & x<<1 --> 0001000 & 0010000 == 0000000
:param x:
:return:
"""... | def max_consecutive_ones(x):
"""
Steps
1. x & x<<1 --> 1101111 & 1011110 == 1001110
2. x & x<<1 --> 1001110 & 0011100 == 0001100
3. x & x<<1 --> 0001100 & 0011000 == 0001000
4. x & x<<1 --> 0001000 & 0010000 == 0000000
:param x:
:return:
"""
count = 0
while x ... |
# Avg week temperature
print("Enter temperatures of 7 days:")
a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())
f = float(input())
g = float(input())
print("Average temperature:", (a+b+c+d+e+f+g)/7)
| print('Enter temperatures of 7 days:')
a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())
f = float(input())
g = float(input())
print('Average temperature:', (a + b + c + d + e + f + g) / 7) |
def digitSum(n,step):
res=0
while(n>0):
res+=n%10
n=n//10
step+=1
if(res<=9):
return (res,step)
else:
return digitSum(res,step)
t=int(input())
for _ in range(t):
minstep=[99999999 for i in range(10)] #cache
hitratio=[0 for i in range(10)]
maxhit=0
n,d=[int(x) for x in input().strip().split()]
if(n... | def digit_sum(n, step):
res = 0
while n > 0:
res += n % 10
n = n // 10
step += 1
if res <= 9:
return (res, step)
else:
return digit_sum(res, step)
t = int(input())
for _ in range(t):
minstep = [99999999 for i in range(10)]
hitratio = [0 for i in range(10)]
... |
######################################################
# #
# author #
# Parth Lathiya #
# https://www.cse.iitb.ac.in/~parthiitb/ #
# #
######################################################
at =... | at = int(input().strip())
for att in range(at):
u = list(map(int, input().strip().split()))
u.remove(len(u) - 1)
print(max(u)) |
# 15/15
num_of_flicks = int(input())
art = []
for _ in range(num_of_flicks):
coords = input().split(",")
art.append((int(coords[0]), int(coords[1])))
lowest_x = min(art, key=lambda x: x[0])[0] - 1
lowest_y = min(art, key=lambda x: x[1])[1] - 1
highest_x = max(art, key=lambda x: x[0])[0] + 1
highest_y = max... | num_of_flicks = int(input())
art = []
for _ in range(num_of_flicks):
coords = input().split(',')
art.append((int(coords[0]), int(coords[1])))
lowest_x = min(art, key=lambda x: x[0])[0] - 1
lowest_y = min(art, key=lambda x: x[1])[1] - 1
highest_x = max(art, key=lambda x: x[0])[0] + 1
highest_y = max(art, key=lam... |
print("Leap Year Range Calculator: ")
year1=int(input("Enter First Year: "))
year2 = int(input("Enter Last Year: "))
while year1<=year2:
if year1 % 4 == 0 :
print(year1,"is a leap year")
year1= year1 + 1
| print('Leap Year Range Calculator: ')
year1 = int(input('Enter First Year: '))
year2 = int(input('Enter Last Year: '))
while year1 <= year2:
if year1 % 4 == 0:
print(year1, 'is a leap year')
year1 = year1 + 1 |
I = lambda : int(input())
LI = lambda : [int(x) for x in input().split()]
MI = lambda : map(int, input().split())
SI = lambda : input()
"""
#Leer de archivo
for line in sys.stdin:
...
"""
"""
def fastio():
import sys
from io import StringIO
from atexit import register
global input
sys.stdin = ... | i = lambda : int(input())
li = lambda : [int(x) for x in input().split()]
mi = lambda : map(int, input().split())
si = lambda : input()
'\n#Leer de archivo\nfor line in sys.stdin:\n ...\n'
'\ndef fastio():\n import sys\n from io import StringIO\n from atexit import register\n global input\n sys.stdin ... |
"""
Generator with a finite loop
can be used with for
"""
def count():
n = 1
while n < 1000:
yield n
n *= 2
gen = count()
for number in gen:
print(number)
| """
Generator with a finite loop
can be used with for
"""
def count():
n = 1
while n < 1000:
yield n
n *= 2
gen = count()
for number in gen:
print(number) |
"""
Constants to be used in the module
"""
__author__ = 'Santiago Flores Kanter (sfloresk@cisco.com)'
QUERY_TARGET_CHILDREN = 'children'
QUERY_TARGET_SELF = 'self'
QUERY_TARGET_SUBTREE = 'subtree'
API_URL = 'api/'
MQ_API2_URL = 'mqapi2/' | """
Constants to be used in the module
"""
__author__ = 'Santiago Flores Kanter (sfloresk@cisco.com)'
query_target_children = 'children'
query_target_self = 'self'
query_target_subtree = 'subtree'
api_url = 'api/'
mq_api2_url = 'mqapi2/' |
#!/usr/bin/env python
"""
File: pentagon_p_solution-garid.py
Find the perimeter of pentagon.
"""
__author__ = "Ochirgarid Chinzorig (Ochirgarid)"
__version__ = "1.0"
# Open file on read mode
inp = open("../test/test1.txt", "r")
# read input lines one by one
# and convert them to integer
a = int(inp.readline... | """
File: pentagon_p_solution-garid.py
Find the perimeter of pentagon.
"""
__author__ = 'Ochirgarid Chinzorig (Ochirgarid)'
__version__ = '1.0'
inp = open('../test/test1.txt', 'r')
a = int(inp.readline().strip())
b = int(inp.readline().strip())
c = int(inp.readline().strip())
d = int(inp.readline().strip())
e =... |
#
# PySNMP MIB module MITEL-IPVIRTUAL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MITEL-IPVIRTUAL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:03:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (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) ... |
def Reverse(Dna):
tt = {
'A' : 'T',
'T' : 'A',
'G' : 'C',
'C' : 'G',
}
ans = ''
for a in Dna:
ans += tt[a]
return ans[::-1]
def main(infile, outfile):
# Read the input, but do something non-trivial instead of count the lines in the file
inp = lines =... | def reverse(Dna):
tt = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
ans = ''
for a in Dna:
ans += tt[a]
return ans[::-1]
def main(infile, outfile):
inp = lines = [line.rstrip('\n') for line in infile]
print(inp)
output = str(reverse(inp[0]))
print(output)
outfile.write(output) |
# configuracoes pessoais
PERSONAL_NAME = 'YOU'
# configuracoes de email
EMAIL = 'your gmail account'
PASSWORD = 'your gmail PASSWORD'
RECEIVER_EMAIL = 'email to forward the contact messages'
# configuracoes do Google ReCaptha
SECRET_KEY = "Google ReCaptha's Secret key"
SITE_KEY = "Google ReCaptha's Site key"
APP_SEC... | personal_name = 'YOU'
email = 'your gmail account'
password = 'your gmail PASSWORD'
receiver_email = 'email to forward the contact messages'
secret_key = "Google ReCaptha's Secret key"
site_key = "Google ReCaptha's Site key"
app_secret_key = '65#9DMN_T'
skills = [{'name': 'Quick learner', 'strength': '90%'}, {'name': '... |
"""Data set for text records.
A Dataset maintains the collection of data instances and metadata
associated with the dataset.
"""
class Dataset(object):
"""Data set for text records.
A Dataset maintains the collection of data instances and metadata
associated with the dataset.
Parameters
-------... | """Data set for text records.
A Dataset maintains the collection of data instances and metadata
associated with the dataset.
"""
class Dataset(object):
"""Data set for text records.
A Dataset maintains the collection of data instances and metadata
associated with the dataset.
Parameters
-------
... |
OCTICON_PAPER_AIRPLANE = """
<svg class="octicon octicon-paper-airplane" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M1.592 2.712L2.38 7.25h4.87a.75.75 0 110 1.5H2.38l-.788 4.538L13.929 8 1.592 2.712zM.989 8L.064 2.68a1.341 1.341 0 011.85-1.462l13.402 5.74... | octicon_paper_airplane = '\n<svg class="octicon octicon-paper-airplane" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M1.592 2.712L2.38 7.25h4.87a.75.75 0 110 1.5H2.38l-.788 4.538L13.929 8 1.592 2.712zM.989 8L.064 2.68a1.341 1.341 0 011.85-1.462l13.402 5.744a... |
def test():
a = 10
fun1 = lambda: a
fun1()
print(a)
a += 1
fun1()
print(a)
return fun1
fun = test()
print(f"Fun: {fun()}")
| def test():
a = 10
fun1 = lambda : a
fun1()
print(a)
a += 1
fun1()
print(a)
return fun1
fun = test()
print(f'Fun: {fun()}') |
# -*- coding: utf-8 -*-
"""
neutrino_api
This file was automatically generated for NeutrinoAPI by APIMATIC v2.0 ( https://apimatic.io ).
"""
class Blacklist(object):
"""Implementation of the 'Blacklist' model.
TODO: type model description here.
Attributes:
is_listed (b... | """
neutrino_api
This file was automatically generated for NeutrinoAPI by APIMATIC v2.0 ( https://apimatic.io ).
"""
class Blacklist(object):
"""Implementation of the 'Blacklist' model.
TODO: type model description here.
Attributes:
is_listed (bool): true if listed, false if not
... |
class DmpIo():
def __init__(self):
# inputs
self.event = None
self.username = None
self.password = None | class Dmpio:
def __init__(self):
self.event = None
self.username = None
self.password = None |
#!/usr/bin/env python3
"""
This prints out my node IPs.
nodes-005.py is used to print out.....
al;jsdflkajsdf
l;ajdsl;faj
a;ljsdklfj
--------------------------------------------------
"""
print('10.10.10.5')
print('10.10.10.4')
print('10.10.10.3')
print('10.10.10.2')
print('10.10.10.1')
| """
This prints out my node IPs.
nodes-005.py is used to print out.....
al;jsdflkajsdf
l;ajdsl;faj
a;ljsdklfj
--------------------------------------------------
"""
print('10.10.10.5')
print('10.10.10.4')
print('10.10.10.3')
print('10.10.10.2')
print('10.10.10.1') |
"""
Exercise 7: Rewrite the grade program from the previous chapter using a function called computegrade that takes a score as its parameter and returns a grade as a string.
"""
def computegrade(score):
if score >= 0.9:
return 'A'
elif score >= 0.8:
return 'B'
elif score >= 0.7:
ret... | """
Exercise 7: Rewrite the grade program from the previous chapter using a function called computegrade that takes a score as its parameter and returns a grade as a string.
"""
def computegrade(score):
if score >= 0.9:
return 'A'
elif score >= 0.8:
return 'B'
elif score >= 0.7:
ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.