content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""
Home of all the miscellaneous BrainPywer utilities that don't deserve their own files
"""
def thaw(snowflake):
"""
Tiny function to return the unix timestamp of a snowflake
:param snowflake: a discord snowflake (It's unique, just like you! ha.)
:type snowflake: int
:return: unix timestamp of ... | """
Home of all the miscellaneous BrainPywer utilities that don't deserve their own files
"""
def thaw(snowflake):
"""
Tiny function to return the unix timestamp of a snowflake
:param snowflake: a discord snowflake (It's unique, just like you! ha.)
:type snowflake: int
:return: unix timestamp of t... |
"""
Problem Description:
In india there is a puzzle"5 characters my name, reverse- forward is the same." You will be presented with a 5 character String, you have to tell whether it satisfy above puzzle, if yes output "Yes" else "No"
Input:
Input is String S of 5 characters.
Output:
Print "Yes" if the String S satisf... | """
Problem Description:
In india there is a puzzle"5 characters my name, reverse- forward is the same." You will be presented with a 5 character String, you have to tell whether it satisfy above puzzle, if yes output "Yes" else "No"
Input:
Input is String S of 5 characters.
Output:
Print "Yes" if the String S satisf... |
# Banker's Algorithm
n = 5 # no. of processes / rows
m = 4 # no. of resources / columns
# Maximum matrix - denotes maximum demand of each process
maxi = [[0, 0, 1, 2],
[1, 7, 5, 0],
[2, 3, 5, 6],
[0, 6, 5, 2],
[0, 6, 5, 6]]
# Allocation matrix - denotes no. of resources allocated to pr... | n = 5
m = 4
maxi = [[0, 0, 1, 2], [1, 7, 5, 0], [2, 3, 5, 6], [0, 6, 5, 2], [0, 6, 5, 6]]
alloc = [[0, 0, 1, 2], [1, 0, 0, 0], [1, 3, 5, 4], [0, 6, 3, 2], [0, 0, 1, 4]]
avail = [1, 5, 2, 0]
f = [0] * n
ans = [0] * n
ind = 0
need = [[0 for i in range(m)] for i in range(n)]
for i in range(n):
for j in range(m):
... |
class dotGuideline_t(object):
# no doc
Curve = None
Id = None
Spacing = None
| class Dotguideline_T(object):
curve = None
id = None
spacing = None |
# draw some simple shapes
# hint! The order in which you draw is important
# change x and y to move him around
x = width/2
y = 25
w = 23 # make him bigger or smaller
h = w # distort by changing the h seperatly
bmi = 1 # body mass index
# a line takes 4 values the starting point and the end point
line(x - w, y + h, x +w... | x = width / 2
y = 25
w = 23
h = w
bmi = 1
line(x - w, y + h, x + w, y + h)
ellipse(x, y, w, h)
point(x, y)
rect(x - bmi / 2, y + h, bmi, h)
no_fill()
begin_shape()
vertex(x - w, y + h * 3)
vertex(x - w, y + h * 2)
vertex(x + w, y + h * 2)
vertex(x + w, y + h * 3)
end_shape() |
class ClientError(Exception):
pass
class ProtocolError(ClientError):
""" Error communicating with the OpenVPN server """
pass
class InvalidPacketError(ProtocolError):
""" Packet that doesn't make any sense and cannot be read correctly. """
pass
class InvalidHMACError(InvalidPacketError):
... | class Clienterror(Exception):
pass
class Protocolerror(ClientError):
""" Error communicating with the OpenVPN server """
pass
class Invalidpacketerror(ProtocolError):
""" Packet that doesn't make any sense and cannot be read correctly. """
pass
class Invalidhmacerror(InvalidPacketError):
pass... |
AdminApp.install('/tmp/installers/war_app/JspDemo.war', '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname JspDemo -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDis... | AdminApp.install('/tmp/installers/war_app/JspDemo.war', '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname JspDemo -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\\.dll=755#.*\\.so=755#.*\\.a=755#.*\\.sl=755 -noallo... |
class Queue(object):
def __init__(self,vals,n=10):
self.queue = [None for x in range(n)]
self.head = -1
self.tail = -1
for val in vals:
self.add(val)
def add(self,val):
if (self.tail+1) % len(self.queue) == self.head:
print("Queue full")
... | class Queue(object):
def __init__(self, vals, n=10):
self.queue = [None for x in range(n)]
self.head = -1
self.tail = -1
for val in vals:
self.add(val)
def add(self, val):
if (self.tail + 1) % len(self.queue) == self.head:
print('Queue full')
... |
"""
DAY 41 : Find first set bit.
https://www.geeksforgeeks.org/position-of-rightmost-set-bit/
QUESTION : Given an integer an N. The task is to return the position of first set bit found from the right
side in the binary representation of the number.
Note: If there is no set bit in the integer N, then return 0... | """
DAY 41 : Find first set bit.
https://www.geeksforgeeks.org/position-of-rightmost-set-bit/
QUESTION : Given an integer an N. The task is to return the position of first set bit found from the right
side in the binary representation of the number.
Note: If there is no set bit in the integer N, then return 0 from t... |
# Split into train and test data for GAN
def build_dataset(X, nx, ny, n_test = 0):
m = X.shape[0]
print("Number of images: " + str(m) )
X = X.T
Y = np.zeros((m,))
# Random permutation of samples
p = np.random.permutation(m)
X = X[:,p]
Y = Y[p]
# Reshape X and crop to 96x96 pixels
X_new ... | def build_dataset(X, nx, ny, n_test=0):
m = X.shape[0]
print('Number of images: ' + str(m))
x = X.T
y = np.zeros((m,))
p = np.random.permutation(m)
x = X[:, p]
y = Y[p]
x_new = np.zeros((m, nx, ny))
for i in range(m):
xtemp = np.reshape(X[:, i], (101, 101))
X_new[i, :... |
#
# Solution to Project Euler Problem 1
# by Lucas Chen
#
# Answer: 233168
#
NUM = 1000
# Compute sum of the naturals that are a multiple of 3 or 5 and less than [NUM]
def compute():
return sum(i for i in range(1, NUM) if i % 3 == 0 or i % 5 == 0)
if __name__ == "__main__":
print(compute())
| num = 1000
def compute():
return sum((i for i in range(1, NUM) if i % 3 == 0 or i % 5 == 0))
if __name__ == '__main__':
print(compute()) |
n=int(input("enter a number "))
backup=n
num=0
while(n>0):
x=n%10
n=n//10
x=x**3
num+=x
if(num==backup):
print(num,"is a armstrong number")
else:
print(backup,"is not a armstrong number") | n = int(input('enter a number '))
backup = n
num = 0
while n > 0:
x = n % 10
n = n // 10
x = x ** 3
num += x
if num == backup:
print(num, 'is a armstrong number')
else:
print(backup, 'is not a armstrong number') |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , n , k ) :
for i in range ( 0 , k ) :
x = arr [ 0 ]
for j in range ( 0 , n - 1 ) :
... | def f_gold(arr, n, k):
for i in range(0, k):
x = arr[0]
for j in range(0, n - 1):
arr[j] = arr[j + 1]
arr[n - 1] = x
if __name__ == '__main__':
param = [([75], 0, 0), ([-58, -60, -38, 48, -2, 32, -48, -46, 90, -54, -18, 28, 72, 86, 0, -2, -74, 12, -58, 90, -30, 10, -88, 2, -1... |
#
# PySNMP MIB module CISCO-DOT11-HT-PHY-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-HT-PHY-CAPABILITY
# Produced by pysmi-0.3.4 at Mon Apr 29 17:38:23 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ... |
#!/usr/bin/env python
class Solution:
def wordBreak(self, s, wordDict):
if len(s) == 0: return True
ret = False
for w in wordDict:
if s.startswith(w):
ret = ret or self.wordBreak(s[len(w):], wordDict)
return ret
s, wordDict = 'leetcode', ['leet', 'code']... | class Solution:
def word_break(self, s, wordDict):
if len(s) == 0:
return True
ret = False
for w in wordDict:
if s.startswith(w):
ret = ret or self.wordBreak(s[len(w):], wordDict)
return ret
(s, word_dict) = ('leetcode', ['leet', 'code'])
(s, ... |
customer_basket_cost = 34
customer_basket_weight = 44
shipping_cost = customer_basket_weight * 1.2
#Write if statement here to calculate the total cost
if customer_basket_weight >= 100:
coste_cesta = customer_basket_cost
print("Total: " + str(coste_cesta) + " euros")
else:
coste_cesta = customer_basket_co... | customer_basket_cost = 34
customer_basket_weight = 44
shipping_cost = customer_basket_weight * 1.2
if customer_basket_weight >= 100:
coste_cesta = customer_basket_cost
print('Total: ' + str(coste_cesta) + ' euros')
else:
coste_cesta = customer_basket_cost + shipping_cost
print('Total: ' + str(coste_cest... |
def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the message... | def test():
assert not cat_cols is None, 'Your answer for cat_cols does not exist. Have you assigned the list of labels for categorical columns to the correct variable name?'
assert type(cat_cols) == list, 'cat_cols does not appear to be of type list. Can you store all the labels of the categorical columns into... |
n, q = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(n - 1):
a, b = map(int, input().split())
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
group = [[], []]
town_color = [-1] * n
tmp = [[0, -1, 0]]
while tmp:
v, past, color = tmp.pop()
town_color[v] = color
gr... | (n, q) = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(n - 1):
(a, b) = map(int, input().split())
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
group = [[], []]
town_color = [-1] * n
tmp = [[0, -1, 0]]
while tmp:
(v, past, color) = tmp.pop()
town_color[v] = color
... |
def main():
grid = open("data.txt").readlines()
for i in range(0, len(grid)):
grid[i] = grid[i][:-1]
x_width = len(grid[i])
y_length = len(grid)
ctr = 0
y_pos = 0
x_pos = 0
product = 1
for i in [[1,1], [3,1], [5,1], [7,1], [1,2]]:
while y_pos < y_length:
... | def main():
grid = open('data.txt').readlines()
for i in range(0, len(grid)):
grid[i] = grid[i][:-1]
x_width = len(grid[i])
y_length = len(grid)
ctr = 0
y_pos = 0
x_pos = 0
product = 1
for i in [[1, 1], [3, 1], [5, 1], [7, 1], [1, 2]]:
while y_pos < y_length:
... |
class Node:
def __init__(self, data):
self.data = data
self.left = self.right = None
def printSpiral(root):
h = height(root)
condi = False
for i in range(1, h + 1):
printGivenLevel(root, i, condi)
condi = not condi
def printGivenLevel(root, level, condi):
if ro... | class Node:
def __init__(self, data):
self.data = data
self.left = self.right = None
def print_spiral(root):
h = height(root)
condi = False
for i in range(1, h + 1):
print_given_level(root, i, condi)
condi = not condi
def print_given_level(root, level, condi):
if r... |
# Course title: Udemy Course: Introduction to the Python Language
# Instructor: Prof. Dr. Diego Mariano
# Example adapted by: Charles Fernandes de Souza
# Date: July 10, 2021
# Print Message
print("Hello, World!")
print("Running Google Colab with Python")
| print('Hello, World!')
print('Running Google Colab with Python') |
def merge(lst1,lst2):
lst = []
while lst1 and lst2:
if lst1[0] < lst2[0]:
lst.append(lst1[0])
lst1.remove(lst1[0])
elif lst1[0] > lst2[0]:
lst.append(lst2[0])
lst2.remove(lst2[0])
else:
lst.append(lst1[0])
lst1.remov... | def merge(lst1, lst2):
lst = []
while lst1 and lst2:
if lst1[0] < lst2[0]:
lst.append(lst1[0])
lst1.remove(lst1[0])
elif lst1[0] > lst2[0]:
lst.append(lst2[0])
lst2.remove(lst2[0])
else:
lst.append(lst1[0])
lst1.remo... |
class Alternativa():
def __init__(self, contenido: str, ayuda: str):
self.contenido = contenido
self.ayuda= ayuda
def mostrar_alternativa(self) -> None:
print(self.contenido)
if self.ayuda:
print(f"({self.ayuda})") | class Alternativa:
def __init__(self, contenido: str, ayuda: str):
self.contenido = contenido
self.ayuda = ayuda
def mostrar_alternativa(self) -> None:
print(self.contenido)
if self.ayuda:
print(f'({self.ayuda})') |
"""
Specification for objects to be accessed, for the purpose of dataframe
interchange between libraries, via the ``__dataframe__`` method on a libraries'
data frame object.
For guiding requirements, see https://github.com/data-apis/dataframe-api/pull/35
Concepts in this design
-----------------------
1. A `Buffer`... | """
Specification for objects to be accessed, for the purpose of dataframe
interchange between libraries, via the ``__dataframe__`` method on a libraries'
data frame object.
For guiding requirements, see https://github.com/data-apis/dataframe-api/pull/35
Concepts in this design
-----------------------
1. A `Buffer`... |
PAD = 0
EOS = 1
BOS = 2
UNK = 3
UNK_WORD = '<unk>'
PAD_WORD = '<pad>'
BOS_WORD = '<s>'
EOS_WORD = '</s>'
NEG_INF = -10000 # -float('inf') | pad = 0
eos = 1
bos = 2
unk = 3
unk_word = '<unk>'
pad_word = '<pad>'
bos_word = '<s>'
eos_word = '</s>'
neg_inf = -10000 |
# !/usr/bin/env python3
#############################################################################
# #
# Program purpose: Prints even numbers in list before an exception. #
# The exception being inclusive. ... | def print_even(num, exc):
for x in num:
if int(x) % 2 == 0 and x != exc:
print(f'{x} ')
elif x == exc:
print(f'{x} ')
break
if __name__ == '__main__':
numbers = [386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219,... |
employees = []
with open("employees.txt", mode="r") as myfile:
for line in myfile:
employee = line.strip().split(",")
full_name, salary, birth_year, department, full_time = employee
employees.append((full_name, float(salary), int(birth_year),
department, full_time =... | employees = []
with open('employees.txt', mode='r') as myfile:
for line in myfile:
employee = line.strip().split(',')
(full_name, salary, birth_year, department, full_time) = employee
employees.append((full_name, float(salary), int(birth_year), department, full_time == 'FULL_TIME'))
prin... |
a=[]
n=int(input("Enter no. of elements: "))
print("Enter array:")
for x in range(n):
element=int(input())
a.append(element)
a.sort()
b=[]
for i in range(0,len(a)-1):
if a[i]==a[i+1]:
b.append(a[i])
b=list(set(b))
a=set(a)
while(len(b)>0):
a.remove(b[0])
b.pop(0)
print("Output:",end=" ")
pri... | a = []
n = int(input('Enter no. of elements: '))
print('Enter array:')
for x in range(n):
element = int(input())
a.append(element)
a.sort()
b = []
for i in range(0, len(a) - 1):
if a[i] == a[i + 1]:
b.append(a[i])
b = list(set(b))
a = set(a)
while len(b) > 0:
a.remove(b[0])
b.pop(0)
print('O... |
N, K = map(int, input().split())
A = list(map(int, input().split()))
bcs = [0] * 41
for i in range(N):
a = A[i]
for j in range(41):
if a & (1 << j) != 0:
bcs[j] += 1
X = 0
for i in range(40, -1, -1):
if bcs[i] >= N - bcs[i]:
continue
t = 1 << i
if X + t <= K:
X ... | (n, k) = map(int, input().split())
a = list(map(int, input().split()))
bcs = [0] * 41
for i in range(N):
a = A[i]
for j in range(41):
if a & 1 << j != 0:
bcs[j] += 1
x = 0
for i in range(40, -1, -1):
if bcs[i] >= N - bcs[i]:
continue
t = 1 << i
if X + t <= K:
x +=... |
def fuzzy_merge(df_1, df_2, key1, key2, threshold=90, limit=2):
"""
:param df_1: the left table to join
:param df_2: the right table to join
:param key1: key column of the left table
:param key2: key column of the right table
:param threshold: how close the matches should be to return a match, b... | def fuzzy_merge(df_1, df_2, key1, key2, threshold=90, limit=2):
"""
:param df_1: the left table to join
:param df_2: the right table to join
:param key1: key column of the left table
:param key2: key column of the right table
:param threshold: how close the matches should be to return a match, b... |
# Assignment 1
def assignment_1():
print("Working on assignment 1\n")
# Assignment 2
def number_is_even(counter):
if counter % 2 == 0:
return True
else:
return False
def assignment_2():
for counter in range (1,21):
if number_is_even(counter):
print("Even numb... | def assignment_1():
print('Working on assignment 1\n')
def number_is_even(counter):
if counter % 2 == 0:
return True
else:
return False
def assignment_2():
for counter in range(1, 21):
if number_is_even(counter):
print('Even number:', counter)
def assignment_3():
... |
class Solution:
def getSum(self, a: int, b: int) -> int:
a &= 0xFFFFFFFF
b &= 0xFFFFFFFF
while b:
carry = a & b
a = a ^ b
b = ((carry) << 1) & 0xFFFFFFFF
return a if a < 0x80000000 else ~(a ^ 0xFFFFFFFF)
| class Solution:
def get_sum(self, a: int, b: int) -> int:
a &= 4294967295
b &= 4294967295
while b:
carry = a & b
a = a ^ b
b = carry << 1 & 4294967295
return a if a < 2147483648 else ~(a ^ 4294967295) |
a=1
b=3
c=a+b
print(c) | a = 1
b = 3
c = a + b
print(c) |
UL = {}
MT = {
'start_message' : ['Welcome to the StolenBottle Bot. I was created to store and reproduce all content that you and '
'other users share with me.\n'
'Send me whatever you want (text, audio, text, etc.) and I will reply with something from mine archive.\n'... | ul = {}
mt = {'start_message': ['Welcome to the StolenBottle Bot. I was created to store and reproduce all content that you and other users share with me.\nSend me whatever you want (text, audio, text, etc.) and I will reply with something from mine archive.\n/help - show help\n/top - top of senders\n/lang - switch lan... |
michelson_coding_test_case = """from unittest import TestCase
from tests import get_data
from pytezos.michelson.micheline import micheline_to_michelson, michelson_to_micheline
class MichelsonCodingTest{case}(TestCase):
def setUp(self):
self.maxDiff = None
"""
test_michelson_parse = """
def tes... | michelson_coding_test_case = 'from unittest import TestCase\n\nfrom tests import get_data\nfrom pytezos.michelson.micheline import micheline_to_michelson, michelson_to_micheline\n\n\nclass MichelsonCodingTest{case}(TestCase):\n \n def setUp(self):\n self.maxDiff = None\n'
test_michelson_parse = "\n def ... |
"""
Script that will navigate the "maze" in testworld
"""
def navigate(env, callback):
for _ in range(100):
callback(env.step([0, 0]))
for _ in range(11):
callback(env.step([0, -30]))
for _ in range(10):
callback(env.step([0, 0]))
for _ in range(123):
callback(env.s... | """
Script that will navigate the "maze" in testworld
"""
def navigate(env, callback):
for _ in range(100):
callback(env.step([0, 0]))
for _ in range(11):
callback(env.step([0, -30]))
for _ in range(10):
callback(env.step([0, 0]))
for _ in range(123):
callback(env.step([... |
#!/usr/bin/python
# list_sorting.py
numbers = [4, 3, 6, 1, 2, 0, 5 ]
print (numbers)
numbers.sort()
print (numbers)
| numbers = [4, 3, 6, 1, 2, 0, 5]
print(numbers)
numbers.sort()
print(numbers) |
def read_file(path):
f = open(path, 'a+')
f.seek(0)
files = [line for line in f.readlines()]
f.close()
return files | def read_file(path):
f = open(path, 'a+')
f.seek(0)
files = [line for line in f.readlines()]
f.close()
return files |
#
# PySNMP MIB module ELTEX-MES-BRIDGE-ERPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-BRIDGE-ERPS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:46:17 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, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ... |
# config.py - Vite's configuration script
title = "icyphox"
author = ""
header = """<a href="/"><- back</a>"""
# actually the sidebar
footer = f"""
<img class="logo" src="/static/white.svg" alt="icyphox's avatar" style="width: 55%"/>
<p>
<span class="sidebar-link">email</span>
<br>
<a href="mail... | title = 'icyphox'
author = ''
header = '<a href="/"><- back</a>'
footer = f"""\n <img class="logo" src="/static/white.svg" alt="icyphox's avatar" style="width: 55%"/>\n <p>\n <span class="sidebar-link">email</span>\n <br>\n <a href="mailto:x@icyphox.sh">x@icyphox.sh</a>\n </p> \n\n <p>\n <span... |
DATASETS = {
"imdb": {
"train": "s3://suching-dev/final-datasets/imdb/train.jsonl",
"dev": "s3://suching-dev/final-datasets/imdb/dev.jsonl",
"test": "s3://suching-dev/final-datasets/imdb/test.jsonl",
"unlabeled": "s3://suching-dev/final-datasets/imdb/unlabeled.jsonl",
"refere... | datasets = {'imdb': {'train': 's3://suching-dev/final-datasets/imdb/train.jsonl', 'dev': 's3://suching-dev/final-datasets/imdb/dev.jsonl', 'test': 's3://suching-dev/final-datasets/imdb/test.jsonl', 'unlabeled': 's3://suching-dev/final-datasets/imdb/unlabeled.jsonl', 'reference_counts': 's3://suching-dev/final-datasets/... |
class LinkedQueue:
""" FIFO queue implementation using a sigle linked list for storage """
#--------------------------------------------------------------------------------
class _Node:
""" LightWeight, non public class for storing a singly linked node """
__slots__ = '_element', '_next'
def __init__(self,... | class Linkedqueue:
""" FIFO queue implementation using a sigle linked list for storage """
class _Node:
""" LightWeight, non public class for storing a singly linked node """
__slots__ = ('_element', '_next')
def __init__(self, element, next):
self._element = element
... |
'''
this function can handle oracle script with block comment
handle change drop table table to
begin execute immediate \'drop table UTLMGT_DASHBOARD.temp_gen_dm_auth_2\'; exception when others then null; end
'''
def convertToBODSScript ( path):
f0 = open(path,'r')
f1 = []
for line in f0:
... | """
this function can handle oracle script with block comment
handle change drop table table to
begin execute immediate 'drop table UTLMGT_DASHBOARD.temp_gen_dm_auth_2'; exception when others then null; end
"""
def convert_to_bods_script(path):
f0 = open(path, 'r')
f1 = []
for line in f0:
if line.... |
size = int(input())
arr=[]
for i in range(size):
string = list(input())
rev_string = list(reversed(string))
msg = "Funny"
for j in range(len(string)):
#print(j)
if not abs(ord(string[j])-ord(string[j-1])) == abs(ord(rev_string[j])-ord(rev_string[j-1])):
msg="Not Funny"
... | size = int(input())
arr = []
for i in range(size):
string = list(input())
rev_string = list(reversed(string))
msg = 'Funny'
for j in range(len(string)):
if not abs(ord(string[j]) - ord(string[j - 1])) == abs(ord(rev_string[j]) - ord(rev_string[j - 1])):
msg = 'Not Funny'
... |
def convert_coordinates(hpos, vpos, width, height, x_res, y_res):
"""
x = (coordinate['xResolution']/254.0) * coordinate['hpos']
y = (coordinate['yResolution']/254.0) * coordinate['vpos']
w = (coordinate['xResolution']/254.0) * coordinate['width']
h = (coordinate['yResolution']/254.0) * coo... | def convert_coordinates(hpos, vpos, width, height, x_res, y_res):
"""
x = (coordinate['xResolution']/254.0) * coordinate['hpos']
y = (coordinate['yResolution']/254.0) * coordinate['vpos']
w = (coordinate['xResolution']/254.0) * coordinate['width']
h = (coordinate['yResolution']/254.0) * coo... |
family = 'wiktionary'
mylang = 'en'
usernames['wiktionary']['en'] = u'AryamanA' # change to your username
console_encoding = 'utf-8'
minthrottle = 0
maxthrottle = 1 | family = 'wiktionary'
mylang = 'en'
usernames['wiktionary']['en'] = u'AryamanA'
console_encoding = 'utf-8'
minthrottle = 0
maxthrottle = 1 |
{
2 : {
"operator" : "selection",
"selectivity" : 0.2
},
4 : {
"operator" : "selection",
"selectivity" : 0.5
},
5 : {
"operator" : "join",
"selectivity" : 0.19,
"multimatch" : False
},
7 : {
"operator" : "selection",
... | {2: {'operator': 'selection', 'selectivity': 0.2}, 4: {'operator': 'selection', 'selectivity': 0.5}, 5: {'operator': 'join', 'selectivity': 0.19, 'multimatch': False}, 7: {'operator': 'selection', 'selectivity': 0.5}, 8: {'operator': 'join', 'selectivity': 0.05, 'multimatch': False}} |
"""
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of
distinct solutions.

"""
class Solution(object):
def totalNQueens(self, n):
"""
:type n: int
:rtype: i... | """
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of
distinct solutions.

"""
class Solution(object):
def total_n_queens(self, n):
"""
:type n: int
:rtyp... |
"""
Given an Array of non-negative intergers find if we can divide the array into two sub arrays of equal sum
"""
dp = ([[False for i in range(50)]
for i in range(10)])
def EqualSumDp(a, n):
s = sum(a)
if s & 1:
return False
s = s//2
for j in range(n+1):
dp[j][0] = True
f... | """
Given an Array of non-negative intergers find if we can divide the array into two sub arrays of equal sum
"""
dp = [[False for i in range(50)] for i in range(10)]
def equal_sum_dp(a, n):
s = sum(a)
if s & 1:
return False
s = s // 2
for j in range(n + 1):
dp[j][0] = True
for j i... |
while True:
inp = input('Enter a number: ')
if inp == 'done' :
break
try:
num = float(inp)
except:
print ('Invalid input')
continue
numbers = list(num)
minimum = None
maximum = None
for num in numbers : ... | while True:
inp = input('Enter a number: ')
if inp == 'done':
break
try:
num = float(inp)
except:
print('Invalid input')
continue
numbers = list(num)
minimum = None
maximum = None
for num in numbers:
if minimum == None or num < minimum:
minimum = num
for num i... |
# Programmed by </Rudransh Joshi> | Class XII - A | Kendriya Vidyalaya Haldwani Cantt :)
out = [] # Initialising an empty list which will store out results
def table(num, start=1): # Table function which will return us a list of numbers as table of the given number
global upto
if start > upto: # Code logic
... | out = []
def table(num, start=1):
global upto
if start > upto:
return
out.append(str(num * start))
return table(num, start + 1)
while True:
num = int(input('Enter a number to print out its table:\t'))
upto = int(input('Enter number upto where you want to print table:\t'))
table(num,... |
LOADTRACKS = "/loadtracks?identifier={query}"
DECODETRACK = "/decodetrack"
DECODETRACKS = "/decodetracks"
ROUTEPLANNER = "/routeplanner/status"
UNMARK_FAILED_ADDRESS = "/routeplanner/free/address"
UNMARK_ALL_FAILED_ADDRESS = "/routeplanner/free/all"
| loadtracks = '/loadtracks?identifier={query}'
decodetrack = '/decodetrack'
decodetracks = '/decodetracks'
routeplanner = '/routeplanner/status'
unmark_failed_address = '/routeplanner/free/address'
unmark_all_failed_address = '/routeplanner/free/all' |
#print(args)
if args[5] == 'COMP':
outTop = op('null')
m = op('movie')
t = op('tox')
fromPath = args[6] + '/' + args[0]
type = op(fromPath + '/info')[1, 'type']
path = op(fromPath + '/info')[1, 'path']
parent().par.Mediatype = type
op('display_select').par.top = fromPath + '/display'
op(fromPath).op('m... | if args[5] == 'COMP':
out_top = op('null')
m = op('movie')
t = op('tox')
from_path = args[6] + '/' + args[0]
type = op(fromPath + '/info')[1, 'type']
path = op(fromPath + '/info')[1, 'path']
parent().par.Mediatype = type
op('display_select').par.top = fromPath + '/display'
op(fromPat... |
"""
Traversing the Node Elements
We can traverse the elements of the node created above by creating a variable and assigning the first element to it.
Then we use a while loop and nextval pointer to print out all the node elements. Note that we have one more additional
data element and the nextval pointers are pr... | """
Traversing the Node Elements
We can traverse the elements of the node created above by creating a variable and assigning the first element to it.
Then we use a while loop and nextval pointer to print out all the node elements. Note that we have one more additional
data element and the nextval pointers are prope... |
#By enumerating with two variables
for i,char in enumerate('enumerate'):
print(1,char)
for i,c in enumerate(list(range(100))):
print(i,c)
if c == 50:
#F is to make the print be able to format the i to a value.
print(f'Index of 50 is: {i}') | for (i, char) in enumerate('enumerate'):
print(1, char)
for (i, c) in enumerate(list(range(100))):
print(i, c)
if c == 50:
print(f'Index of 50 is: {i}') |
def check_values(group, value):
for x in group:
if x == value:
return True
return False
print (check_values([34, 56, 77], 22))
print (check_values([34, 56, 77], 34))
| def check_values(group, value):
for x in group:
if x == value:
return True
return False
print(check_values([34, 56, 77], 22))
print(check_values([34, 56, 77], 34)) |
class EditGuildFailed(Exception):
"""Raises when editing the guild is failed."""
pass
class FetchGuildChannelsFailed(Exception):
"""Raises when fetching the guild channels is failed."""
pass
class CreateGuildChannelFailed(Exception):
"""Raises when creating new guild channel is failed."""
... | class Editguildfailed(Exception):
"""Raises when editing the guild is failed."""
pass
class Fetchguildchannelsfailed(Exception):
"""Raises when fetching the guild channels is failed."""
pass
class Createguildchannelfailed(Exception):
"""Raises when creating new guild channel is failed."""
pass... |
a = (1, 2, 3, 4, 5)
print(a, type(a))
b = (6, 7, [10, 20, 30])
print(b, type(b))
b[2].append(100)
print(b, type(b))
print(len(a))
print(2 in a or 5 in a and 3 in a)
print(a + b, b + a)
print(sum(a))
print(a.index(2))
a.count(4)
print(a.__sizeof__())
# you can't change tuple after init
# but you can make ch... | a = (1, 2, 3, 4, 5)
print(a, type(a))
b = (6, 7, [10, 20, 30])
print(b, type(b))
b[2].append(100)
print(b, type(b))
print(len(a))
print(2 in a or (5 in a and 3 in a))
print(a + b, b + a)
print(sum(a))
print(a.index(2))
a.count(4)
print(a.__sizeof__())
list1 = list(a)
print(list1, type(list1))
list1.append(10)
a = tuple... |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# Copyright 2019-2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.... | """Exception Class for sdflexutils module."""
class Sdflexutilsexception(Exception):
"""Parent class for all sdflexutils exceptions."""
pass
class Invalidinputerror(Exception):
message = 'Invalid Input: %(reason)s'
def __init__(self, message=None, **kwargs):
if not message:
messag... |
class Solution:
def lowestCommonAncestor(self, root, p, q):
curr = root
while curr:
if p.val > curr.val and q.val > curr.val:
curr = curr.right
elif p.val < curr.val and q.val < curr.val:
curr = curr.left
else:
retu... | class Solution:
def lowest_common_ancestor(self, root, p, q):
curr = root
while curr:
if p.val > curr.val and q.val > curr.val:
curr = curr.right
elif p.val < curr.val and q.val < curr.val:
curr = curr.left
else:
re... |
def sqroot(num):
"""Natural square root (decimal points are ignored).
Needed because math.sqrt breaks with numbers bigger than 2 to the power of 1024."""
lenght = len(str(num))#convert number to string
half = str(num)[0:(lenght//2)]#create a substring that is roughly a half of the number
i = (int("1... | def sqroot(num):
"""Natural square root (decimal points are ignored).
Needed because math.sqrt breaks with numbers bigger than 2 to the power of 1024."""
lenght = len(str(num))
half = str(num)[0:lenght // 2]
i = int('1' + '0' * (lenght // 2))
root = int(half)
while True:
if i < 1:
... |
A5_CHECK_DIR = '/etc/dd-agent/checks.d'
A5_CONF_DIR = '/etc/dd-agent/conf.d'
A5_EXE_PATH = '/opt/datadog-agent/agent/agent.py'
A6_CHECK_DIR = '/etc/datadog-agent/checks.d'
A6_CONF_DIR = '/etc/datadog-agent/conf.d'
A6_EXE_PATH = '/opt/datadog-agent/bin/agent/agent'
def get_agent_exe_path(agent_version_major):
if ... | a5_check_dir = '/etc/dd-agent/checks.d'
a5_conf_dir = '/etc/dd-agent/conf.d'
a5_exe_path = '/opt/datadog-agent/agent/agent.py'
a6_check_dir = '/etc/datadog-agent/checks.d'
a6_conf_dir = '/etc/datadog-agent/conf.d'
a6_exe_path = '/opt/datadog-agent/bin/agent/agent'
def get_agent_exe_path(agent_version_major):
if in... |
# Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def minMeetingRooms(self, intervals):
"""
:type intervals: List[Interval]
:rtype: int
"""
intervals = sorted(in... | class Solution(object):
def min_meeting_rooms(self, intervals):
"""
:type intervals: List[Interval]
:rtype: int
"""
intervals = sorted(intervals, key=lambda i: i.start)
rooms = list()
for (i, interv) in enumerate(intervals):
settled = False
... |
def pytest_addoption(parser):
parser.addoption("--unity_exe_path",
action="store",
default=None)
| def pytest_addoption(parser):
parser.addoption('--unity_exe_path', action='store', default=None) |
#
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | model = model()
i1 = input('input', 'TENSOR_FLOAT32', '{2, 2}')
perms = input('perms', 'TENSOR_INT32', '{0}')
output = output('output', 'TENSOR_FLOAT32', '{2, 2}')
model = model.Operation('TRANSPOSE', i1, perms).To(output)
quant8 = data_type_converter().Identify({i1: ('TENSOR_QUANT8_ASYMM', 0.5, 0), output: ('TENSOR_QU... |
# encoding: utf-8
# module Grasshopper.Kernel.Graphs calls itself Graphs
# from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# functions
def GH_GraphProxyObject(n_owner): # real signature unk... | """ NamespaceTracker represent a CLS namespace. """
def gh__graph_proxy_object(n_owner):
""" GH_GraphProxyObject(n_owner: IGH_Graph) """
pass
class Gh_Abstractgraph(object, IGH_Graph, GH_ISerializable):
def add_grip(self, *args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
... |
def betweenness_centrality(G, k=None, normalized=True, weight=None, endpoints=False, seed=None):
# doesn't currently support `weight`, `k`, `endpoints`, `seed`
query = """\
CALL gds.betweenness.stream({
nodeProjection: $node_label,
relationshipProjection: {
relType: {
... | def betweenness_centrality(G, k=None, normalized=True, weight=None, endpoints=False, seed=None):
query = ' CALL gds.betweenness.stream({\n nodeProjection: $node_label,\n relationshipProjection: {\n relType: {\n type: $relationship_type,\n orientation: $direc... |
# A foolish try.
def splitp(p: str):
res = []
tmp = ""
for i in range(len(p)):
if p[i] != "*" and p[i] != ".":
tmp += p[i]
elif p[i] == ".":
res.append(tmp)
res.append(p[i])
tmp = ""
else:
if len(res) > 0 and res[-1] == "."... | def splitp(p: str):
res = []
tmp = ''
for i in range(len(p)):
if p[i] != '*' and p[i] != '.':
tmp += p[i]
elif p[i] == '.':
res.append(tmp)
res.append(p[i])
tmp = ''
else:
if len(res) > 0 and res[-1] == '.' and (tmp == ''):
... |
__author__ = 'awbennett'
class AbstractMethod(object):
def __init__(self):
pass
def fit(self, x_train, z_train, y_train, x_dev, z_dev, y_dev):
raise NotImplementedError()
def predict(self, x_test):
raise NotImplementedError()
| __author__ = 'awbennett'
class Abstractmethod(object):
def __init__(self):
pass
def fit(self, x_train, z_train, y_train, x_dev, z_dev, y_dev):
raise not_implemented_error()
def predict(self, x_test):
raise not_implemented_error() |
class KeyParser:
def __init__(self, separator='\t', row=1, column=0):
"""
:param separator: Field separator to split one line in several values
:param row: The position in a line of the row identifier (starting at zero)
:param column: The position in a line of the column identifie... | class Keyparser:
def __init__(self, separator='\t', row=1, column=0):
"""
:param separator: Field separator to split one line in several values
:param row: The position in a line of the row identifier (starting at zero)
:param column: The position in a line of the column identifier... |
def findDivisible(numberList):
print("Given list is ",numberList)
print("Divisible by 5 in a list")
for num in numberList:
if(num%5==0):
print(num)
numberList=[10,55,21,26,55]
findDivisible(numberList) | def find_divisible(numberList):
print('Given list is ', numberList)
print('Divisible by 5 in a list')
for num in numberList:
if num % 5 == 0:
print(num)
number_list = [10, 55, 21, 26, 55]
find_divisible(numberList) |
event_aliases = {
'halloween 2020': 1,
'candy': 2,
'swimsuits 2020': 3,
'maids': 5,
'christmas 2020': 6,
'countdown': 7,
'monster hunter pt1': 9,
'mh1': 9,
'monster hunter pt2': 10,
'mh2': 10,
}
| event_aliases = {'halloween 2020': 1, 'candy': 2, 'swimsuits 2020': 3, 'maids': 5, 'christmas 2020': 6, 'countdown': 7, 'monster hunter pt1': 9, 'mh1': 9, 'monster hunter pt2': 10, 'mh2': 10} |
BZX = Contract.from_abi("BZX", "0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f", interface.IBZx.abi)
TOKEN_REGISTRY = Contract.from_abi("TOKEN_REGISTRY", "0xf0E474592B455579Fe580D610b846BdBb529C6F7", TokenRegistry.abi)
list = TOKEN_REGISTRY.getTokens(0, 100)
for l in list:
iTokenTemp = Contract.from_abi("iTokenTemp", ... | bzx = Contract.from_abi('BZX', '0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f', interface.IBZx.abi)
token_registry = Contract.from_abi('TOKEN_REGISTRY', '0xf0E474592B455579Fe580D610b846BdBb529C6F7', TokenRegistry.abi)
list = TOKEN_REGISTRY.getTokens(0, 100)
for l in list:
i_token_temp = Contract.from_abi('iTokenTemp',... |
class PdfRelayException(Exception):
def __init__(self, *args, **kwargs):
super(PdfRelayException, self).__init__(args, kwargs)
class JobError(PdfRelayException):
"""Issue with the parameters of the conversion job"""
class EngineError(PdfRelayException):
"""Engine process spawning/execution error"""
class Metad... | class Pdfrelayexception(Exception):
def __init__(self, *args, **kwargs):
super(PdfRelayException, self).__init__(args, kwargs)
class Joberror(PdfRelayException):
"""Issue with the parameters of the conversion job"""
class Engineerror(PdfRelayException):
"""Engine process spawning/execution error"... |
expected_output = {
'vrf': {
'default': {
'local_label': {
201: {
'outgoing_label_or_vc': {
'Pop tag': {
'prefix_or_tunnel_id': {
'10.18.18.18/32': {
... | expected_output = {'vrf': {'default': {'local_label': {201: {'outgoing_label_or_vc': {'Pop tag': {'prefix_or_tunnel_id': {'10.18.18.18/32': {'outgoing_interface': {'Port-channel1/1/0': {'next_hop': 'point2point', 'bytes_label_switched': 0}}}}}}}, 'No Label': {'outgoing_label_or_vc': {'2/35': {'prefix_or_tunnel_id': {'1... |
a = 1
b = 2
num = 3
| a = 1
b = 2
num = 3 |
_base_ = [
'r50_sz224_4xb64_head1_lr0_1_step_ep20.py',
]
# optimizer
optimizer = dict(lr=0.01)
| _base_ = ['r50_sz224_4xb64_head1_lr0_1_step_ep20.py']
optimizer = dict(lr=0.01) |
KNOWN_SIDS = {
"S-1-0": "Null Authority",
"S-1-0-0": "Nobody",
"S-1-1": "World Authority",
"S-1-1-0": "Everyone",
"S-1-2": "Local Authority",
"S-1-2-0": "Local",
"S-1-3": "Creator Authority",
"S-1-3-0": "Creator Owner",
"S-1-3-1": "Creator Group",
"S-1-3-4": "Owner Rights",
... | known_sids = {'S-1-0': 'Null Authority', 'S-1-0-0': 'Nobody', 'S-1-1': 'World Authority', 'S-1-1-0': 'Everyone', 'S-1-2': 'Local Authority', 'S-1-2-0': 'Local', 'S-1-3': 'Creator Authority', 'S-1-3-0': 'Creator Owner', 'S-1-3-1': 'Creator Group', 'S-1-3-4': 'Owner Rights', 'S-1-4': 'Non-unique Authority', 'S-1-5': 'NT ... |
'''
Write a Python program to count the number occurrence of a specific character in a string.
'''
data = input("Enter a long sentence: ")
datas = data[4]
print(data.count(datas)) | """
Write a Python program to count the number occurrence of a specific character in a string.
"""
data = input('Enter a long sentence: ')
datas = data[4]
print(data.count(datas)) |
class Reversed_Proxy(object):
def __init__(self, app, script_name=None, scheme='http', server=None):
self.app = app
self.script_name = script_name
self.scheme = scheme
self.server = server
def __call__(self, environ, start_response):
script_name = environ.get('HTTP_X_SC... | class Reversed_Proxy(object):
def __init__(self, app, script_name=None, scheme='http', server=None):
self.app = app
self.script_name = script_name
self.scheme = scheme
self.server = server
def __call__(self, environ, start_response):
script_name = environ.get('HTTP_X_SC... |
class ResponsePayloadOperations:
def ProductsJSON(self, records):
products = []
i = 0
while i < len(records):
products.append({
'id' : records[i][0],
'name' : records[i][1],
'description': records[i][2],
'count' :... | class Responsepayloadoperations:
def products_json(self, records):
products = []
i = 0
while i < len(records):
products.append({'id': records[i][0], 'name': records[i][1], 'description': records[i][2], 'count': records[i][3], 'price': float(records[i][4])})
i += 1
... |
class dtype(object):
def __init__(self, name):
self.type_name = name
float = dtype('float')
double = dtype('double')
half = dtype('half')
uint8 = dtype('uint8')
int16 = dtype('int16')
int32 = dtype('int32')
int64 = dtype('int64')
| class Dtype(object):
def __init__(self, name):
self.type_name = name
float = dtype('float')
double = dtype('double')
half = dtype('half')
uint8 = dtype('uint8')
int16 = dtype('int16')
int32 = dtype('int32')
int64 = dtype('int64') |
#!/usr/bin/python3
def print_list_integer(my_list=[]):
for i in range(len(my_list)):
print("{:d}".format(my_list[i]))
| def print_list_integer(my_list=[]):
for i in range(len(my_list)):
print('{:d}'.format(my_list[i])) |
# example of a function that does not mutate its input
def add_one_to_series(series):
"""Adds one to a series
"""
# we are not mutating the original data, but returning a copy with new values
return series + 1
# example of a function that does not mutate its data frame input
def add_one_to_data_frame(... | def add_one_to_series(series):
"""Adds one to a series
"""
return series + 1
def add_one_to_data_frame(df):
"""Adds one to the "zeros" column in the input data frame
"""
another = df.copy()
another['zeros'] = another['zeros'] + 1
return another
def clean_name(name):
"""Clean a name... |
res=0
for i in range(1,1001):
res += i**i
res=str(res)
#res='nursyahjaya'
print(res[len(res)-10:])
| res = 0
for i in range(1, 1001):
res += i ** i
res = str(res)
print(res[len(res) - 10:]) |
def get_token_group(partitioner="murmur3", group="static-random"):
return static_tokens[partitioner][group]
static_tokens = {
"murmur3": {
"static-random": [
"-1046743493966813495,-1127180199537005110,-118022819648698044,-1189703775502125091,-1249903220729897117,-1363229807648136104,-14179... | def get_token_group(partitioner='murmur3', group='static-random'):
return static_tokens[partitioner][group]
static_tokens = {'murmur3': {'static-random': ['-1046743493966813495,-1127180199537005110,-118022819648698044,-1189703775502125091,-1249903220729897117,-1363229807648136104,-1417918458648377457,-1437865264282... |
COMMAND_HELP = '''
oplab <command> [<args>]
'''
TRAIN_COMMAND_HELP = '''
oplab t|train
--params <params_file_path>
--output <model_save_path>
'''
| command_help = '\n oplab <command> [<args>]\n'
train_command_help = '\n oplab t|train \n --params <params_file_path> \n --output <model_save_path>\n' |
"""
:type people: List[List[int]]
:rtype: List[List[int]]
[ ] [ ] [ ] [ ] [4] [ ] # [4, 4]: 6 slots, insert 4 with 4 empty space before it
[5] [ ] [ ] [ ] [ ] # [5, 0]: 5 slots, insert 5 with 0 empty space before it
[ ] [5] [ ] [ ] # [5, 2 - 1]: 4 slots, insert 5 with 1 empty space before it
... | """
:type people: List[List[int]]
:rtype: List[List[int]]
[ ] [ ] [ ] [ ] [4] [ ] # [4, 4]: 6 slots, insert 4 with 4 empty space before it
[5] [ ] [ ] [ ] [ ] # [5, 0]: 5 slots, insert 5 with 0 empty space before it
[ ] [5] [ ] [ ] # [5, 2 - 1]: 4 slots, insert 5 with 1 empty space before it
... |
# Storage Account
def storage (storage_client,storage_account_name, location):
#storage_account_name = 'invalid-or-used-name'
availability = storage_client.storage_accounts.check_name_availability(storage_account_name)
print('The storage account account {} is available: {}'.format(storage_account_name, ava... | def storage(storage_client, storage_account_name, location):
availability = storage_client.storage_accounts.check_name_availability(storage_account_name)
print('The storage account account {} is available: {}'.format(storage_account_name, availability.name_available))
print('Reason: {}'.format(availability.... |
"""
File: weather_master.py
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
def main():
"""
Enabl... | """
File: weather_master.py
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
def main():
"""
Ena... |
# Tower of Hanoi
def toh(n,A,B,C):
if n==0:
return
toh(n-1,A,C,B)
print("Moved Disk",n,"From Tower",A,"To Tower ",B)
toh(n-1,C,B,A)
no_of_disk = int(input())
not1 = input()
not2 = input()
not3 = input()
toh(no_of_disk,not1,not2,not3)
| def toh(n, A, B, C):
if n == 0:
return
toh(n - 1, A, C, B)
print('Moved Disk', n, 'From Tower', A, 'To Tower ', B)
toh(n - 1, C, B, A)
no_of_disk = int(input())
not1 = input()
not2 = input()
not3 = input()
toh(no_of_disk, not1, not2, not3) |
dd = {
'a': 1,
'b': 2,
'c': 3
}
ll = [1, 2, 3, 4]
print(ll[0])
print(dd)
dd['new'] = 7
print(dd)
dd['new'] += 6
print(dd)
| dd = {'a': 1, 'b': 2, 'c': 3}
ll = [1, 2, 3, 4]
print(ll[0])
print(dd)
dd['new'] = 7
print(dd)
dd['new'] += 6
print(dd) |
class WinRMError(Exception):
def __init__(self, code, msg):
super(Exception, self).__init__(msg)
self.code = code
| class Winrmerror(Exception):
def __init__(self, code, msg):
super(Exception, self).__init__(msg)
self.code = code |
name = 'forum'
aliases = ('forums', 'f')
pad_none = False
async def run(message):
await message.send('Forum commands: **!forums user (username)**')
| name = 'forum'
aliases = ('forums', 'f')
pad_none = False
async def run(message):
await message.send('Forum commands: **!forums user (username)**') |
num = int(input('Type a number between 0 and 9999: '))
u = num % 10
t = num // 10 % 10
h = num // 100 % 10
th = num // 1000 % 10
print(f'Unity: {u} \n'
f'Ten: {t} \n'
f'Hundred: {h} \n'
f'Thousand: {th}')
| num = int(input('Type a number between 0 and 9999: '))
u = num % 10
t = num // 10 % 10
h = num // 100 % 10
th = num // 1000 % 10
print(f'Unity: {u} \nTen: {t} \nHundred: {h} \nThousand: {th}') |
'''
Created on Nov 21, 2012
@author: Gary
'''
| """
Created on Nov 21, 2012
@author: Gary
""" |
class InstanceDefinitionArchiveFileStatus(
Enum, IComparable, IFormattable, IConvertible
):
"""
The archive file of a linked instance definition can have the following possible states.
Use InstanceObject.ArchiveFileStatus to query a instance definition's archive file status.
enum InstanceDe... | class Instancedefinitionarchivefilestatus(Enum, IComparable, IFormattable, IConvertible):
"""
The archive file of a linked instance definition can have the following possible states.
Use InstanceObject.ArchiveFileStatus to query a instance definition's archive file status.
enum InstanceDefinitionArchiveF... |
print(a == b)
print(a == c)
print(b == c)
# a and b evaluate to the same | print(a == b)
print(a == c)
print(b == c) |
#
# PySNMP MIB module MIMOSA-NETWORKS-BASE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MIMOSA-NETWORKS-BASE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:12:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) ... |
# Question 3
# Midpoints of a line
x1 = float(input("Enter x of 1st point: "))
y1 = float(input("Enter y of 1st point: "))
x2 = float(input("Enter x of 2nd point: "))
y2 = float(input("Enter y of 2nd point: "))
midpoint_x = abs(x1 + x2) / 2
midpoint_y = abs(y1 + y2) / 2
print("Midpoint of a line: (" + str(midpoin... | x1 = float(input('Enter x of 1st point: '))
y1 = float(input('Enter y of 1st point: '))
x2 = float(input('Enter x of 2nd point: '))
y2 = float(input('Enter y of 2nd point: '))
midpoint_x = abs(x1 + x2) / 2
midpoint_y = abs(y1 + y2) / 2
print('Midpoint of a line: (' + str(midpoint_x) + ', ' + str(midpoint_y) + ')') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.