content stringlengths 7 1.05M |
|---|
"""
In Central_Phila.gdb
Use an UpdateCursor to update any Parks 'ADDRESS' records ending in PWY or BLD to PKWY or BLVD
"""
# Import modules
# Set variables
# Execute operation
|
class ConfigFileNotFoundError(Exception):
"""Denotes failing to find configuration file."""
def __init__(self, message, locations, *args):
self.message = message
self.locations = ", ".join(str(l) for l in locations)
super(ConfigFileNotFoundError, self).__init__(message, locations,
... |
class Node:
def __init__(self, value, adj):
self.value = value
self.adj = adj
self.visited = False
def dfs(graph):
for source in graph:
source.visited = True
dfs_node(source)
def dfs_node(node):
print(node.value)
for e in node.adj:
if not e.visited:
... |
class Cuenta():
def __init__(self, nombre, saldo):
self.nombre=nombre
self.saldo=saldo
def get_ingreso(self):
ingresos=self.saldo + 100
return ingresos
def get_reintegro(self):
reintegro=self.saldo-300
return reintegro
def get_transferencia(self):
... |
class MessageDispatcher:
def __init__(self):
self._bacteria = []
self.message_uid = 1
def broadcast(self, message):
message.uid = self.message_uid
#print('-- {} Broad casting for agent# {}'.format(message.uid, message.sender.uid))
self.message_uid += 1
for bact... |
# Takes a solution of size n, and returns the candidates of size N + 1.
def join(solutionN):
k = len(solutionN[0]) - 1
candidatesN = set()
currentItem = []
currentItemCount = 0
nextItem = 1
for i in range(len(solutionN)):
for j in range(nextItem, len(solutionN) ):
# Checki... |
#!/usr/local/bin/python3
class Cpu():
def __init__(self, components):
self.components = [ tuple([int(x) for x in component.strip().split("/")]) for component in components ]
self.validBridges = self.__generateValidBridges(0, self.components)
def __generateValidBridges(self, port, components, b... |
def create_log_file(fname, optimization_method, directions, nodes, step, method_dd, method_ds_db, method_d2s_db2,
method_jacobian, method_hessian, e_dd, e_ds_db, ex_d2s_db2, ey_d2s_db2, e_jacobian,
ex_hessian, ey_hessian):
format1 = "# {:71}: {}\n"
format2 = "# {:71}: {:... |
class Node:
def __init__(self, element):
self.item = element
self.next_link = None
class QueueLL:
def __init__(self):
self.head = None
def is_empty(self):
if self.head is None:
print("Error! The queue is empty!")
return True
else:
... |
"""
Crie um programa que tenha a função leiaInt(),
que vai funcionar de forma semelhante a função input() do Python
só que fazendo a validação para aceitar apenas um valor numérico. Ex: n = leiaInt(‘Digite um n: ‘)
"""
# guardar valor dentro de uma vriavel, dica: ler como string
def leia_int(msg):
while True:
... |
def simulateSeats(seats):
#output seats
new_seats = []
# seat_n
# seat_ne
# seat_e
# seat_se
# seat_s
# seat_sw
# seat_w
# seat_nw
for i, seat_row in enumerate(seats):
for j, seat in enumerate(seats[i]):
print(" i : " + str(i) + " j : "+ str(j) + " seat :... |
# General system information
system_information = {
"SERVICE": "wecken_api",
"ENVIRONMENT": "development",
"BUILD": "dev_build",
}
# Database settings
database = {
"CONNECTION_STRING": "",
"LOCAL_DB_NAME": "mongo-wecken-dev-db"
}
# user settings
user = {
"profile": {
... |
#string
my_var1="hello students"
myvar1="hello \t students"
print(my_var1)
print(myvar1)
print("class \t hello \t studennts")
#innt
my_var2=20
print("number is",my_var2, "msg ",my_var1)
#float
my_var3=20.123456789123456789
print(my_var3)
#complex
my_var4=23j
print(my_var4)
#list
my_var5=[1,20,"hello","world"]
prin... |
#
# PySNMP MIB module CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:26:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... |
filename = "classes.csv"
filout = "classescleaned.csv"
with open(filename) as filein:
with open(filout,"w") as fileo:
for line in filein.readlines():
lineSplit = line.split(",")
# if len(lineSplit)>1:
# print(lineSplit[2])
# try:
# int(lin... |
# def multiply(a, b):
# if b == 0:
# return 0
# if b == 1:
# return a
# return a + multiply(a, b - 1)
def multiply(a, b):
if a < 0 and b < 0:
return multiply(-a, -b)
elif a < 0 or b < 0:
return -multiply(abs(a), abs(b))
elif b == 0:
return 0
elif b =... |
class GrocyPicnicProduct():
grocy_id = ""
grocy_name = ""
grocy_img_id = ""
grocy_weight = ""
grocy_id_stock = ""
picnic_id = ""
def __init__(self, picnic_id: str, grocy_id: str, grocy_name: str, grocy_img_id: str, grocy_weight: str, grocy_id_stock: str):
self.picnic_id = p... |
def checkDigestionWithTwoEnzymes(splitdic, probebindingsites, keyfeatures):
keylist2 = []; newSplitDic = {}; keylistTwoEnzymes = []; keydict = {}; banddic = {}
for key in splitdic:
keylist2.append(key)
for i in range(len(keylist2)):
for j in range(i+1, len(keylist2)):
bandsTwoE... |
@bot.command(name='roll')
async def roll(ctx, roll_type="action", number=1, placeholder="d", sides=20, modifier=0):
# broken
if number <= 0 or number > 10:
await ctx.send("Please enter a number of dice between 1 and 10.")
return
if sides < 1:
await ctx.send("Please enter a valid numbe... |
# ---------------------------- defining functions ---------------------------- #
def f(x, z):
return z
def s(x, z):
return -alpha * x
# ---------------------- system parameters and constants --------------------- #
g = 9.8 # gravitational acceleration | m/s^2
mu = 0.6 # kinetic friction coefficient
... |
class DataTable:
"""A DataTable is an object used to define the domain and data for a DiscreteField.
Attributes
----------
dataWidth: int
An Int specifying the width of the data. Valid widths are 1, 6, 21, corresponding to
scalar data, orientations and 4D tensors.
name: str
... |
def max_number(n):
sorting ="".join(sorted(str(n), reverse = True))
s =int(sorting)
return s
def max_number2(n):
return int(''.join(sorted(str(n), reverse=True)))
|
"""
1389. Create Target Array in the Given Order
Given two arrays of integers nums and index. Your task is to create target array under the following rules:
* Initially target array is empty.
* From left to right read nums[i] and index[i], insert at index index[i] the value nums[i] in target array.
* Repe... |
for i in range(1,101):
print(i,"(",end="")
if i % 2 == 0:
print(2,",",end="")
if i % 3 == 0:
print(3,",",end="")
if i % 5 == 0:
print(5,",",end="")
print(")")
|
#!/usr/local/bin/python3
class Potencia:
# Calcula uma potencia especifica
def __init__(self, expoente): # construtor padrão
# (self) está relacionada a própria instancia - param obrigatorio
self.expoente = expoente
def __call__(self, base):
return base ** self.expoente
if __name... |
class ProcessingNode:
def execute(self, processor, img):
raise NotImplementedError()
def dependencies(self, processor):
return []
|
# course_2_assessment_2
"""
At the halfway point during the Rio Olympics, the United States had 70 medals,
Great Britain had 38 medals, China had 45 medals, Russia had 30 medals, and
Germany had 17 medals. Create a dictionary assigned to the variable medal_count
with the country names as the keys and the number of med... |
#
# PySNMP MIB module SIP-UA-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/SIP-UA-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:28:20 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( OctetS... |
class Model(object):
def __init__(self):
self.username = None
self.password = None
self.deck = None
def username(self):
return self.username
def password(self):
return self.password
def deck(self):
return self.deck |
with open('text.txt', 'r') as f:
for num, line in enumerate(f):
if line.find('text') > -1:
print(f'The word text is present on the line {num + 1}')
# print(content)
|
def collision(x1, y1, radius1, x2, y2, radius2) -> bool:
if ((x1 - x2) ** 2 + (y1 - y2) ** 2) <= (radius1 + radius2) ** 2:
return True
return False
|
#removing duplicates
l1=list()
for i in range(5):
l1.append((input("enter element:")))
print(l1)
i=0
while i<len(l1):
j=i+1
while j<len(l1):
if l1[i]==l1[j]:
del l1[j]
else:
j+=1
i+=1
print(l1)
|
EXPECTED_METRICS = {
"php_apcu.cache.mem_size": 0,
"php_apcu.cache.num_slots": 1,
"php_apcu.cache.ttl": 0,
"php_apcu.cache.num_hits": 0,
"php_apcu.cache.num_misses": 0,
"php_apcu.cache.num_inserts": 0,
"php_apcu.cache.num_entries": 0,
"php_apcu.cache.num_expunges": 0,
"php_apcu.cache... |
'''
QUESTION:
868. Binary Gap
Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N.
If there aren't two consecutive 1's, return 0.
Example 1:
Input: 22
Output: 2
Explanation:
22 in binary is 0b10110.
In the binary representation of 22, ther... |
def convert_to_unicode(text):
"""Converts `text` to Unicode (if it's not already), assuming utf-8 input."""
if six.PY3:
if isinstance(text, str):
return text
elif isinstance(text, bytes):
return text.decode("utf-8", "ignore")
else:
raise ValueError("Unsupported string type: %s" % (typ... |
file1 = open('/home/student/.ros/log/a13f3d8c-1369-11eb-a6ad-08002707b8e3/rosout.log','r')
file2 = open('/home/student/CarND-Capstone/imgs/Train_Imgs/Train_data.txt','w')
count=1
while True:
line = file1.readline()
if not line:
break
# if line.split(' ')[2][1:7]=='tl_det':
sep_line = line.split(' ')
if len(s... |
def kebab_to_snake_case(json):
if isinstance(json, dict):
return kebab_to_snake_case_dict(json)
if isinstance(json, list):
new_json = []
for d in json:
if isinstance(d, dict):
new_json.append(kebab_to_snake_case_dict)
return json
def kebab_to_snake_case_... |
class InterMolError(Exception):
""""""
class MultipleValidationErrors(InterMolError):
""""""
def __str__(self):
return '\n\n{0}\n\n'.format('\n'.join(self.args))
class ConversionError(InterMolError):
""""""
def __init__(self, could_not_convert, engine):
Exception.__init__(self)
... |
#Laboratorio de Variables
#Millas a kilómetros.
#Kilómetros a millas.
kilometros = 12.25
millas = 7.38
millas_a_kilometros = millas * 1.61
kilometros_a_millas = kilometros / 1.61
print(millas, " millas son ", round(millas_a_kilometros, 2), " kilómetros ")
print(kilometros, " kilómetros son ", round(kilometros_a_mill... |
#Every true traveler must know how to do 3 things: fix the fire, find the water and extract useful information
#from the nature around him. Programming won't help you with the fire and water, but when it comes to the
#information extraction - it might be just the thing you need.
#Your task is to find the angle of the... |
class Lightbulb:
def __init__(self):
self.state = "off"
def change_state(self):
if self.state == "off":
self.state = "on"
print("Turning the light on")
else:
self.state = "off"
print("Turning the light off")
|
# Enable standard authentication functionality for this application
def user():
return dict(form=auth())
def index():
return dict()
def login():
form = auth.login(next=URL(a='loginexample', c='default',f='gallery'))
form.custom.widget.email['_class'] = 'form-control my-3 bg-light'
form.custom.wi... |
class Solution(object):
def coinChange(self, coins, amount):
"""
:type coins: List[int]
:type amount: int
:rtype: int
"""
"""
definition: dp[i] means min coins to achieve total i
result: return dp[amount]
assume the initial would be inf
... |
# Space: O(1)
# Time: O(n)
# recursive approach
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def swapPairs(self, head):
if head is None or head.next is None:
return head... |
# SQL-Code ausführen, Parameter: Datenbank (die Verbindung), und der SQL-Befehl
def executeSQL(db, sql, dictionary=True):
# Cursor setzen und Daten als Dictionary speichern, außer die Variabe wurde auf "FALSE" gesetzt
if dictionary == True:
cursor = db.cursor(dictionary=True)
else:
... |
"""
Interface for Controllers
functionality described in ps4.py ord xbox.py
"""
class IController:
def start(self):
raise NotImplementedError
def getActions(self):
raise NotImplementedError
|
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
if len(s) != len(t):
return False
# 两个字符不能映射到同一个字符上,但字符可以映射自己本身。
hash_table = dict() # 用于保存映射关系
hash_set = set() # 用于判断 value 是否相同
for cs, ct in zip(s, t):
val = hash_table.get(cs)
... |
"""
Retrieve and display information from GBIF for all species in the dataset
"""
def register(parser):
parser.add_argument('-U', '--update', default=False, action='store_true')
def run(args):
if args.update:
args.api.update_gbif()
args.api.tree()
|
fin = open("input_18.txt")
digits = '1234567890'
def prep(text):
text = text.strip().replace(' ','')
text = text[::-1]
text = text.replace('(','X')
text = text.replace(')','(')
text = text.replace('X',')')
return text
def geval(text):
# print(text)
if text[0] == '(':
plevel =... |
#!/usr/bin/env python
#
# Converts the Gonnet matrix to a pair-wise score
#
# Read replacements
replacements = {}
filename = 'gonnet.csv'
print('Reading ' + filename)
rows = []
arow = []
acol = []
with open(filename, 'r') as f:
for k, line in enumerate(f):
row = line.strip().split(',')
if k < 19:
... |
class Constant:
RESERVE_MARGIN = './data/每日尖峰備轉容量率.csv'
RESERVE_MARGIN_TEST = './data/本年度每日尖峰備轉容量率.csv'
OUTPUT_FILE = './submission.csv'
TRAIN_SIZE = 0.8
# Format
#
# date, operating_reserve(MW)
# 20210323, 2557
# 20210324, 1899
# 20210325, 1891
# 20210326, 1811
# 2021032... |
# rename this file to config.py
# change with your info from adafruit.io
ADAFRUIT_IO_USERNAME = "XXXX"
ADAFRUIT_IO_KEY = "aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
APIURL="https://api.openweathermap.org/data/2.5/weather?lat=41.XXXXXX&lon=-73.XXXXXX&appid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&units=imperial"
|
loud_string = "This string is going to get sliced down!!!!"
quiet_string = loud_string[:-4]
print(quiet_string)
string_one = "Uno"
string_one += " means one in spanish."
print(string_one)
# Join method
# join string . join (sequence to be joined )
string = " "
sequence = ("a", "b", "c", "d")
print(strin... |
"""Clean output files (.jdr) from wire sniffing."""
__author__ = "James Mullinix"
__version__ = "0.1.0"
|
# Copyright 2018 eBay Inc.
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# 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... |
consumer_conf = {
"aws_region":"",
"kinesis_stream":"",
"kinesis_endpoint":"",
"kinesis_app_name":"",
"AWS_ACCESS_KEY":"",
"AWS_SECRET_KEY":"",
"AWS_ACCESS_KEY_ID":"",
"AWS_SECRET_ACCESS_KEY":"",
"MONGO_CONNECTION_STRING":""
} |
'''
Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).
The algorithm for myAtoi(string s) is as follows:
Read in and ignore any leading whitespace.
Check if the next character (if not already at the end of the string) is '-' or '+'. Read thi... |
def maior_primo(n):
""" Recebe n >= 2 e devolve o próximo número primo > n.
Ex:
>>> maior_primo(7)
11
>>> maior_primo(25)
29
:param n: number
:return: number
"""
while n >= 2:
c = 0
p = n + 1
while 1 <= p <= n + 1:
if (n + 1) % p == 0:
... |
# ==========================================================================
# Only for a given set of 10 companies the data is being extracted/collected
# to make predictions as they are independent and are also likely to sample
# lot of variation from engineering, beverages, mdicine, investment banking
# etc and the... |
# from decorators import do_twice
#
#
# @do_twice
def return_greeting(name):
print("Создание приветствия")
return f"Hi {name}"
hi_vlad = return_greeting("Vlad")
def do_twice(func):
def wrapper_do_twice(*args, **kwargs):
func(*args, **kwargs)
return func(*args, **kwargs)
return wrapp... |
def getFix(s):
ret = ""
for i in range(1, len(s) - 1):
if s[i] == '(':
ret += ')'
else:
ret += '('
return ret
def isCorrect(s):
cnt = 0
for c in s:
if c == '(':
cnt += 1
else:
cnt -= 1
if cnt < 0:
re... |
# https://leetcode.com/problems/subarray-sum-equals-k/
class Solution:
def subarraySum(self, nums: list[int], k: int) -> int:
block_sum = 0
sum_counts = {0: 1} # Pretend sum at the left of nums[0] was 0.
good_subarrays = 0
for num in nums:
block_sum += num
r... |
def const_ver():
return "v8.0"
def is_gpvdm_next():
return False
|
if True:
pass
elif (banana):
pass
else:
pass |
load("@//tools/base/bazel:merge_archives.bzl", "merge_jars")
def setup_bin_loop_repo():
native.new_local_repository(
name = "baseline",
path = "bazel-bin",
build_file_content = """
load("@cov//:baseline.bzl", "construct_baseline_processing_graph")
construct_baseline_processing_graph()
""",
... |
other_schema = {
"type": "list",
"items": [
{"type": "string"},
{"type": "integer", "min": 500},
{
"type": "list",
"items": [
{"type": "string"},
{"type": "integer", "name": "nd_int"},
{"type": "integer"},
... |
# As you already know, the string is one of the most
# important data types in Python. To make working with
# strings easier, Python has many special built-in string
# methods. We are about to learn some of them.
# An important thing to remember, however, is that the
# string is an immutable data type! It means t... |
class CircularDependency(Exception):
pass
class UnparsedExpressions(Exception):
pass
class UnknownFilter(Exception):
pass
class FilterError(Exception):
pass
|
#!/usr/bin/env python
data = [i for i in open('day03.input').readlines()]
fabric = [[0]*1000 for i in range(1000)]
def get_x_y_w_h(line):
_, _, coord, dim = line.split()
x, y = map(int, coord[:-1].split(','))
w, h = map(int, dim.split('x'))
return x, y, w, h
for line in data:
x, y, w, h = get_x_y... |
try:
hours = int(input("enter hours :"))
rate=int(input("enter rate :"))
pay = int(hours * rate)
print("pay")
except:
print("Error, enter numeric input!") |
class Person():
"""docstring for Person"""
def __init__(self, name, age):
self.name = name
self.age = age
def __str__(self):
return "{} is {} years old".format(self.name, self.age)
class Employee(Person):
def __str__(self):
return "{} is employee".format(self.name)
maria = Person("Maria", 20... |
# Tuplas devem ser uma sequência de itens separados por vírgula e dentro de ().
# A variável 'CONSTANTES' recebe os valores 3.1415, 9.81, 1.6
CONSTANTES = (3.1415, 9.81, 1.6) # CONSTANTES = tuple((3.1415, 9.81, 1.6))
'Quando escrevemos uma variável em toda em maiúscula, ela é considerada uma constante.'
# Retorna o ... |
valor = []
maior = menor = 0
for c in range(0, 5):
valor.append(int(input(f'Digite o {c + 1}° valor: ')))
if c == 0:
maior = menor = valor[c]
else:
if valor[c] > maior:
maior = valor[c]
if valor[c] < menor:
menor = valor[c]
print(f'A sua lista foi {valor}')
#... |
occurrence = int(input())
city = {}
for i in range(occurrence):
strike = input()
if strike in city:
city[strike] += 1
else:
city[strike] = 0
strike_counter = 0
for v in city.values():
strike_counter += v
if strike_counter > 0:
print('1')
else:
print('0') |
class CohereObject():
def __str__(self) -> str:
contents = ''
exclude_list = ['iterator']
for k in self.__dict__.keys():
if k not in exclude_list:
contents += f'\t{k}: {self.__dict__[k]}\n'
output = f'cohere.{type(self).__name__} {{\n{contents}}}'
... |
class Plot(object):
""" """
def __init__(self):
""" """
return 0
|
class Producto:
def __init__(self, nombre, descripcion, precio, stock, codigo):
self.nombre = nombre
self.descripcion = descripcion
self.precio = precio
self.stock = stock
self.codigo = codigo |
# The number of nook purchase price periods
PRICE_PERIOD_COUNT = 12
# Alternating 'AM' 'PM' labels
PRICE_TODS = [["AM", "PM"][i % 2] for i in range(PRICE_PERIOD_COUNT)]
PRICE_DAYS = ["Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"]
PRICE_PERIODS = [x for x in range(PRICE_PERIOD_COUNT)]
# The y range of price graphs
PRICE... |
"""Should raise SyntaxError: cannot assign to __debug__ in Py 3.8
and assignment to keyword before."""
a.__debug__ = 1
|
# Litkowski Norbert
# Cw.1
# Python
# McCulloch-Pitts neuron
def f(weights, inputs, m):
x = float(0)
for i in range(m):
x += (weights[i] * inputs[i])
if x >= 0:
return 1
else:
return 0
def and_gate():
inputs = []
weights = [float(0.3), float(0.3), float(-0.5)]
m ... |
def bubble_sort(mass, cmp = lambda a, b: a - b):
len_mass= len(mass)
for i in range(len_mass, 0, -1):
need = False
for j in range(1, i):
if cmp(mass[j-1], mass[j]) > 0:
mass[j-1], mass[j] = mass[j], mass[j-1]
need = True
if not need: break
... |
# You are a product manager and currently leading a team to develop a new product.
# Unfortunately, the latest version of your product fails the quality check.
# Since each version is developed based on the previous version,
# all the versions after a bad version are also bad.
# Suppose you have n versions [1, 2, ..... |
class Room:
#Initialises a room. Do not change the function signature (line 2)
def __init__(self, name):
self.name = name
self.quest = None
self.north = None
self.south = None
self.east = None
self.west = None
#Returns the room's name.
def get_name(self):
return self.name
#Returns a string containi... |
class Pessoa:
olhos = 2
def __init__(self, *filhos, nome=None, idade=35):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def comprimentar(self):
return f'olá{id(self)}'
@staticmethod
def metodo_estatico():
return 10
@classmethod
def ... |
# Time: O(n * l), n is number of quries
# , l is length of query
# Space: O(1)
class Solution(object):
def camelMatch(self, queries, pattern):
"""
:type queries: List[str]
:type pattern: str
:rtype: List[bool]
"""
def is_matched(query, pattern):
... |
def selection_sort(A,n):
for i in range(n-1, 0, -1):
m = A.index(max(A[0:i+1])) #정렬되지 않은 수 중 가장 큰 값의 인덱스
A[i], A[m]=A[m], A[i]
def insertion_sort(A,n):
for i in range(1,n):
m=0
for j in range(i-1, -1, -1):
if A[j]<A[i]:
m=j+1
break
... |
CALIB_FILE_NAME = "calib.p"
PERSPECTIVE_FILE_NAME = "projection.p"
VIDEO_SIZE = 1280, 720
ORIGINAL_SIZE = 1280, 720
MODEL_SIZE = 608., 608.
UNWARPED_SIZE = 500, 600 |
class Alpha(object):
#===================================== A L P H A B E T =====================================================
alpha = ["•", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y", "z"]
#===============... |
#!/usr/bin/env python
foo = 123
class NothingMoreToSeeHere(Exception):
""" Don't recon any farther.
This exception can be thrown in a provider to signal to
TileStache.getTile() that the result tile should be returned,
and saved in a cache, but no further child tiles should be rendered... |
""" Number Data types
Integers(int)
Floating Point(float)
Integer
"""
|
n = float(input('Digite um valor '))
n1 = float(input('Digite outro valor '))
s = n + n1
print('A soma entre {} + {} é iqual a {}'.format(n, n1, s))
|
class PipConfigurationError(Exception):
pass
|
# Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.
# Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case
# https://www.codew... |
# 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 not u... |
class Field(object):
def __init__(self, name, column_type, primary_key, default):
self.name = name
self.column_type = column_type
self.primary_key = primary_key
self.default = default
def __str__(self):
return '<%s, %s:%s>' % (self.__class__.__name__, self.column_type, ... |
def Rotate(arr):
temp = []
for i in range(len(arr)):
for j in range(0, len(arr)):
if i != j and i < j:
arr[i][j], arr[j][i] = arr[j][i], arr[i][j]
for l in arr:
l.reverse()
print(l)
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Rotate(arr)
|
# coding: utf-8
lib_common = {
'uri': 'common',
'type': 'config',
'cxxflags': [
'-std=c++11',
],
'source_base_dir': 'd:/lib/ogre',
'install_dirs_map': {
},
}
def dyn_common(lib, context):
c = context
versions = c.parseFile(
'OgreMain/include/OgrePrerequ... |
ReLU
[[-0.426116, -1.36682, 1.82537, -0.359894, 0.781783], [0.0141898, -1.74668, 2.10078, 0.199607, -0.625995], [0.236925, -0.387744, 0.335238, -0.0708328, -0.872241], [0.189836, 1.80645, 0.228501, 1.39699, -1.70341], [3.36428, -0.00959754, -0.02829, -0.00182374, -0.00321689], [-0.00116646, -1.30479, -0.646313, 0.38497... |
class MyCalendarThree:
def __init__(self):
self.times = []
def book(self, start, end):
bisect.insort(self.times, (start, 1))
bisect.insort(self.times, (end, -1))
res = cur = 0
for _, x in self.times:
cur += x
res = max(res, cur)
return re... |
# A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that
# all students are numbered from 1 to n, inclusive. Before the university programming championship
# the coach wants to split all students into groups of three. For some pairs of students we know that
# they want to be on... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.