content stringlengths 7 1.05M |
|---|
class Solution(object):
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
if n == 0:
return 1.0
if n < 0:
return 1.0/self.myPow(x, -n)
tmp = self.myPow(x, n/2)
if n%2 == 0:
return tmp*t... |
# 12. Integer to Roman(https://leetcode.com/problems/integer-to-roman/)
# Question: Given an integer, convert it to a roman numeral.
# Solution: https://www.w3resource.com/python-exercises/class-exercises/python-class-exercise-1.php
# Ideas:
"""
Get num divided by roman units, starting from the largest, till result ... |
def check_bunch_match(bunch, symbol):
res = True
for one in bunch:
if one != symbol:
res = False
break
return res
def get_ttt_winner(board):
r, c = len(board), len(board[0])
for symbol in "XO":
for ri in range(r):
row = board[ri]
if ... |
def concat(*args, sep="/"):
return sep.join(args)
print(concat("earth", "mars", "venus"))
print(*list(range(5,10))) |
def create_dictionaries():
JupiterMoons = ('Io','Europa','Ganymede','Callisto')
Radius = (1821.6,1560.8,2634.1,2410.3)
Gravity = (1.796,1.314,1.438,1.235)
Orbit = (1.769,3.551,7.154,16.689)
MeanRadius = dict()
SurfaceGravity = dict()
OrbitalPeriod = dict()
for index in range(len(JupiterM... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# little exercise for basic Python
name=raw_input('Please input your name!\n')
print('hello,',name)
age=int(input('Please input your age!\n'))
if age >= 18:
print('your age is',age)
print('you are adult')
else:
print('your age is',age)
print('you are not adult... |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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 applica... |
# Copyright 2018 - Nokia Corporation
#
# 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 law or agreed to in ... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
n = float(input("Enter no.: "))
i = int(n)
f = n - i
d = ""
for t in range(4):
f *= 2
p = int(f)
d += str(p)
f -= p
print("{0}.{1}".format(bin(i), d))
|
USER_AGENT_PRODUCT: str = "uHoo"
USER_AGENT_PRODUCT_VERSION: str = "10.3.1"
USER_AGENT_SYSTEM_INFORMATION: str = "iPhone;13.3; iOS 14.7.1; Scale/3.00"
APP_VERSION: int = 93
CLIENT_ID: str = "0000000000000000000|0000000000000000000"
|
def decoupling_softing_prepare(graph, sigma_square,lambda_input):
# get W matrix, Z(for row sum) and Z_prime(for col sum), and A_tilde
# get matrix W:
A = np.array(nx.adjacency_matrix(graph).todense())
d = np.sum(A, axis=1)
D = np.diag(d)
# Alternative way(19): set Sigma_square = sigma_square./... |
def one_away(string1,string2):
idx = 0
if(len(string1) > len(string2)):
aux = string1
string2 = string1
string1 = aux
if(len(string2) -len(string1) > 1):
return False
while(idx < len(string1) and idx < len(string2)):
char1 = string1[idx]
char2 = str... |
#!/usr/bin/env python3 -tt
def doAttackNavigator(case, nav_list, eachtechnique):
nav_pairs = {
"T1001": "{\n \"techniqueID\": \"T1001\",\n \"tactic\": \"command-and-control\",\n \"color\": \"#00ACB4\",\n \"comment\": \"\",\n \"enabled\": true,\n ... |
def preprocess_sotu_text(text):
removed_applause_text = text.replace('(Applause.)', ' ')
removed_ddash_text = removed_applause_text.replace('--', ' ')
processed_text = removed_ddash_text
return processed_text |
def executar(n, lista):
for i in range(n):
lista += str(i + 1) + "\t"
print(lista)
lista = ''
n = int(input("Digite n: "))
executar(n, lista)
|
def ingredient_translator(recipe_info):
"""This function creates common words for synonymous ingredient names"""
for c1, r in enumerate(recipe_info): # for each recipe r and its counter c
for c2, i in enumerate(r['ingredients']): # for each ingredient of this recipe
# SPICES
... |
my_tuple = (1, 2, 3)
str_tuple = ('hello!',)
print("Tuple Length:", len(my_tuple))
print("Concatenation with (3, 4):", my_tuple + (3, 4))
print("Multiplication:", str_tuple*2)
print("Search. Is 2 in my_tuple?", 2 in my_tuple)
print("Values in my_tuple:")
for x in my_tuple:
print(x) |
class Car:
def __init__(self, engine):
self.engine = engine
def run(self):
self.engine.start()
class Engine:
def start(self):
print("Engine started!")
trinity5_8 = Engine()
ford = Car(trinity5_8)
ford.run() |
__author__ = 'fmontes'
class ContributionStats:
def __init__(self, contributor_name, line_count):
self.contributor_name = contributor_name
self.contributed_lines = line_count
def average(self, total_lines_to_consider=1):
return float(self.contributed_lines) / float(total_lines_to_con... |
class A(object):
def __init__(self):
self.value = "Some Value"
def return_true(self):
return True
def raise_exc(self, val):
raise KeyError(val)
|
# coding=utf-8
FLODER_AUTH = 'auth'
HTTP_OR_HTTPS = 'https://'
AGENT_WEIXIN = 'MicroMessenger'
AGENT_ALIPAY = 'AlipayClient'
AGENT_WEIBO = 'Weibo'
AGENT_QQ = 'QQ'
TEMPLATE_FOOTER = \
"<script language=javascript src='/r/theme/whiteconsole/scripts/jquery-3.3.1.min.js'></script>\
<script language=javascript sr... |
"""
ydf
~~~
:copyright: (c) 2017 Andrew Hawker
:license: Apache 2.0, see LICENSE file
"""
__version__ = '0.0.1'
|
#--------- Training ---------#
# metrics for each episode
time_steps = [] # number of time steps in total
epsilons = [] # epsilon at the end of each episode
greedy = [] # the ratio of greedy choices
coverage = [] # the ratio of visited cells at the end
speed = [] # number of time steps to cover decent amount of cells
... |
class Triangle(object):
def __init__(self, angle1, angle2, angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3
number_of_sides = 3
def check_angles(self):
if (self.angle1 + self.angle2 + self.angle3) == 180:
return True
else:
... |
# https://binarysearch.com/
# GGA 2020.10.27
#
# User Problem
# You have: int
# You Need: each digit ^ number of dig
# You Must:
#
# Solution (Feature/Product)
#
# Edge cases:
#
# input-ouput-example:
# Given an integer n, return whether it is equal to the
# sum of its own digits raised to the power of the
# number... |
class ContainerFilterService(object):
""" Provides a base class for the container filter service. """
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return ContainerFilterService()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
def FilterComponents(self,components):
"""
... |
# Python program to demonstrate delete operation
# in binary search tree
# A Binary Tree Node
class Node:
# Constructor to create a new node
def __init__(self, key):
self.key = key
self.left = None
self.right = None
def inorder(root):
if root is not None:
inorder(root.left)
print... |
#ESCREVA UM PROGRAMA QUE PERGUNTE A QUANTIDADE DE KM PERCORRIDOS POR UM CARRO ALUGADO E A QUANTIDADE DE DIAS
#PELOS QUAIS ELE FOI ALUGADO. CALCULE O PREÇO A PAGAR, SABENDO QUE O CARRO CUSTA R$60 POR DIA E R$0.15 POR KM RODADO.
dias = float(input('Quantos dias você vai ficar com o carro?: '))
km= float(input('Qual a k... |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class RemovalStateEnum(object):
"""Implementation of the 'RemovalState' enum.
Specifies the current healing state of the Cluster.
'kNoRemoval' indicates that there are no removal operations currently
happening on the Cluster.
'kNodeRemoval' i... |
num = int(input('Digite um número para calcular o seu factorial: '))
cont = num
fat = 1
print(f'Calculando {num}! = ', end='')
for c in range(cont, 0, -1):
print(c, end='')
print(' X' if c > 1 else ' =', end=' ')
fat *= c
print(fat)
|
while True:
s=input().split()
if len(s)==1 and len(s[0])==1 and s[0]=='*':break
tam=len(s)
f=[]
for i in range(tam):f.append(s[i][0].lower())
tam=len(f)
print("Y") if f.count(f[0])==tam else print("N")
|
def releaseleftclothes():
##arms get to middle
i01.setHandSpeed("left", 1.0, 0.80, 0.80, 0.80, 1.0, 0.80)
i01.setHandSpeed("right", 1.0, 0.70, 0.70, 1.0, 1.0, 0.80)
i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
i01.setHeadSpeed(0.90, 0.80)
i0... |
stats = airline[['Year', 'Passengers']].groupby('Year').mean()
stats['Max'] = airline[['Year', 'Passengers']].groupby('Year').max()
stats['Min'] = airline[['Year', 'Passengers']].groupby('Year').min()
stats['Range'] = stats['Max']-stats['Min']
ax = stats.plot(y='Passengers', yerr='Range', legend=False)
ax.set_ylabel(r... |
"""Helper macro to compile and test code samples."""
def code_sample_cc(name):
native.cc_binary(
name = name,
srcs = [name + ".cc"],
deps = [
"//ortools/sat:cp_model",
"//ortools/sat:cp_model_solver",
"//ortools/util:sorted_interval_list",
"@c... |
n = 0
while True:
inn = input()
if inn == '0':
break
n += int(inn)
print(n)
|
"""
This package implements the MSAL flow to obtain a personal api token for an instance
of azure databricks without using the web interface.
see url:
https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/app-aad-token
see also:
https://docs.microsoft.com/en-us/azure/active-directory/develop/repl... |
PAS = 'pass'
INF = float('inf')
class Expectimax:
def __init__(self, max_who, rules):
self.max_who = max_who
self.rules = rules
def value(self, state, agent_id, depth):
if state.is_over() or depth <= 0:
return self.evaluation_function(state, agent_id)
if agent_id =... |
class Target:
"""
This must be consist of <app_label>.<modal>.<field>
"""
pass
class StorageProvider:
S3 = 's3'
CLOUDINARY = 'cloudinary'
PROVIDERS = (StorageProvider.S3, StorageProvider.CLOUDINARY)
|
substrings = ['These', 'are', 'strings', 'to', 'concatanate.']
s = ' '
# Highly inefficient
# for substring in substrings:
# s += substring
# print(s)
s = ' '.join(substrings)
print(s)
# OR using an "unbound" method call
x = str.join(' ', substrings)
print(x)
|
def main():
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
if n==1 or n==2:
print(0)
for i in l:
print(i, end=' ')
print()
return
flag = 0
ind = n//2
while(l[ind]==l[ind+1] and ind>0):
ind -= 1
flag = 1... |
expected_output = {
'eigrp_instance': {
'100': {
'vrf': {
'default': {
'address_family': {
'ipv6': {
'eigrp_interface': {
'Ethernet1/1.90': {
... |
class Solution:
def subsetsWithDup(self, nums: List[int], sorted: bool = False) -> List[List[int]]:
if not nums: return [[]]
if len(nums) == 1: return [[], nums]
if not sorted: nums.sort()
pre_lists = self.subsetsWithDup(nums[:-1], sorted=True)
all_lists = [i + [nums[-1]] for... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 5 17:51:53 2021
@author: kody
"""
S = 6
count = 1
for x in range(1,7):
print(int(input("Enter grade")) + x) |
"""
1. Clarification
2. Possible solutions
- Prefix sum + Hash
3. Coding
4. Tests
"""
# T=O(m^2 * n), S=O(n), see also leetcode 560
class Solution:
def numSubmatrixSumTarget(self, matrix: List[List[int]], target: int) -> int:
def subarraySum(nums: List[int], k: int) -> int:
mp = collection... |
salario = float(input('Qual o valor de seu salario? R$'))
#Regra de 3/x
salario_aumento = salario + (salario * 15 / 100)
#calcula os 15% do salario e adiciona ao salario normal
print('O seu salario, com um aumento de 15%, é {}.'.format(salario_aumento)) |
def path_from_root_to_node(root, data):
"""
Assuming data as input to find the node
The solution can be easily changed to find a node instead of data
:param data:
:return:
"""
output = path_from_node_to_root(root, data)
return list(reversed(output))
def path_from_node_to_root(root, data... |
__version__ = "2.3.1"
"""
/////////
Changelog :
2.3.1 : Netutils : si trop de Hosts dans get_ListHosts_str, on retourne 1 message trop de hosts
-------------------------------------------------
Ce Module Permet de donner la version du Module :
Notes:
------
Inspiré de :
http://sametmax.com/creer-un-setup-py-et-... |
#!/usr/bin/env python
# mode - Degree of scanning done by service modules.
# Default is 'normal', 2nd option is 'stealth'.
mode = 'normal'
|
# -*- coding: utf-8 -*-
"""
x tools for easy work
"""
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Custom filters for use in openshift-ansible
"""
# Disabling too-many-public-methods, since filter methods are necessarily
# public
# pylint: disable=too-many-public-methods
class FilterModule(object):
""" Custom ansible filters """
@staticmethod
def oo_cert_e... |
arr=[1,0,-1,0,-2,2]
target=0
def four_sum( arr, target):
hash_map = dict()
arr.sort()
result = set()
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
curr_sum = arr[i] + arr[j]
diff = target - curr_sum
if diff in hash_map:
... |
class Reader:
def __init__(self, checker, size: int):
self.checker = checker
self.size = size
def read(self, path: str):
f = open(path, 'rb')
data = [0] * self.size
for i in range(self.size):
data[i] = [0] * self.size
col = 0
row = 0
... |
# Author Maria carroll
# Week 2
# https://www.w3resource.com/python-exercises/python-basic-exercise-66.php
# Lecture 2 Statements
# Lecturer: Andrew Beatty
#Here we are writng a program to take information from the user to assertain a bmi result from their input
height = float(input ("Enter height in metres: "))
w... |
def pause_game(game):
for i in range(1):
r = game.make_action([False, False, False])
def spawn_agent(game, x, y, orientation=0):
x_pos, y_pos = to_acs_float(x), to_acs_float(y)
game.send_game_command("pukename set_position %i %i %i" %
(x_pos, y_pos, orientation))
# pa... |
# Is Graph Bipartite?: https://leetcode.com/problems/is-graph-bipartite/
# There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More formally, for each v in graph[u], there is an undir... |
# -*- coding: utf-8 -*-
# URL : https://leetcode-cn.com/problems/median-of-two-sorted-arrays/
""""""
"""
problem:
给定两个大小为 m 和 n 的有序数组 nums1 和 nums2。
请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。
你可以假设 nums1 和 nums2 不会同时为空。
示例 1:
nums1 = [1, 3]
nums2 = [2]
则中位数是 2.0
示例 2:
nums1 = [1, 2]
nums2 = [3, 4]
则中位数是 (2 +... |
# We need to make our string alternating, i. e. si≠si+1. When we reverse substring sl…sr,
# we change no more than two pairs sl−1,sl and sr,sr+1. Moreover, one pair should be a
# consecutive pair 00 and other — 11. So, we can find lower bound to our answer as maximum
# between number of pairs of 00 and number of pair... |
"""
Write a function that takes in an array of integers and returns a sorted version of that array. Use the QuickSort algorithm to sort the array.
"""
def quick_sort(array):
if len(array) <= 1:
return array
_rec_helper(array, 0, len(array) - 1)
return array
def _rec_helper(array, start, end):
... |
#crie um tupla com o nome dos produtos, seguidos do preço.
#mostre uma listagem de preços, de forma tabular.
lista = ('Lápis', 1.5, 'Borracha', 2.5, 'Caderno', 10.8,
'Estojo', 20, 'Mochila', 100.5)
print('\033[31m--'*20)
print(f'{"LISTAGEM DE PREÇOS":^40}')
print('--'*20, '\033[m')
for i in range(0, len(lis... |
def _get_main(ctx):
if ctx.file.main:
return ctx.workspace_name + "/" + ctx.file.main.path
main = ctx.label.name + ".py"
for src in ctx.files.srcs:
if src.basename == main:
return ctx.workspace_name + "/" + src.path
fail(
"corresponding default '{}' does not appear in... |
"""
Write a program to check whether a given number is an ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.
Example 1:
Input: 6
Output: true
Explanation: 6 = 2 × 3
Example 2:
Input: 8
Output: true
Explanation: 8 = 2 × 2 × 2
Example 3:
Input: 14
Output: false
Explanation: 14 i... |
def aMax (list):
if len(list) == 0:
return None
max = list[0]
for item in list:
if item > max:
max = item
return max
def aMin (list):
if len(list) == 0:
return None
min = list[0]
for item in list:
if item < min:
... |
"""Character count
This program counts how often each character appears in a string.
"""
def main():
message = 'It was a bright cold day in April, and the clocks were striking thirteen.'
"""str: Message to count characters."""
count = {}
"""dict: Characters as keys and counts as values."""
... |
load(
"@rules_mono//dotnet/private:providers.bzl",
"DotnetLibrary",
)
def _make_runner_arglist(dotnet, source, output):
args = dotnet.actions.args()
args.add("/useSourcePath")
if type(source) == "Target":
args.add_all(source.files)
else:
args.add(source)
args.add(output)
... |
try:
f = open("myfile","w")
a,b = [int(x) for x in input("Enter two numbers:").split()]
c = a/b
f.write("Writing %d into file" %c)
except ZeroDivisionError:
print("Division by zero is not allowed")
print("Please enter a non zero number")
finally:
f.close() # Writi... |
"""
Article object, read in from json
"""
class Article(object):
def __init__(self, head, lead, body,
date, time, writers,
publisher, source_outlet,
additional_information, annotation_list,
feature_list, raw_article):
"""
:param h... |
class Solution(object):
def findKthLargest(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
pivot = random.choice(nums);
nums1, nums2 = [], []
for num in nums:
if num > pivot:
nums1.append(num)
eli... |
"""
Enlace al problema:
https://leetcode.com/problems/merge-two-sorted-lists/
Si deseas probar la solución sólo tienes que copiar la clase Solution
ya que dicha clase es la que se ejecuta en la plataforma de LeetCode.
"""
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
... |
# File: cofenseintelligence_consts.py
#
# Copyright (c) 2020-2021 Splunk Inc.
#
# 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 req... |
# -*- coding: utf-8 -*-
"""
Global fixtures for testing CastorStudy
@author: R.C.A. van Linschoten
https://orcid.org/0000-0003-3052-596X
"""
pytest_plugins = [
"tests.test_castor_objects.fixtures_castor_objects",
"tests.test_integration.fixtures_integration",
"tests.test_api_endpoints.fixtures_api",
"... |
n=int(input("enter year\n"))
if(n%400==0 and n%100==0):
print("leap year")
elif(n%4==0 and n%100!=0):
print("leap year")
else:
print("not leap year")
|
def create_new(numbers):
n = len(numbers)
keys = [None for i in range(2 * n)]
for num in numbers:
idx = num % len(keys)
while keys[idx] is not None:
idx = (idx + 1) % len(keys)
keys[idx] = num
return keys
def create_new_broken(numbers):
n = len(numbers)
... |
class Solution:
def isHappy(self, n: int) -> bool:
x=[]
def Happy(n,x):
t,k=0,0
while n>0:
t=n%10
n=n//10
k=k+t*t
if k==1:
return True
else:
if k in x:
... |
def draw_mem():
c_width = int( w.Canvas2.cget( "width" ))
c_height = int( w.Canvas2.cget( "height" ))
print( c_width )
box_start = c_width * 0.05
box_end = c_width * 0.95
mem_title = w.Canvas2.create_text(( c_width / 2 ), 10, fill = "black", font = "Times 10", text = "Flash" )
mem1 = w.Canva... |
disease_name = 'COVID-19'
# Prob. of fatality (https://www.worldometers.info/coronavirus/coronavirus-age-sex-demographics):
p_covid19_fat_by_age_group = {
'0-9' : 0.000,
'10-19' : 0.002,
'20-29' : 0.002,
'30-39' : 0.002,
'40-49' : 0.004,
'50-59' : 0.013,
'60-69' : 0.036,
'70-79' : 0.0... |
# 不变的魔术师
def show_magicians(magicians):
for magician in magicians:
print('magician\'s name is ' + magician)
def make_great(magicians):
for item in magicians:
magicians[magicians.index(item)] = 'The Great ' + item
return magicians
magicians = ['singi', 'sunjun']
magicians2 = make_great(... |
def test_snap100_component_sub_pages(component_map, dash_doc):
for _, grouper in component_map:
for resources in grouper:
href = "/".join(resources)
dash_doc.visit_and_snapshot(
href, hook_id="wait-for-page-/{}".format(href)
)
|
"""
Presets for the ffmpeg manager
"""
# video
MP4_VIDEO = {'format':'mp4',
'vcodec':'mpeg4',
'qmin':'3',
'qmax':'5',
'g':'300',
'bitrate':'700k',
'vf':'"scale=-1:360"',
}
MP4_AUDIO =... |
midade = 0
idhma = 0
idfme = 0
count = 0
for p in range(1, 5):
print('============== {}ª Pessoa =============='.format(p))
nome = str(input('Digite seu nome completo: ')).upper().strip()
id = int(input('Digite a sua idade: ').format(p))
sexo = str(input('Qual seu sexo? (M/F) ')).upper().strip()
if s... |
t=int(input())
a=1
while(a<=t):
n=int(input())
h=input().split()
for i in range(n):
h[i]=int(h[i])
c=0
for i in range(1,n-1):
if(h[i-1]<h[i]>h[i+1]):
c+=1
print('Case #' + str(a) + ': ' + str(c))
a+=1 |
# Singleton through a decorator.
def singleton(class_):
instances = {}
def getinstance(*args, **kwargs):
if class_ not in instances:
instances[class_] = class_(*args, **kwargs)
return instances[class_]
return getinstance
@singleton
class MyClass(object):
pass
m1 = MyClass()
print(m1)
m2 = ... |
def data(Type, value):
'''
Type (NAME | FLOAT | NUMBER | STRING)
'''
return (Type, {'value': value})
def expression(op, lhs, rhs):
'''
lhs (left-hand-side)
rhs (right-hand-side)
op (operator)
'''
return ('Expression', {'op': op, 'lhs': lhs, 'rhs': rhs})
def var_assign(name, ... |
class Watchdog:
def waitForData(self):
data = self.Socket.recv(1024)
print(data)
return data
def sendData(self,data):
print(data)
return self.Socket.send(data.encode("UTF-8"))
def __init__(self, clientSocket):
self.Socket = clientSocket |
# 1.4) check if palindrome permutation
def palindrome_permutation(str=''):
if len(str) < 2:
return False
frequencies = {}
not_even_count = 0
for char in str.lower():
if char == ' ':
continue
frequencies[char] = 1 + frequencies.get(char, 0)
for number in frequ... |
#!/usr/bin/python3
#‑∗‑ coding: utf‑8 ‑∗‑
dqn_config = {
"alpha": 1e-2,
"gamma": 0.99,
"epsilon": 1.0,
"min_epsilon": 1e-2,
"epsilon_decay_factor": 0.999,
"memory_size": 50000,
"batch_size": 128,
"update_step": 8,
"tau": 1e-3,
"device": "cpu",
"tensorboard_log": True
}
|
#
# PySNMP MIB module HOST-RESOURCES-V2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HOST-RESOURCES-V2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:20:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class AdversarialMachine():
'''
An abstract adversarial learning-to-rank framework
'''
def __init__(self, eval_dict=None, data_dict=None, gpu=False, device=None):
#todo double-check the necessity of these two arguments
self.eval_dict = eva... |
# -*- coding: utf-8 -*-
"""Packages to be installed by the system package manager."""
ZYPPER = (
"gawk",
"coreutils",
"-t pattern devel_basis",
"gcc",
"gcc-fortran",
"util-linux",
"R-base",
"bc",
"lshw",
"numactl",
"java",
"libaio",
"python",
)
YUM = (
"epel-rel... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: mcxiaoke
# @Date: 2015-08-18 20:14:05
INVALID_CHARS='/\\<>:?*"|'
def get_safe_filename(text):
text=text.replace(':', 'x')
for c in INVALID_CHARS:
if c in text:
text = text.replace(c, "_")
|
server_records_from_cap = {
"@id": "doc:server",
"@type": "terminus:Server",
"rdfs:comment": {"@language": "en", "@value": "The current Database Server itself"},
"rdfs:label": {"@language": "en", "@value": "The DB server"},
"terminus:allow_origin": {"@type": "xsd:string", "@value": "*"},
"termin... |
command = '/opt/django/mikaponics-back/env/bin/gunicorn'
pythonpath = '/opt/django/mikaponics-back/mikaponics'
bind = '127.0.0.1:8001'
workers = 3
|
treatment = [
{
"id": "1",
"name": "Dactolisib",
"data_source": "TRACE"
},
{
"id": "2",
"name": "capecitabine",
"data_source": "TRACE"
},
{
"id": "3",
"name": "PREDNISONE",
"data_source": "TRACE"
},
{
"id": "4",
... |
CLUSTER_COL = "cluster"
COUNT_COL = "count"
RECOMMENDED_COL = "recommended"
CLUSTER_COUNT_COL = "cluster_count"
CLUSTER_SUM_COL = "cluster_sum"
NGRAM_COL = "ngram"
FINGERPRINT_COL = "fingerprint"
NGRAM_FINGERPRINT_COL = "ngram_fingerprint"
LEVENSHTEIN_DISTANCE = "LEVENSHTEIN_DISTANCE"
STRING_TO_INDEX = "string_to_ind... |
#
# PySNMP MIB module TIMETRA-QOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-QOS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:17: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... |
counter = ('zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete', 'oito',
'nove', 'dez', 'onze', 'doze', 'treze', 'catorze', 'quinze', 'dezesseis',
'dezessete', 'dezoito', 'dezenove', 'vinte')
number = int(input('Escola um número de 0 a 20: '))
while number not in range(0, 21):
numb... |
#
# PySNMP MIB module CISCO-FC-SPAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FC-SPAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:58:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
# Source : https://github.com/mission-peace/interview/blob/master/python/dynamic/longest_increasing_subsequence.py
# Find a subsequence in given array in which the subsequence's elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible.
# Time Complexity: O(N^2), Space Compl... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... |
#Copyright (c) 2016 Vidhya, Nandini
#Following code is available for use under MIT license. Please see the LICENSE file for details.
#This project uses as constant the genres we need to train with and classify into. This constant list of genres is stored in this file and is included in others for prediction.
# This i... |
"""
Entradas: 2 numeros enteros que se procederan a dividir utilizando restas sucesivas
Numero 1 --> int --> A
Numero 2 --> int --> B
Salidas: El resto de la división
Resto --> int --> A
"""
# Entradas
A = int(input("\nDime el primer numero (Dividendo) "))
B = int(input("Dime el Segundo numero (Divisor) "))
# C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.