content stringlengths 7 1.05M |
|---|
expected_output = {
"Ethernet1/1": {
"advertising_code": "Passive Cu",
"cable_attenuation": "0/0/0/0/0 dB for bands 5/7/12.9/25.8/56 " "GHz",
"cable_length": 2.0,
"cis_part_number": "37-1843-01",
"cis_product_id": "QDD-400-CU2M",
"cis_version_id": "V01",
"cisc... |
a=input().split();r=5000
for i in a:
if i=='1':
r-=500
elif i=='2':
r-=800
else:
r-=1000
print(r)
|
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 16 14:25:12 2021
@author: ELCOT
"""
class Solution:
def myPow(self, x: float, n: int) -> float:
if n == 0:
return 1.0
if n == 1:
return x
if n == 2:
return x*x
... |
# https://leetcode.com/problems/clone-graph/description/
#
# algorithms
# Medium (25.08%)
# Total Accepted: 180.2K
# Total Submissions: 718.5K
# beats 50.23% of python submissions
# Definition for a undirected graph node
# class UndirectedGraphNode:
# def __init__(self, x):
# self.label = x
# se... |
class Preprocessor(object):
"""
Preprocessor: Apply simple preprocessing operations to real-valued numerical datasets (min-max normalization)
"""
def __init__(self, data):
"""
Initializes the Preprocessor according to the provided dataset
Arguments:
data {np.ndarray... |
def preprocess_input(date, state_holiday):
day, month = (int(date.split(" ")[0]), int(date.split(" ")[1]))
if state_holiday == 'a':
state_holiday = 1
elif state_holiday == 'b':
state_holiday = 2
elif state_holiday == 'c':
state_holiday = 3
else:
state_holiday = 0
return day, month, state_holiday |
class dotDrawText_t(object):
# no doc
aText=None
Color=None
Location=None
|
numeros = [-12, 84, 13, 20, -33, 101, 9]
def separar(lista):
pares = []
impares = []
for numero in lista:
if numero%2 == 0:
pares.append(numero)
else:
impares.append(numero)
return pares, impares
pares, impares = separar(numeros)
print(pares)
print(impares)
|
# callback handlers: reloaded each time triggered
def message1(): # change me
print('spamSpamSPAM') # or could build a dialog...
def message2(self):
print('Ni! Ni!') # change me
self.method1() # access the 'Hello' instance...
|
class DetailModel:
class Mesh:
def __init__(self):
self.vertices_count = None
self.indices_count = None
self.uv_map_name = 'Texture'
self.bpy_mesh = None
self.bpy_material = None
def __init__(self):
self.shader = None
self.tex... |
def fibonacci_numbers(ul: int) -> int:
numbers: list = []
a: int = 0
b: int = 1
total: int = 0
while (total <= ul):
numbers.append(total)
a = b
b = total
total = a + b
return sum(filter(lambda x: not x % 2, numbers))
if __name__ == '__main__':
t: int = int(i... |
MASK_CODE = {
0: '',
10: '贴条',
20: '匿名',
30: '重复回帖',
40: '无图片',
50: '无关键词',
60: '超过最大加分楼层',
70: '已有加分记录',
}
def generate_mask(lou, post, seen_uids, config):
if not post.content: # except comment
return 10
if post.user.is_anonymous: # except anonymous user
retu... |
nm = input().split()
n = int(nm[0])
m = int(nm[1])
mt = []
for _ in range(n):
matrix_item = input()
mt.append(matrix_item)
p=0
print(mt)
k = int(input())
for i in range(n):
for j in range(m):
if(mt[i][j]=="M"):
print(i,j)
for i in range(n):
for ... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
vars内置函数
返回对象的属性和属性值的字典对象
"""
class Demo(object):
"""doc"""
name = "demo class"
def basic_demo():
print(vars())
print(type(vars()))
print(vars(Demo))
print(vars(Demo()))
if __name__ == "__main__":
basic_demo()
|
class TwoSum:
def __init__(self):
self.numberCountMap = {}
"""
@param number: An integer
@return: nothing
"""
def add(self, number):
count = 1
if number in self.numberCountMap :
count = self.numberCountMap[number]+1
self.numberCountMap[number] = coun... |
# -*- coding: utf-8 -*-
"""
:copyright: © 2010-2020 by Farhan Ahmed.
:license: See LICENSE for more details.
"""
NOT_FOUND = -1001
INVALID_REQUEST = -1002
MESSAGES = {
NOT_FOUND: "The bundle `{}` was not found.",
INVALID_REQUEST: "The provided bundle is not in the valid format.",
}
|
sentence = input("Please enter a sentence : ").lower()
constants = 0
vowels = 0
digit = 0
space = 0
for i in range(len(sentence)):
if sentence[i] in set("aeiou"):
vowels += 1
elif sentence[i] in set("bcçdfghjklmnpqrstwxyz"):
constants += 1
elif sentence[i] in set("0123456789"):
... |
class Formatter:
def __init__(self):
pass
def format(self, args, data):
if args.vba:
self.format_VBA(args,data)
elif args.csharp:
self.format_CSharp(args,data)
elif args.cpp:
self.format_CPP(args,data)
elif args.raw:
... |
"""This module contains code for computing variant statistics and pedigree checks.
It provides similar functionality to Peddy but works with a database backend. Peddy is described in
Pedersen & Quinlan (2017).
"""
|
"""The all pair shortest path algorithm is also known as Floyd-Warshall algorithm is used to find all pair shortest
path problem from a given weighted graph. As a result of this algorithm, it will generate a matrix, which will
represent the minimum distance from any node to all other nodes in the graph. """
"""For bet... |
M = int(input())
N = int(input())+1
numbers = []
for i in range(M,N):
c = 0
for j in range(1,i+1):
if i%j == 0:
c += 1
if c > 2:
break
if c == 2:
numbers.append(i)
if sum(numbers) == 0:
print(-1)
else:
print(sum(numbers),min(numbers),sep='\n') |
# Runtime: 176 ms
# Beats 77.94% of Python submissions
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution():
def constructMaximumBinaryTree(self, nums):
"""
:type n... |
{
'name': 'Legrand App',
'description': 'Legrand raktárkészlet és gyártás támogatás',
'author': 'Csók Tibor',
'depends': ['szefo_admin'],
'application': True,
'data': [
'security/legrand_access_rules.xml',
'security/ir.model.access.csv',
'legrand_view.xml',
'views/anyagigeny.xml',
'vi... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 17:44:11 2020
@author: Ashish
"""
x = int ( input("Enter a number: "))
y = int ( input("Enter a number: "))
n = int ( input("Enter a number: "))
print ([[ i, j] for i in range( x + 1) for j in range( y + 1) if ( ( i + j ) != n )]) |
_base_ = ["../../_base_/gdrn_base.py"]
OUTPUT_DIR = "output/gdrn_selfocc/lm/mm_r50v1d_a6_cPnP_GN_gelu_lm13"
INPUT = dict(
DZI_PAD_SCALE=1.5,
COLOR_AUG_PROB=0.0,
COLOR_AUG_TYPE="code",
COLOR_AUG_CODE=(
"Sequential(["
"Sometimes(0.4, CoarseDropout( p=0.1, size_percent=0.05) ),"
# ... |
N,K=map(int,input().split())
x=list(map(int,input().split()))
n=N-K+1
left=[0]*n
for i in range(n):left[i]=abs(x[i])+abs(x[i]-x[i+K-1])
x=x[::-1]
right=[0]*n
for i in range(n):right[i]=abs(x[i])+abs(x[i]-x[i+K-1])
print(min(min(left),min(right))) |
'''
Created on Mar 13, 2021
@author: mballance
'''
print("SystemVerilog generator") |
def reverse_print_for(word):
reversed_word = ''
for letter in reversed(word):
reversed_word += letter
print(reversed_word)
reverse_print_for('banannafor')
def reverse_print(word):
print(word[::-1])
reverse_print('bananna')
def is_palindrome(sequence):
return sequence.lower() == sequence[... |
def calc_combinations(names, n, combs=[]):
if len(combs) == n:
print(", ".join(combs))
for i in range(len(names)):
name = names[i]
combs.append(name)
calc_combinations(names[i+1:], n, combs)
combs.pop()
names = input().split(", ")
n = int(input())
calc_combinations(... |
#! /usr/bin/python3
def partOne(arr):
timeStamp = int(arr[0])
busses = []
tmp = [x for x in arr[1].split(',')]
for x in tmp:
if x != 'x':
busses.append(int(x))
maxTime = max(busses)
calculateTimeStamp = timeStamp + maxTime
# shortest waittime ?
# find bus near timest... |
def main(request, response):
if b'mime' in request.GET:
return [(b'Content-Type', request.GET[b'mime'])], b""
return [], b""
|
#!/usr/bin/env python
"""Interface for packaging"""
__author__ = 'edelman@room77.com (Nicholas Edelman)'
__copyright__ = 'Copyright 2013 Room77, Inc.'
class PkgRulesInterface(object):
"""Base class for making packages"""
@classmethod
def make_package(cls, rule):
"""Generates a package
Args:
rule:... |
N = int(input())
if -(2 ** 31) <= N < 2 ** 31:
print("Yes")
else:
print("No") |
""" Create a function that returns the ASCII value of the passed in character.
Examples
ctoa("A") ➞ 65
ctoa("m") ➞ 109
ctoa("[") ➞ 91
ctoa("\") ➞ 92
"""
def ctoa(char):
return ord(char) |
def motif_and_its_rev_comp_counter(motif, sample):
counter_of_motif = 0
counter_of_res_comp_motif = 0
for i in range(len(sample)):
if sample.startswith(motif, i):
counter_of_motif += 1
comp_pairs = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
rev_comp_of_motif = ''
for i in moti... |
"""
Given a string S and a string T, count the number of distinct subsequences of T in S.
A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the
characters without disturbing the relative positions of the remaining characters. (ie, "ACE" is a subsequen... |
# → Loops
# while loop = a statement that will execute its block of code, as long as it's condition remains true
# while 1==1:
# print("Help! I'm stuck in a loop.")
# name = ""
# while len(name) == 0:
# name = input("Enter your name: ")
#
# print("Hello "+name)
# while not name:
# name = input("Enter y... |
#!/usr/bin/env python3
# coding: utf8
if __name__ == "__main__":
pass
|
def piece_wise_linear_fn(x, y_0,y_1,x_0,x_1):
'''
This fn computes y_0 + (y_1 - y_0)/(x_1-x_0)*(x - x_0),
i.e. a fn with offset y_0 and slope (y_1 - y_0)/(x_1-x_0)
before x_0 the value is returned as y_0
after x_1 the value is returned as y_1
:param y_0:
:param y_1:
:param x_0:
:para... |
class Solution:
"""
@param nums: a list of integers
@param m: an integer
@return: return a integer
"""
def splitArray(self, nums, m):
# write your code here
start, end = max(nums), sum(nums)
def doable(target):
count = 1
sum = 0
for num... |
#
# PySNMP MIB module Nortel-Magellan-Passport-VnsMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-VnsMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:19:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pytho... |
def selection_sort(ar):
n = len(ar)
for k in range(n):
minimal = k
for j in range(k + 1, n):
if ar[j] < ar[minimal]:
minimal = j
print(k, j, minimal, ar)
ar[k], ar[minimal] = ar[minimal], ar[k]
return ar
ar = [1, 5, 2, 7, 9, 6]
res = sele... |
# coding = utf-8
vis_js_template = """
<html>
<head>
<script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,... |
# Time: O(n)
# Space: O(h)
# Given the root of a binary tree, then value v and depth d,
# you need to add a row of nodes with value v at the given depth d. The root node is at depth 1.
#
# The adding rule is: given a positive integer depth d,
# for each NOT null tree nodes N in depth d-1, create two tree nodes
# with... |
""" Aprimore o desafio 86, mostrando no final:
A) A soma de todos os valores pares digitados.
B) A soma dos valores da terceira coluna.
C) O maior valor da segunda linha."""
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
ispar = mai = iscol = 0
for linha in range(0, 3):
for coluna in range(0, 3):
matriz[linha]... |
# The Nexus software is licensed under the BSD 2-Clause license.
#
# You should have recieved a copy of this license with the software.
# If you did not, you can find one at the following link.
#
# http://opensource.org/licenses/bsd-license.php
(i,j,k) = (x,y,z)
entitylist.append(["fish",(x,y,z),7,7,(i,j,k),3,False])... |
#
# PySNMP MIB module ONEACCESS-BRIDGE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-BRIDGE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:34:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
"""
OS related constants
"""
LINK_ROOT = "http://localhost:8050"
LINK_ROOT_LOGIN = "http://{}:{}@localhost:8050"
LINK_MAIN = "/"
LINK_DASHBOARD = "/dashboard"
LINK_EVOLUTION = "/evolution"
LINK_COMPARISON = "/comparison"
LINK_HEATMAPS = "/heatmaps"
LINK_PIES = "/pies"
LINK_LIQUID = "/liquid"
LINK_INVESTMENTS = "/... |
data = (
((-0.010000, -0.090000), (-0.010000, -0.040000)),
((0.589999, -0.040000), (0.730000, -0.040000)),
((0.990000, -0.980000), (0.990000, -0.840000)),
((0.630000, -0.490000), (0.630000, -0.480000)),
((-0.300000, 0.160000), (-0.250000, 0.160000)),
((0.440000, -0.190000), (0.440000, -0.240000)),
((0.150000, -0.630000... |
# -*- coding: utf-8 -*-
# @Author : LG
"""
执行用时:196 ms, 在所有 Python3 提交中击败了5.21% 的用户
内存消耗:13.6 MB, 在所有 Python3 提交中击败了86.94% 的用户
解题思路:
模拟机器人运动
"""
class Solution:
def judgeCircle(self, moves: str) -> bool:
dic = {'U': [0, 1], # 运动方向对应的坐标运动
'D': [0, -1],
'L': [-1, 0],
... |
name1 = "Atilla"
for ch in name1:
print(ch)
|
def Articles():
articles = [
{
'id': 1,
'title': 'Article one',
'body': 'O Lorem Ipsum é um texto modelo da indústria tipográfica e de impressão. O Lorem Ipsum tem vindo a ser o texto padrão usado por estas indústrias desde o ano de 1500, quando uma misturou os caracteres... |
def add_feather_vertex(location=(0.0, 0.0)):
pass
def add_feather_vertex_slide(MASK_OT_add_feather_vertex=None, MASK_OT_slide_point=None):
pass
def add_vertex(location=(0.0, 0.0)):
pass
def add_vertex_slide(MASK_OT_add_vertex=None, MASK_OT_slide_point=None):
pass
def copy_splines():
pass
d... |
#
# Copyright 2013 The Regents of The University California
# Copyright 2016 Alex Caudill
#
# 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
# ... |
"""
246. Strobogrammatic Number
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).
Write a function to determine if a number is strobogrammatic. The number is represented as a string.
Example 1:
Input: "69"
Output: true
Example 2:
Input: "88"
Output: true
Exampl... |
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
r = len(numbers)
for ind in range(r):
goal = target - numbers[ind]
l = ind
while l < r:
m = l + (r - l) // 2
if numbers[m] == goal:
... |
"""
generate table:
from matplotlib import cm
import numpy as np
_m = cm.get_cmap('jet')
gradient = np.linspace(0, 1, 256)
l = [cm.colors.to_hex(_m(c)) for c in gradient]
"""
COLORS = ['#000080', '#000084', '#000089', '#00008d', '#000092', '#000096', '#00009b', '#00009f', '#0000a4', '#0000a8',
'#0000ad', '#... |
@staticmethod
def __filter_contours(
input_contours,
min_area,
min_perimeter,
min_width,
max_width,
min_height,
max_height,
solidity,
max_vertex_count,
min_vertex_count,
min_ratio,
max_ratio,
):
"""Filters out contours that do not meet certain criteria.
Args:
... |
# mysql = {
# "name": "AdClickTool",
# "host": "dev02.cmjwzbzhppgn.us-west-1.rds.amazonaws.com",
# "port": "3306",
# "user": "root",
# "passwd": "R%LKsIJF412"
# }
mysql = {
"name": "AdClickTool",
"host": 'trackingdb02.col8oozqk3ay.us-east-2.rds.amazonaws.com',
"user": 'root',
"port":... |
# logger = logging.getLogger()
# logger.setLevel(logging.DEBUG)
"""--- Main handler --- """
def lambda_handler(event, context):
# os.environ['TZ'] = 'America/New_York'
# time.tzset()
# logger.debug('event.bot.name={}'.format(event['bot']['name']))
return dispatch(event)
def dispatch(intent_request):
intent_... |
# Title : TODO
# Objective : TODO
# Created by: Wenzurk
# Created on: 2018/2/6
alien_color = 'green'
# if alien_color == 'green':
# print("You get 5 point.")
# if alien_color == 'yellow':
# print("You are a loser.")
# if alien_color == 'green':
# print("You got 5 point.")
# else:
# print("You got... |
expected_output = {
'dir': {
'total_free_bytes': '939092 kbytes',
'files':
{'pnet_cfg.log':
{'permission': '-rw-r--r--', 'date': 'May 10 2017', 'index': '14', 'size': '10429'},
'status_file':
{'permission': '-rw-r--r--', 'date': 'May 10 13:1... |
'''
Author: your name
Date: 2021-08-16 11:00:16
LastEditTime: 2021-08-16 11:00:17
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: /lanenet-lane-detection-pytorch/local_utils/__init__.py
'''
|
produto = str(input("Nome do Produto: ")).strip()
preco = float(input("Preço do Produto? R$"))
print("Modos de Pagameento:")
print('[0] - Dinheiro: 10% de Desconto')
print('[1] - Cheque: 10% de Desconto.')
print('[2] - Cartão: 5% de Desconto.')
print('[3] - 2x no Cartão: Sem Desconto')
print('[4] - 3x ou mais no cartão... |
arr = [1,2,3,4,6,7,8,9,12,4,2,5,7,2,5,2,1,4,6,3]
# arr = [21,31,43,57,97,89,63,61,51,75,2,4,6,8,0,12,22,24,12,68,62]
print(arr)
lst = list(sorted(arr, key=lambda x: [x % 2, x]))
print(lst)
# f_idx = 0
# b_idx = len(arr) - 1
# while f_idx < b_idx:
# if arr[f_idx] % 2 != 0:
# if arr[b_idx] % 2 != 0:
# ... |
def test_str(RS, str_data):
assert RS(str_data, 0.8) != str_data
assert type(RS(str_data, 0.8)) is str
assert len(RS(str_data, 0.8, repetition=3)) == 3
def test_list(RS, list_data):
assert RS(list_data, 0.8) != list_data
assert type(RS(list_data, 0.8)) is list
assert len(RS(list_data, 0.8, rep... |
class Solution:
def minArea(self, image: List[List[str]], x: int, y: int) -> int:
m = len(image)
n = len(image[0])
dirs = [0, 1, 0, -1, 0]
topLeft = [x, y]
bottomRight = [x, y]
q = deque([(x, y)])
image[x][y] = '2' # visited
while q:
i, j = q.popleft()
for k in range(4):
... |
"""
ID: TRAN
Title: Transitions and Transversions
URL: http://rosalind.info/problems/tran/
"""
def fasta_file_parser(fasta_file_path):
"""
Parses Fasta files.
Args:
fasta_file_path {str}: path of Fasta file
Returns:
dict: list of dnas
"""
with open(fasta_file_path, 'r'... |
#@+leo-ver=5-thin
#@+node:ekr.20170428084207.353: * @file ../external/npyscreen/npysNPSFilteredData.py
#@+others
#@+node:ekr.20170428084207.354: ** class NPSFilteredDataBase
class NPSFilteredDataBase:
#@+others
#@+node:ekr.20170428084207.355: *3* __init__
def __init__(self, values=None):
self._value... |
my_dictionary = {'name': 'naeim', 'age': 33}
print(my_dictionary['name'])
print(my_dictionary['age'])
print(type(my_dictionary))
print(my_dictionary)
my_dictionary['family'] = 'nobahari'
print(my_dictionary)
for item in my_dictionary:
print(f"your {item} is {my_dictionary[item]}")
del my_dictionary['family']
pri... |
'''
There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.
The cost of painting each house with a certain color is represented by a n x k c... |
"""
Inverting Keys & Values
"""
# Invert dict1 - make the current keys into values and the current values into keys.
dict1 = { "k1" : "v1", "k2" : "v2", "k3" : "v1" }
|
''' 007 Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média '''
nota1 = float(input('Digite a nota 1: '))
nota2 = float(input('Digite a nota 2: '))
print(f'A média é: {(nota1 + nota2)/2:.2f}') |
############################################################
# from django.urls import path, include
############################################################
app_name = "adventure"
urlpatterns = []
|
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def helper(self, node, cur_sum):
if not node.left and not node.right:
self.ans += cur_sum*2 + node.val
... |
#declaration of x
x = "There are %d types of people." % 10
#declaration of a variable
binary = "binary"
#here it is also a variable
do_not = "don't"
#declaretion of y
y = "Those who know %s and those who %s." % (binary,do_not)
# it prints x
print (x + y)
# it prints y
print ("hello '%s' hi" % y) |
class Bracket:
def __init__(self, round16):
self.round16 = round16
self.quarters = [None] * 8
self.semis = [None] * 4
self.finals = [None] * 2
self.thirdPlaceMatch = [None] * 2
# results
self.champion = [None] * 1
self.runnerUp = [None] * 1
sel... |
input = """
8 2 2 3 0 0
6 0 2 0 2 3 1 2
0
3 b
2 a
0
B+
0
B-
1
0
1
"""
output = """
COST 1@1
"""
|
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param: he... |
#Python 3.X solution for Easy Challenge #0008
#GitHub: https://github.com/Ashkore
#https://www.reddit.com/user/Ashkoree/
string = " bottles of beer on the wall, take one down, pass it around."
bottles = 99
for x in range(bottles+1):
print (str(bottles-x)+string)
#Extra Credit ??
newstring = ""
for x in range(bott... |
# DO NOT SHARE YOUR CREDENTIALS
# Login into your Spotify developer account at https://developer.spotify.com.
# Create an app and visit the Dashboard, go to the app's overview to retrieve the 'Client ID' and 'Client Secret' values.
# Put these values into the variables below.
client_id = ''
client_secret = ''
usernam... |
# Python Variables
# Variables
# Variables are containers for storing data values.
# Creating Variables
# Python has no command for declaring a variable.
# A variable is created the moment you first assign a value to it.
# Example
x = 5
y = "John"
print(x)
print(y)
# Variables do not need to be declared with any par... |
class Solver:
@staticmethod
def create(board):
return Solver(board)
def __init__(self, board):
self._board = board
def solve(self):
return self._tryToPlaceValidQueen(self._board)
def _tryToPlaceValidQueen(self, solution):
columns = self._getNonThreatenedList(solut... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
def get_rate(compressed_binary, uncompressed_bits):
"""
获取压缩率
计算公式: 压缩后的体积/压缩前的体积
"""
return len(compressed_binary) * 100 / uncompressed_bits
|
def export_tomo_scan_legacy(h, fpath=None):
if fpath is None:
fpath = './'
else:
if not fpath[-1] == '/':
fpath += '/'
scan_type = "tomo_scan"
scan_id = h.start["scan_id"]
try:
x_eng = h.start["XEng"]
except:
x_eng = h.start["x_ray_energy"]
bkg_i... |
{
"name": "SISVAC Appointments",
"description": """
SISVAC Appointments
""",
"author": "OPTIC, Kevin Jiménez",
"website": "http://optic.gob.do",
"category": "Uncategorized",
"version": "0.1",
"depends": [
"base",
"stock",
"calendar",
"base_rest",
... |
class Options:
def __init__(self, *, filename: str, collapse_single_pages: bool, strict: bool):
self.filename = filename
self.collapse_single_pages = collapse_single_pages
self.strict = strict
|
__all__ = [
'Mouse',
'Render'
]
|
METRICS = ['cityblock', 'euclidean']
NORMALIZE = 'gaussian'
SUB_SAMPLE = 64_000 # for testing the implementation
MAX_DEPTH = 50 # even though no dataset reaches this far
|
#Leia um numero e mostre seu dobro, triplo e raiz quadrada
n = int(input('Digite um numero: '))
print('O número é: {}'.format(n))
print('O dobro é: {}'.format(n*2))
print('O triplo é: {}'.format(n*3))
print('A raiz quadrada é: {}'.format(n**(1/2)))
|
"""
"""
def authenticate(username):
return 'm:auth:' + username
def get_user(user_id):
return 'm:geus:' + str(user_id)
def has_account(username):
return 'm:haac:' + username
|
# from ..package1 import module1a ValueError: attempted relative import beyond top-level package
def func2a():
print('2a')
|
configs = {
'camera_res': (320, 240),
'crop_top' : 2/6,
'crop_bot' : 5/6,
'exposure' : 3,
'CSIexposure' : 3000,
'CSIframerate': 90
}
cropped_vres = int(configs['camera_res'][1]*(configs['crop_bot'])) - int(configs['camera_res'][1]*(configs['crop_top']))
configs['output_res'] = (configs['ca... |
headPort = "COM5"
i01 = Runtime.createAndStart("i01", "InMoov")
mouthControl=i01.startMouthControl("COM5")
head = i01.startHead(headPort)
leftArm = i01.startLeftArm(headPort)
leftHand = i01.startLeftHand(headPort)
headTracking = i01.startHeadTracking("COM5")
eyesTracking= i01.startEyesTracking("COM5")
i01.headTrac... |
def method1(n: int) -> int:
'''Return a list of prime factors of an integer by
first checking if the modulo of the value of d and number is equal to 0.
Then applying the for loop inside the for loop to count a factor only once.
'''
divisors = [d for d in range(2, n // 2 + 1) if n % d == 0]
retu... |
class Solution:
def totalNQueens(self, n: int) -> int:
def backtrack(row, cols, diagonals, antiDiagonals):
if row == n:
return 1
solutions = 0
for col in range(n):
currentDiagonal = row - col
currentAntiDiagonal = row + col
... |
s = '''en;q=0.8, de;q=0.7, fr-CH, fr;q=0.9, *;q=0.5'''
accept_language = AcceptLanguage(s)
pobj(accept_language.sarr)
pobj(accept_language.darr)
accept_language.header_type
accept_language.forbidden_header_name
accept_language.cros_safelisted_request_header
accept_language.qsort()
accept_language.rm_locale("CH")
acce... |
# Python Program to Calculate Sum of Odd Numbers from 1 to 20
maxnum = 20
oddadd = 0
for num in range(1, maxnum + 1):
if num % 2 != 0:
#print("odd number :",num)
oddadd=oddadd+num
print("Sum of Odd Number from 1 to 20 is:",oddadd)
|
#!/usr/bin/env python
NAME = 'Naxsi'
def is_waf(self):
return self.match_header(('X-Data-Origin', '^naxsi'))
|
# Copyright (c) The Libra Core Contributors
# SPDX-License-Identifier: Apache-2.0
class Database:
""" The interface that underlying database should implement """
def get(self, prefix, key):
""" Given a prefix and key, return the value in db """
return NotImplementedError() # pragma: no cover... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.