content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class AnonymousName():
def __init__(self, Name):
### Store a Name, and prepare to store score_name
self.Name = Name
self.score_name = []
def show_Name(self):
print(self.Name)
def store_response(self, new_response):
self.score_name.append(new_response)
def sho... | class Anonymousname:
def __init__(self, Name):
self.Name = Name
self.score_name = []
def show__name(self):
print(self.Name)
def store_response(self, new_response):
self.score_name.append(new_response)
def show_results(self):
print('Name results: ')
for... |
class Song:
def __init__(self, filename):
with open(filename) as f:
self.title = f.readline().strip()
self.song_filename = f.readline().strip()
self.background_image = f.readline().strip()
self.song_offset = int(f.readline().strip())
data = f.readl... | class Song:
def __init__(self, filename):
with open(filename) as f:
self.title = f.readline().strip()
self.song_filename = f.readline().strip()
self.background_image = f.readline().strip()
self.song_offset = int(f.readline().strip())
data = f.read... |
# TCP port of the REST API server
rest_api_port = 9999
# Ingress interface name
ingress_interface = "ens4"
# Egress interface name
egress_interface = "ens5"
# Burst limit in rate limiting rules of iptables
iptables_limit_burst = "20"
# Name of bridge between ingress-egress interfaces
br_name = "br0"
| rest_api_port = 9999
ingress_interface = 'ens4'
egress_interface = 'ens5'
iptables_limit_burst = '20'
br_name = 'br0' |
def foo(x): # x is a function parameter
print("x = " + str(x))
foo(5) # Pass 5 to foo(). Here 5 is an argument passed to function foo.
def square(x):
print(x ** 2)
square(4)
square(8)
square(15)
square(23)
square(42)
| def foo(x):
print('x = ' + str(x))
foo(5)
def square(x):
print(x ** 2)
square(4)
square(8)
square(15)
square(23)
square(42) |
img_rows, img_cols, img_chns = 94, 94, 3
latent_dim = 32
intermediate_dim = 256
epsilon_std = 1.0
epochs = 100
filters = 32
num_conv = 3
batch_size = 256
| (img_rows, img_cols, img_chns) = (94, 94, 3)
latent_dim = 32
intermediate_dim = 256
epsilon_std = 1.0
epochs = 100
filters = 32
num_conv = 3
batch_size = 256 |
class AuroraDatabaseException(Exception):
pass
class AuroraParameterException(Exception):
pass
| class Auroradatabaseexception(Exception):
pass
class Auroraparameterexception(Exception):
pass |
def bitwiseComplement(n):
if n == 0:
return 1
bits = []
while n:
r = n % 2
bits.append(r)
n = n//2
rev_bits = [0 if bit == 1 else 1 for bit in bits]
number = 0
i = 0
for r in rev_bits:
number += r*(2**i)
i += 1
return number
| def bitwise_complement(n):
if n == 0:
return 1
bits = []
while n:
r = n % 2
bits.append(r)
n = n // 2
rev_bits = [0 if bit == 1 else 1 for bit in bits]
number = 0
i = 0
for r in rev_bits:
number += r * 2 ** i
i += 1
return number |
class NotSparseError(AttributeError): pass
def raise_non_sparse_metric_or_loss_error():
sparse_err = "mpunet 0.1.3 or higher requires integer targets" \
" as opposed to one-hot encoded targets. All metrics and " \
"loss functions should be named 'sparse_[org_name]' to " \
... | class Notsparseerror(AttributeError):
pass
def raise_non_sparse_metric_or_loss_error():
sparse_err = "mpunet 0.1.3 or higher requires integer targets as opposed to one-hot encoded targets. All metrics and loss functions should be named 'sparse_[org_name]' to reflect this change in accordance with the naming co... |
#
# PySNMP MIB module NTWS-ROOT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTWS-ROOT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:25:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, constraints_intersection, value_range_constraint) ... |
EDGE_UNCONDITIONAL = 'unconditional'
EDGE_CONDITIONAL_TRUE = 'conditional_true'
EDGE_CONDITIONAL_FALSE = 'conditional_false'
EDGE_FALLTHROUGH = 'fallthrough'
EDGE_CALL = 'call'
class Edge:
def __init__(self, node_from, node_to, edge_type=EDGE_UNCONDITIONAL,
condition=None):
self.node_fr... | edge_unconditional = 'unconditional'
edge_conditional_true = 'conditional_true'
edge_conditional_false = 'conditional_false'
edge_fallthrough = 'fallthrough'
edge_call = 'call'
class Edge:
def __init__(self, node_from, node_to, edge_type=EDGE_UNCONDITIONAL, condition=None):
self.node_from = node_from
... |
print('='*40)
n = int(input('Please enter a number to see your multiplication table: '))
print('='*40)
count = 0
while count < 10:
count += 1
print('{:^3} x {:^3} = {}'.format(n, count, n*count))
print('='*40) | print('=' * 40)
n = int(input('Please enter a number to see your multiplication table: '))
print('=' * 40)
count = 0
while count < 10:
count += 1
print('{:^3} x {:^3} = {}'.format(n, count, n * count))
print('=' * 40) |
values = []
index = 1
for i in range(100):
x = int(input())
if i == 0:
higher = x
elif higher < x:
higher = x
index = i+1
print('{}\n{}'.format(higher, index))
| values = []
index = 1
for i in range(100):
x = int(input())
if i == 0:
higher = x
elif higher < x:
higher = x
index = i + 1
print('{}\n{}'.format(higher, index)) |
print('hello world')
# calculate the circumference of circle.
PI = 3.14
r = float(input("Enter the radius of a circle:"))
area = PI * r * r
print("Area of a circle = %.2f" %area)
#calulate the surface area of a circle.
def findArea(r):
PI = 3.14
return PI * (r*r);
print("Area of circle = %.6f" % findArea(6));
... | print('hello world')
pi = 3.14
r = float(input('Enter the radius of a circle:'))
area = PI * r * r
print('Area of a circle = %.2f' % area)
def find_area(r):
pi = 3.14
return PI * (r * r)
print('Area of circle = %.6f' % find_area(6)) |
def FreezeLayers(model,keys=None,freeze_type="LAYERS"):
if(freeze_type=="ALL"):
for layer in model.layers:
layer.trainable=False
elif(keys==None):
raise Exception("FreezeLayers Error: The arg 'keys' can't be None.")
elif(type(keys[0])==str and freeze_type=="LAYERS"):
... | def freeze_layers(model, keys=None, freeze_type='LAYERS'):
if freeze_type == 'ALL':
for layer in model.layers:
layer.trainable = False
elif keys == None:
raise exception("FreezeLayers Error: The arg 'keys' can't be None.")
elif type(keys[0]) == str and freeze_type == 'LAYERS':
... |
n=input()
sum=0
for i in n:
i=int(i)
s=i**len(n)
sum=sum+s
print(sum)
| n = input()
sum = 0
for i in n:
i = int(i)
s = i ** len(n)
sum = sum + s
print(sum) |
{
"targets": [
{
"target_name": "sha3",
"sources": [
"src/addon.cpp",
"src/displayIntermediateValues.cpp",
"src/KeccakF-1600-reference.cpp",
"src/KeccakNISTInterface.cpp",
"src/KeccakSponge.cpp"
],
"include_dirs": [
"<!(node -e \"require('n... | {'targets': [{'target_name': 'sha3', 'sources': ['src/addon.cpp', 'src/displayIntermediateValues.cpp', 'src/KeccakF-1600-reference.cpp', 'src/KeccakNISTInterface.cpp', 'src/KeccakSponge.cpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")']}]} |
def get_recognised_device(request):
device_override = request.session.get('device_override', None)
if device_override:
device = device_override
else:
device = request.META.get('HTTP_X_UA_BRAND_NAME', 'Other')
return {
'nokia': {
'name': device,
'template'... | def get_recognised_device(request):
device_override = request.session.get('device_override', None)
if device_override:
device = device_override
else:
device = request.META.get('HTTP_X_UA_BRAND_NAME', 'Other')
return {'nokia': {'name': device, 'template': 'opportunities/tomtom/qualify_dev... |
'''
molokai theme
'''
def init(obj):
obj.tag_config('Boolean', foreground='#AE81FF')
obj.tag_config('Charactor', foreground='#E6DB74')
obj.tag_config('Number', foreground='#AE81FF')
obj.tag_config('String', foreground='#E6DB74')
obj.tag_config('Conditional', foreground='#F92672')
obj.tag_config(... | """
molokai theme
"""
def init(obj):
obj.tag_config('Boolean', foreground='#AE81FF')
obj.tag_config('Charactor', foreground='#E6DB74')
obj.tag_config('Number', foreground='#AE81FF')
obj.tag_config('String', foreground='#E6DB74')
obj.tag_config('Conditional', foreground='#F92672')
obj.tag_config... |
def alphabet_position(letter):
letter = letter.lower()
position = ord(letter) - 97
return position
def rotate_character(char, rot):
position = alphabet_position(char)
rotate = (position + rot) % 26
if ord(char) > 64 and ord(char) < 91:
new_char = chr(rotate + 65)
return new_char... | def alphabet_position(letter):
letter = letter.lower()
position = ord(letter) - 97
return position
def rotate_character(char, rot):
position = alphabet_position(char)
rotate = (position + rot) % 26
if ord(char) > 64 and ord(char) < 91:
new_char = chr(rotate + 65)
return new_char... |
'''
@Date: 2019-12-07 19:41:45
@Author: ywyz
@LastModifiedBy: ywyz
@Github: https://github.com/ywyz
@LastEditors: ywyz
@LastEditTime: 2019-12-07 20:05:09
'''
def Test(line):
if len(line) == 11:
if line[:3].isdigit() and line[3] == "-" and line[4:6].isdigit(
) and line[6] == "-" and line[7:-1].isdi... | """
@Date: 2019-12-07 19:41:45
@Author: ywyz
@LastModifiedBy: ywyz
@Github: https://github.com/ywyz
@LastEditors: ywyz
@LastEditTime: 2019-12-07 20:05:09
"""
def test(line):
if len(line) == 11:
if line[:3].isdigit() and line[3] == '-' and line[4:6].isdigit() and (line[6] == '-') and line[7:-1].isdigit():
... |
def in_array(arr1, arr2):
r = []
for i in arr1:
found = False
for j in range(len(arr2)):
for y in range(len(arr2[j])):
if arr2[j][y] == i[0]:
if arr2[j][y:len(i)] == i:
... | def in_array(arr1, arr2):
r = []
for i in arr1:
found = False
for j in range(len(arr2)):
for y in range(len(arr2[j])):
if arr2[j][y] == i[0]:
if arr2[j][y:len(i)] == i:
found = True
r.append(i)
... |
# Refer from:
# https://leetcode.com/problems/expression-add-operators/solution/
# offical solution
class Solution:
def addOperators(self, num: str, target: int) -> List[str]:
N = len(num)
answers = []
def recurse(index, prev_operand, current_operand, value, string):
# Done pro... | class Solution:
def add_operators(self, num: str, target: int) -> List[str]:
n = len(num)
answers = []
def recurse(index, prev_operand, current_operand, value, string):
if index == N:
if value == target and current_operand == 0:
answers.appen... |
#sorting a list permanently
cars=['bmw','ferrari','lamborghini','ford','dodge','toyata','porche']
cars.sort()
print(cars)
#sorting a list TEMPORARILY
cars=['bmw','ferrari','lamborghini','ford','dodge','toyata','porche']
print(f'\nThe original list is: \n{cars}')
print(f'\nThe sorted list is:\n{sorted(cars)}')
... | cars = ['bmw', 'ferrari', 'lamborghini', 'ford', 'dodge', 'toyata', 'porche']
cars.sort()
print(cars)
cars = ['bmw', 'ferrari', 'lamborghini', 'ford', 'dodge', 'toyata', 'porche']
print(f'\nThe original list is: \n{cars}')
print(f'\nThe sorted list is:\n{sorted(cars)}')
print(f'\n\tHere is the Original list again!!!:\n... |
def merge(string1, string2):
# Base Case1
if string1 == "":
if string2 == "":
return ""
return string2
# Base Case2
elif string2 == "":
return string1
elif len(string1) < len(string2) or len(string2) < len(string1):
return string1 + string2
# Recursi... | def merge(string1, string2):
if string1 == '':
if string2 == '':
return ''
return string2
elif string2 == '':
return string1
elif len(string1) < len(string2) or len(string2) < len(string1):
return string1 + string2
elif string1[0] > string2[0]:
return ... |
# ========================
# Information
# ========================
# Direct Link: https://www.hackerrank.com/challenges/30-linked-list/problem
# Difficulty: Easy
# Max Score: 30
# Language: Python
# ========================
# Solution
# ========================
class Node:
def __init__(self, data)... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Solution:
def display(self, head):
current = head
while current:
print(current.data, end=' ')
current = current.next
def insert(self, head, data):
if type(head) =... |
## Simulation
PATH_TO_MAIN_CARLA_FOLDER = "lib/Carla"
CONNECTION_IP = "localhost"
CONNECTION_PORT = 2000
SIM_QUALITY = "Low" # Low / Epic
NUM_OF_AGENTS = 4
PREVIEW_AGENTS = True
FPS_COMPENSATION = 20.0
LOG_EVERY = 10
# End thresholds
ROTATION_THRESHOLD = 75
COLLISION_FILTER = [['static.sidewalk', -1], ['static.roa... | path_to_main_carla_folder = 'lib/Carla'
connection_ip = 'localhost'
connection_port = 2000
sim_quality = 'Low'
num_of_agents = 4
preview_agents = True
fps_compensation = 20.0
log_every = 10
rotation_threshold = 75
collision_filter = [['static.sidewalk', -1], ['static.road', -1], ['vehicle.', 80]]
seconds_per_expisode =... |
n = int(input())
testes = []
for x in range(n):
testes_ = input().split()
testes.append(testes_)
for y in range(n):
popA = int(testes[y][0])
popB = int(testes[y][1])
tA = int((float(testes[y][2])*popA)/100)
tB = int((float(testes[y][3])*popB)/100)
anos = 0
while popA <= popB:
p... | n = int(input())
testes = []
for x in range(n):
testes_ = input().split()
testes.append(testes_)
for y in range(n):
pop_a = int(testes[y][0])
pop_b = int(testes[y][1])
t_a = int(float(testes[y][2]) * popA / 100)
t_b = int(float(testes[y][3]) * popB / 100)
anos = 0
while popA <= popB:
... |
x = []
for i in range(10):
x.append(int(input()))
if x[i] <= 0:
x[i] = 1
for i in range(10):
print(f'X[{i}] = {x[i]}')
| x = []
for i in range(10):
x.append(int(input()))
if x[i] <= 0:
x[i] = 1
for i in range(10):
print(f'X[{i}] = {x[i]}') |
load("@bazel_gazelle//:deps.bzl", "go_repository")
def nogo_deps():
go_repository(
name = "com_github_gostaticanalysis_analysisutil",
importpath = "github.com/gostaticanalysis/analysisutil",
sum = "h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk=",
version = "v0.7.1",
)
go_re... | load('@bazel_gazelle//:deps.bzl', 'go_repository')
def nogo_deps():
go_repository(name='com_github_gostaticanalysis_analysisutil', importpath='github.com/gostaticanalysis/analysisutil', sum='h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk=', version='v0.7.1')
go_repository(name='com_github_gostaticanalysis_comm... |
class prefix:
l = 0
w = 0
h = 0
def __init__(self,l,w,h):
self.l = l
self.w = w
self.h = h
def calcvolume(self):
l = self.l
w = self.w
h = self.h
print("The volume equals:", str(w*l*h))
def calcsurface(self):
l = self.l
... | class Prefix:
l = 0
w = 0
h = 0
def __init__(self, l, w, h):
self.l = l
self.w = w
self.h = h
def calcvolume(self):
l = self.l
w = self.w
h = self.h
print('The volume equals:', str(w * l * h))
def calcsurface(self):
l = self.l
... |
d = list()
for x in range(8):
t = int(input())
if t <= 100:
d.append(t)
b = sum(d)/len(d)
print(b)
m = int()
for x in range(len(d)):
m += d[x]**2
print((m/len(d)-b**2)**(1/2))
| d = list()
for x in range(8):
t = int(input())
if t <= 100:
d.append(t)
b = sum(d) / len(d)
print(b)
m = int()
for x in range(len(d)):
m += d[x] ** 2
print((m / len(d) - b ** 2) ** (1 / 2)) |
# Busqueda secuencial de un elemento en un arreglo
def busquedaLineal(buscado, arreglo):
for i, elemento in enumerate(arreglo):
if elemento == buscado:
return i
return -1
| def busqueda_lineal(buscado, arreglo):
for (i, elemento) in enumerate(arreglo):
if elemento == buscado:
return i
return -1 |
input_list = [int(op) for op in open("day2/input.txt").readline().split(",")]
def run(noun, verb):
inp = input_list[:]
inp[1], inp[2], pointer = noun, verb, 0
while pointer < len(inp):
v1,v2,target=inp[pointer+1:pointer+4]
if inp[pointer] == 1:
inp[target] = inp[v1]+inp[v2]
elif inp[pointer] ==... | input_list = [int(op) for op in open('day2/input.txt').readline().split(',')]
def run(noun, verb):
inp = input_list[:]
(inp[1], inp[2], pointer) = (noun, verb, 0)
while pointer < len(inp):
(v1, v2, target) = inp[pointer + 1:pointer + 4]
if inp[pointer] == 1:
inp[target] = inp[v1... |
def main():
n,m,Q = map(int,input().split())
answer = [[0 for _ in range(n)] for _ in range(n)]
for i in range(m):
l,r = map(int,input().split())
r -= 1
answer[r][0] += 1
if l != n:
answer[r][l] -= 1
for i in range(n):
for j in range(1,n):
... | def main():
(n, m, q) = map(int, input().split())
answer = [[0 for _ in range(n)] for _ in range(n)]
for i in range(m):
(l, r) = map(int, input().split())
r -= 1
answer[r][0] += 1
if l != n:
answer[r][l] -= 1
for i in range(n):
for j in range(1, n):
... |
def get_the_question() -> str:
return "life universe and everything"
print("Hello from Module B")
| def get_the_question() -> str:
return 'life universe and everything'
print('Hello from Module B') |
# -*- coding: utf8 -*-
class MovementException(Exception):
pass
class RightException(MovementException):
pass
class LeftException(MovementException):
pass
class RotateException(MovementException):
pass
class ColException(MovementException):
pass
class DownException(MovementException):
... | class Movementexception(Exception):
pass
class Rightexception(MovementException):
pass
class Leftexception(MovementException):
pass
class Rotateexception(MovementException):
pass
class Colexception(MovementException):
pass
class Downexception(MovementException):
pass |
class Constant(int):
def __new__(cls, s, i):
obj = super(Constant, cls).__new__(cls, i)
return obj
| class Constant(int):
def __new__(cls, s, i):
obj = super(Constant, cls).__new__(cls, i)
return obj |
def web_socket_do_extra_handshake(request):
pass
def web_socket_transfer_data(request):
request.ws_stream._send_pong("{payload: 'yes'}")
request.ws_stream.send_message("sent pong")
line = request.ws_stream.receive_message()
| def web_socket_do_extra_handshake(request):
pass
def web_socket_transfer_data(request):
request.ws_stream._send_pong("{payload: 'yes'}")
request.ws_stream.send_message('sent pong')
line = request.ws_stream.receive_message() |
t = int(input())
while t:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
B.sort()
A.pop()
B.pop()
if sum(A) > sum(B):
print('Bob')
elif sum(A) < sum(B):
print('Alice')
else:
print('Draw')
t = t... | t = int(input())
while t:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
A.sort()
B.sort()
A.pop()
B.pop()
if sum(A) > sum(B):
print('Bob')
elif sum(A) < sum(B):
print('Alice')
else:
print('Draw')
t = t - 1 |
def get_output_filename(input_filename):
return input_filename.replace('input', 'output')
class Captcha:
day = 1
test = 2
def getDistance(self, input_lengt):
if self.day == 1 and self.test == 1:
return 1
if self.day == 1 and self.test == 2:
return i... | def get_output_filename(input_filename):
return input_filename.replace('input', 'output')
class Captcha:
day = 1
test = 2
def get_distance(self, input_lengt):
if self.day == 1 and self.test == 1:
return 1
if self.day == 1 and self.test == 2:
return int(input_len... |
async def start(hub, name):
'''
Called only after the named run has compiled low data. If no low data
is present an exception will be raised
'''
if not hub.idem.RUNS[name].get('low'):
raise ValueError()
ctx = {'run_name': name, 'test': hub.idem.RUNS[name]['test']}
rtime = hub.idem.RU... | async def start(hub, name):
"""
Called only after the named run has compiled low data. If no low data
is present an exception will be raised
"""
if not hub.idem.RUNS[name].get('low'):
raise value_error()
ctx = {'run_name': name, 'test': hub.idem.RUNS[name]['test']}
rtime = hub.idem.R... |
POST_CONTENT_API = 'https://www.dcard.tw/api/post/all/'
FORUM_API = 'https://www.dcard.tw/api/forum'
TOP_POST_API = 'https://www.dcard.tw/api/forum/all/{page_number}/popular'
FORUM_APIS = {
'FORUM_ALL_API': 'https://www.dcard.tw/api/forum/all/',
'FORUM_MOTHER_API': 'https://www.dcard.tw/api/forum/mother/',
... | post_content_api = 'https://www.dcard.tw/api/post/all/'
forum_api = 'https://www.dcard.tw/api/forum'
top_post_api = 'https://www.dcard.tw/api/forum/all/{page_number}/popular'
forum_apis = {'FORUM_ALL_API': 'https://www.dcard.tw/api/forum/all/', 'FORUM_MOTHER_API': 'https://www.dcard.tw/api/forum/mother/', 'FORUM_GRADUA... |
palette = {
"YlGn": {
"min": 3,
"max": 9,
3: ["#f7fcb9", "#addd8e", "#31a354"],
4: ["#ffffcc", "#c2e699", "#78c679", "#238443"],
5: ["#ffffcc", "#c2e699", "#78c679", "#31a354", "#006837"],
6: ["#ffffcc", "#d9f0a3", "#addd8e", "#78c679", "#31a354", "#006837"],
... | palette = {'YlGn': {'min': 3, 'max': 9, 3: ['#f7fcb9', '#addd8e', '#31a354'], 4: ['#ffffcc', '#c2e699', '#78c679', '#238443'], 5: ['#ffffcc', '#c2e699', '#78c679', '#31a354', '#006837'], 6: ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'], 7: ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#2... |
#Leia um valor em metros cubicos m3 e apresente-o convertido em litros.
#A formula de conversao eh: L=1000*M, sendo L o volume em litros
#e M o volume em metros cubicos
m=float(input("Informe os metros cubicos: "))
l=1000*m
print(f"Convertidos o volume em litros eh {l}") | m = float(input('Informe os metros cubicos: '))
l = 1000 * m
print(f'Convertidos o volume em litros eh {l}') |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @date : 2019-02-04 13:53:50
# @author : maixiaochai
# @email : maixiaochai@qq.com
# @Link : https://github.com/MaiXiaochai
# @Version : 1.0
class Company(object):
def __init__(self, employee_list):
self.employee = employee_list
def __getitem__... | class Company(object):
def __init__(self, employee_list):
self.employee = employee_list
def __getitem__(self, item):
return self.employee[item]
def __len__(self):
return len(self.employee)
def main():
company = company(['tom', 'bob', 'jane'])
for em in company:
pr... |
class Node(object):
def __init__(self, parent, n, contour = None, box=None):
self.children = []
self.parent = parent
self.n = n
self.contour = contour
self.box = box
def add_child(self, node):
self.children.append(node)
def __eq__(self, other):
retu... | class Node(object):
def __init__(self, parent, n, contour=None, box=None):
self.children = []
self.parent = parent
self.n = n
self.contour = contour
self.box = box
def add_child(self, node):
self.children.append(node)
def __eq__(self, other):
return... |
play_args = [
'name',
'hosts',
'become',
'become_method',
'gather_facts'
]
| play_args = ['name', 'hosts', 'become', 'become_method', 'gather_facts'] |
# This is executed when "Marry me" is the chosen subject
if loveBonus == 3:
print(name + "...")
sleep(1.5)
print("I love you too, but I don't think marriage would work out...")
sleep(2)
print("Don't take me wrong! I would if I could.")
sleep(1.5)
print("But in today's society, I don't thin... | if loveBonus == 3:
print(name + '...')
sleep(1.5)
print("I love you too, but I don't think marriage would work out...")
sleep(2)
print("Don't take me wrong! I would if I could.")
sleep(1.5)
print("But in today's society, I don't think you could hold up against the pressure.")
sleep(2.5)
... |
#!/usr/local/bin/python3
MYSQL = {
'host': '127.0.0.1',
'user': 'root',
'password': 'root',
'db': 'comment',
'port': '3306',
'charset': 'utf8',
}
LOG = {
'MySql': 'mysql/error.log',
'Driver': 'driver/error.log',
'Request': 'request/error.log',
'Soup': 'soup/error.log'
}
url_lis... | mysql = {'host': '127.0.0.1', 'user': 'root', 'password': 'root', 'db': 'comment', 'port': '3306', 'charset': 'utf8'}
log = {'MySql': 'mysql/error.log', 'Driver': 'driver/error.log', 'Request': 'request/error.log', 'Soup': 'soup/error.log'}
url_list = ['http://price.zol.com.cn/', 'http://mobile.zol.com.cn/', 'http://mo... |
# programa que leia a idade e o sexo de varias pessoas, a cada pessoa cadastrada perguntar se quer continuar
# mostre quantas pessoas tem mais de 18 anos, quantos homens foram cadastrados e quantas mulheres tem menos de 20 anos
anos = 0
homens = 0
mulheres = 0
while True:
idade = int(input('Qual sua idade? '))
... | anos = 0
homens = 0
mulheres = 0
while True:
idade = int(input('Qual sua idade? '))
sexo = str(input('Qual seu sexo [M] ou [F]? ')).strip().upper()[0]
while sexo not in 'FfMm':
sexo = str(input('Qual seu sexo [M] ou [F]? ')).strip().upper()[0]
if idade > 18:
anos += 1
if sexo in 'Mm'... |
#Coded by TheSpaceCowboy
#Github: https://www.github.com/thespacecowboy42534
#Date: 13/11/17
#
# Actual Module
# Note: Based of this information: https://www.blackjackapprenticeship.com/resources/how-to-count-cards/
#
class cardCounting: # Creates the class cardCounting
def __init__(self): # Intializes the c... | class Cardcounting:
def __init__(self):
self.trueCount = 0
self.count = 0
self.numOfDecks = 0
def calc_true_count(self):
self.trueCount = self.count / self.numOfDecks
def get_true_count(self):
return self.trueCount
def set_num_of_decks(self, numOfDecks: int):
... |
def c(ele,wt):
r = 0
if ele == 'flame':
r += (0.18+0.07+0.04)
elif ele == 'water':
r += (0.18+0.07+0.07+0.04)
elif ele == 'wind':
r += (0.18+0.07+0.04)
elif ele == 'light':
r += (0.18+0.07+0.07)
elif ele == 'shadow':
r += (0.18+0.07+0.04)
if wt :
... | def c(ele, wt):
r = 0
if ele == 'flame':
r += 0.18 + 0.07 + 0.04
elif ele == 'water':
r += 0.18 + 0.07 + 0.07 + 0.04
elif ele == 'wind':
r += 0.18 + 0.07 + 0.04
elif ele == 'light':
r += 0.18 + 0.07 + 0.07
elif ele == 'shadow':
r += 0.18 + 0.07 + 0.04
... |
class Node:
def __init__(self,data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head=None
def print_list(self):
cur_node = self.head
while cur_node:
print(cur_node.data)
cur_node = cur_node.next
... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def print_list(self):
cur_node = self.head
while cur_node:
print(cur_node.data)
cur_node = cur_node.next
def... |
class CustomBaseError(Exception):
pass
class ValidationError(CustomBaseError):
pass
| class Custombaseerror(Exception):
pass
class Validationerror(CustomBaseError):
pass |
def make_posh(func):
'''This is the function decorator'''
def wrapper():
'''This is the wrapper function'''
print("+---------+")
print("| |")
result = func()
print(result)
print("| |")
print("+=========+")
return result
... | def make_posh(func):
"""This is the function decorator"""
def wrapper():
"""This is the wrapper function"""
print('+---------+')
print('| |')
result = func()
print(result)
print('| |')
print('+=========+')
return result
return ... |
def parse(query: str) -> dict:
if '?' in query:
my_str = query.split('?')[-1]
my_split_list = my_str.split('&')
my_split_list = list(filter(None, my_split_list))
my_dict = {}
for i in my_split_list:
my_key, my_value = i.split('=')[0], i.split('=')[-1]
... | def parse(query: str) -> dict:
if '?' in query:
my_str = query.split('?')[-1]
my_split_list = my_str.split('&')
my_split_list = list(filter(None, my_split_list))
my_dict = {}
for i in my_split_list:
(my_key, my_value) = (i.split('=')[0], i.split('=')[-1])
... |
def checkio(data: str) -> bool:
#replace this for solution
is_lower = False
is_upper = False
is_digital = False
if len(data) < 10:
return False
for i in data:
if str.isupper(i):
is_upper = True
if str.islower(i):
is_lower = True
if str.isdi... | def checkio(data: str) -> bool:
is_lower = False
is_upper = False
is_digital = False
if len(data) < 10:
return False
for i in data:
if str.isupper(i):
is_upper = True
if str.islower(i):
is_lower = True
if str.isdigit(i):
is_digital ... |
# def array_length(arr):
# return len(test)
# def insert_number(arr, index, number):
# arr.insert(index, number)
# return arr
def insertShiftArray(arr, num):
array_length = len(arr)
if array_length % 2:
middle_array = round(array_length // 2) + 1
else:
middle_array = array_length // 2
arr.in... | def insert_shift_array(arr, num):
array_length = len(arr)
if array_length % 2:
middle_array = round(array_length // 2) + 1
else:
middle_array = array_length // 2
arr.insert(middle_array, num)
return arr |
all = [
'basic',
'typevars',
'typeclass,'
'torch',
] | all = ['basic', 'typevars', 'typeclass,torch'] |
'''Better Solution'''
def solution1():
result = list()
for _ in range(int(input())):
N, p, q, r = (int(x) for x in input().split())
if p == q or p == r or q == r:
result.append(0)
break
count = 0
for i in range(2, N+1):
if i % p == 0 and i % q ... | """Better Solution"""
def solution1():
result = list()
for _ in range(int(input())):
(n, p, q, r) = (int(x) for x in input().split())
if p == q or p == r or q == r:
result.append(0)
break
count = 0
for i in range(2, N + 1):
if i % p == 0 and i... |
# https://leetcode.com/problems/remove-one-element-to-make-the-array-strictly-increasing
class Solution:
def canBeIncreasing(self, nums: List[int]) -> bool:
N = len(nums)
cnt = 0
for i in range(N):
ls = nums[:]
ls.pop(i)
flag = True
for j, _ ... | class Solution:
def can_be_increasing(self, nums: List[int]) -> bool:
n = len(nums)
cnt = 0
for i in range(N):
ls = nums[:]
ls.pop(i)
flag = True
for (j, _) in enumerate(ls):
if j == 0:
continue
... |
#
# PySNMP MIB module UCD-DEMO-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/UCD-DEMO-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:21:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ... |
# example to understand variables
a= [2, 4, 6]
b=a
a.append(8)
print(b)
# example to understand variable scope
a=10;b=20
def my_function():
global a
a=11; b=21
my_function()
print(a) #prints11
print(b) #prints20
# example to understand the conditions
x='one'
if x==0:
print('False')
elif x==1:
... | a = [2, 4, 6]
b = a
a.append(8)
print(b)
a = 10
b = 20
def my_function():
global a
a = 11
b = 21
my_function()
print(a)
print(b)
x = 'one'
if x == 0:
print('False')
elif x == 1:
print('True')
else:
print('Something else')
words = ['cat', 'dog', 'elephant']
for w in words:
print(w) |
# Write your code here
def mean(x,y,z):
print((x+y+z)/3)
# Testing the function
if __name__ == "__main__":
mean(1, 2, 3)
mean(10, 1, 1) | def mean(x, y, z):
print((x + y + z) / 3)
if __name__ == '__main__':
mean(1, 2, 3)
mean(10, 1, 1) |
strInput = input('Enter your secret message: ')
strInputLength = len(strInput)
strOutput = ""
if strInput == "":
print('Nothing to encode.')
exit()
for i in range(strInputLength):
asciiChar = ord(strInput[i])
if strInput[i].isalpha():
strAscii = asciiChar + 13
if strInput[i].isupp... | str_input = input('Enter your secret message: ')
str_input_length = len(strInput)
str_output = ''
if strInput == '':
print('Nothing to encode.')
exit()
for i in range(strInputLength):
ascii_char = ord(strInput[i])
if strInput[i].isalpha():
str_ascii = asciiChar + 13
if strInput[i].isuppe... |
#
# PySNMP MIB module TE-LINK-STD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TE-LINK-STD-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:08:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ... |
class Solution:
def letterCasePermutation(self, S: str) -> List[str]:
result = []
def dfs(i, prefix):
if i >= len(S):
result.append(''.join(prefix))
elif S[i].isnumeric():
prefix.append(S[i])
dfs(i + 1, prefix)
... | class Solution:
def letter_case_permutation(self, S: str) -> List[str]:
result = []
def dfs(i, prefix):
if i >= len(S):
result.append(''.join(prefix))
elif S[i].isnumeric():
prefix.append(S[i])
dfs(i + 1, prefix)
... |
def data_file_string_is_accurate(data: str):
return all([
data[:10] == '{"id":"248',
data[-10:] == ':59:59Z"}\n'
])
| def data_file_string_is_accurate(data: str):
return all([data[:10] == '{"id":"248', data[-10:] == ':59:59Z"}\n']) |
class GameBoard():
def __init__(self, size):
self.size = size
self.bord = self.set_up_board()
# Is necessary put the name of bord inside the method name? like create_board_range
def create_range(self):
rows_numbers = range(1, self.size + 1)
columns_letters = "ABCDEFGHIJ... | class Gameboard:
def __init__(self, size):
self.size = size
self.bord = self.set_up_board()
def create_range(self):
rows_numbers = range(1, self.size + 1)
columns_letters = 'ABCDEFGHIJKLMNOPQRSTUVXZ'[:self.size]
return (rows_numbers, columns_letters)
def set_up_boa... |
n = int(input())
ll = []
for i in range(n):
ll.append(input())
print(ll)
| n = int(input())
ll = []
for i in range(n):
ll.append(input())
print(ll) |
def print_verbose(items):
for item in items:
for key, value in item.items():
print(f'{key}: {value}')
print('===================================')
| def print_verbose(items):
for item in items:
for (key, value) in item.items():
print(f'{key}: {value}')
print('===================================') |
# fmt: off
TEST_VECTORS = [
{
"s": bytes.fromhex("243f6a8885a308d313198a2e03707344"),
"n": 1,
"t": 1,
"c": [
bytes.fromhex("243f6a8885a308d313198a2e03707344"),
],
"shares": [
(1, bytes.fromhex("243f6a8885a308d313198a2e03707344")),
],
... | test_vectors = [{'s': bytes.fromhex('243f6a8885a308d313198a2e03707344'), 'n': 1, 't': 1, 'c': [bytes.fromhex('243f6a8885a308d313198a2e03707344')], 'shares': [(1, bytes.fromhex('243f6a8885a308d313198a2e03707344'))]}, {'s': bytes.fromhex('243f6a8885a308d313198a2e03707344'), 'n': 2, 't': 1, 'c': [bytes.fromhex('243f6a8885... |
def make_board():
board = {}
columns = 'abcdefgh'
for i in range(1,9):
board[i] = {c: ' ' for c in columns}
board[1] = {'a' : '\N{WHITE CHESS ROOK}',
'b' : '\N{WHITE CHESS KNIGHT}',
'c' : '\N{WHITE CHESS BISHOP}',
'd' : '\N{WHITE CHESS QUEEN... | def make_board():
board = {}
columns = 'abcdefgh'
for i in range(1, 9):
board[i] = {c: ' ' for c in columns}
board[1] = {'a': 'β', 'b': 'β', 'c': 'β', 'd': 'β', 'e': 'β', 'f': 'β', 'g': 'β', 'h': 'β'}
board[2] = {c: 'β' for c in columns}
board[7] = {c: 'β' for c in columns}
board[8] ... |
# basic strings
x = 'abc'
print(x)
x += 'def'
print(x)
print('123' + "456")
print('123' * 5)
print('abc'[1])
print('abc'[-1])
try:
'abc'[100]
except IndexError:
print('caught')
try:
'abc'[-4]
except IndexError:
print('caught2')
# iter
print(list('str'))
print('123' + '789' == '123789')
print('a' ... | x = 'abc'
print(x)
x += 'def'
print(x)
print('123' + '456')
print('123' * 5)
print('abc'[1])
print('abc'[-1])
try:
'abc'[100]
except IndexError:
print('caught')
try:
'abc'[-4]
except IndexError:
print('caught2')
print(list('str'))
print('123' + '789' == '123789')
print('a' + 'b' != 'a' + 'b ') |
class Solution(object):
def count_sentence_fit(self, sentence, rows, cols):
if sentence is None:
raise TypeError('sentence cannot be None')
if rows is None or cols is None:
raise TypeError('rows and cols cannot be None')
if rows < 0 or cols < 0:
raise Val... | class Solution(object):
def count_sentence_fit(self, sentence, rows, cols):
if sentence is None:
raise type_error('sentence cannot be None')
if rows is None or cols is None:
raise type_error('rows and cols cannot be None')
if rows < 0 or cols < 0:
raise v... |
load(
"@rules_mono//dotnet/private:repositories.bzl",
_dotnet_repositories = "dotnet_repositories",
)
dotnet_repositories = _dotnet_repositories
| load('@rules_mono//dotnet/private:repositories.bzl', _dotnet_repositories='dotnet_repositories')
dotnet_repositories = _dotnet_repositories |
class Solution:
def criticalConnections(self, n, connections):
g = [[] for _ in range(n)]
for u, v in connections:
g[u].append(v)
g[v].append(u)
lookup = [-1] * n
def dfs(par, curr, lvl, lookup, g, res):
lookup[curr] = lvl + 1
for ch... | class Solution:
def critical_connections(self, n, connections):
g = [[] for _ in range(n)]
for (u, v) in connections:
g[u].append(v)
g[v].append(u)
lookup = [-1] * n
def dfs(par, curr, lvl, lookup, g, res):
lookup[curr] = lvl + 1
for ... |
#
# PySNMP MIB module HUAWEI-3COM-OID-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-3COM-OID-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:21:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ... |
M, N = map(int, input().split())
if M == 0:
print(N+1)
elif M == 1:
print(N+2)
elif M == 2:
print(2*N+3)
elif M == 3:
print(pow(2, N+3)-3)
| (m, n) = map(int, input().split())
if M == 0:
print(N + 1)
elif M == 1:
print(N + 2)
elif M == 2:
print(2 * N + 3)
elif M == 3:
print(pow(2, N + 3) - 3) |
class Observation(object):
pass
def json_to_observation(jsn):
obs = Observation()
# metadata
obs.round = jsn['round']
obs.num_rounds = jsn['num_rounds']
obs.frame = jsn['frame']
# features
obs.action = jsn['action']
obs.x = jsn['x']
obs.y = jsn['y']
obs.heading = jsn['hea... | class Observation(object):
pass
def json_to_observation(jsn):
obs = observation()
obs.round = jsn['round']
obs.num_rounds = jsn['num_rounds']
obs.frame = jsn['frame']
obs.action = jsn['action']
obs.x = jsn['x']
obs.y = jsn['y']
obs.heading = jsn['heading']
obs.scanned = jsn['sca... |
budget = float(input())
crew = int(input())
price_clothes = float(input()) * crew
if crew > 150:
price_clothes *= 0.9
expenses = float((budget * 0.1) + price_clothes)
if expenses > budget:
print("Not enough money!")
print(f"Wingard needs {abs(expenses - budget):.2f} leva more.")
else:
print("Action!"... | budget = float(input())
crew = int(input())
price_clothes = float(input()) * crew
if crew > 150:
price_clothes *= 0.9
expenses = float(budget * 0.1 + price_clothes)
if expenses > budget:
print('Not enough money!')
print(f'Wingard needs {abs(expenses - budget):.2f} leva more.')
else:
print('Action!')
... |
def removeList():
l1 = [1, 4, 9, 10, 23]
l2 = [4, 9]
## Write your code here
for each in l2:
l1.remove(each)
return l1 | def remove_list():
l1 = [1, 4, 9, 10, 23]
l2 = [4, 9]
for each in l2:
l1.remove(each)
return l1 |
# Parameters for model
INPUT_SIZE = 1024
HIDDEN_SIZE = 500
OUTPUT_SIZE = 2
# Paths
# FFNN
SAVED_MODEL_PATH = "./save_test/mytest.ckpt.meta"
CHECKPOINT_PATH = "./save_test"
# CNN
CNN_SAVED_MODEL_PATH = './saved_model_cnn/cnn_param.ckpt.meta'
CNN_CHECKPOINT_PATH = './saved_model_cnn' | input_size = 1024
hidden_size = 500
output_size = 2
saved_model_path = './save_test/mytest.ckpt.meta'
checkpoint_path = './save_test'
cnn_saved_model_path = './saved_model_cnn/cnn_param.ckpt.meta'
cnn_checkpoint_path = './saved_model_cnn' |
PORT = 5000
DEBUG = False
CREDENTIALS = {'example.com': 'some-string'}
DATABASE = 'mrw.db'
| port = 5000
debug = False
credentials = {'example.com': 'some-string'}
database = 'mrw.db' |
__author__ = 'Shane'
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]
class MockedTypes(object):
__metaclass__ = Singleton
... | __author__ = 'Shane'
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]
class Mockedtypes(object):
__metaclass__ = Singleton
... |
def int_to_str(input_int):
if input_int < 0:
is_negative = True
input_int *= -1
else:
is_negative = False
output_str = []
while input_int > 0:
output_str.append(chr(ord('0') + input_int % 10))
input_int //= 10
output_str = output_str[::-1]
output_str = ... | def int_to_str(input_int):
if input_int < 0:
is_negative = True
input_int *= -1
else:
is_negative = False
output_str = []
while input_int > 0:
output_str.append(chr(ord('0') + input_int % 10))
input_int //= 10
output_str = output_str[::-1]
output_str = ''.... |
class OneHot:
def __init__(self, all_sentences, all_words):
self.tokenize_matrix = []
self.all_sentences = all_sentences
self.all_words = all_words
def encode(self):
words_occ = {}
for sentence in self.all_sentences:
# print(sentence)
for i, w... | class Onehot:
def __init__(self, all_sentences, all_words):
self.tokenize_matrix = []
self.all_sentences = all_sentences
self.all_words = all_words
def encode(self):
words_occ = {}
for sentence in self.all_sentences:
for (i, word) in enumerate(self.all_words... |
# change this to your API keys
# Weather Underground API key
wuapi = 'YOUR WEATHER UNDERGROUND API KEY'
# Google Maps API key
googleapi = '' # Empty string, optional -- with PiClock, you'll be ok
| wuapi = 'YOUR WEATHER UNDERGROUND API KEY'
googleapi = '' |
# -*- coding: utf-8 -*-
LOCAL_T_MAX = 5 # repeat step size
RMSP_ALPHA = 0.99 # decay parameter for RMSProp
RMSP_EPSILON = 0.1 # epsilon parameter for RMSProp
CHECKPOINT_DIR = 'checkpoints'
LOG_FILE = 'logs'
INITIAL_ALPHA_LOW = 1e-4 # log_uniform low limit for learning rate
INITIAL_ALPHA_HIGH = 1e-2 # log_uniform ... | local_t_max = 5
rmsp_alpha = 0.99
rmsp_epsilon = 0.1
checkpoint_dir = 'checkpoints'
log_file = 'logs'
initial_alpha_low = 0.0001
initial_alpha_high = 0.01
parallel_size = 20
action_size = 4
initial_alpha_log_rate = 0.4226
gamma = 0.99
entropy_beta = 0.01
max_time_step = 10.0 * 10 ** 6
grad_norm_clip = 40.0
use_gpu = Fa... |
class Solution:
def lastStoneWeight(self, stones) -> int:
while len(stones) > 1:
stones.sort()
if stones[-1] == stones[-2]:
stones = stones[:-2]
else:
new_stone = stones[-1] - stones[-2]
stones = stones[:-2]
... | class Solution:
def last_stone_weight(self, stones) -> int:
while len(stones) > 1:
stones.sort()
if stones[-1] == stones[-2]:
stones = stones[:-2]
else:
new_stone = stones[-1] - stones[-2]
stones = stones[:-2]
... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def goodNodes(self, root: TreeNode) -> int:
def dfs(curr, maxVal):
if curr is None:
... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def good_nodes(self, root: TreeNode) -> int:
def dfs(curr, maxVal):
if curr is None:
return 0
count = 1... |
# Bradley Grose
# define the Vehicle class
class Vehicle:
name = ""
kind = "car"
color = ""
value = 100.00
def description(self):
desc_str = "%s is a %s %s worth $%.2f." % (self.name, self.color, self.kind, self.value)
return desc_str
car1 = Vehicle()
car1.name = "Fer"
car1.color =... | class Vehicle:
name = ''
kind = 'car'
color = ''
value = 100.0
def description(self):
desc_str = '%s is a %s %s worth $%.2f.' % (self.name, self.color, self.kind, self.value)
return desc_str
car1 = vehicle()
car1.name = 'Fer'
car1.color = 'red'
car1.kind = 'convertible'
car1.value =... |
# The section names and function parameter names follow the MPI 3.1 standard
functions = [
# 3.2 Blocking Send and Receive Operations
("int", "MPI_Send", [
("const void *", "buf"),
("int", "count"),
("MPI_Datatype", "datatype"),
("int", "dest"),
("int", "tag"),
... | functions = [('int', 'MPI_Send', [('const void *', 'buf'), ('int', 'count'), ('MPI_Datatype', 'datatype'), ('int', 'dest'), ('int', 'tag'), ('MPI_Comm', 'comm')], None), ('int', 'MPI_Recv', [('void *', 'buf'), ('int', 'count'), ('MPI_Datatype', 'datatype'), ('int', 'source'), ('int', 'tag'), ('MPI_Comm', 'comm'), ('MPI... |
class OutputKey:
KeyData = "data"
KeyTick = "tick"
KeyChannelCh = "ch"
KeyChannelRep = "rep"
| class Outputkey:
key_data = 'data'
key_tick = 'tick'
key_channel_ch = 'ch'
key_channel_rep = 'rep' |
COLOR_RELIEF_EXT = '_CR'
HILL_SHADE_EXT = '_HS'
SLOPE_EXT = '_SL'
SLOPE_HILL_SHADE_EXT = '_SL_HS'
SLOPE_WATER_EXT = '_SL_Water'
SLOPE_POLY_EXT = '_SL_poly'
TOPO_EXT = '_Topo'
RED_VAL = 35
GREEN_VAL = 170
BLUE_VAL = 181 | color_relief_ext = '_CR'
hill_shade_ext = '_HS'
slope_ext = '_SL'
slope_hill_shade_ext = '_SL_HS'
slope_water_ext = '_SL_Water'
slope_poly_ext = '_SL_poly'
topo_ext = '_Topo'
red_val = 35
green_val = 170
blue_val = 181 |
# 12. Length & Sum
grades = [80,75,100,90]
total = sum(grades)
length = len(grades)
average = total/length
print(average) # Output - 86.25
# NOW, HERE IS A QUESTION,
# Q. Which of the following data structures is not-ideal for grades
grades = [80,75,100,90]
grades = {80,75,100,90}
grades = (80,75,100,90)
# - ... | grades = [80, 75, 100, 90]
total = sum(grades)
length = len(grades)
average = total / length
print(average)
grades = [80, 75, 100, 90]
grades = {80, 75, 100, 90}
grades = (80, 75, 100, 90) |
'''
Module provides some test utilities
'''
class Spy:
'''
This is the test helper which helps us to check whether function has been
called and which parameters have been passed to
'''
def __init__(self, call_fake=None, returns=None):
self.call_count = 0
self.args = []
self... | """
Module provides some test utilities
"""
class Spy:
"""
This is the test helper which helps us to check whether function has been
called and which parameters have been passed to
"""
def __init__(self, call_fake=None, returns=None):
self.call_count = 0
self.args = []
self... |
# original headers for output.csv file (from RePORTER downloaded csv files)
ACTIVITY = 'ACTIVITY'
ADMINISTERING_IC = 'ADMINISTERING_IC'
APPLICATION_ID = 'APPLICATION_ID'
APPLICATION_TYPE = 'APPLICATION_TYPE'
ARRA_FUNDED = 'ARRA_FUNDED'
AWARD_NOTICE_DATE = 'AWARD_NOTICE_DATE'
BUDGET_END = 'BUDGET_END'
BUDGET_START = 'B... | activity = 'ACTIVITY'
administering_ic = 'ADMINISTERING_IC'
application_id = 'APPLICATION_ID'
application_type = 'APPLICATION_TYPE'
arra_funded = 'ARRA_FUNDED'
award_notice_date = 'AWARD_NOTICE_DATE'
budget_end = 'BUDGET_END'
budget_start = 'BUDGET_START'
cfda_code = 'CFDA_CODE'
core_project_num = 'CORE_PROJECT_NUM'
di... |
# -*- coding: utf-8 -*-
# This file is generated from NI-SCOPE API metadata version 20.5.0d7
config = {
'api_version': '20.5.0d7',
'c_header': 'niScope.h',
'c_function_prefix': 'niScope_',
'service_class_prefix': 'NiScope',
'java_package': 'com.ni.grpc.scope',
'csharp_namespace': 'NationalInstru... | config = {'api_version': '20.5.0d7', 'c_header': 'niScope.h', 'c_function_prefix': 'niScope_', 'service_class_prefix': 'NiScope', 'java_package': 'com.ni.grpc.scope', 'csharp_namespace': 'NationalInstruments.Grpc.Scope', 'namespace_component': 'niscope', 'close_function': 'Close', 'context_manager_name': {'abort_functi... |
#
# PySNMP MIB module DV2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DV2-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:54:55 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.