content stringlengths 7 1.05M |
|---|
"""
Helper functions for Bounding boxs
==================================
.. autosummary::
:toctree: ../generated/
set_buffer_on_gdf
"""
def set_buffer_on_gdf(
gdf, buffer=50, convex_hull=True, to_epsg_=True, epsg_="EPSG:3857"
):
"""
Set buffer and simplify (convexhull) geometry.
Parameters... |
"""
file: list_mode_data_mask.py
brief: Defines data masks for all frequencies, bit resolutions, and revisions
author: S. V. Paulauskas
date: January 16, 2019
"""
class ListModeDataMask:
""" Defines data masks used to decode data from XIA's Pixie-16 product line. """
def __init__(self, frequency=250, firmwar... |
# player names are used as id.
PLAYERS = ['Ronaldo', 'Zidan', 'Raul', 'Beckham', 'Figo', 'Carlos']
# default values for trueskill calculator
# I made this (50, 16.33)
# even though trueskill's originals are (25, 8.33)
# because it ranges 0-100, it's more intuitive and natural I think.
MEAN = 50
STDDEV = 16.3333
... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 16:23:59 2019
@author: DevTequilaUser
Practica 3: Cadenas
"""
nombre = "Luis Cobian"
print(nombre)
mi_bio = """INSTITUTO TECNOLOGICO
DOCENTE PTC
INFORMATICA"""
print(mi_bio)
#Formas de concatenar cadenas
cade1 = "cadena"
cade2 = 'xxxxxx'
#Primera forma
unidos = "Es... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... |
# -*- coding: utf-8 -*-
# *******************************************************
# Copyright (c) VMware, Inc. 2020-2021. All Rights Reserved.
# SPDX-License-Identifier: MIT
# *******************************************************
# *
# * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
# * WARRANTIES OR C... |
## params ##
nNodes = 5
nTraders = 2000
nGenesis = 4
nAddresses = nTraders
nMaxConfTerms = 100
nMaxConfVertices = 35
tSimtime = 100 # sec
tPow = 0.00 # sec
tNodeNetwork = 0.2 # sec
tHttpRequest = 0.2 # sec
tUnitVal = 0.003 # sec
tUnitValVar = 10 ** -7 # sec
tConfCycle = 1.0 # sec
tBroad = 0.01 # sec
rTxRate = 50 #
r... |
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
class AnimalsidService:
"""
auto-generated. don't touch.
"""
@staticmethod
def _get_methods():
return (("animalsid_get", ""),)
def __init__(self, client):
self.client = client
def animalsid_g... |
class Person:
"This is a person class"
age = 10
def greet(self):
print("Hello")
# Output: 10
print(Person.age)
# Output: <function Person.greet>
print(Person.greet)
# Output: "This is a person class"
print(Person.__doc__)
|
positive_words = {
"a+",
"abound",
"abounds",
"abundance",
"abundant",
"accessable",
"accessible",
"acclaim",
"acclaimed",
"acclamation",
"accolade",
"accolades",
"accommodative",
"accomodative",
"accomplish",
"accomplished",
"accomplishment",
"acc... |
class Device:
def __init__(self, name, ise_id, address, device_type):
self.name = name
self.ise_id = ise_id
self.address = address
self.device_type = device_type
def get_name(self):
return self.name
def get_ise_id(self):
return self.ise_id
def get_addre... |
c.TemplateExporter.exclude_input = True
c.Exporter.preprocessors = ['literacy.Execute']
#c.Exporter.preprocessors = ['literacy.template.Execute'] |
#Faça um Programa que peça dois números e imprima o maior deles.
print('\033[4m Digite dois número para saber qual dele é o maior\033[4m')
n1 = int(input('\033[0;34mDigite um número:\n\033[0;34m'))
n2 = int(input('\033[0;31mDigite outro número:\n\033[0;31m'))
if n1 > n2:
print('{} é o maior'.format(n1))
else:
p... |
class Crc8:
def __init__(s):
s.crc=255
def hash(s,int_list):
for i in int_list:
s.addVal(i)
return s.crc
def addVal(s,n):
crc = s.crc
for bit in range(0,8):
if ( n ^ crc ) & 0x80:
crc = ( crc << 1 ) ^ 0x31
else:
... |
class Service:
@staticmethod
def ulr_identification(user_data):
url = user_data["url"]
return url
@staticmethod
def location(user_data):
lat = user_data["lat"]
lon = user_data["lon"]
return lat, lon
|
# Chapter05_01
# Python Function
# Python Function and lambda
# How to defeine Function
# def function_name(parameter):
# code
# Ex1
def first_func(w):
print('Hello, ', w)
word = 'Goodboy'
first_func(word)
# Ex2
def return_func(w1):
value = 'Hello, ' + str(w1)
return value
x = return_func('Goodb... |
class DistcoveryException(Exception):
def __init__(self, **kwargs):
super(DistcoveryException, self). \
__init__(self.template % kwargs)
class NoMoreAttempts(DistcoveryException):
template = 'Coudn\'t create unique name with %(length)d ' \
'digit%(length_suffix)s in %(limit)d... |
__all__ = ["COMPRESSIONS"]
COMPRESSIONS = {
# gz
".gz": "gz",
".tgz": "gz",
# xz
".xz": "xz",
".txz": "xz",
# bz2
".bz2": "bz2",
".tbz": "bz2",
".tbz2": "bz2",
".tb2": "bz2",
# zst
".zst": "zst",
".tzst": "zst",
}
|
def count_1478(digits, output):
sum = 0
if len(digits) == 10 and len(output) == 4:
digit_sets = [set()] * 10
for digit in digits:
if len(digit) == 2:
digit_sets[1] = set(digit)
elif len(digit) == 3:
digit_sets[7] = set(digit)
el... |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysnmp/license.html
#
# PySNMP MIB module SNMP-NOTIFICATION-MIB (http://snmplabs.com/pysnmp)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/SNMP-NOTIFICATION-MIB
# Produced by pysmi-0.... |
input = """
c num blocks = 1
c num vars = 180
c minblockids[0] = 1
c maxblockids[0] = 180
p cnf 180 785
-119 50 -67 0
-114 -178 170 0
100 81 119 0
-8 37 77 0
60 -10 164 0
4 -120 -175 0
-134 40 -165 0
178 -135 1 0
-7 -175 -9 0
107 -24 -92 0
-24 -171 133 0
135 -10 -63 0
-121 -165 108 0
83 -173 168 0
14 171 89 0
-55 82 13... |
# Created by MechAviv
# Map ID :: 620100043
# Ballroom : Lobby
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.sendDelay(3000)
sm.showEffect("Effect/DirectionNewPirate.img/newPirate/balloonMsg2/6", 2000, 130, 0, 10, -2, True, 0)
sm.sendDelay(1000)
sm.setSp... |
"""Reshape layer"""
class ReshapeLayer():
def __init__(self, input_shape, output_shape):
"""
Apply the reshape operation to the incoming data
Args:
num_input: size of each input sample
num_output: size of each output sample
"""
self.input_shape = input_shape
self.output_shape = output_sha... |
#
# PySNMP MIB module RUCKUS-SZ-EVENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RUCKUS-SZ-EVENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:59:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
def tmpCount(sumN, l):
digit, i = 0, 0
while l:
... |
def f(c):
for i in [1, 2, 3]:
if c:
x = 0
break
else:
x = 1
return x #pass
|
__author__ = 'rolandh'
ENTITYATTRIBUTES = "urn:oasis:names:tc:SAML:metadata:attribute&EntityAttributes"
def entity_categories(md):
res = []
if "extensions" in md:
for elem in md["extensions"]["extension_elements"]:
if elem["__class__"] == ENTITYATTRIBUTES:
for attr in elem... |
def convert(text, mappings):
""" Convert the text using the mapping given """
if hasattr(mappings, 'items'):
return _convert(text, mappings)
else:
for mapping in mappings:
text = _convert(text, mapping)
return text
def _convert(text, mapping):
... |
#!usr/bin/python3
# Filename: break.py
while True: # Fakes R's repeat loop
s = (input('Enter something: '))
if s == 'quit': # Provide condition to end the loop
break
print('Length of the string is ', len(s))
print('Done') |
task_definition = """
{{
"family":"{queue_name}",
"executionRoleArn":"{EXECUTION_ROLE_ARN}",
"networkMode":"awsvpc",
"containerDefinitions":[
{{
"name": "{container_name}",
"image": "{WORKER_IMAGE}",
"essential": True,
"environment": [
... |
class ICloneable:
""" Supports cloning,which creates a new instance of a class with the same value as an existing instance. """
def Clone(self):
"""
Clone(self: ICloneable) -> object
Creates a new object that is a copy of the current instance.
Returns: A new object that is a copy of this ins... |
class Collection:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
ber_over_snr = Collection(
bits_per_slot=440,
slot_per_frame=1,
give_up_value=1e-6,
# How many bits to aim for at give_up_value
certainty=20,
# Stop early at x number of errors. Make sure to scale togethe... |
# Copyright 2019 Google LLC.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
class Solution:
# Max Sum LC (Accepted), O(m * n) time, O(m) space
def maximumWealth(self, accounts: List[List[int]]) -> int:
return max(sum(row) for row in accounts)
# Max Map Sum (Top Voted), O(m * n) time, O(m) space
def maximumWealth(self, accounts: List[List[int]]) -> int:
return m... |
GSTR_APPFOLDER = 1
GSTR_CONFOLDER = 2
GSTR_LANFOLDER = 3
GSTR_TEMFOLDER = 4
GSTR_CE_FILE = 5
GSTR_CONF_FILE = 6
GSTR_LOC_FILE = 7
GSTR_SSET_FILE = 8
GSTR_LOCX_FILE = 9
GSTR_CEX_FILE = 10
GSTR_CONFX_FILE = 11
GSTR_TZ_FILE = 12
GSTR_COUNTRY_FILE = 13
GSTR_TEXT_FILE = 14
GSTR_TIPS_FILE = 15
GSTR_HELP_FILE = 16
|
# -*- coding: utf-8; -*-
#
# @file descriptorstypes.py
# @brief Setup the types of descriptors.
# @author Frédéric SCHERMA (INRA UMR1095)
# @date 2017-01-03
# @copyright Copyright (c) 2017 INRA/CIRAD
# @license MIT (see LICENSE file)
# @details
DESCRIPTORS = {
'acronym_1': {
'id': None,
'name': 'a... |
text = input('digite algo')
print('O tipo primitivo desse valor é ', type(text))
print('Só tem espaços?', text.isspace())
print('É um número?', text.isnumeric())
print('É alfabético?', text.isalpha())
print('É alfanumerico?', text.isalnum())
print('Está em Maiúscula?', text.isupper())
print('Está em Minuscula?... |
""" https://leetcode.com/problems/container-with-most-water
Examples:
>>> Solution().maxArea([])
0
See Also:
- pytudes/_2021/leetcode/hard/_42__trapping_rain_water.py
"""
class Solution:
def maxArea(self, height: list[int]) -> int:
return compute_max_area(height)
def compute_max_area(heig... |
"""Dicts for different Trees that can be drawn by the SpaceTurtle (not all work properly yet)"""
DRAGON ={
"A":"F",
"D": 10,
"S":5,
"AN":90,
"R": {
"F": "F+G",
"G": "F-G"
}
}
PLANT ={
"A":"X",
"D": 5,
"S": 5,
"AN":25,
"R": {
"X": "F+[[X]-X]-... |
bind_to = 'localhost'
port = 8001
client_id = 'INSERT GOOGLE CLIENT ID'
|
# like a version, touched for the very first time
version = '0.2.10'
# definitions for coin types / chains supported
# selected by sqc.cfg['cointype']
ADDR_CHAR = 0
ADDR_PREFIX = 1
P2SH_CHAR = 2
P2SH_PREFIX = 3
BECH_HRP = 4
BLKDAT_MAGIC = 5
BLKDAT_NEAR_SYNC = 6
BLK_REWARD = 7
HALF_BLKS = 8
coin_cfg = {
'bitcoin... |
#!/usr/bin/python3
# https://practice.geeksforgeeks.org/problems/pairs-of-prime-number/0
def getPrimes(n):
primes = [True]*(n+1)
primes[0] = False
primes[1] = False
i=2
while i*i<=n:
if primes[i]:
for j in range(2*i, n+1, i):
primes[j] = False
i+=1
... |
class Solution:
def wordBreak(self, s: str, wordDict: List[str]) -> List[str]:
if not s or not wordDict or len(wordDict) == 0:
return []
return self.dfs(s, wordDict, {})
def dfs(self, s: str, wordDict: List[str], memo: dict[str, List[str]]) -> None:
if s in memo:
... |
class Coordenada:
def __init__(self, x, y):
self.x = x
self.y = y
def distancia(self, otro_cordenada):
x_diff = (self.x - otro_cordenada.x)**2
y_diff = (self.y - otro_cordenada.y)**2
return (x_diff + y_diff)**0.5
if __name__ == '__main__':
coord1 = Coordenada(... |
ENV = "BipedalWalker-v2"
LOAD = True
DISPLAY = True
DISCOUNT = 0.99
FRAME_SKIP = 4
EPSILON_START = 0.1
EPSILON_STOP = 0.05
EPSILON_STEPS = 25000
ACTOR_LEARNING_RATE = 1e-3
CRITIC_LEARNING_RATE = 1e-3
# Memory size
BUFFER_SIZE = 100000
BATCH_SIZE = 1024
# Number of episodes of game environment to train with
TRA... |
class MessageTooLong(Exception):
pass
class MissingAttributes(Exception):
def __init__(self, attrs):
msg = 'Required attribute(s) missing: {}'.format(attrs)
super().__init__(msg)
class MustBeBytes(Exception):
pass
class NoLineEnding(Exception):
pass
class StrayLineEnding(Exceptio... |
# SPDX-FileCopyrightText: 2021 Jean-Sébastien Dieu <jean-sebastien.dieu@cfm.fr>
#
# SPDX-License-Identifier: MIT
def test_list_head_resources_on_all_metrics(monitor, gen):
# Lets generate 200 metrics
c, s = gen.new_context(), gen.new_session()
for i in range(200):
mem = abs(100 - i) * 100
... |
deg, dis = map(int, input().split())
dirs = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]
wps = [2, 15, 33, 54, 79, 107, 138, 171, 207, 244, 284, 326]
w = 0
for n in wps:
if int(dis/6 + 0.5) > n:
w += 1
dir = dirs[(deg * 10 + 1125) % 36000 // 2250] ... |
class SearchRunsIterator:
"""
Usage:
runs = SearchRunsIterator(client, exp.experiment_id, max_results)
for run in runs:
print(run)
"""
def __init__(self, client, experiment_id, max_results=1000, query=""):
self.client = client
self.experiment_id = experiment_... |
class Node:
def __init__(self, data) -> None:
self.data = data
self.next = None
class LinkedList:
def __init__(self) -> None:
self.head = None
def push(self, data):
New_node = Node(data)
New_node.next = self.head
self.head = New_node... |
# -*- coding: utf-8 -*-
"""
>>> from pycm import *
>>> from matplotlib import pyplot as plt
>>> import seaborn as sns
>>> y_act = [0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2]
>>> y_pre = [0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,2,0,1,2,2,2,2]
>>> cm = ConfusionMatrix(y_act,y_pre)
>>> ax = cm.plot()
>>> ax.ge... |
class StakeHolderDetails:
def __init__(self, blockchain_id, staker, amount_staked, reward_amount, claimable_amount, refund_amount,
auto_renewal, block_no_created):
self.__blockchain_id = blockchain_id
self.__staker = staker
self.__amount_staked = amount_staked
self._... |
'''
Tipo Numérico
Exemplo:
numero = "15"
numero = 15
Exemplo:
numero_1 = 10
numero_2 = "15"
numero_3 = numero_1 + numero_2
print(numero_3)
Exemplo:
numero_1 = 10
numero_2 = "15"
print(type(numero_1))
print(type(numero_2))
'''
num = 1_000_000
print(num)
# Podemos converter float para inteiros:
num = 1_000_... |
expected_output = {
'active_query': {
'periodicity_mins': 30,
'status': 'Enabled'
},
'mdns_gateway': 'Enabled',
'mdns_query_type': 'ALL',
'mdns_service_policy': 'default-mdns-service-policy',
'sdg_agent_ip': '10.1.1.2',
'service_instance_suffix': 'N... |
n=[]
t=[]
nome=""
while(nome!="fim"):
nome=input("Digite um nome: ")
if(nome!="fim"):
n.append(nome)
t.append(input("Digite o telefone: "))
tamanhoDaLista=len(n)
print(n)
print(t)
print(tamanhoDaLista)
print(n[-1]) #de tras pra frente |
class Solution:
def isValid(self, pos):
if(pos[0] >= self.matrix_row or pos[1] >= self.matrix_col):
return False
return True
def get_all_path_to_goal(self, matrix, st):
self.matrix_row = len(matrix)
self.matrix_col = len(matrix[0])
self.matrix = matrix
... |
"""
author : Ali Emre SAVAS
Link : https://www.hackerrank.com/challenges/py-set-add/problem
"""
if __name__ == "__main__":
counter = int(input())
countries = set()
for _ in range(counter):
countries.add(input())
print(len(countries))
|
class ListNode:
def __init__(self, val: int, prev_node=None, next_node=None):
self.val = val
self.prev_node = prev_node
if self.prev_node:
self.prev_node.next_node = self
self.next_node = next_node
if self.next_node:
self.next_node.prev_node = self
... |
class VerificationModel(object):
def __init__(self, password, mail, code):
self.Password = password
self.Mail = mail
self.CodeUtilisateur = code
|
#!/usr/bin/env python3.6
#Author: Vishwas K Singh
#Email: vishwasks32@gmail.com
# Program: A Simple module with some problematic test code
# Listing10.3
# hello3.py
def hello():
print('Hello, world!')
# A test:
hello()
|
def success_get_stats(user):
return f"✅ Successfully get stats.\n\n👤 Id: {user.get_id()}\n" \
+ f"🤡 Username: {user.get_name()}\n🪙 Balance: {user.get_balance()}"
def fail_error_occurred():
return "❌ An error occurred while trying to get your stats."
def fail_not_registered_user():
return "❌ Y... |
def extractAnonanemoneWordpressCom(item):
'''
Parser for 'anonanemone.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('tmpw', 'The Man\'s Perfect Wife', ... |
def square(n):
print("Square of ",n,"is",(n*n))
def cude(n):
print("Cube of ",n,"is",(n*n*n))
cude(3)
square(4) |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 GEO Secretariat.
#
# geo-knowledge-hub-ext is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""GEO Knowledge Hub Record Service"""
|
#!/usr/bin/env python
def pie_percent(n):
"""
:param n: int
:return: int
precodition: n >0
"""
return int(100 / n )
print(pie_percent(3))
print(pie_percent(2))
print(pie_percent(5)) |
name_and_hp = '''SELECT name, hp
FROM charactercreator_character;'''
# More queries to go here below
|
dummy_papers = [
{
"abstract": "This is an abstract.",
"authors": ["Yi Zhu", "Shawn Newsam"],
"category": "cs.CV",
"comment": "WACV 2017 camera ready, minor updates about test time efficiency",
"img": "/static/thumbs/1612.07403v2.pdf.jpg",
"link": "http://arxiv.org/ab... |
"""Ceaser Cipher
This is a fun little module that implements encryption/decryption using
the Ceaser cipher. The purpose of which is to
Example:
First import the ceasercipher module, then...
ceaser = CeaserCipher()
cipher = ceaser.ceaser(>0, plain)
plain = ceaser.ceaser(<0, cipher)
... |
#!/usr/bin/python3
count = 0
i = 2
while i < 100:
k = i/2
j = 2
while j <= k:
k = i % j
if k == 0:
count = count - 1
break
k = i/2
j = j + 1
count = count + 1
i = i + 1
print(count)
|
# Databricks notebook source
# MAGIC %md
# MAGIC # Schema Evolution
# MAGIC
# MAGIC 😲 The health tracker changed how it records data, which means that the
# MAGIC raw data schema has changed. In this notebook, we show how to build our
# MAGIC streams to merge the changes to the schema.
# MAGIC
# MAGIC **TODO** *Disc... |
class Dataset(object):
"""
这是一个数据集基类。
你需要重写的方法是:
args()
args里应当包含self._MISSION_LIST的定义,指定数据集可以执行的任务。
"""
def __init__(self, *args, **kwargs):
self.INPUT_SHAPE = ()
self.NUM_CLASSES = 0
self._list = ['mission', 'NUM_TRAIN', 'NUM_TEST', 'NUM_VAL', 'NUM_CLASSES', 'INPUT_SHAPE... |
"""
A module for storing utility math functions.
"""
def mean(data):
"""
Calculate the average value in a numeric list
"""
_data = list(data)
length = len(_data)
if length > 0:
return sum(_data)/length
else:
return 0
|
class IAMUsers():
def __init__(self, iam):
self.client = iam
# User methods
def _users_marker_handler(self, marker=None):
if marker:
response = self.client.list_users(Marker=marker)
else:
response = self.client.list_users()
return response
def _... |
"""
Dictionaries are Python's implementation of associative arrays.
There's not much different with Python's version compared to what
you'll find in other languages (though you can also initialize and
populate dictionaries using comprehensions just like you can with
lists!).
The docs can be found here:
https:/... |
"""
File: transformation.py
Purpose: Base class for tranformation classes.
"""
class Transformation(object):
def __init__(self):
pass
|
# 성실한 개미
checkerboard = [[0 for j in range(10)] for i in range (10)]
count = 0
for i in range(10): # 10번 반복
row = map(int, input().split())
for point in row:
checkerboard[i][count] = point
count += 1
count = 0
x, y = 1, 1
while(True):
if checkerboard[x][y]==2: # 현 위치가 2일 경우
... |
'''
Leia 3 valores inteiros e ordene-os em ordem crescente.
No final, mostre os valores em ordem crescente, uma linha em branco e em seguida, os valores na sequência como foram lidos.
'''
values = str(input(''))
value = values.split(' ')
lous = [int(value[0]), int(value[1]), int(value[2])]
lista = [int(value[0]),int(... |
# https://www.beecrowd.com.br/judge/pt/problems/view/1043
'''
Leia 3 valores reais (A, B e C) e verifique se eles formam ou não um triângulo. Em caso positivo, calcule o perímetro do triângulo e apresente a mensagem:
Perimetro = XX.X
Em caso negativo, calcule a área do trapézio que tem A e B como base e C como a... |
{
"targets":
[
{
"target_name": "SpatialHashing",
"sources": ["src/SpatialHashing/SpatialHashing.cc"]
}
]
}
|
def is_prime(n):
cnt=2
if n<=1 :
return 0
if n==2 or n==3:
return 1
if n%2==0 or n%3==0:
return 0
if n<9:
return 1
counter=5
while(counter*counter<=n):
if n%counter==0:
return 0
if n%(counter+2)==0:
return... |
class Question:
def __init__(self, text, category):
self.__question_text = text
self.__question_category = category
@property
def question_text(self):
return self.__question_text
@question_text.setter
def question_text(self, value):
self.__question_text = value
... |
class FailureSummary(object):
def __init__(self, protocol, ctx, failed_method, reason):
self.__protocol = protocol
self.is_success = False
self.is_failure = True
self.ctx = ctx
self.__failed_method = failed_method
self.__failure_reason = reason
def failed_on(self... |
class Solution:
def generate(self, numRows: int) -> List[List[int]]:
triangle = []
for row_num in range(numRows):
row=[None for _ in range(row_num+1)]
row[0],row[-1]=1,1
for j in range(1,len(row)-1):
row[j]=triangle[r... |
print("Hello World!!")
print()
print('-----------------------')
print()
print(note := 'python supports break and continue')
print(note := 'Below loop will stop when i = 5')
for i in range(1, 11):
# we can do comparison like below
if i % 5 == 0:
print(note := 'we have found a multiple of 5')
print(i)
print(no... |
#Desenvolva um programa que leia seis números inteiros e mostre a soma
# apenas daqueles que forem pares. Se o valor digitado for ímpar, desconsidere-o.
n = []
s = 0
for x in range(0, 6):
n.append(int(input('Digite o {} valor: '.format(x+1))))
print(n)
for x in range(0, 6):
if n[x] % 2 == 0:
s += n[x]
p... |
# -*- coding: utf-8 -*-
def info_path(owner_id):
return 'data/photos_{}.csv'.format(owner_id)
|
furryshit = ["Rawr x3",
"nuzzles",
"how are you",
"pounces on you",
"you're so warm o3o",
"notices you have a bulge o:",
"someone's happy :wink:",
"nuzzles your necky wecky~ murr~",
"hehehe rubbies your bulgy wolgy",
"you're so big :oooo ",
"rubbies more on your bulgy w... |
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
搜索旋转排序数组,但是数组中可以有重复
"""
if not nums:return False
return self.binarySearch(nums,target,0,len(nums)-1)
def binarySearch(self,nums... |
WORKING_DIR_PATH_FULL = '/Users/hitesh/Documents/workspace/JARVIS/'
SAVED_FILES_DIR_FULL_PATH = WORKING_DIR_PATH_FULL + 'saved_files/'
NER_DIR_FULL_PATH = SAVED_FILES_DIR_FULL_PATH + 'ner/'
NER_TRAINING_FILE_PATH_FULL = NER_DIR_FULL_PATH + 'NER_token_training.tsv'
NER_PROPERTY_FILE_PATH_FULL = NER_DIR_FULL_PATH + 'NE... |
#! /usr/bin/python3
param_list = [
{
'task': 'train',
'boosting_type': 'gbdt',
'objective': 'binary',
'metric': {'auc'},
'train_metric': True,
'num_leaves': 63,
'lambda_l1': 0,
'lambda_l2': 1,
# 'min_data_in_leaf': 100,
'min_child_weight': 50,
'learning_rate': 0.1,
'feat... |
# -*- coding: utf-8 -*-
"""
The UI for opalescence is implemented in this package.
Currently, only a cli is provided.
"""
|
"""
You are going to be given an array of integers. Your job is to take that array and find an index N where the sum of
the integers to the left of N is equal to the sum of the integers to the right of N. If there is no index that
would make this happen, return -1.
For example:
Let's say you are g... |
def prime_num(n,prime):
while(True):
for a in range(2,n):
if n%a==0:
n+=1
prime_num(n,prime);
else:
print(n)
prime.append(n)
if len(prime)==10:
break
n=2
prime=[]
prime_num(n,prime);
|
expected_output = {
"svl_info": {
1: {
"link_status": "U",
"ports": "HundredGigE1/0/26",
"protocol_status": "R",
"svl": 1,
"switch": 1,
}
}
}
|
#CvModName.py
modName = "BUG Mod"
displayName = "BUG Mod"
modVersion = "4.4 [Build 2220]"
civName = "BtS"
civVersion = "3.13-3.19"
def getName():
return modName
def getDisplayName():
return displayName
def getVersion():
return modVersion
def getNameAndVersion():
return modName + " " + modVe... |
#
# PySNMP MIB module CISCO-CCM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CCM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:35:23 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... |
#!/usr/bin/env python
'''
Event class and enums for Mission Editor
Michael Day
June 2014
'''
#MissionEditorEvents come FROM the GUI (with a few exceptions where the Mission Editor Module sends a message to itself, e.g., MEE_TIME_TO_QUIT)
#MissionEditorGUIEvents go TO the GUI
#enum for MissionEditorEvent types
MEE_READ_... |
l = int(input("Enter number of lines: "))
for i in range (1, l+1):
for z in range(1, i + 1):
print(z, end = " ")
print() |
def simple_operations(a1: torch.Tensor, a2: torch.Tensor, a3: torch.Tensor):
# multiplication of tensor a1 with tensor a2 and then add it with tensor a3
answer = a1 @ a2 + a3
return answer
# add timing to airtable
atform.add_event('Coding Exercise 2.2 : Simple tensor operations-simple_operations')
# Computing ... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: flat
class BoostOption(object):
Normal_Boost = 0
Unlimited_Boost = 1
Slow_Recharge = 2
Rapid_Recharge = 3
No_Boost = 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.