content stringlengths 7 1.05M |
|---|
# https://leetcode.com/problems/determine-if-string-halves-are-alike/
def halves_are_alike(s):
vowels = {
'a': True,
'e': True,
'i': True,
'o': True,
'u': True,
'A': True,
'E': True,
'I': True,
'O': True,
'U': True,
}
... |
def hex_rgb(argument):
"""Convert the argument string to a tuple of integers.
"""
h = argument.lstrip("#")
num_digits = len(h)
if num_digits == 3:
return (
int(h[0], 16),
int(h[1], 16),
int(h[2], 16),
)
elif num_digits == 4:
return (
... |
"""
Distributed optimal power flow for DC networks.
"""
|
"""
PASSENGERS
"""
numPassengers = 11416
passenger_arriving = (
(2, 4, 1, 3, 2, 0, 2, 2, 1, 1, 1, 0, 0, 1, 2, 2, 1, 3, 2, 2, 0, 2, 1, 1, 1, 0), # 0
(4, 1, 4, 4, 1, 1, 1, 2, 1, 1, 1, 0, 0, 4, 4, 3, 3, 6, 0, 1, 1, 0, 1, 0, 1, 0), # 1
(2, 3, 3, 0, 2, 0, 2, 1, 1, 0, 0, 0, 0, 1, 7, 3, 5, 1, 2, 3, 0, 2, 0, 0, 0, 0), ... |
# -*- coding: utf-8 -*-
# Kiírja az állapotnak megfelelő ikont, és utána a szöveget
class colorPrint:
def errPrint(self, message):
print('\n[&&&] ' + message)
def warnPrint(self, message):
print('\n[*] ' + message)
def okPrint(self, message):
print('\n[+] ' + message)
def finePrint(self, message):
prin... |
def findReplaceString(s, indexes, sources, targets):
dupe_s = s[:]
for i in range(len(indexes)):
curr = s[indexes[i]]
if curr == sources[i][0]:
print(curr)
dupe_s = dupe_s.replace(sources[i], targets[i])
print(dupe_s)
return dupe_s |
# 1. 수를 비트연산으로 바꾸면서
# 2. 다른 지점을 하나씩 구해서
# 3. 1, 2 가 나오면 바로 retrun
def solution(numbers) :
result = []
for number in numbers :
comp = bin(number)[2:]
while True :
comp_number = 0
number += 1
comp_new = bin(number)[2:]
length = len(comp_new) - l... |
#
# Copyright (C) 2020 The Android Open Source Project
#
# 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 la... |
class twitter_nlp_toolkit:
def __init__(self):
print("twitter_nlp_toolkit initialized")
|
#difference between a given number and 17, if the number is greater than 17 return double the absolute difference.
x = int(input('Enter the number:'))
y = 17
n = y-x
if x > 17:
print(abs(n)*2)
else:
print(n) |
def compare(physical_inventory, digital_inventory):
if physical_inventory == digital_inventory:
return {}
discrepencies = {}
for item, quantity in digital_inventory.items():
if item not in physical_inventory:
discrepencies[item] = {"physical":None,"digital":quantity}
for item, quantity in physical_inventory.... |
print(type(1))
print(type(1.1))
print(type('texto'))
print(type(False))
print(type(True))
|
app_host = '127.0.0.1'
app_port = 9090
app_desc = 'Local Server'
app_title = 'API Template'
app_key = 'AWEREG#Q$^#!%^QEH$##%'
admin_id = 'admin'
admin_pw = 'w4b35ya253vu5e6n'
db_type = 'mysql+pymysql'
db_host = 'localhost'
db_port = '33066'
db_name = 'hrms'
db_user = 'root'
db_pass = 'fnxm1qazXSW@' |
s = float(input('digite o salario do funcionario? R$'))
if s <= 1250.0:
c1 = (s * 15 / 100) + s
print('agora o funcionario vai ter o reajuste de 15%\nentao o salario dele que era R${:.2f}, passa a ser de R${:.2f}'.format(s, c1))
else:
c2 = (s * 10 / 100) + s
print('agora o fucionario vai ter o reajuste... |
def name(firstname,lastname):
return f"My name is {firstname} {lastname}"
print(name("Atherv", "Patil"))
|
# -*- coding: utf-8 -*-
"""
桥接模式适应场景:
1 不希望在抽象和它的实现部分之间有一个固定的绑定
2 类的抽象以及它的实现部分都应该可以通过生成子类的方法加以扩充
3 对一个抽象的实现部分的修改对应的客户不产生影响,即客户的代码不必重新编译
Created by 相濡HH on 3/18/15.
"""
class Abstraction(object):
"""
抽象结口
"""
def __init__(self, impl):
"""
参数具体实例
:param impl:
:retu... |
# -*- coding: utf-8 -*-
def view_grid(grid_space):
for row in range(len(grid_space)):
for column in range(len(grid_space[0])):
print (grid_space[row][column],end = ' '),
if column == 2 or column == 5:
print('|', end=' ')
if row == 2 or row == 5:... |
# 🚨 Don't change the code below 👇
print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n")
name2 = input("What is their name? \n")
# 🚨 Don't change the code above 👆
# Write your code below this line 👇
lower_case_name1 = name1.lower()
lower_case_name2 = name2.lower()
count_T = lower_case_... |
"""
dp[i][k] := minimum difficulty of a k days job schedule, D[:i].
maxInRange[i][j] := max(D[i:j+1])
"""
class Solution(object):
def minDifficulty(self, D, K):
if not D or not K or K>len(D): return -1
N = len(D)
maxInRange = [[0 for _ in xrange(N)] for _ in xrange(N)]
for i in xra... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 23 17:32:12 2019
@author: giles
"""
'''
Question 1
Can you remember how to check if a key exists in a dictionary?
Using the capitals dictionary below write some code to ask the user to input
a country, then check to see if that country is in the dictionary and... |
n = int(input())
sl = {}
for i in range(n):
s = input()
if not(s in sl):
sl[s] = 0
else:
sl[s] += 1
ans = []
s_max = max(sl.values())
for key in sl:
if sl[key] == s_max:
ans.append(key)
ans.sort()
for a in ans:
print(a)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__title__ = 'lasotuvi'
__version__ = '1.0.1'
__author__ = 'doanguyen'
__author_email__ = 'dungnv2410 at gmail.com'
__license__ = 'MIT License'
|
#Robot in a grid. Imagine a robot sitting in the upper left corner of a grid
#with r rows and c columns. The robot can only move in two directions,
#right and down, but certain cells are "off limits" such that the robot
#cannot step on them. Design an algorithm to find a path for the robot
#from the top left to the bot... |
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
class Connection:
"""
A representation for the connection between the camera and the host
"""
def __init__(self, api, api_requests):
self._api = api
self._requests = api_requests
def get_connection_info(self) -> str:
"""
... |
'''
Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. (i.e., from left to right, level by level from leaf to root).
'''
# RECURSION
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Exception classes used by filters."""
class ImageErrors(Exception):
"""The base class for filter errors."""
pass
class NotSquareImage(ImageErrors):
"""The image not have NxN dimension"""
pass
class DimensionNotIsPowerTwo(ImageErrors):
""""The ... |
class Electrodomestico(object):
"""description of class"""
__color = ''
__precio = ''
__sku = ''
__fecha_creacion = ''
__pais_de_origen = ''
__marca = ''
def __init__(self,color,precio,sku,fecha_creacion,pais_de_origen,marca):
self.__color = color
self.__precio = pr... |
# Print out numbers from 1 to 100 (including 100).
# But, instead of printing multiples of 3, print "Fizz"
# Instead of printing multiples of 5, print "Buzz"
# Instead of printing multiples of both 3 and 5, print "FizzBuzz".
for number in range(1, 101):
if number % 3 == 0 and number % 5 == 0:
print("FizzBu... |
# Faça um programa que leia um número inteiro diga se ele é o não um número primo.
numero_digitado_pelo_usuario = int(input('Digite um número qualquer: '))
if numero_digitado_pelo_usuario != 1 and numero_digitado_pelo_usuario % 2 != 0 and numero_digitado_pelo_usuario % 3 != 0 and numero_digitado_pelo_usuario % 5 != ... |
# Stackmaps don't get emitted for code that's dead even if it exists in IR:
class C(object):
pass
c = C()
if 1 == 0:
c.x = 1
|
class FlipFlop:
GATE_LVL = False
def __init__(self, clock, input, name="FlipFlop"):
self.clock = clock
self.input = input
self.output = None
self.outputp = None
self.output_star = None
self.name = name
self.build()
def logic(self):
pass
... |
def SelectionSort(array):
# Traverse through all array elements
for i in range(len(array)):
# Find the minimum element in remaining
# unsorted array
min_idx = i
for j in range(i+1, len(array)):
if array[min_idx] > array[j]:
min_idx = j
# Swap the found minimum element with
# the first eleme... |
def yes_no_bool(val):
if val.lower() == 'yes':
return True
elif val.lower() == 'no':
return False
else:
raise ValueError(
'Cannot translate "{}" to bool'.format(val))
|
# Calculate distance of 1056 feet in yard and miles.
# 1 mile = 1760 yards and 1 yard = 3 feet.
feet = 1056
yard = feet / 3
print("1056 feet is",yard,"yards")
mile = yard / 1760
print("1056 feet is",mile,"miles") |
#if文の基本
"""
if 条件式1:
条件式1がTrueのときに実行する内容
elif 条件式2:
条件式1がFalseかつ条件式2がTrueのときに実行する内容
else:
すべての条件式がFalseのときに行う処理
"""
#例
con = int(input("整数値を入力してください-->")) #con(conditions)
if (con > 8) and (con != 13):
print("その値は8より大きいですね")
num = -1 * (con -13)
print(num,"加算すると私の誕生日の日ですね")
elif con == 13:
pri... |
# -----
model_path_asr= 'models/asr/'
processor_path_asr='models/asr/'
device_asr = 'cuda'
min_len_sec=100
max_len_sec=150
# -----
model_path_punctuation='models/v1_4lang_q.pt'
step_punctuation=30
# -----
model_path_summarization= 'models/sum/'
tokenizer_path_summarization='models/sum/'
max_length_sum=50
step_sum=450
d... |
# detection params
detector_path = 'retina_r50/'
box_score_thresh = 0.8
img_target_size = 480
img_max_size = 640
nms_thresh = 0.4
|
def main():
n = int(input())
player_hp = [11 + i for i in range(n)]
i = 0
out = 0
out_indexes = []
while out < len(player_hp) - 1:
if player_hp[i] == 0:
i += 1
if i == len(player_hp):
i = 0
continue
hp = player_hp[target(play... |
#TODOS LOS METODOS QUE EXISTEN PARA HACER COMENTARIOS EN PYTHON
#ESTE ES UN EJEMPLO DE COMENTARIO
print('COMETARIOS EN EL CODIGO')
"ESTE ES OTRO EJEMPLO DE COMO HACER COMENTARIOS"
'''HOLA
ESTO ES EJEMPLO DE COMO HACER
COMENTARIOS MULTILINEA
'''
|
#-*-coding:utf-8-*-
# Create dummy secrey key so we can use sessions
SECRET_KEY = '123456790'
# Create in-memory database
DATABASE_FILE = '../hhlyDevops_db.sqlite'
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + DATABASE_FILE
SQLALCHEMY_ECHO = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
#... |
num1 = 10
print("Global variable num1=",num1)
def func(num2):
print("In function num2 = " ,num2)
num3 = 30
print("In function num3 = " ,num3)
func(20)
print("num1 again=",num1)
print("num3 outside function =",num3) # it will throw error since is local variable.
|
preco = float(input('Preço do produto: R$'))
print('''Condições de pagamento:
[ 1 ] À vista dinheiro/cheque: 10% de desconto
[ 2 ] À vista no cartão: 5% de desconto
[ 3 ] Em até 2x no cartão: Preço normal
[ 4 ] 3x ou mais: no cartão: 20% de juros
''')
opcao = int(input('Opção desejada: '))
if opcao == 1:
novo... |
red='\033[1;31m'
aqua = '\033[1;36m'
blink = "\033[5m"
reset = reset="\033[0m"
b = f"""
{red} ____ _ ____ _ _
| _ \ ___ __| |/ ___(_)_ __ | |__ ___ _ __
| |_) / _ \/ _` | | | | '_ \| '_ \ / _ \ '__|
| _ < __/ (_| | |___| | |_) | | | | __/ |
|_| \_\___|\__,_|\____|_| ... |
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
size = len(nums)
if (size == 0):
return 0
j = 0
k = size - 1
while (j < k) :
while (j < k and nums[j] != val):
j += 1
while (j < k and nums[k] == va... |
frase = str(input('Digite uma frase: ')).upper().strip()
contador = frase.count('A')
print(f'Quantidades de vezes que aparece a letra "A": {contador}')
print('A primeira letra A apareceu na posição {}'.format(frase.find('A') + 1))
print('A última letra A apareceu na posição {}'.format(frase.rfind('A') + 1))
|
controlNum = list(map(int, input().split()))
controlArr = list(map(int, input().split()))
tvChannelCost = []
for i in range(10):
tvChannelCost.extend(list(map(int, input().split())))
origin, destination = input().split()
origin = int(origin)
destination = int(destination)
results = []
# check can go directly to ... |
size(200, 200)
path = BezierPath()
path.rect(50, 50, 100, 100)
path.reverse()
path.rect(75, 75, 50, 50)
drawPath(path)
|
class vowels:
__VOWELS = ["A", "a", "E", "e",
"I", "i", "O", "o",
"U", "u", "Y", "y"]
def __init__(self, text):
self.text = text
self.start = 0
@staticmethod
def is_vowel(char):
return char in vowels.__VOWELS
def __iter__(self):
return s... |
@xbot.xfunction
@bot.command(name='add')
async def add(ctx):
"""__GENERATED__ cross platform generated function"""
try:
message = ctx.message.content
(_, left, right) = message.split(' ')
result = (int(left) + int(right))
await ctx.send(result)
except (IndexError, ValueError)... |
"""
Stworz prosty symulator gry karcianej wojna.
Zadaniem Twojej funkcji jest wskazanie, ktora karta
zwyciezy. Parametrami sa znaki card1 oraz card2.
Moga one przyjmowac wartosci:
<"1", "2", "3", ..., "10", "J", "D", "K", "A"> - wielkosc
liter bedzie miala znaczenie (choc mozna przedstawic... |
class Solution(object):
def intersect(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
if len(nums1) > len(nums2):
return self.intersect(nums2, nums1)
freq = {}
for ele in nums1:
... |
print(len("Python"))
print(len("programming"))
print(len(" "))
print("Maciej" + "Zurek")
print("Maciej " + "Zurek")
print("Maciej" + " Zurek")
print("Maciej" + " " + "Zurek")
print("a" "b" "c")
print("---" * 10)
|
# Copyright 2015–2020 Kullo GmbH
#
# This source code is licensed under the 3-clause BSD license. See LICENSE.txt
# in the root directory of this source tree for details.
DEFAULT_DB = 'default'
class KulloDbRouter(object):
def db_for_read(self, model, **hints):
try:
return model.KulloMeta.db_... |
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
# please adjust these two lines if necessary
# zaehlen-ini.py
# (C) Günter Partosch 2016-2020
# Initialisierung, Vorbesetzungen
# Stand: 2018-08-17
# 2020-08-02 (Voreinstellungen geändert)
# 2020-08-12 (Ausgabe-Strings hierher verlagert)
# 2020-08-20... |
# Find the IP address in the following line using a regex group and the
# re.search function. Print the IP address using the match object group
# method, as well as the index of where the grouping starts and ends.
log = '208.115.111.73 - - [01/Apr/2013:06:30:26 -0700] "GET /nanowiki/index.php/1_November_2007_-_Day_1 HT... |
__author__ = 'ivan.arar@gmail.com'
class Paging(object):
def __init__(self, paging_data):
self.paging_data = paging_data
def has_next(self):
if int(self.paging_data['page']) == int(self.paging_data['pages']):
return False
else:
return True
def has_previou... |
f = open("01.txt", "r")
past = 150 # using this as base case since first number on file is 150 (prevent dec or inc count from chaning)
dec = 0
inc = 0
for i in f.read().splitlines():
if i > past:
inc += 1
elif i < past:
dec += 1
past = i
print(inc)
|
mapping = {
"files": [
("site-example.conf", "/etc/nginx/sites-available/site-example.conf")
],
"templates": [
("index.html.tmpl", "/var/www/html/index.html")
]
}
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class CacheTypes(object):
"""Cache Types ENUM
"""
UNDEFINED = None
MEMCACHED_CACHE = 'Memcached'
@staticmethod
def validate(cache_type):
return cache_type in [
CacheTypes.MEMCACHED_CACHE,
] |
###Titulo: Conversor
###Função: Este programa converte número de dias, horas minutos e segundos em segundos
###Autor: Valmor Mantelli Jr.
###Data: 30/11/20148
###Versão: 0.0.2
# Declaração de variável
x = 0
y = 0
z = 0
w = 0
convD = 0
convH = 0
convM = 0
soma = 0
# Atribuição de valor a variavel
x = int(inp... |
# - helloworld.py *- coding: utf-8 -*-
"""
This program simply prints the phrase "Hello, World!"
@author: wboyd
"""
print("Hello, World!")
|
#----------------------------------------------------------------------------------------------------------
#
# AUTOMATICALLY GENERATED FILE TO BE USED BY W_HOTBOX
#
# NAME: Toggle Adjust Points
# COLOR: #3a97bd
#
#---------------------------------------------------------------------------------------------------------... |
#!/usr/bin/env python3
# ## Algorithm:
#
# - Initialize an empty set to store the already visited elements
# - Iterate through the list
# - If the current element is in the set, return True
# - Otherwise, add the element to the set
#
# ## Time Complexity:
#
# - O(n) to run through the entire list
# - O(1) to add an... |
#==============================================================================================
#Multiples of 3 and 5
#===============================================================================================
#Problem 1
#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and... |
# -*- coding: utf-8 -*-
__author__ = "Paul Schifferer <dm@sweetrpg.com>"
"""
"""
__title__ = 'PACKAGE_NAME'
__description__ = 'PACKAGE_DESC'
__url__ = 'PACKAGE_URL'
__version__ = '0.0.0'
__build__ = 0x000000
__author__ = 'PACKAGE_AUTHOR'
__author_email__ = 'PACKAGE_AUTHOR_EMAIL'
__license__ = 'MIT'
__copyright__ = 'Co... |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def pthreadpool():
http_archive(
name = "pthreadpool",
bu... |
class Message(object):
def __init__(self, text, user_agent, message_date, email=None, referer=None, device=None):
"""Message
:param text: text of the message
:param user_agent: User-Agent from the query
:param message_date: date of the message
:param email: email address of t... |
#
# PySNMP MIB module HPICF-SAVI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPICF-SAVI-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:33:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... |
__title__ = 'db_cache'
__description__ = 'DB Cache'
__url__ = 'https://github.com/dskrypa/db_cache'
__version__ = '2020.09.19-1'
__author__ = 'Doug Skrypa'
__author_email__ = 'dskrypa@gmail.com'
__copyright__ = 'Copyright 2020 Doug Skrypa'
|
'''
Created on 29 Oct 2009
@author: charanpal
An abstract class which reads graphs from files.
'''
class GraphReader(object):
def __init__(self):
pass
def readFromFile(self, fileName):
pass
|
class FPS:
sum_e=(911660635, 509520358, 369330050, 332049552, 983190778, 123842337, 238493703, 975955924, 603855026, 856644456, 131300601, 842657263, 730768835, 942482514, 806263778, 151565301, 510815449, 503497456, 743006876, 741047443, 56250497)
sum_ie=(86583718, 372528824, 373294451, 645684063, 112220581, 69... |
'''面试题14:剪绳子
给你一根长度为n的绳子,请把绳子剪成m段(m、n都是整数,n>1并且m>1),
每段绳子的长度记为k[0],k[1]…,k[m]。请问k[0] × k[1] x … × k[m]可能的最大乘积是多少?
-----------------
Example:
input: 8
output: 18 # 2*3*3
'''
def cut_rope_dynamic(length):
# O(n^2) time O(n) space
if not isinstance(length, int) or length < 0:
return -1
if length ... |
def build_shopkeeper_dialog(scene, buyer, seller):
class ItemDisplay(gui.BorderedControl):
def __init__(self, item, depreciate=True, **kwargs):
gui.BorderedControl.__init__(self, **kwargs)
self.item = item
self.depreciate = depreciate
self._initComponents()
... |
input_file = 'input.txt'
def process_input():
with open(input_file) as f:
content = f.readlines()
# stripping whitespace
stripped = [x.strip() for x in content]
return stripped
def build_rules(raw):
# converts the line-by-line representation
# into a dictionary, keyed by the bag (e.g. "mirrored bla... |
class Animal:
def say(self):
pass
class Bird(Animal):
def say(self):
print('i am bird')
class Fish(Animal):
def say(self):
print('i am fish')
class AnimalFactory:
@staticmethod
def create():
pass
class FishFactory(AnimalFactory):
@staticmethod
def crea... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
n_input = input()
int_input = input().split()
print(all([int(i) > 0 for i in int_input]) and any([j == j[::-1] for j in int_input]))
|
# Class Method
class sample:
x = 10
@classmethod
def modify(cls):
cls.x += 1
s1 = Sample()
s2 = Sample()
print(s1.x, s2.x)
s1.modify()
print(s1.x, s2.x)
s1.x += 1
print(s1.x, s2.x)
|
# Settings for finals
# Foreign language classes for finals logic
FOREIGN_LANGUAGES = {
'ARABIC': ['100A', '100B', '1A', '1B', '20A', '20B'],
'ARMENI': ['101A', '101B', '1A', '1B'],
'BANGLA': ['101A', '101B', '1A', '1B'],
'BERMESE': ['1A', '1B'],
'BOSCRSR': ['117A', '117B', '27A', '27B'],
'BULGA... |
#%%
file = open("../dataset/novel.txt")
# %%
characters = []
file2 = open("../dataset/character.txt")
for line in file2:
if line != '\n':
line = line.strip('\n')
characters.append(line)
# %%
relationship = [[0 for column in range(len(characters))] for row in range(len(characters))]
lines = file.re... |
with open("sample.txt",'r+') as f:
for line in f:
for letter in line:
print(letter)
|
class Solution:
def numUniqueEmails(self, emails):
_dict = {}
for email in emails:
at_idx = email.index('@')
if email[:at_idx].count('+') == 0:
if email[:at_idx].count('.') == 0:
new_mail_address = email
else:
... |
search_fruit = 'apple'
fruit_box = ['banana', 'mango', 'apple', 'pineapple']
for fruit in fruit_box:
if fruit == search_fruit:
print('Found fruit : {}'.format(search_fruit))
break
else:
print('{} fruit not found'.format(search_fruit))
|
#!/usr/bin/env python3
# encoding: UTF-8
"""
This file is part of IPGeoLocation tool.
Copyright (C) 2015-2016 @maldevel
https://github.com/maldevel/IPGeoLocation
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
This program is free software: you can re... |
apps = ["admin", "AjaxSpreadsheet", "AppointmentManager", "ArXivInterface", "BingApi", "BitcoinExample", "CarSales", "CeleryIntegrationExample", "CookbookExample", "CssDesigner", "CustomerRelationshipManagement", "DnaAnalysisNeedlemanWunsh", "eCardsOnMap", "EmailContactForm", "EStoreExample", "FacebookClone", "Facebook... |
# Approach 1
class Solution:
def maxProfit(self, prices: List[int]) -> int:
i = 0
maxprofit = 0
v = prices[0]
p = prices[0]
while i < len(prices) - 1:
while i < len(prices) - 1 and prices[i] > prices[i + 1]:
i += 1
v = prices[i]
... |
#1.
#a = float(input('请输入摄氏温度:'))
#b = float(input('请输入华氏温度:'))
#c = a*9/5+32
#d = 5/9 *(b-32)
#print('摄氏温度{}转换为华氏温度为:{}'.format(a,c))
#print('华氏温度{}转换为摄氏温度为:{}'.format(b,d))
#2.
#import math
#length = float(input('输入圆柱体的长:'))
#Radius = float(input('输入圆柱体的半径:'))
#area = math.pi * Radius * Radius
#Volume ... |
class Parameters:
course_number_per_program = {"min":3,"max":6}
remote_learning_start_year = 2018
professor_number = 3000
student_enrollment_year = {"start":2015,"end":2016}
student_number = 20000
before_remote_learning_drop_off = {"rate":10,"remote":20}
after_remote_learning_drop_off = {"ra... |
'''
#####################################
# 300. Longest Increasing Subsequence
#####################################
class Solution:
def lengthOfLIS(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
tail = [0] * len(nums)
size = 0
for num in nums:
... |
#!/usr/bin/env python
# coding=UTF-8
"""
@Author: WEN Hao
@LastEditors: WEN Hao
@Description:
@Date: 2021-07-22
@LastEditTime: 2021-09-01
"""
# from .attack import Attack
# from .attack_args import AttackArgs
# from .attack_generator import AttackGenerator
# from .attack_eval import AttackEval
# from .attack_result im... |
# Introduction fo Computation and Programming Using Python (2021)
# Chapter 3, Finger Exercise 1
"""
Change the code in Figure 3-2 so that it returns
the largest rather than the smallest divisor. Hint: if y*z = x and y is
the smallest divisor of x, z is the largest divisor of x.
Code in Figure 3-2:
# Test if an in... |
word_size = 27
num_words = 512
words_per_row = 4
local_array_size = 60
output_extended_config = True
output_datasheet_info = True
netlist_only = True
nominal_corner_only = True
|
unos = {
0: 'cero', 1: 'uno', 2: 'dos', 3: 'tres', 4: 'cuatro', 5: 'cinco', 6: 'seis',
7: 'siete', 8: 'ocho', 9: 'nueve', 10: 'diez', 11: 'once', 12: 'doce',
13: 'trece', 14: 'catorce', 15: 'quince',
16: 'dicicéis', 17: 'dicisiete', 18: 'diciocho', 19: 'dicinueve'}
decenas = {
2: 'veinte', 3: 'trent... |
"""Utilities for tracking progress of runs, including time taken per
generation, fitness plots, fitness caches, etc."""
cache = {}
# This dict stores the cache for an evolutionary run. The key for each entry
# is the phenotype of the individual, the value is its fitness.
runtime_error_cache = []
# This list stores a ... |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Tests for components for Flocker documentation.
"""
|
"""Nevermore is a multiple task learning benckmark."""
__version__ = '0.0.1'
__author__ = ''
|
"""
TODO:
- does the last plane fit the first plane?
"""
def is_periodic(wire) -> bool:
return wire.planes[0].fits(wire.planes[-1])
|
'''
Created on Dec 19, 2013
@author: kyle
'''
def convert_array_to_YxZ(val, z):
out_list_list = []
for i in xrange(len(val)/z + 1):
out_list_list.append([])
for j in xrange(z):
if i*z+j < len(val):
out_list_list[i].append( val[i*z+j] )
return out_list_list
|
"""
Programa 096
Área de estudos.
data 02.12.2020 (Indefinida) Hs
@Autor: Abraão A. Silva
"""
notas = list()
for aluno in range(1, 11):
print(f'{aluno}º Aluno.:')
nome = str(input('Nome.: ')).strip().title()
for nota in range(1, 5):
n = float(input(f'{nota}º Nota.: '))
notas.append... |
class Metric(object):
def reset(self):
raise NotImplementedError
def update(self, x, y):
raise NotImplementedError
def score(self):
raise NotImplementedError
def mean(self):
raise NotImplementedError
|
def get_php_bp_obd():
return """
$dir=pos(glob("./*", GLOB_ONLYDIR));
$cwd=getcwd();
$ndir="./%s";
if($dir === false){
$r=mkdir($ndir);
if($r === true){$dir=$ndir;}}
chdir($dir);
if(function_exists("ini_set")){
ini_set("open_basedir","..")... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.