content stringlengths 7 1.05M |
|---|
# ["172.16.3.1", “172.16.1.5”, “172.15.2.0”, “172.16.3.1”, “172.16.3.1”, “172.16.1.5”]统计在此列表中每一个ip出现的次数,并输出出现频率最高的成员
l = ["172.16.3.1","172.16.1.5", "172.15.2.0", "172.16.3.1", "172.16.3.1","172.16.1.5"]
s1 = l.count('172.16.3.1')
s2 = l.count('172.16.1.5')
s3 = l.count('172.15.2.0')
b1 = l[0]
b2 = l[1]
b3 = l[2]
print ("Count for 172.16.3.1 :",l.count('172.16.3.1'))
print ("Count for 172.16.1.5 :",l.count('172.16.1.5'))
print ("Count for 172.15.2.0 :",l.count('172.15.2.0'))
print(max(b1,b2,b3))
|
#定义个返回response类,方便使用
class BaseResp:
def __init__(self,code,msg,data=None):
self.code=code
self.msg=msg
self.data=data
class respCode:
SUCCESS=200
UNAUTHERROR=401
PARAMERR=402
def respSuccess(msg,data=None):
return BaseResp(code=respCode.SUCCESS,msg=msg,data=data).__dict__
def respParamErr(msg='参数错误',data=None):
return BaseResp(code=respCode.PARAMERR,msg=msg,data=data).__dict__
def respUnAutherr(msg='没有访问权限'):
return BaseResp(code=respCode.UNAUTHERROR,msg=msg).__dict__
|
#
# @lc app=leetcode id=1137 lang=python3
#
# [1137] N-th Tribonacci Number
#
# https://leetcode.com/problems/n-th-tribonacci-number/description/
#
# algorithms
# Easy (62.05%)
# Likes: 1412
# Dislikes: 88
# Total Accepted: 204K
# Total Submissions: 328.7K
# Testcase Example: '4'
#
# The Tribonacci sequence Tn is defined as follows:
#
# T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0.
#
# Given n, return the value of Tn.
#
#
# Example 1:
#
#
# Input: n = 4
# Output: 4
# Explanation:
# T_3 = 0 + 1 + 1 = 2
# T_4 = 1 + 1 + 2 = 4
#
#
# Example 2:
#
#
# Input: n = 25
# Output: 1389537
#
#
#
# Constraints:
#
#
# 0 <= n <= 37
# The answer is guaranteed to fit within a 32-bit integer, ie. answer <= 2^31 -
# 1.
#
#
# @lc code=start
class Solution:
def tribonacci(self, n: int) -> int:
T = (0, 1, 1)
if n <= 2:
return T[n]
for i in range(n-2):
T = (T[1], T[2], sum(T))
return T[2]
# @lc code=end
|
test_cases = int(input().strip())
secrets = {
'0001101': 0,
'0011001': 1,
'0010011': 2,
'0111101': 3,
'0100011': 4,
'0110001': 5,
'0101111': 6,
'0111011': 7,
'0110111': 8,
'0001011': 9,
}
for t in range(1, test_cases + 1):
N, M = map(int, input().strip().split())
code = ''
for i in range(N):
line = input().strip()
if not code and '1' in line:
code = line
end_idx = 0
for i in range(M - 1, -1, -1):
if code[i] == '1':
end_idx = i
break
nums = [0] * 8
idx = 7
for i in range(end_idx, -1, -7):
nums[idx] = secrets[code[i - 6: i + 1]]
idx -= 1
if idx < 0:
break
check = (nums[0] + nums[2] + nums[4] + nums[6]) * 3 + (nums[1] + nums[3] + nums[5]) + nums[7]
result = 0
if check % 10 == 0:
result = sum(nums)
print('#{} {}'.format(t, result))
|
homepage_publish_event = {
"sys": {
"type": "Entry",
"id": "5bfZXM2wx8fCAb60IuLDdH",
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "83pwon8meh4m"
}
},
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"contentType": {
"sys": {
"type": "Link",
"linkType": "ContentType",
"id": "homePage"
}
},
"revision": 8,
"createdAt": "2020-12-21T16:41:56.909Z",
"updatedAt": "2020-12-29T15:48:20.027Z"
},
"fields": {
"page": {
"en-US": {
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "5P4wtOQF1TIULKEixOOesS"
}
}
},
"title": {
"en-US": "Adventure Trips"
},
"featuredImage": {
"en-US": {
"sys": {
"type": "Link",
"linkType": "Asset",
"id": "1CKhMZljDByaL0tfwUXd6A"
}
}
},
"description": {
"en-US": {
"data": {},
"content": [
{
"data": {},
"content": [
{
"data": {},
"marks": [],
"value": "We are a boutique tour operator focusing on a handpicked selection of our favourite adventure trips around the globe :)",
"nodeType": "text"
}
],
"nodeType": "paragraph"
}
],
"nodeType": "document"
}
},
"reviews": {
"en-US": [
{
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "3lNXHY1zY8cr9eM5AtcEQ3"
}
},
{
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "xj4oobeiVF9wUWpyuFvNL"
}
},
{
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "3oh7w0AVD8DtgbQrY2AUWU"
}
}
]
}
}
}
generic_text_page_publish_event = {
"sys": {
"type": "Entry",
"id": "20Nz2Y1oRRDkCeAJ8Anbvd",
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "83pwon8meh4m"
}
},
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"contentType": {
"sys": {
"type": "Link",
"linkType": "ContentType",
"id": "page"
}
},
"revision": 1,
"createdAt": "2021-02-04T08:25:14.567Z",
"updatedAt": "2021-02-04T08:25:14.567Z"
},
"fields": {
"page": {
"en-US": {
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "7sT7h262jsMfYHhPX18Aaq"
}
}
},
"slug": {
"en-US": "asdas"
},
"body": {
"en-US": {
"data": {},
"content": [
{
"data": {},
"content": [
{
"data": {},
"marks": [],
"value": "Test",
"nodeType": "text"
}
],
"nodeType": "paragraph"
}
],
"nodeType": "document"
}
},
"featuredImage": {
"en-US": {
"sys": {
"type": "Link",
"linkType": "Asset",
"id": "4shwYI3POEGkw0Eg6kcyaQ"
}
}
}
}
}
|
"""
Entradas --> 11 valores float entre notas de tareas y examentes finales
Examen Matematicas --> float --> ex_m
Nota 1 matematicas --> float --> M1
Nota 2 matematicas --> float --> M2
Nota 3 matematicas --> float --> M3
Examen Física --> float --> ex_f
Nota 1 física --> float --> f1
Nota 2 física --> float --> f2
Examen Química --> float --> ex_q
Nota 1 química --> float --> q1
Nota 2 química --> float --> q2
Nota 3 química --> float --> q3
Salidas --> 4 valores float correspondientes a la nota de cada asignatura, y al promedio general
Nota en matematicas --> float --> Matematicas
Nota en Física --> float --> Física
Nota en Química --> float --> Química
Promedio genetal --> float --> prom
"""
# Entradas
ex_m = float(input("\nEscribe la nota de tu examen final de Matemáticas "))
m1 = float(input("\nEscribe las notas de tus 3 tareas de Matemáticas\n"))
m2 = float(input())
m3 = float(input())
ex_f = float(input("\nEscribe la nota de tu examen final de Física "))
f1 = float(input("\nEscribe las notas de tus 2 tareas de Física\n"))
f2 = float(input())
ex_q = float(input("\nEscribe la nota de tu examen final de Química "))
q1 = float(input("\nEscribe las notas de tus 3 tareas de Química\n"))
q2 = float(input())
q3 = float(input())
# Caja negra
matematicas = (ex_m * 0.90) + ((m1+m2+m3)/3)*0.10
física = (ex_f * 0.80) + ((f1+f2)/2)*0.20
química = (ex_q * 0.85) + ((q1+q2+q3)/3)*0.15
prom = (matematicas + física + química)/3
# Salida
print("\nEn Matematicas tu nota es de: ",matematicas,"\nen Física tu nota es de: ",física,"\n en Química tu nota es de: ",química,"\n Y tu promedio general en",prom) |
# arquivo principal
# Declarando a variavel "sinal"
sinal = input("Qual operação deseja realizar ?")
# criando loop de repetição em caso de erro de digitação
while(sinal != '+' and sinal != '-' and sinal != '*' and sinal != '/'):
print("\n Você digitou uma operação invalida!")
sinal = input('\nQual operação deseja realizar ?')
# Declarando a variavel "numeroInicial"
numeroInicial = float(input("\nDigite o primeiro número..."))
# Declarando a variavel "numeroFinal"
numeroFinal = float(input("\nDigite p segundo número..."))
# Declarando a variavel "resultadoFinal"
resultadoFinal = 0
# Esquema de calculo
if(sinal == '+'):
resultadoFinal = numeroInicial + numeroFinal
print(resultadoFinal)
elif(sinal == '-'):
resultadoFinal = numeroInicial - numeroFinal
print(resultadoFinal)
elif(sinal == '*'):
resultadoFinal = numeroInicial * numeroFinal
print(resultadoFinal)
elif(sinal == '/'):
resultadoFinal = numeroInicial / numeroFinal
print(resultadoFinal) |
# Py
PI = 3.1415926535897932384626433832795
#endif
# 2.0 * PI
TWO_PI = 6.283185307179586476925286766559
#endif
# PI / 2.0
HALF_PI = 1.5707963267948966192313216916398
# 2.0/3.0 * PI
TWOTHIRD_PI = 2.0943951023931954923084289221863
# degree to pi multiplier (PI/360.0)
DEG_TO_PI = PI/360.0
# degree to 2*pi multiplier (TWO_PI/360.0)
DEG_TO_TWO_PI = PI/180.0
# 2*pi to degree multiplier (360.0/TWO_PI) */
TWO_PI_TO_DEG = 180.0/PI
# degree to radians multiplier (1.0/360.0)
DEG_TO_RAD = 0.0027777777777777777777777777777
# sqrt(2.0) *
SQRT_2 = 1.4142135623730950488016887242097
# tanh(1.0) *
TANH_1 = 0.761594
# 1.0/tanh(1.0)
TANH_1_I = 1.313035
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 30 17:38:52 2017
@author: zhejianpeng
"""
answer = 'ab'
secret = ['a','a']
input_board = ['aabbbbbb','aabbbbbb','bbbbbbbb','bbbbbbbb','bbbbbbbb','bbbbbbbb','bbbbbbbb','bbbbbbbb']
board = []
for i in input_board:
board.append(list(i))
# count = number of solution
# char need to find
sol = ''
counter = 0
# declare a matrix keep in track which point is vistied
notVisited = [[True for x in y] for y in board]
print(notVisited)
def solve(x,y, sol, counter,n): #x,y position, c is the elementes your looking for
if sol==answer:
print('solved')
print(sol)
n+=1
global counter
counter = 0
sol=''
else:
for i in range(x,len(board)):
for j in range(y,len(board)):
if board[i][j] == secret[counter]: # if that space is correct char arr[i][j]
print('HERE')
sol +=board[i][j]
counter+=1
notVisited[i][j] = False
if solve(i,j,sol, counter,n) and notVisited[i][j]:
return True
else:
notVisited[i][j] = True
print('no solution')
solve(0,0,sol, 0,0)
|
def add(x, y):
"""Return sum of 2 numbers"""
return x+y
def subtract(x, y):
'''Subtract x-y'''
return x-y
|
#!/usr/bin/env python3
# Task3: Caesar cipher
#
U = ['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']
l = ['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']
def find_char(char, secret, lst):
"""Takes a character from given string,
shifts it secret times and return the
character from lst depending on case of
the taken character."""
pos = lst.index(char)
offset = (pos + secret) % 26
ch = lst[offset]
return ch
def caesar_encrypt(str, n):
"""Method that takes a string, encrypt it
char by char and returns encrypted string"""
encrypted_msg = ""
for element in str:
if element in U:
char = find_char(element, n, U)
elif element in l:
char = find_char(element, n, l)
else:
char = element
encrypted_msg += char
return encrypted_msg
if __name__ == "__main__":
print (caesar_encrypt("Hello World!",2))
|
"""
3.1 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked above 40 hours. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75). You should use input to read a string and float() to convert the string to a number. Do not worry about error checking the user input - assume the user types numbers properly.
"""
def computepay(h,r):
if h < 0 or r < 0:
return None
elif h > 40:
return (40*r+(h-40)*1.5*r)
else:
return (h*r)
try:
hour = float(input("Enter Hours:"))
rate = float(input("please input your rate:"))
p = computepay(hour,rate)
print(p)
except:
print("Please,input your numberic")
|
class CommentInteraction:
def __init__(self, like=None, dislike=None):
self.like = like # Int
self.dislike = dislike # Int
@staticmethod
def generate(source):
if source is None or type(source) is str and len(source) == 0:
return CommentInteraction()
return CommentInteraction(source['like'], source['dislike'])
|
# local settings for this tlsscout installation,
# the {{ foo }} bits should be replaced with real values (by Ansible or by hand)
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'hemmelig'
# debug settings - remember to set allowed_hosts if debug is disabled
DEBUG=True
ALLOWED_HOSTS = []
# Database settings
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'tlsscoutdb',
'USER': 'tlsscout',
'PASSWORD': 'tlsscout',
'HOST': '127.0.0.1',
},
}
# admin site url prefix, set to 'admin' for /admin/
ADMIN_PREFIX='admin'
# email settings
EMAIL_BACKEND='django.core.mail.backends.console.EmailBackend'
#EMAIL_HOST='mailhost.example.com'
#EMAIL_PORT=587
#EMAIL_HOST_USER='mymailuser'
#EMAIL_HOST_PASSWORD='mymailpassword'
#EMAIL_USE_TLS=True
#EMAIL_FROM='noreply@example.com' # NOTE: this email is included in the useragent when using the SSL Labs API
# enable new accout creation / signups / registration?
ENABLE_SIGNUP=False
# pagination
EVENTS_PER_PAGE=100
|
#
# PySNMP MIB module Juniper-HOST-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-HOST-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:02:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint")
juniMibs, = mibBuilder.importSymbols("Juniper-MIBs", "juniMibs")
ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup")
ModuleIdentity, Counter32, iso, Integer32, MibIdentifier, Bits, NotificationType, TimeTicks, ObjectIdentity, Unsigned32, Counter64, IpAddress, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "Counter32", "iso", "Integer32", "MibIdentifier", "Bits", "NotificationType", "TimeTicks", "ObjectIdentity", "Unsigned32", "Counter64", "IpAddress", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
TextualConvention, DisplayString, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "RowStatus")
juniHostMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33))
juniHostMIB.setRevisions(('2004-11-26 00:00', '2002-09-16 21:44', '2001-05-07 17:02', '2000-01-26 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: juniHostMIB.setRevisionsDescriptions(('Added Tftp option in juniHostProtocol object.', 'Replaced Unisphere names with Juniper names.', 'Increase the max lenght of the host name.', 'Initial version of this MIB module.',))
if mibBuilder.loadTexts: juniHostMIB.setLastUpdated('200209162144Z')
if mibBuilder.loadTexts: juniHostMIB.setOrganization('Juniper Networks, Inc.')
if mibBuilder.loadTexts: juniHostMIB.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Road Westford, MA 01886-3146 USA Tel: +1 978 589 5800 E-mail: mib@Juniper.net')
if mibBuilder.loadTexts: juniHostMIB.setDescription('The host configuration MIB for Juniper Networks enterprise.')
juniHostObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1))
juniHost = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1, 1))
juniHostTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1, 1, 1), )
if mibBuilder.loadTexts: juniHostTable.setStatus('current')
if mibBuilder.loadTexts: juniHostTable.setDescription('The entries in this table describe host configuration information.')
juniHostEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1, 1, 1, 1), ).setIndexNames((1, "Juniper-HOST-MIB", "juniHostName"))
if mibBuilder.loadTexts: juniHostEntry.setStatus('current')
if mibBuilder.loadTexts: juniHostEntry.setDescription('An entry describing the configuration of a host.')
juniHostName = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1, 1, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 40))).setMaxAccess("readonly")
if mibBuilder.loadTexts: juniHostName.setStatus('current')
if mibBuilder.loadTexts: juniHostName.setDescription('The hostname identifier associated with this host entry.')
juniHostIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1, 1, 1, 1, 2), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: juniHostIpAddress.setStatus('current')
if mibBuilder.loadTexts: juniHostIpAddress.setDescription('The IP address associated with this host entry.')
juniHostProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("juniHostFtp", 1), ("juniHostTftp", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: juniHostProtocol.setStatus('current')
if mibBuilder.loadTexts: juniHostProtocol.setDescription('The file transfer protocol associated with this host entry.')
juniHostUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1, 1, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: juniHostUserName.setStatus('current')
if mibBuilder.loadTexts: juniHostUserName.setDescription('The username associated with this host entry.')
juniHostUserPassword = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1, 1, 1, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 25))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: juniHostUserPassword.setStatus('current')
if mibBuilder.loadTexts: juniHostUserPassword.setDescription('The password associated with this host entry. Reading this object returns a null DisplayString to avoid security breaches. However, a null string is not accepted for create or write operations.')
juniHostRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 1, 1, 1, 1, 6), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: juniHostRowStatus.setStatus('current')
if mibBuilder.loadTexts: juniHostRowStatus.setDescription("Controls creation/deletion of entries in this table. Only the values 'createAndGo' and 'destroy' may be SET.")
juniHostMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 4))
juniHostMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 4, 1))
juniHostMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 4, 2))
juniHostCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 4, 1, 1)).setObjects(("Juniper-HOST-MIB", "juniHostGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniHostCompliance = juniHostCompliance.setStatus('current')
if mibBuilder.loadTexts: juniHostCompliance.setDescription('The compliance statement for systems supporting host configuration.')
juniHostGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 33, 4, 2, 1)).setObjects(("Juniper-HOST-MIB", "juniHostName"), ("Juniper-HOST-MIB", "juniHostIpAddress"), ("Juniper-HOST-MIB", "juniHostProtocol"), ("Juniper-HOST-MIB", "juniHostUserName"), ("Juniper-HOST-MIB", "juniHostUserPassword"), ("Juniper-HOST-MIB", "juniHostRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniHostGroup = juniHostGroup.setStatus('current')
if mibBuilder.loadTexts: juniHostGroup.setDescription('The basic collection of objects providing management of host configuration functionality in a Juniper product.')
mibBuilder.exportSymbols("Juniper-HOST-MIB", juniHostObjects=juniHostObjects, juniHostMIBConformance=juniHostMIBConformance, juniHostIpAddress=juniHostIpAddress, juniHostGroup=juniHostGroup, juniHostProtocol=juniHostProtocol, juniHostTable=juniHostTable, juniHostUserPassword=juniHostUserPassword, juniHostEntry=juniHostEntry, juniHostMIB=juniHostMIB, juniHostName=juniHostName, juniHost=juniHost, juniHostUserName=juniHostUserName, PYSNMP_MODULE_ID=juniHostMIB, juniHostRowStatus=juniHostRowStatus, juniHostMIBGroups=juniHostMIBGroups, juniHostCompliance=juniHostCompliance, juniHostMIBCompliances=juniHostMIBCompliances)
|
##def do_twice(f):
# f()
# f()
#
#def print_spam():
# print('spam')
#
#do_twice(print_spam)
def do_twice(dt_function,dt_value):
dt_function(dt_value)*2
thing = "Sausage, Egg and Spam"
do_twice(print,"thing")
|
#!/usr/bin/env python
# encoding: utf-8
'''
@author: Jason Lee
@license: (C) Copyright @ Jason Lee
@contact: jiansenll@163.com
@file: jianzhi_offer_28.py
@time: 2019/3/26 18:26
@desc:
字符串的排列:
输入一个字符串,按字典序打印出该字符串中字符的所有排列。
例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba。
Recursive implementation
'''
def Permutation(str):
temp = list(str)
res = []
if not temp or len(temp) == 1:
return temp
for i in range(0, len(temp)):
temp[0], temp[i] = temp[i], temp[0]
temp1 = Permutation(temp[1:])
for j in temp1:
res.append(temp[0] + j)
temp[0], temp[i] = temp[i], temp[0]
return sorted(list(set(res)))
if __name__ == '__main__':
str = "aba"
b = Permutation(str)
print(b)
#print(['a'+'b',1])
|
class Tile:
map_word = "Island beach"
def describe(self):
print("The beach is really quiet and you can hear and see the seagulls "
"on the sea.\n")
def action(self, player, do):
print("What is this gibberish?")
def leave(self, player, direction):
if direction == "e":
print("You can't go back by swimming, that part is full of "
"electric eels.\n")
return False
elif direction == "s":
print("I'm afraid I can't let you go there Dave.")
return False
elif direction == "w":
print("The sandy beach is transforming into big rocks but it looks "
"like you are able to climb them.\n"
"Just be careful because they are a bit slipery.")
return True
else:
return True
|
f = maxsumit
assert f([]) == []
assert f([-1]) == []
assert f([0]) == []
assert f([1]) == [1]
assert f([1, 0]) == [1]
assert f([0, 1]) == [0, 1]
assert f([0, 1, 0]) == [0, 1]
assert f([2]) == [2]
assert f([2, -1]) == [2]
assert f([-1, 2]) == [2]
assert f([-1, 2, -1]) == [2]
assert f([2, -1, 3]) == [2, -1, 3]
assert f([2, -1, 3, -1]) == [2, -1, 3]
assert f([-1, 2, -1, 3]) == [2, -1, 3]
assert f([-1, 2, -1, 3, -1]) == [2, -1, 3]
assert f([-1, 1, 2, -5, -6]) == [1,2]
|
field=[[0]*100 for i in range(100)]
n,m=map(int,input().split())
for i in range(n):
x,y,a,b=map(int,input().split())
for j in range(x-1,a):
for k in range(y-1,b):
field[j][k]+=1
a=0
for i in range(100):
for j in range(100):
if field[i][j]>m:a+=1
print(a) |
class oprand:
def init (self):
self.props = {}
def add (self, name, value):
self.props[name] = value
def get (self, name):
return self.props.get(name, "")
def remove (self, name):
return self.props.pop(name)
def parse (self, stream):
pass
def run (self):
pass
def build (self):
pass
__init__ = init
|
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
print(' Hello world ')
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
user_input = input('What is your name?')
reply = 'Nice to meet you ' + user_input
print(reply)
|
def get_next_sparse(num):
str_bin = str(bin(num))[2:]
new_str_bin = ""
prev_digit = None
flag = False
for i, digit in enumerate(str_bin):
if digit == '1' and prev_digit == '1':
flag = True
if flag:
new_str_bin += '0' * (len(str_bin) - i)
break
else:
new_str_bin += digit
prev_digit = digit
if flag:
if new_str_bin[0] == '1':
new_str_bin = '10' + new_str_bin[1:]
else:
new_str_bin = '1' + new_str_bin
new_num = int(new_str_bin, base=2)
return new_num
# Tests
assert get_next_sparse(21) == 21
assert get_next_sparse(25) == 32
assert get_next_sparse(255) == 256
|
#!/usr/bin/env python
# coding=utf-8
'''
@Author: John
@Email: johnjim0816@gmail.com
@Date: 2020-07-22 11:28:02
@LastEditor: John
@LastEditTime: 2020-07-22 11:28:19
@Discription:
@Environment: python 3.7.7
'''
# Source : https://leetcode.com/problems/search-in-rotated-sorted-array/
# Author : JohnJim0816
# Date : 2020-07-22
#####################################################################################################
#
# Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
#
# (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
#
# You are given a target value to search. If found in the array return its index, otherwise return -1.
#
# You may assume no duplicate exists in the array.
#
# Your algorithm's runtime complexity must be in the order of O(log n).
#
# Example 1:
#
# Input: nums = [4,5,6,7,0,1,2], target = 0
# Output: 4
#
# Example 2:
#
# Input: nums = [4,5,6,7,0,1,2], target = 3
# Output: -1
#####################################################################################################
class Solution:
def search(self, nums: List[int], target: int) -> int:
n = len(nums)
if n == 0:
return -1
left = 0
right = n - 1
while left <= right:
mid = (left + right)//2
if nums[mid] == target:
return mid
if nums[0] <= nums[mid]: # 判断mid在左边坡上
if nums[0] <= target < nums[mid]:
right = mid - 1
else:
left = mid + 1
else:
if nums[mid] < target <= nums[n-1]:
left = mid + 1
else:
right = mid - 1
return -1 |
__author__ = 'mcxiaoke'
def gen():
for i in range(4):
yield i
gene=gen()
print(type(gene))
print(gene.next())
print(gene.next())
print(gene.next())
re=iter(range(10))
try:
#for i in range(5):
for i in range(20):
print(re.next())
except StopIteration as e:
print('here is the end: ',i)
else:
print("next")
finally:
print("finally")
print('hahahah') |
l = list(range(101))
def even(i):
return i % 2 == 0
print(list(filter(even, l)))
def fake_filter(function, list):
list_new=[]
for n in list:
if function(n) is True:
list_new.append(n)
return list_new
print(fake_filter(even, l))
|
#
# PySNMP MIB module BCCUSTOM-OPR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BCCUSTOM-OPR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:36:29 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint")
fcSwitch, = mibBuilder.importSymbols("Brocade-REG-MIB", "fcSwitch")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, Bits, ModuleIdentity, Counter32, Gauge32, MibIdentifier, TimeTicks, iso, Integer32, Counter64, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "Bits", "ModuleIdentity", "Counter32", "Gauge32", "MibIdentifier", "TimeTicks", "iso", "Integer32", "Counter64", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "NotificationType")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
bcCustomOperation = ModuleIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52))
bcCustomOperation.setRevisions(('2011-12-19 10:30',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: bcCustomOperation.setRevisionsDescriptions(('Initial version of this module.',))
if mibBuilder.loadTexts: bcCustomOperation.setLastUpdated('200807291830Z')
if mibBuilder.loadTexts: bcCustomOperation.setOrganization('Brocade Communications Systems, Inc.')
if mibBuilder.loadTexts: bcCustomOperation.setContactInfo('Customer Support Group Brocade Communications Systems, 120 Holger Way, San Jose, CA 95134 U.S.A Tel: +1-408-333-6061 Email: support@Brocade.COM WEB: www.brocade.com.')
if mibBuilder.loadTexts: bcCustomOperation.setDescription('The MIB module is to get the details of T8000 Embedded switch. copyright (c) 2011-2018 Brocade Communications Systems, Inc. All rights reserved.')
hwinfospsaveCmd = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 1))
if mibBuilder.loadTexts: hwinfospsaveCmd.setStatus('current')
if mibBuilder.loadTexts: hwinfospsaveCmd.setDescription('The OID subtree for supportsave operation.')
hwinfospsaveSet = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwinfospsaveSet.setStatus('current')
if mibBuilder.loadTexts: hwinfospsaveSet.setDescription("Parameter required for FC switch to execute supportsave operation: FTP Server IP Type: IPV4/IPV6 Server IP address: IP address of FTP server FTP User: FTP server username to login FTP Code: password of FTP server Command: which is executed on the FC switch board. Filename: The name of info package after command executed. Used: Trigger 'supportsave' command when received a trap of FC switch work abnormally.")
hwinfospsaveGet = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("success", 0), ("ftperror", 1), ("progressing", 2), ("systemerror", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwinfospsaveGet.setStatus('current')
if mibBuilder.loadTexts: hwinfospsaveGet.setDescription('Get the state how the triggered Command executed. Command: which is executed on the FC switch board. Used: Get state of Hwinfospsaveget execute. 0x0: command execute success ,file already transferred to FTP server 0x1: FTP server connect Error 0x2: progressing 0x3: System Error.')
hwUpdateFilecmd = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2))
if mibBuilder.loadTexts: hwUpdateFilecmd.setStatus('current')
if mibBuilder.loadTexts: hwUpdateFilecmd.setDescription('The OID subtree for Firmware download operation.')
hwUpdateFile = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwUpdateFile.setStatus('current')
if mibBuilder.loadTexts: hwUpdateFile.setDescription("Does Firmware upgrade of the FC switch. Use a space between each attribute separated. 1.The type, the current must be IPV4 2.ftp Host ip 3.ftp User name 4.ftp Password 5.The upgrade of the software loaded, you can bear with the path. Example: 'IPV4 172.16.128.1 user password xcbf.cc'")
hwUpdateFileInfo = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwUpdateFileInfo.setStatus('current')
if mibBuilder.loadTexts: hwUpdateFileInfo.setDescription("For getting firmware upgrade and progress status. Format is 1. INT32 iStatus 'Update state' 2. UINT8 ucResv[2] 'Reserved' Example: 1. Success - Firmwaredownload completed successfully 2. Inprogress - Firmwaredownload is going on 3. Another Firmware download in progress - When another download is going on 4. Invalid URI - Input URI is in incorrect format 5. Failure - Firmwaredownload is failed")
hwSoftwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 4096))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwSoftwareVersion.setStatus('current')
if mibBuilder.loadTexts: hwSoftwareVersion.setDescription("Software firmware version information. Format is 1. UINT32 hwSoftwareVersionNum 'The number of software' 'Version of the software structure' 2. UINT8 ucNameLen 'Software name length' 3. char ucName[ucNameLen] 'Software Name' Example (XCBC board) are as follows 00.00.00.02. --- The number of software 03. --- The length of the current version of the software (Firmware 1) 32.31.38. --- The current version of the software 218 (Firmware 1) 03. --- The length of the current version of the software (Firmware 2) 32.31.38. --- The current version of the software 218 (Firmware 2")
mibBuilder.exportSymbols("BCCUSTOM-OPR-MIB", hwinfospsaveGet=hwinfospsaveGet, hwinfospsaveSet=hwinfospsaveSet, bcCustomOperation=bcCustomOperation, hwinfospsaveCmd=hwinfospsaveCmd, hwUpdateFileInfo=hwUpdateFileInfo, PYSNMP_MODULE_ID=bcCustomOperation, hwUpdateFile=hwUpdateFile, hwUpdateFilecmd=hwUpdateFilecmd, hwSoftwareVersion=hwSoftwareVersion)
|
def findDecision(obj): #obj[0]: Driving_to, obj[1]: Passanger, obj[2]: Weather, obj[3]: Temperature, obj[4]: Time, obj[5]: Coupon, obj[6]: Coupon_validity, obj[7]: Gender, obj[8]: Age, obj[9]: Maritalstatus, obj[10]: Children, obj[11]: Education, obj[12]: Occupation, obj[13]: Income, obj[14]: Bar, obj[15]: Coffeehouse, obj[16]: Restaurantlessthan20, obj[17]: Restaurant20to50, obj[18]: Direction_same, obj[19]: Distance
# {"feature": "Coupon", "instances": 85, "metric_value": 0.9465, "depth": 1}
if obj[5]>0:
# {"feature": "Occupation", "instances": 69, "metric_value": 0.8281, "depth": 2}
if obj[12]<=6:
# {"feature": "Age", "instances": 40, "metric_value": 0.6098, "depth": 3}
if obj[8]<=2:
# {"feature": "Maritalstatus", "instances": 22, "metric_value": 0.2668, "depth": 4}
if obj[9]<=1:
return 'True'
elif obj[9]>1:
return 'False'
else: return 'False'
elif obj[8]>2:
# {"feature": "Restaurant20to50", "instances": 18, "metric_value": 0.8524, "depth": 4}
if obj[17]<=1.0:
# {"feature": "Income", "instances": 12, "metric_value": 0.9799, "depth": 5}
if obj[13]>2:
# {"feature": "Gender", "instances": 10, "metric_value": 0.8813, "depth": 6}
if obj[7]<=0:
# {"feature": "Bar", "instances": 6, "metric_value": 1.0, "depth": 7}
if obj[14]<=1.0:
# {"feature": "Passanger", "instances": 4, "metric_value": 0.8113, "depth": 8}
if obj[1]>0:
return 'False'
elif obj[1]<=0:
return 'True'
else: return 'True'
elif obj[14]>1.0:
return 'True'
else: return 'True'
elif obj[7]>0:
return 'True'
else: return 'True'
elif obj[13]<=2:
return 'False'
else: return 'False'
elif obj[17]>1.0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[12]>6:
# {"feature": "Distance", "instances": 29, "metric_value": 0.9784, "depth": 3}
if obj[19]<=2:
# {"feature": "Weather", "instances": 26, "metric_value": 0.9306, "depth": 4}
if obj[2]<=0:
# {"feature": "Direction_same", "instances": 22, "metric_value": 0.976, "depth": 5}
if obj[18]<=0:
# {"feature": "Driving_to", "instances": 18, "metric_value": 1.0, "depth": 6}
if obj[0]<=0:
# {"feature": "Time", "instances": 11, "metric_value": 0.8454, "depth": 7}
if obj[4]>2:
# {"feature": "Bar", "instances": 7, "metric_value": 0.9852, "depth": 8}
if obj[14]<=1.0:
# {"feature": "Income", "instances": 5, "metric_value": 0.971, "depth": 9}
if obj[13]>2:
# {"feature": "Passanger", "instances": 3, "metric_value": 0.9183, "depth": 10}
if obj[1]>1:
# {"feature": "Temperature", "instances": 2, "metric_value": 1.0, "depth": 11}
if obj[3]<=80:
# {"feature": "Coupon_validity", "instances": 2, "metric_value": 1.0, "depth": 12}
if obj[6]<=0:
# {"feature": "Gender", "instances": 2, "metric_value": 1.0, "depth": 13}
if obj[7]<=1:
# {"feature": "Age", "instances": 2, "metric_value": 1.0, "depth": 14}
if obj[8]<=4:
# {"feature": "Maritalstatus", "instances": 2, "metric_value": 1.0, "depth": 15}
if obj[9]<=0:
# {"feature": "Children", "instances": 2, "metric_value": 1.0, "depth": 16}
if obj[10]<=0:
# {"feature": "Education", "instances": 2, "metric_value": 1.0, "depth": 17}
if obj[11]<=0:
# {"feature": "Coffeehouse", "instances": 2, "metric_value": 1.0, "depth": 18}
if obj[15]<=4.0:
# {"feature": "Restaurantlessthan20", "instances": 2, "metric_value": 1.0, "depth": 19}
if obj[16]<=2.0:
# {"feature": "Restaurant20to50", "instances": 2, "metric_value": 1.0, "depth": 20}
if obj[17]<=2.0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[1]<=1:
return 'True'
else: return 'True'
elif obj[13]<=2:
return 'False'
else: return 'False'
elif obj[14]>1.0:
return 'True'
else: return 'True'
elif obj[4]<=2:
return 'True'
else: return 'True'
elif obj[0]>0:
# {"feature": "Restaurantlessthan20", "instances": 7, "metric_value": 0.5917, "depth": 7}
if obj[16]>1.0:
return 'False'
elif obj[16]<=1.0:
return 'True'
else: return 'True'
else: return 'False'
elif obj[18]>0:
return 'True'
else: return 'True'
elif obj[2]>0:
return 'True'
else: return 'True'
elif obj[19]>2:
return 'False'
else: return 'False'
else: return 'True'
elif obj[5]<=0:
# {"feature": "Education", "instances": 16, "metric_value": 0.6962, "depth": 2}
if obj[11]<=3:
return 'False'
elif obj[11]>3:
# {"feature": "Age", "instances": 4, "metric_value": 0.8113, "depth": 3}
if obj[8]>1:
return 'True'
elif obj[8]<=1:
return 'False'
else: return 'False'
else: return 'True'
else: return 'False'
|
class PyraFaceMapper:
@staticmethod
def is_face_twist(original_move: str) -> bool:
return (len(original_move) >= 2 and original_move[1] == 'w') or \
(len(original_move) >=
3 and original_move[0] == '2' and original_move[2] == 'w')
@staticmethod
def convert_vertex_twist_to_face_twist(original_move: str) -> str:
'''
Given a vertex twist X, translate it to a face twist followed by a vertex-based rotation
For example, U becomes Dw [U], and U' becomes Dw' [U']
Given a face twist, keep it after checking validity
For example, Dw' stays as Dw'
'''
vertex_face_map = {
"U": "Dw", "R": "Lw", "L": "Rw", "B": "Fw",
"u": "2Dw", "r": "2Lw", "l": "2Rw", "b": "2Fw"
}
accepted_directions = ["", "'", "2", "2'", "'2"]
accepted_faces = vertex_face_map.values()
if PyraFaceMapper.is_face_twist(original_move):
# e.g. if the original move is Dw2 or 2Fw2', etc.,
# the move should be left unchanged but verified
wide_move_char_index = original_move.find('w')
if wide_move_char_index < 0:
raise Exception("Invalid move entered: " + original_move)
move_direction = original_move[wide_move_char_index + 1:]
face_move = original_move[:wide_move_char_index + 1]
if face_move not in accepted_faces:
raise Exception("Invalid move entered: " + original_move)
final_face_move = original_move
else:
# e.g. if the original move is u',
# the face move with the direction is 2Dw',
# and the following_rotation is [U']
vertex_move_tip = original_move[:1]
move_direction = original_move[1:]
tmp_move = vertex_face_map.get(vertex_move_tip)
if tmp_move is None:
raise Exception("Invalid move entered: " + original_move)
face_move = tmp_move
face_move_with_direction = face_move + move_direction
final_face_move = face_move_with_direction + \
" " + "[" + original_move.upper() + "]"
if move_direction not in accepted_directions:
raise Exception("Invalid move direction detected")
return final_face_move
|
class TestGenerate(unittest.TestCase):
def test_generate_bin(self):
M = [1, 1, 1, 3, 3, 3, 5, 5, 5, 5, 2, 6]
ctrl = [0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 0, 3]
self.assertTrue(np.array_equal(ctrl, generate_bin(M, 3)))
M = np.array([0.1, 3.0, 0.0, 1.2, 2.5, 1.7, 2])
ctrl = [0, 3, 0, 1, 2, 1, 2]
self.assertTrue(np.array_equal(ctrl, generate_bin(M, 3)))
def test_choose_rows_where(self):
M = [[1,2,3], [2,3,4], [3,4,5]]
col_names = ['heigh','weight', 'age']
lables= [0,0,1]
M = diogenes.utils.cast_list_of_list_to_sa(
M,
col_names=col_names)
arguments = [{'func': val_eq, 'col_name': 'heigh', 'vals': 1},
{'func': val_lt, 'col_name': 'weight', 'vals': 3},
{'func': val_between, 'col_name': 'age', 'vals':
(3, 4)}]
res = choose_rows_where(
M,
arguments,
'eq_to_stuff')
ctrl = np.array(
[(1, 2, 3, True), (2, 3, 4, False), (3, 4, 5, False)],
dtype=[('heigh', '<i8'), ('weight', '<i8'), ('age', '<i8'),
('eq_to_stuff', '?')])
self.assertTrue(np.array_equal(res, ctrl))
def test_combine_cols(self):
M = np.array(
[(0, 1, 2), (3, 4, 5), (6, 7, 8)],
dtype=[('f0', float), ('f1', float), ('f2', float)])
ctrl = np.array(
[(0, 1, 2, 1, 1.5), (3, 4, 5, 7, 4.5), (6, 7, 8, 13, 7.5)],
dtype=[('f0', float), ('f1', float), ('f2', float),
('sum', float), ('avg', float)])
M = combine_cols(M, combine_sum, ('f0', 'f1'), 'sum')
M = combine_cols(M, combine_mean, ('f1', 'f2'), 'avg')
self.assertTrue(np.array_equal(M, ctrl))
def test_normalize(self):
col = np.array([-2, -1, 0, 1, 2])
res, mean, stddev = normalize(col, return_fit=True)
self.assertTrue(np.allclose(np.std(res), 1.0))
self.assertTrue(np.allclose(np.mean(res), 0.0))
col = np.arange(10)
res = normalize(col, mean=mean, stddev=stddev)
self.assertTrue(np.allclose(res, (col - mean) / stddev))
def test_distance_from_point(self):
# Coords according to https://tools.wmflabs.org/geohack/
# Paris
lat_origin = 48.8567
lng_origin = 2.3508
# New York, Beijing, Jerusalem
lat_col = [40.7127, 39.9167, 31.7833]
lng_col = [-74.0059, 116.3833, 35.2167]
# According to http://www.movable-type.co.uk/scripts/latlong.html
# (Rounds to nearest km)
ctrl = np.array([5837, 8215, 3331])
res = distance_from_point(lat_origin, lng_origin, lat_col, lng_col)
# get it right within 1km
self.assertTrue(np.allclose(ctrl, res, atol=1, rtol=0))
if __name__ == '__main__':
unittest.main()
|
def test_admin_peers(web3, skip_if_testrpc):
skip_if_testrpc(web3)
assert web3.admin.peers == []
|
'''
LeetCode Q.1170 Compare Strings by Frequency of the Smallest Character
'''
def numSmallerByFrequency(queries, words):
def bin_search(arr, t):
l = 0
r = len(arr)-1
while l <= r:
mid = (l+r)//2
if l == r:
if arr[mid] > t:
return len(arr) - mid
elif arr[mid] == t:
return len(arr) - mid - 1
else:
break
if (arr[mid] <= t and arr[mid+1] > t):
return len(arr) - mid-1
if (arr[mid-1] <= t and arr[mid] > t):
return len(arr) - mid
elif arr[mid] <= t:
l = mid+1
else:
r = mid-1
return 0
def f(s):
smallest = min(s)
return s.count(smallest)
arr1 = [f(i) for i in queries]
arr2 = sorted([f(i) for i in words])
ans = [0] * len(arr1)
for ind, i in enumerate(arr1):
ans[ind] = bin_search(arr2, i)
return ans
if __name__ == '__main__':
queries = ["cbd"]
words = ["zaaaz"]
print(numSmallerByFrequency(queries, words))
|
#!/usr/bin/env python
prod = 0
for a in range(1, 1001):
for b in range(a + 1, 1001):
c = 1000 - a - b
if a**2 + b**2 == c**2:
prod = a * b * c
break
if prod != 0:
break
print(prod)
|
def max_sub_array(nums):
""" Returns the max subarray of the given list of numbers.
Returns 0 if nums is None or an empty list.
Time Complexity: O(n)
Space Complexity: O(n)
"""
if nums == None:
return 0
if len(nums) == 0:
return 0
max_sum = 0
current_sum = 0
for i in range(len(nums)):
current_sum = max((nums[i] + current_sum), nums[i])
max_sum = max(current_sum, max_sum)
if max_sum <=0:
return max(nums)
return max_sum
|
d = list(map(int, input().split()))
d.sort()
if d[0] == d[1] and d[1] == d[2]:
print(10000 + d[0] * 1000)
elif d[0] == d[1]:
print(1000 + d[0] * 100)
elif d[1] == d[2]:
print(1000 + d[1] * 100)
else:
print(100 * d[2])
|
# -*- coding: utf-8 -*-
# author: Wu Mingchun
"""conf.
数据库配置文件
"""
DATABASE = "mathsql"
USER = "minch"
PWD = "Wu12260917"
HOST = "localhost"
PORT = "5432"
|
# Aggregate all `python` rules to one loadable file
load(":python_proto_compile.bzl", _python_proto_compile="python_proto_compile")
load(":python_grpc_compile.bzl", _python_grpc_compile="python_grpc_compile")
load(":python_grpclib_compile.bzl", _python_grpclib_compile="python_grpclib_compile")
load(":python_proto_library.bzl", _python_proto_library="python_proto_library")
load(":python_grpc_library.bzl", _python_grpc_library="python_grpc_library")
load(":python_grpclib_library.bzl", _python_grpclib_library="python_grpclib_library")
python_proto_compile = _python_proto_compile
python_grpc_compile = _python_grpc_compile
python_grpclib_compile = _python_grpclib_compile
python_proto_library = _python_proto_library
python_grpc_library = _python_grpc_library
python_grpclib_library = _python_grpclib_library
# Aliases
py_grpc_compile = _python_grpc_compile
py_grpc_library = _python_grpc_library
py_grpclib_compile = _python_grpclib_compile
py_grpclib_library = _python_grpclib_library
py_proto_compile = _python_proto_compile
py_proto_library = _python_proto_library
|
def initFont(name, w, h): # -> fontId
imagep = Image.open(name)
ix = imagep.size[0]
iy = imagep.size[1]
image = imagep.tobytes("raw", "RGBX", 0, -1)
tid = texture_init(image, ix, iy)
col_count = ix // w
row_count = iy // h
return {
#'tid':tid,
'col':col_count,
'row':row_count,
'w':w,
'h':h,
'width':ix,
'height':iy,
}
def font_coord_to_tex_coord(fid, x, y):
w = fid['w'] + 1
h = fid['h'] + 1
width = fid['width']
height = fid['height']
s, t = x, y
x *= w
y *= h
x = x/width
y = 1.0 - y/height
s = (s+1) * w
t = (t+1) * w
s = s/width
t = 1.0 - t/height
return x, t, s, y
def say_2dfont(font_id, msg):
tid = font_id['tid']
col = font_id['col']
glColor3f(1.0, 1.0, 1.0)
glDisable(GL_BLEND)
glEnable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, tid)
glLoadIdentity()
glTranslatef(50.0, 50.0, -0.1)
x = window_width
x /= 30
y = x
left = -40.0
for char in msg:
code = ord(char) - ord('a')
xx = code % col
yy = code // col
a, b, s, t = font_coord_to_tex_coord(font_id, xx, yy)
#print(msg, char, code, x, a,b,s,t)
glBegin(GL_QUADS)
glTexCoord2f(a, b)
glVertex3f(left-x, -y, 0.0)
glTexCoord2f(a, t)
glVertex3f(left - x, y, 0.0)
glTexCoord2f(s, t)
glVertex3f(left + x, y, 0.0)
glTexCoord2f(s, b)
glVertex3f(left + x, -y, 0.0)
glEnd()
left += 10
|
# Returns length of LCS for X[0..m-1], Y[0..n-1]
def longest_common_subsequence(X, Y):
X_length = len(X)
Y_length = len(Y)
L = [[0 for x in range(Y_length + 1)] for x in range(X_length + 1)]
# Following steps build L[m+1][n+1] in bottom up fashion. Note
# that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1]
for i in range(X_length + 1):
for j in range(Y_length + 1):
if i == 0 or j == 0:
L[i][j] = 0
elif X[i - 1] == Y[j - 1]:
L[i][j] = L[i - 1][j - 1] + 1
else:
L[i][j] = max(L[i - 1][j], L[i][j - 1])
# Following code is used to print LCS
index = L[X_length][Y_length]
# Create a character array to store the lcs string
lcs = [""] * (index + 1)
lcs[index] = ""
# Start from the right-most-bottom-most corner and
# one by one store characters in lcs[]
i = X_length
j = Y_length
while i > 0 and j > 0:
# If current character in X[] and Y are same, then
# current character is part of LCS
if X[i - 1] == Y[j - 1]:
lcs[index - 1] = X[i - 1]
i -= 1
j -= 1
index -= 1
# If not same, then find the larger of two and
# go in the direction of larger value
elif L[i - 1][j] > L[i][j - 1]:
i -= 1
else:
j -= 1
# print("LCS of " + X + " and " + Y + " is " + "".join(lcs))
return "".join(lcs)
# Test
X = "ACCAEF"
Y = "CCAACCF"
longest_common_subsequence(X, Y) |
################################################################################
#
# Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors
#
# This file is a part of the MadGraph5_aMC@NLO project, an application which
# automatically generates Feynman diagrams and matrix elements for arbitrary
# high-energy processes in the Standard Model and beyond.
#
# It is subject to the MadGraph5_aMC@NLO license which should accompany this
# distribution.
#
# For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch
#
################################################################################
tutorial_MadLoop = """
You have entered tutorial mode. This will introduce you to the main
syntax options for MadLoop which are mostly similar to the MadGraph5_aMC@NLO one.
If you have not done so already, please follow MadGraph5_aMC@NLO tutorial before
this one.
Remember that exactly as in MadGraph5, you can learn more about the different
options for any command by typing
MG5_aMC> help A_CMD
And to see a list of all commands, use
MG5_aMC> help
MadLoop is the part of MadGraph5_aMC@NLO used to generate the code for
evaluating the loop diagrams. This tutorial teaches you how to use MadLoop
as standalone tool for studying loops within particular processes.
Therefore in this mode, you can only consider definite processes, meaning
without multiparticle labels.
This tutorial has three parts:
a) How to generate a process.
b) How to cross-check / profile an output.
c) How to compute the loop matrix element squared for local phase-space points.
Let's start with the first point, how to generate a process with MadLoop in
standalone mode. Keep in mind that this means only the loop and born diagrams
are generated.
MG5_aMC>generate g g > d d~ [virt=QCD]
Note that a space is mandatory between the particle names and that '[virt=QCD]'
specifies that you want to consider QCD NLO corrections. The keyword option
'virt' before '=' within the squared brackets precisely specifies you are only
interested in the virtual contribution.
"""
tutorial = tutorial_MadLoop
generate = """
You have just generated a new process.
You can find more information on supported syntax by using:
MG5_aMC>help generate
To list all defined processes, type
MG5_aMC>display processes
You can display a pictorial representation of the diagrams with
MG5_aMC> display diagrams
Notice you can add the option 'loop' or 'born' if you only want those diagrams
to be displayed.
If you want to add a second process, you can use the add process command:
MG5_aMC>add process e+ e- > d d~ [virt=QCD]
But keep in mind that you must still consider only virtual corrections and
cannot employ multiparticle labels. Also decay chains are not available for
loops.
At this stage you can export your processes.
This is done simply by typing:
MG5_aMC>output MY_FIRST_MADLOOP_RUN
Notice that the standalone output mode (implicit in the above) is the only
available for MadLoop standalone runs.
"""
display_processes = """
You have seen a list of the already defined processes.
At this stage you can export your processes to different formats.
To create a MadLoop standalone output for these, simply type:
MG5_aMC>output MY_FIRST_MADLOOP_RUN
"""
display_diagrams = """
You have displayed the diagrams.
Notice you can add the 'born' or 'loop' option to this command to specify the
class of diagrams to be displayed.
At this stage you can export your processes to different formats.
To create a MadLoop standalone output for these, simply type:
MG5_aMC>output MY_FIRST_MADLOOP_RUN
"""
add_process = """
You have added a process to your process list.
At this stage you can export your processes.
For this, simply type
MG5_aMC>output MY_FIRST_MADLOOP_RUN
"""
output = """
If you are following the tutorial, a directory MY_FIRST_MADLOOP_RUN has
been created under your MadGraph5_aMC@NLO installation directory.
The code for the evaluation of the squared loop matrix element is in
'SubProcesses/P0_<shell_proc_name>/'. There, you can compile and edit
running parameters from 'MadloopParams.dat' and then run the code with './check'
Alternatively, for a simple quick run, type:
MG5_aMC>launch -f
This computes the squared matrix element for a given PS points.
For the purpose of this tutorial, the option '-f' is added to automatically skip
the edition of the cards and phase-space point specification.
"""
launch = """
You just launched the MadLoop standalone evalutation of the squared loop matrix
element for (a/many) specific process(es) for a random Phase-Space point.
The two processes proposed in this tutorial were g g > d d~ and e+ e- > d d~.
You can check that you get the right double pole normalized with respect to
the born*(alpha_s/2*pi), namely -26/3 and -8/3 respectively.
Now this tutorial will introduce you to two checking functionalities for the
evaluation of the contributions of virtual origin.
Start by typing:
MG5_aMC>check g g > d d~ [virt=QCD]
This will test lorentz and crossing invariance as well as of the gauge
invariance check from the ward identity for the initial state gluon.
You can add an option after check to specify to perform only one definite check.
Notice that the check functionality is only available for MadLoop standalone
runs (those with the 'virt=' option).
"""
check = """
You have seen the results for the various consistency checks performed on the
MadGraph5_aMC@NLO loop computation.
You can now use the check command to obtain a full profiling of a given process
including loop contributions.
Simply type:
MG5_aMC>check profile g g > d d~ [virt=QCD]
Notice that you can replace 'profile' by 'timing' or 'stability' if
you only want timing or stability benchmarks about this process.
"""
check_profile = """
You have seen detailed information about the stability, timings and code size
of a given process including loop.
Keep in mind that these check functionalities are only available for MadLoop
standalone runs.
You just learned the basic commands for the MadLoop runs (i.e. with the
'virt=' option). You can close this tutorial by typing
MG5_aMC>tutorial stop
Or exit MG5 with
MG5_aMC>exit
"""
|
__all__ = ['directories',
'load_wfcorrection',
'mosaic_tools',
'wise_flux_correction']
|
dirfrom = open(r"C:\Users\emurphy24\Documents\GitHub\WoordleCalculator\dictfrom.txt", "r", encoding="utf-8")
dirlist = []
for line in dirfrom:
line = line.strip()
dirlist.append(line)
print(len(dirlist))
dirfrom.close()
dirto = open(r"C:\Users\emurphy24\Documents\GitHub\WoordleCalculator\fiveletterdir", "a", encoding="utf-8")
for i in dirlist:
if len(i) == 5 and i.isalpha():
dirto.write(i + "\n") |
# Advent of Code Day 12
# https://adventofcode.com/2020/day/12
def heading_to_dir(heading):
if heading == 0:
return "N"
elif heading == 90:
return "E"
elif heading == 180:
return "S"
elif heading == 270:
return "W"
def rotate_waypoint(old_north, old_east, degrees):
# degrees in increments of 90, pos or neg
new_north = old_north
new_east = old_east
degrees = (degrees + 360) % 360 # make the movement positive
for turns in range(degrees // 90):
old_north = new_north
old_east = new_east
new_north = -1 * old_east
new_east = old_north
return new_north, new_east
def test_rotate_waypoint():
north, east = rotate_waypoint(10, 4, 90)
assert north == -4 and east == 10
north, east = rotate_waypoint(10, 4, 180)
assert north == -10 and east == -4
north, east = rotate_waypoint(10, 4, 270)
assert north == 4 and east == -10
north, east = rotate_waypoint(10, 4, 360)
assert north == 10 and east == 4
north, east = rotate_waypoint(10, 4, -90)
assert north == 4 and east == -10
north, east = rotate_waypoint(10, 4, -180)
assert north == -10 and east == -4
north, east = rotate_waypoint(10, 4, -270)
assert north == -4 and east == 10
if __name__ == "__main__":
filepath = ".\\AdventOfCode\\2020\\day12-input.txt"
with open(filepath) as f:
instructions = [line.strip() for line in f]
# print(instructions)
part1_instr = instructions.copy()
# state
state_north = 0
state_east = 0
state_heading = 90
for ins in part1_instr:
command = ins[0]
value = int(ins[1:])
if command == "N":
state_north += value
elif command == "S":
state_north -= value
elif command == "E":
state_east += value
elif command == "W":
state_east -= value
elif command == "F":
part1_instr.append(heading_to_dir(state_heading) + str(value))
elif command == "L":
state_heading = (state_heading - value) % 360
elif command == "R":
state_heading = (state_heading + value) % 360
# print(f"North: {state_north} East: {state_east} Heading:{state_heading}")
print(f"Part 1: {abs(state_north) + abs(state_east)}")
# Part 2
part2_instr = instructions.copy()
# state
state_north = 0
state_east = 0
# state_heading = 90
waypoint_north = 1
waypoint_east = 10
for ins in part2_instr:
command = ins[0]
value = int(ins[1:])
if command == "N":
waypoint_north += value
elif command == "S":
waypoint_north -= value
elif command == "E":
waypoint_east += value
elif command == "W":
waypoint_east -= value
elif command == "F":
state_north += waypoint_north * value
state_east += waypoint_east * value
elif command == "L":
waypoint_north, waypoint_east = rotate_waypoint(
waypoint_north, waypoint_east, -1 * value
)
elif command == "R":
waypoint_north, waypoint_east = rotate_waypoint(
waypoint_north, waypoint_east, value
)
# print(f"North: {state_north} East: {state_east} Heading:{state_heading}")
print(f"Part 2: {abs(state_north) + abs(state_east)}") # 6276 too low
|
def test_home_page(test_client):
"""
GIVEN a Flask application
WHEN the '/' page is requested (GET)
THEN check the response is valid
"""
response = test_client.get('/')
assert response.status_code == 200
assert b"Fantasy PLQ" in response.data
assert b"Login" in response.data
def test_valid_login(test_client, init_database):
"""
GIVEN a Flask application
WHEN the '/login' page is posted to (POST)
THEN check the response is valid
"""
response = test_client.post('/login',
data=dict(email='test@user.com', password='hi'),
follow_redirects=True)
# print(response)
assert response.status_code == 200
assert b"Logout" in response.data
assert b"Profile" in response.data
def test_valid_logout(test_client, init_database):
"""
GIVEN a Flask application
WHEN the '/logout' page is requested (GET)
THEN check the response is valid
"""
response = test_client.get('/logout', follow_redirects=True)
assert response.status_code == 200
assert b"Logout" not in response.data
|
'''
input:
123
-123
120
0
1534236469
Output
321
-321
21
0
0
'''
class Solution:
def reverse(self, x: int) -> int:
range_value = 2**31
val = x;
output = ""
if x < 0:
output += "-"
val = abs(val)
while True:
dig = val%10
val = int(val/10)
output += str(dig)
if val == 0:
break
val = int(output)
# print(output)
if -range_value <= val <= range_value - 1:
return val
else:
return 0
|
""" this is the application url path(s)
"""
__all__ = [
'auth', 'postfix', 'dovecot', 'fetch'
]
|
print('========================')
print(' BANCO CEV ')
print('========================')
while True:
cont = 0
cont1 = 0
cont2 = 0
cont3 = 0
valor = int(input('Digite o valor a ser sacado: '))
print('')
while valor < 1000:
print('ERRO! Valor permitido a ser sacado a partir de R$1000 ')
valor = int(input('Digite o valor a ser sacado: '))
print('')
while valor > 9999:
print('ERRO! Valor a ser sacado é alto demais. Tente um valor menor')
valor = int(input('Digite o valor a ser sacado: '))
print('')
milhar = ((valor // 1000) % 10) * 1000
centena = ((valor // 100) % 10) * 100
dezena = ((valor // 10) % 10) * 10
unidade = ((valor // 1) % 10) * 1
for c in range(1, milhar+1, 50):
cont += 1
print(f'TOTAL DE: {cont} cédulas de R$50,00')
for c in range(1, centena+1, 20):
cont1 += 1
print(f'TOTAL DE: {cont1} cédulas de R$20,00')
for c in range(1, dezena+1, 10):
cont2 += 1
print(f'TOTAL DE: {cont2} cédulas de R$10,00')
for c in range(1, unidade+1, 1):
cont3 += 1
print(f'TOTAL DE: {cont3} cédulas de R$1,00')
print('')
parada = str(input('Deseja sacar outro valor? [S/N] ')).upper()
print('')
while parada != 'S' and parada != 'N':
print('ERRO! Valor digitado não reconhecido. Tente Novamente')
parada = str(input('Deseja sacar outro valor? [S/N] ')).upper()
print('')
if parada == 'N':
print('Volte sempre ao BANCO CEV! Tenha um bom dia!')
break
|
# Dragon
sm.setSpeakerID(1013001)
sm.sendNext("You, who is destined to be a Dragon Master... You have finally arrived.")
sm.sendNext("Go and fulfill your duties as the Dragon Master...")
#todo effects
sm.warp(100030100, 0)
sm.dispose() |
def foo():
pass
def bar():
pass
def boing():
pass
|
"""
Este es el comentario del archivo tarea2.py
""" |
dict_month = {"A": 1, "B": 2, "C": 3,
"D": 4, "E": 5, "F": 6,
"G": 7, "H": 8, "I": 9,
"J": 10, "K": 11, "L": 12,
"M": 1, "N": 2, "O": 3,
"P": 4, "Q": 5, "R": 6,
"S": 7, "T": 8, "U": 9,
"V": 10, "W": 11, "X": 12}
dict_is_call = {"A": True, "B": True, "C": True,
"D": True, "E": True, "F": True,
"G": True, "H": True, "I": True,
"J": True, "K": True, "L": True,
"M": False, "N": False, "O": False,
"P": False, "Q": False, "R": False,
"S": False, "T": False, "U": False,
"V": False, "W": False, "X": False}
def get_option_info_from_ticker(ticker, equity_length=3):
asset = ticker[:equity_length]
exp_month_code = ticker[equity_length]
month = dict_month[exp_month_code]
is_call = dict_is_call[exp_month_code]
day = int(ticker[equity_length + 1:equity_length + 3])
year = int(ticker[equity_length + 3:equity_length + 5]) + 2000
K = int(ticker[equity_length + 5:-2]) / 100
country = ticker[-1]
return asset, is_call, month, day, year, K, country
|
#python 3
debug = False
def from_input():
m = int(input())
idx_matrix = []
for _ in range(m):
row = list(map(float, input().split()))
idx_matrix.append(row)
return idx_matrix
def to_str(x):
return list(map(lambda a: format(a, '.6f'), x))
def gauss(matrix):
if len(matrix) == 0:
return []
size = len(matrix[0]) - 1
size_rows = len(matrix)
used_columns = [False] * size
used_rows = [False] * size_rows
def makePivot(selectedRow, selectedColumn):
used_rows[selectedRow] = True
used_columns[selectedColumn] = True
def leftMostNonZeroInNonPivotRow():
if False not in used_rows:
return False
initialRow = used_rows.index(False)
for row in range(initialRow, size_rows):
for column in range(size):
if matrix[row][column] != 0 and column < size:
used_rows[row] = True
return (row, column)
return False
def swapRowToTopOfNonPivotRow(selectedRow):
if False not in used_rows:
return
topNonPivotRow = used_rows.index(False)
if topNonPivotRow < selectedRow:
matrix[topNonPivotRow], matrix[selectedRow] = matrix[selectedRow], matrix[topNonPivotRow]
selectedRow = topNonPivotRow
def rescaleToMakePivotOne(selectedRow, selectedColumn):
pivot = matrix[selectedRow][selectedColumn]
matrix[selectedRow] = [elem/pivot for elem in matrix[selectedRow]]
def substractToMakeOtherRowsZero(selectedRow, selectedColumn):
for row in range(size_rows):
if row != selectedRow:
times = matrix[row][selectedColumn]
matrix[row] = [i - (times * j) for i, j in zip(matrix[row], matrix[selectedRow])]
while False in used_rows and False in used_columns:
selectedRow, selectedColumn = leftMostNonZeroInNonPivotRow()
swapRowToTopOfNonPivotRow(selectedRow)
makePivot(selectedRow, selectedColumn)
rescaleToMakePivotOne(selectedRow, selectedColumn)
substractToMakeOtherRowsZero(selectedRow, selectedColumn)
res = [matrix[row][-1] for row in range(size_rows)]
for i in range(len(res)):
if res[i] == -0.0:
res[i] = 0.0
return to_str(res)
def test():
def run(data, expected, f=gauss):
result = f(data)
if result != expected:
raise Exception("Expected %s, Actual: %s" % (expected, result))
run([[1.0, 1.0, 3.0], [2.0, 3.0, 7.0]], ["2.000000", "1.000000"])
run([[1.0, 1.0]], ["1.000000"])
run([], [])
run([[5.0, -5.0, -1.0], [-1.0, -2.0, -1.0]], ["0.200000", "0.400000"])
run([[1.0, 0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0, 5.0],
[0.0, 0.0, 1.0, 0.0, 4.0], [0.0, 0.0, 0.0, 1.0, 3.0]],
["1.000000", "5.000000", "4.000000", "3.000000"])
run([
[2.0, 4.0, -2.0, 0.0, -2.0],
[-1.0, -2.0, 1.0, -2.0, -1.0],
[2.0, 2.0, 0.0, 2.0, 0.0]],
["-1.000000", "1.000000", "0.000000"])
print("Tests passed")
if __name__ == '__main__':
if debug:
test()
else:
s = gauss(from_input())
print(" ".join(s)) |
class Dog:
kind = 'canine'
# tricks = []
def __init__(self, name):
self.name = name
self.tricks = []
def add_trick(self, trick):
self.tricks.append(trick)
my_dog = Dog('Carl')
my_dog.add_trick('roll over')
another_dog = Dog('Max')
another_dog.add_trick('play dead')
print(my_dog.name, my_dog.kind, my_dog.tricks)
print(another_dog.name, another_dog.kind, another_dog.tricks)
|
# reverse the order of the items in an array
lista_unu = [1, 2, 3, 4, 5]
def Reverse(list):
list.reverse()
return list
print(Reverse(lista_unu))
# number of occurrences
lista_doi = [1, 1, 1, 1, 4, 4, 6, 7, 9, 9, 9, 3]
def NumberOfOccu(var, list):
occ = 0
for i in list:
if i == var:
occ += 1
return occ
var = 6
print(NumberOfOccu(var, lista_doi))
# number of words
string = "numaram cate cuvinte avem in propozitia asta "
def Words(string):
words = 1
for i in range(len(string)-1):
if string[i] == " " and string[i+1] != " ":
words += 1
return words
print(Words(string))
|
#
# PySNMP MIB module DLINK-PORT-SECURITY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-PORT-SECURITY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:35:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion")
dlink_common_mgmt, = mibBuilder.importSymbols("DLINK-ID-REC-MIB", "dlink-common-mgmt")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Integer32, IpAddress, ObjectIdentity, NotificationType, ModuleIdentity, MibIdentifier, iso, Gauge32, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, Bits, Unsigned32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "IpAddress", "ObjectIdentity", "NotificationType", "ModuleIdentity", "MibIdentifier", "iso", "Gauge32", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "Bits", "Unsigned32", "TimeTicks")
MacAddress, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "MacAddress", "DisplayString", "TextualConvention")
swPortSecMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 12, 63))
if mibBuilder.loadTexts: swPortSecMIB.setLastUpdated('1210161030Z')
if mibBuilder.loadTexts: swPortSecMIB.setOrganization('D-Link Corp.')
swPortSecCtrl = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 1))
swPortSecInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 2))
swPortSecMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3))
swPortSecTrapLogState = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecTrapLogState.setStatus('current')
swPortSecSysMaxLernAddr = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecSysMaxLernAddr.setStatus('current')
swPortSecTrapState = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecTrapState.setStatus('current')
swPortSecLogState = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecLogState.setStatus('current')
swPortSecMgmtByPort = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1))
swPortSecPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1), )
if mibBuilder.loadTexts: swPortSecPortTable.setStatus('current')
swPortSecPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1), ).setIndexNames((0, "DLINK-PORT-SECURITY-MIB", "swPortSecPortIndex"))
if mibBuilder.loadTexts: swPortSecPortEntry.setStatus('current')
swPortSecPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 1), Integer32())
if mibBuilder.loadTexts: swPortSecPortIndex.setStatus('current')
swPortSecPortMaxLernAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecPortMaxLernAddr.setStatus('current')
swPortSecPortLockAddrMode = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("permanent", 1), ("deleteOnTimeout", 2), ("deleteOnReset", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecPortLockAddrMode.setStatus('current')
swPortSecPortAdmState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecPortAdmState.setStatus('current')
swPortSecPortClearCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("start", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecPortClearCtrl.setStatus('current')
swPortSecPortViolationAction = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("drop", 1), ("shutdown", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecPortViolationAction.setStatus('current')
swPortSecMgmtByVLAN = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2))
swPortSecVLANTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1), )
if mibBuilder.loadTexts: swPortSecVLANTable.setStatus('current')
swPortSecVLANEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1), ).setIndexNames((0, "DLINK-PORT-SECURITY-MIB", "swPortSecVLANID"))
if mibBuilder.loadTexts: swPortSecVLANEntry.setStatus('current')
swPortSecVLANID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094)))
if mibBuilder.loadTexts: swPortSecVLANID.setStatus('current')
swPortSecVLANMaxLernAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecVLANMaxLernAddr.setStatus('current')
swPortSecVLANClearCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("start", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecVLANClearCtrl.setStatus('current')
swPortSecMgmtByVLANOnPort = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3))
swPortSecVLANOnPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1), )
if mibBuilder.loadTexts: swPortSecVLANOnPortTable.setStatus('current')
swPortSecVLANOnPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1, 1), ).setIndexNames((0, "DLINK-PORT-SECURITY-MIB", "swPortSecPortIndex"), (0, "DLINK-PORT-SECURITY-MIB", "swPortSecVLANID"))
if mibBuilder.loadTexts: swPortSecVLANOnPortEntry.setStatus('current')
swPortSecVLANOnPortMaxLernAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1, 1, 1), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecVLANOnPortMaxLernAddr.setStatus('current')
swPortSecVLANOnPortAddCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("add", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swPortSecVLANOnPortAddCtrl.setStatus('current')
swPortSecMgmtByVLANOnPortClearCtrl = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2))
swPortSecMgmtByVLANOnPortClearPort = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2, 1), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecMgmtByVLANOnPortClearPort.setStatus('current')
swPortSecMgmtByVLANOnPortClearVID = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecMgmtByVLANOnPortClearVID.setStatus('current')
swPortSecMgmtByVLANOnPortClearAction = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("start", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecMgmtByVLANOnPortClearAction.setStatus('current')
swPortSecEntriesTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4), )
if mibBuilder.loadTexts: swPortSecEntriesTable.setStatus('current')
swPortSecEntriesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1), ).setIndexNames((0, "DLINK-PORT-SECURITY-MIB", "swPortSecMac"), (0, "DLINK-PORT-SECURITY-MIB", "swPortSecVID"))
if mibBuilder.loadTexts: swPortSecEntriesEntry.setStatus('current')
swPortSecMac = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 1), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swPortSecMac.setStatus('current')
swPortSecVID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swPortSecVID.setStatus('current')
swPortSecPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swPortSecPort.setStatus('current')
swPortSecDelCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("start", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swPortSecDelCtrl.setStatus('current')
mibBuilder.exportSymbols("DLINK-PORT-SECURITY-MIB", swPortSecDelCtrl=swPortSecDelCtrl, swPortSecVLANOnPortEntry=swPortSecVLANOnPortEntry, swPortSecVLANEntry=swPortSecVLANEntry, swPortSecPortClearCtrl=swPortSecPortClearCtrl, swPortSecPort=swPortSecPort, swPortSecTrapState=swPortSecTrapState, swPortSecMgmtByVLANOnPortClearPort=swPortSecMgmtByVLANOnPortClearPort, swPortSecMgmtByVLANOnPortClearAction=swPortSecMgmtByVLANOnPortClearAction, swPortSecPortLockAddrMode=swPortSecPortLockAddrMode, swPortSecCtrl=swPortSecCtrl, swPortSecLogState=swPortSecLogState, swPortSecVLANID=swPortSecVLANID, swPortSecVLANOnPortMaxLernAddr=swPortSecVLANOnPortMaxLernAddr, swPortSecMIB=swPortSecMIB, swPortSecPortViolationAction=swPortSecPortViolationAction, swPortSecMgmtByVLANOnPortClearVID=swPortSecMgmtByVLANOnPortClearVID, swPortSecVLANMaxLernAddr=swPortSecVLANMaxLernAddr, swPortSecPortAdmState=swPortSecPortAdmState, swPortSecMgmtByVLAN=swPortSecMgmtByVLAN, swPortSecPortTable=swPortSecPortTable, swPortSecMac=swPortSecMac, swPortSecEntriesTable=swPortSecEntriesTable, swPortSecSysMaxLernAddr=swPortSecSysMaxLernAddr, swPortSecVLANTable=swPortSecVLANTable, swPortSecMgmt=swPortSecMgmt, swPortSecVLANOnPortTable=swPortSecVLANOnPortTable, swPortSecTrapLogState=swPortSecTrapLogState, swPortSecVLANClearCtrl=swPortSecVLANClearCtrl, swPortSecVID=swPortSecVID, swPortSecMgmtByVLANOnPortClearCtrl=swPortSecMgmtByVLANOnPortClearCtrl, swPortSecEntriesEntry=swPortSecEntriesEntry, swPortSecPortMaxLernAddr=swPortSecPortMaxLernAddr, swPortSecPortEntry=swPortSecPortEntry, swPortSecInfo=swPortSecInfo, swPortSecPortIndex=swPortSecPortIndex, swPortSecMgmtByPort=swPortSecMgmtByPort, swPortSecVLANOnPortAddCtrl=swPortSecVLANOnPortAddCtrl, PYSNMP_MODULE_ID=swPortSecMIB, swPortSecMgmtByVLANOnPort=swPortSecMgmtByVLANOnPort)
|
class Node:
def __init__(self):
self.data=None
self.next=None
class Linked_List(Node):
def __init__(self):
self.start=None
def Create(self):
while True:
newnode=Node()
newnode.data=int(input("Enter data part : "))
if self.start==None:
self.start=newnode
current=newnode
else:
current.next=newnode
current=newnode
char=input("DO YOU WANT TO ENTER MORE NODES? : ")
if char in ('n','N'):
break
def Display(self):
ptr=self.start
print("\n\nDATA IS AS FOLLOWS : \n")
while ptr!=None:
print(ptr.data,end=' ')
ptr=ptr.next
print()
def Reverse(self,ptr):
if ptr==None:
return
self.Reverse(ptr.next)
print(ptr.data)
l1=Linked_List()
l1.Create()
l1.Display()
l1.Reverse(l1.start)
|
# -------------------
# Universal Exception
# -------------------
class FontPartsError(Exception):
pass
|
for i in range(2,10):
flag=0
s=0
for j in range(2,i//2+1):
if i%j==0:
flag=1
break
if flag==0:
s+=i
print('prime',i,s)
|
#!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'wtq'
MONGODB_HOST = '127.0.0.1'
MONGODB_PORT = 27017
keywords = ['石油', '石化', '天然气', '的']
|
class RoadmapNode:
def __init__(self, id, config):
self.id = id
self.config = config
self.neighbors = []
def get_config(self):
return self.config
def get_id(self):
return self.id
''' Add another RoadmapNode as neighbor. '''
def add_neighbor(self, node):
self.neighbors.append(node)
def get_neighbors(self):
return self.neighbors
def __len__(self):
return 3
def __getitem__(self, i):
return self.config[i]
def __repr__(self):
return 'Item({}, {})'.format(self.config[0], self.config[1]) |
class AudioError(Exception):
""" Any audio-related error.
This is used as the base error type for all errors in the audio module.
"""
pass
class MixerError(AudioError):
""" An audio mixer IO error.
An error that occurs while loading audio data from disk.
"""
pass
class RequestError(AudioError):
""" A TTS request IO error.
An error that occurs when writing a request to disk.
"""
pass
class TTSError(AudioError):
""" A TTS invocation error.
An error that occurs when the external TTS command fails. This is raised
when the DEC invocation returns an error code other than zero. Information
written to stderr by DEC is usually included with this exception.
"""
pass
|
model_source = 'bert-base-chinese'
max_len = 512
num_workers = 2
batch_size = 32
# for training
manual_seed = 1313
exp_name = 'bert_detection'
train_json = 'data/aishell3_train.json'
valid_json = 'data/aishell3_valid.json'
lr = 5e-5
val_interval = 100
num_iter = 10000
|
# Aula 18 - Desafio 86: Matriz em Python
# Criar uma matriz 3x3 e preencher com valores lidos pelo teclado. (tudo numa unica lista)
# No final, a matriz na tela, com a formataçao correta.
'''
00 01 02
10 11 12
20 21 22
'''
matriz = []
coordenadas = []
for a in range(3):
for b in range(3):
coordenadas.append(int(input(f'Informe o dado da coordenada ({a},{b}): ')))
matriz.append(coordenadas[:])
coordenadas.clear()
titulo = ' MATRIZ 3X3 '
print('=+'*10)
print(titulo.center(20, '#'))
print('=+'*10)
for c in range(3):
print(matriz[c], end=' ')
print()
for c in range(3, 6):
print(matriz[c], end=' ')
print()
for c in range(6, 9):
print(matriz[c], end=' ')
# outra maneira
'''
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for linha in range(0, 3):
for coluna in range(0, 3):
matriz[linha][coluna] = int(input(f'Digite um valor p/ a posiçao ({linha},{coluna}): '))
print('='*30)
for linha in range(0, 3):
for coluna in range(0, 3):
print(f'[{matriz[linha][coluna]:^5}]', end='') # O '^5' usa 5 espaços e centraliza
print()
''' |
#!/usr/bin/env python
# coding: utf-8
def sort_blocks():
# First, we load the current README into memory
with open('README.md', 'r', encoding='UTF8') as read_me_file:
read_me = read_me_file.read()
# Separating the 'table of contents' from the contents (blocks)
table_of_contents = ''.join(read_me.split('- - -')[0])
blocks = ''.join(read_me.split('- - -')[1]).split('\n# ')
for i in range(len(blocks)):
if i == 0:
blocks[i] = blocks[i] + '\n'
else:
blocks[i] = '# ' + blocks[i] + '\n'
# Sorting the libraries
inner_blocks = sorted(blocks[0].split('##'))
for i in range(1, len(inner_blocks)):
if inner_blocks[i][0] != '#':
inner_blocks[i] = '##' + inner_blocks[i]
inner_blocks = ''.join(inner_blocks)
# Replacing the non-sorted libraries by the sorted ones and gathering all at the final_README file
blocks[0] = inner_blocks
final_README = table_of_contents + '- - -' + ''.join(blocks)
with open('README.md', 'w+', encoding='UTF8') as sorted_file:
sorted_file.write(final_README)
def main():
# First, we load the current README into memory as an array of lines
with open('README.md', 'r', encoding='UTF8') as read_me_file:
read_me = read_me_file.readlines()
# Then we cluster the lines together as blocks
# Each block represents a collection of lines that should be sorted
# This was done by assuming only links ([...](...)) are meant to be sorted
# Clustering is done by indentation
blocks = []
last_indent = None
for line in read_me:
s_line = line.lstrip()
indent = len(line) - len(s_line)
if s_line.startswith('-'):
if indent == last_indent:
blocks[-1].append(line)
else:
blocks.append([line])
last_indent = indent
else:
blocks.append([line])
last_indent = None
with open('README.md', 'w+', encoding='UTF8') as sorted_file:
# Then all of the blocks are sorted individually
blocks = [
''.join(sorted(block, key=str.lower)) for block in blocks
]
# And the result is written back to README.md
sorted_file.write(''.join(blocks))
# Then we call the sorting method
sort_blocks()
if __name__ == "__main__":
main() |
for i in range(int(input())):
s = input().split()
if 'not' in s:
print('Real Fancy')
else:
print('regularly fancy')
|
def gcd(a, b):
"""
a, b: two positive integers
Returns the greatest common divisor of a and b
"""
if b == 0:
return a
return gcd(b, a % b)
def general_poly (L):
""" L, a list of numbers (n0, n1, n2, ... nk)
Returns a function, which when applied to a value x, returns the value
n0 * x^k + n1 * x^(k-1) + ... nk * x^0 """
def in_poly(x):
result = 0
for k in range(len(L)):
result += L[k] * x**(len(L) - k - 1)
return result
return in_poly
if __name__ == "__main__":
print(general_poly([1, 2, 3, 4])(10))
print(general_poly([1, 2, 3, 4])(-7))
print(general_poly([1, 2, 3, 4])(4.32))
|
input = [
"17-19 p: pwpzpfbrcpppjppbmppp",
"10-11 b: bbbbbbbbbbbj",
"17-19 c: ccccccccccfrcctcccjc",
"8-10 k: kkkkkkkfkkks",
"13-14 l: lvllvllllslllv",
"8-9 n: nhhcnnnknnqnb",
"1-3 d: pdbdfbws",
"5-6 v: vvvgvb",
"7-8 x: gxcxtwbl",
"2-15 r: xlgrwqpcsqtrvfrrt",
"9-14 l: glnldlllllllln",
"2-3 r: vxnw",
"8-9 g: gfggczgkgggjgg",
"4-5 d: ddddh",
"6-9 t: zttttbhbttttftd",
"3-6 k: kkkzwnmv",
"2-7 w: sgmvplwwjx",
"11-13 h: hhhvhhhhhhvhh",
"9-10 f: mhfdfffffmlffsfvts",
"17-18 l: llllllllllllllllrzl",
"4-5 c: crcccccccvc",
"9-12 q: qqqqqpqrqqlcq",
"7-8 n: nnnnnndn",
"3-5 f: ffqnfpffhf",
"3-4 j: djpj",
"17-18 q: qqqqqqqmqqsqqqqqjq",
"8-15 j: bjmjbbqfjjrgjgfkjj",
"2-11 d: xdgdmxgwzdpdxdhjwd",
"8-9 p: bppppppmp",
"10-11 t: ttttttttttb",
"5-8 v: vhxvfcsvvxjvvvpgwdv",
"9-17 q: mqqqqqqqqqjvqqqqzlq",
"1-2 t: tptbbn",
"9-11 q: gqqqqqqfwqqqq",
"8-9 h: hsdsfkgphxglmsjndhh",
"2-3 z: mzgz",
"4-16 n: nxnsqmrnnnpfvnfnb",
"1-3 r: rbzcrkjrqrrnjxj",
"1-5 c: ccccccq",
"4-11 m: mmmgmmmmmmm",
"8-9 z: zlzvzzzpzz",
"1-18 h: xzqhmkzhhrtxpljptbc",
"3-4 p: pbpg",
"16-20 j: jrfjjzjjjrjjgvjkzjjj",
"6-9 t: ctdtthtlttttpt",
"3-4 h: mfhj",
"5-10 t: tgtxttqhtl",
"1-3 w: fwgw",
"6-7 q: qvqlrqp",
"12-13 m: mmmmmmmmrmmmplm",
"12-14 r: rrrrhrrrrrrrrbrc",
"4-6 b: ljzbqgwxcdmdjfbcwd",
"7-10 g: gggggggmgpg",
"2-3 c: mbcc",
"7-8 k: kbkkkktkckc",
"7-8 p: pppppppbp",
"5-8 w: twwwwwwgvvwvdttmh",
"13-17 p: ppppfppppppppppppp",
"8-12 x: xxxcxxxbjxxxxk",
"9-18 b: hhbbqcbbbsblbgpwbbhf",
"6-8 h: hhhhfhhchhjhhch",
"7-11 g: ggtnwvcdgctkrggxj",
"5-8 k: kknhndzm",
"4-5 z: zzznz",
"2-4 p: pbtp",
"16-18 r: rrrrtrrrrrrrrrrhrr",
"15-16 r: rhrrrrrrrrrrrrrx",
"7-10 l: lllklmhxzlxcdljz",
"7-8 q: qqpwsqqb",
"9-13 k: qkknkkxlzkrkkkkkpk",
"4-8 h: wlrhfbth",
"6-8 q: vppqqqgntfqqgqq",
"19-20 g: ggggggggggggggggggfg",
"4-5 m: shmzmsdm",
"3-4 k: kkhkk",
"4-7 b: cbsqkcpnkcfzhmpvfvgz",
"18-19 l: lllllllnllltdlwgllxl",
"14-15 z: zztzzzthdzzzzzn",
"9-10 s: ksssbsssstss",
"2-10 t: mltjpttttthpttttz",
"3-9 n: pqnpfxgfnzqxv",
"7-11 d: ndddddhdddddddd",
"11-13 v: vkvbwrchzvhhvpc",
"13-15 l: llllllllllllllll",
"10-13 c: ccclwbcbccbxvcrdzctc",
"8-9 w: klvwtwwwbwhww",
"2-4 j: mnmb",
"10-14 w: wwwmwwwwwwwwlnwsw",
"14-17 x: xxxxxxxxxxxxxlxxkxx",
"3-7 r: bxrqzxsrfmclfdrqrtpf",
"7-14 b: bbbbqbbbbbbbbbbbbbb",
"7-13 p: wwvhwdprjxppwnhsbp",
"2-3 h: hqhh",
"8-11 n: nnnnnnnjcnn",
"5-12 l: cwzxlpvwlsfjqrgk",
"3-5 v: vvphwvv",
"5-16 d: dpdrdfdrhwdrrqdqxd",
"14-18 z: zzzzzzzzzzzzzzzzzkzz",
"2-5 h: hcjlh",
"12-13 w: wwwwwwwwwbwlw",
"15-16 c: ccccccccccccccxc",
"4-7 b: lbbsbbwhb",
"2-5 z: qtwmzhzmwqw",
"5-6 d: drjddc",
"7-9 q: qqqqjqqfdqq",
"14-15 r: rvrqrrrrrwsrrmrrd",
"16-17 h: hhhhhhhhhhhhhhhhlh",
"10-16 f: fvhgfzffchmffgfff",
"3-7 q: qcqlvdvgrqtqcq",
"7-9 x: xxsxxrxxpsx",
"3-10 h: hjhjthhrthcdhhhhxz",
"15-16 t: tttttttztwbwptjt",
"3-5 x: xrlxqx",
"3-4 b: bbbp",
"1-4 n: jnhnndn",
"3-6 c: ccccfm",
"7-8 v: tvtvdvspvvv",
"6-8 l: lljlllgsglcsw",
"2-13 h: jhzzcgpxhbgqsbwhf",
"17-18 j: jjjjjjjjjjjjjjjjhc",
"2-3 c: ctcchxklnbrqc",
"3-14 w: wwcwwwwwwwcwww",
"1-3 k: kcxf",
"9-14 t: ttttkttlnttmtttt",
"2-4 x: xkxxqzxvck",
"5-6 h: dgmxghjxjnhs",
"4-12 f: fvhlffxnfjhfffqxfcf",
"1-10 b: pfsbflbbkbqk",
"8-9 s: qzkfszjss",
"1-14 m: mmmmmsmmxmqmmmmmmmm",
"11-13 w: nsgwwwwwwpbwvwww",
"2-15 t: sprsbpztsznslst",
"3-4 d: tqscgnrjxrqdwqd",
"5-17 x: xqrzxxxxfxzxrzxxxw",
"8-9 m: mkmhmgdmq",
"6-8 q: qqqqqqqxq",
"2-5 m: mmmmmf",
"4-13 v: gvvvsvfmmmvvx",
"13-16 t: ttttttttgtvtwttntt",
"8-16 c: ccccccczccccccccc",
"10-11 b: bbbbbbkbbvbbbbb",
"1-12 n: pnnnnbnhnnbng",
"5-6 b: qbbbbb",
"4-6 z: zzzzzvjzzznxdzx",
"2-3 p: dwxqpjp",
"4-6 w: wwwxwq",
"2-3 x: pvpdh",
"5-8 n: pqnnkncnnfnnnnnn",
"10-12 w: drqwwxrwwkwwwswwl",
"2-4 g: rbggfslgjqqhj",
"9-19 r: pzxhrcfrrrqjqfkhrhjz",
"3-6 n: rngtnnnnn",
"4-14 t: tttttttttttftgttttht",
"6-8 q: qqdtqqmrgqcqqqqc",
"3-14 t: tttnttttttttqk",
"9-10 w: qqwcjzwgjnqdrdxwjwl",
"10-12 t: tthtthtktvtttt",
"2-7 v: vzvvvvv",
"5-17 p: zzpsmpgpprdmhxprsvs",
"8-9 t: ttttttvnt",
"4-8 v: vvvfvvvvvvvvvvv",
"7-15 h: cwkhdzmththzjnh",
"7-9 v: vjvlwzvvmv",
"1-2 c: hchw",
"7-8 f: ffpfffsfqf",
"5-8 s: xlssskszb",
"2-15 x: fxzpbvqzmkxvtlljjrg",
"1-3 s: hsss",
"7-14 m: xmmtmmmgmrmmxzmxm",
"10-13 z: dnzztzzzzzfszxzczg",
"3-8 h: rhthhnhh",
"6-9 g: hbggggggggbg",
"13-15 z: zzzzpzbzzzzzfzzz",
"5-15 l: llllwlllllllllll",
"3-5 m: dhmmm",
"2-13 h: hrrhgqhhnhkhhhhb",
"1-5 p: kpppp",
"2-13 m: fmqjmrzhskzwdnt",
"7-8 q: bqxvzqqsjpqqqq",
"2-13 d: ddhdddddddddbddddd",
"5-9 s: nhkmxssqsjssjs",
"2-11 b: vlrtxpzkqwb",
"6-7 q: qqqqqcq",
"7-9 n: nnnnnknnmgn",
"3-9 n: qfkxknwnn",
"15-16 d: dddddddddddddddgd",
"12-13 h: hhhhhhhhhjmvhhh",
"3-4 w: tbfw",
"8-9 f: fkffbfhtf",
"2-4 q: qjsqqf",
"2-11 t: ttttpdgtlxhtx",
"7-10 k: dkkkkkkkkh",
"6-7 c: hccccxcgv",
"6-7 j: sjcbfmj",
"1-2 w: vtrwjcgndvwx",
"12-13 m: mmmcmmmmmmmms",
"3-7 h: hhhhhhw",
"9-13 g: gghgwgrrkgcgg",
"12-13 g: gggggggggggfgggg",
"13-16 s: sssssssfsssssszb",
"2-17 p: pbpmpmwpnqppppppphbd",
"2-9 c: cmrcwfnjcdcxccccrzc",
"8-12 j: jvjjjcjxjjdqjjjr",
"6-9 m: mgjxmcfdm",
"2-5 l: klmxlx",
"2-10 x: jvxwxpxrxx",
"2-3 r: rrzrp",
"2-12 v: cbfrnctdmzwvlbvjmdgg",
"2-9 r: wrbrrrrzm",
"12-13 h: fhsbhhhhhhhwhhhhhh",
"5-8 d: ddhqdddddp",
"4-5 l: djnlnlllbl",
"2-9 t: tdtgttddtwwj",
"16-20 t: tttttttttttttttttttt",
"5-8 z: zzzszzzmszz",
"8-13 d: dddddddbdzwddd",
"9-10 z: zzztzzzhzxgz",
"10-12 p: wppcppxpppgpppzr",
"4-5 w: wkwtwwzww",
"3-9 m: dmmmrmmmm",
"1-4 g: gvmr",
"8-9 d: frxndpdzwd",
"17-20 q: qqqqqqnqqqqqqqqqhqqq",
"7-13 w: pwfwwrwwwkwww",
"3-5 q: qqpqw",
"11-13 p: pplpppppppppb",
"4-12 g: glggjmsggggjrgbgm",
"3-7 p: cfphqrxpsgthp",
"12-15 f: gfnrhffgftnbggfwtbp",
"16-18 p: pppppppppppppppppm",
"3-4 l: lllzn",
"1-2 d: dddd",
"8-12 n: nnnnxnnhnnnn",
"2-4 z: zzzzz",
"1-4 s: sssms",
"2-4 h: hghhh",
"1-10 l: nhtnzhdtmslxqskf",
"5-13 j: bpzjjrrqzndjtw",
"1-2 x: xxchn",
"1-16 v: vjvrxvdbdnvvkzvg",
"9-10 b: xbvzbbmfmbqbbvbbrb",
"8-12 k: ktnkfbgkkkkbkmkk",
"7-9 h: hhhhhhwhh",
"16-17 g: sgggmggggggggggvggg",
"3-10 q: qmlqqqqqqq",
"11-14 h: hhhxhhhhhchhwkh",
"9-14 f: kqwqcftkfdxgmsd",
"12-13 p: pppppppppppph",
"7-8 f: dkfnjfff",
"5-6 f: jtfrrfxckhfmfffszggg",
"6-8 n: jzhpkszn",
"8-10 c: cccccnckcxmrchjc",
"14-15 d: dddjdjdddddddpp",
"8-10 f: cfshmqfffwtffltfzff",
"3-4 b: bdbq",
"2-6 b: cfqkbtvmn",
"15-16 z: zgzzqzjhzzmnzkzvzz",
"4-6 r: krrrrlm",
"3-6 c: dcczrfr",
"8-9 s: ssssssfws",
"11-12 s: mssssssssssq",
"1-2 r: zrznpmzrs",
"10-11 k: kkkkkkkkkfk",
"3-9 k: kbkkkkgkk",
"1-4 w: lwwtw",
"3-4 t: ttkt",
"2-3 m: htvmjk",
"2-4 p: mdpp",
"10-17 s: ssssssssssssssssws",
"1-2 m: gmmc",
"5-9 d: dddbvjkdd",
"5-8 z: tmnfplzz",
"7-14 s: ssssssssssssstkss",
"2-7 q: gqbcxnqcvszwbxqkz",
"6-17 b: btbxlbbbbbbbbbvtbkd",
"6-9 l: lllllllld",
"11-12 q: nqqjjrhgxgqp",
"6-9 n: nlnnfnnjb",
"13-17 x: xnxxxxxxxxbdbxxrc",
"5-13 w: wwtwrwzwwwqfwtkwtwbw",
"5-10 g: gggxbgmgrgggggg",
"13-16 h: mhhhhmshhchhhhhl",
"2-3 f: flff",
"2-4 k: kkhr",
"2-6 m: mmmqmml",
"6-7 p: ppppppp",
"2-6 k: ksktkkk",
"2-4 m: gkml",
"5-6 h: hhvqhjz",
"2-5 h: hkhqhfh",
"3-4 z: zzglz",
"2-3 f: zhfn",
"10-11 m: mmzmmmmmmfmm",
"3-13 d: ddwzdmmddmddz",
"1-2 h: hvkhm",
"4-5 n: nnnnb",
"5-7 f: fjppbffffz",
"2-4 g: tmlp",
"15-16 q: bqfvqqqcptqqzqqx",
"18-19 g: lpgqgcgsdtngfddbggnp",
"3-5 z: kjzkq",
"1-6 q: qjkqqzqq",
"3-4 m: bpmmjgmmfmj",
"2-5 k: jkvkz",
"11-14 q: qqqbjqqqqqgqqq",
"6-17 q: bfqqtlqqfjgqtqtqs",
"5-16 s: ssdzfbsdhsszspssvs",
"1-7 n: nhnvmhb",
"4-5 b: hbbrk",
"9-14 f: fffbffkfftcfnfgf",
"1-3 n: nznxndpb",
"3-4 k: qkktw",
"3-8 r: rrprrgrrr",
"2-5 l: sqmllls",
"6-7 n: njnknvnnpvlbnx",
"3-5 t: hbrtmcttt",
"5-9 j: fjjnjcgjhnkcpqjbc",
"2-4 l: jllx",
"7-8 d: dddddndd",
"3-6 t: gtsttjnt",
"9-11 m: cbmgjlqcbsmllm",
"1-2 l: vllfcckl",
"10-11 p: ppppzppppplp",
"2-4 m: slzmmrw",
"3-8 h: bhhgmpbs",
"7-14 t: tttttthttttttttt",
"1-3 r: rrvvrrprwrfrcr",
"5-15 w: gwbhwjwwwkswcsww",
"2-5 v: zvtls",
"1-4 v: vsvv",
"10-15 z: zzzzzzzzzztrjzr",
"3-5 v: vvvjhdvv",
"3-12 s: wqssnmdlwlws",
"2-3 r: djrftptcrskpzrz",
"1-3 p: nbppgkmfnjp",
"17-18 w: wwwwwwwwtwwwwwwwrw",
"2-5 l: xqntklqlt",
"2-5 g: gtkggghcvgl",
"18-19 z: zzzzzzgzzzzzzzzzzztz",
"16-17 x: xxcxxwxxblpxzkfxzj",
"15-19 f: frffffstcwffccffffff",
"3-4 n: npnm",
"2-3 d: zvddd",
"7-9 x: xzxxctxxl",
"13-14 s: hhsxbzssdtssfss",
"4-5 m: vbpmhmrmvrjnmhlsbmm",
"3-6 z: zzzzzwdzzzzzzzzzz",
"18-19 g: gggggggggggggggggng",
"14-15 x: fxxjxxxxxxmxxwxxnxb",
"10-12 m: xmmmmfmdmmkh",
"3-4 b: bbgbgb",
"11-13 c: cclcccbcxcccqcczc",
"10-17 w: wwwwwwwswwwwwwnwpw",
"5-7 l: blllqll",
"4-10 n: nnnnnnnnntn",
"9-10 z: fzzztzczwzzgkzzn",
"4-5 x: gxjhxbxxx",
"3-6 p: plhxppk",
"10-19 p: mpgpmxdvqphrcckpvqw",
"3-14 p: kfdwtqxpstpcfpgcfmp",
"2-6 k: gnxkkkjrzkknskmpbsj",
"8-10 l: lzllklldplllzl",
"16-17 n: nnnsnnnnnnnnpnnjnnn",
"1-14 c: kccccccccgccccc",
"2-11 s: lsqghkzwsgsbdmgq",
"6-7 p: pcpgqrcpqpptpm",
"1-11 h: lhhhhhhhhqhhxbhhfhhh",
"11-12 r: rrhjrbrrvrrrrdrrr",
"5-8 c: cccccwck",
"6-8 w: wwwwwwwb",
"12-15 n: htvxnnhvnpnnknnhnt",
"1-2 c: jcct",
"2-10 v: vsvvvvvvvvv",
"4-5 x: xhxtx",
"3-4 f: ffxf",
"5-8 v: wprmvflppqwvwfwpkq",
"5-7 n: znnnnnxblcrn",
"8-9 n: zljnjjbnn",
"10-11 m: mzwkrvmzrdc",
"3-7 h: hxkhfhcqhr",
"6-13 j: vhcmljdxwkqnfcvmjjb",
"1-6 g: gvgggthkr",
"6-10 l: bldnllklkllllclslm",
"6-7 g: gggggng",
"1-4 x: xxxxxpnsv",
"15-16 q: qqqqqsqqqqqqqqqbq",
"6-7 q: qnqqqdqqq",
"5-6 p: ppppspppp",
"3-5 k: kkskkk",
"1-2 j: jrjjjjj",
"8-9 d: ddpzdlldmddhdhdd",
"5-8 t: ttsljtnt",
"2-4 w: qwwmwwhwwwwwwww",
"6-8 c: clcccccv",
"1-8 f: ffbfqfpfbfb",
"5-13 r: rrrrkrrrrrrrrr",
"15-18 v: vvvvvvvvjvvvvvvvvvvv",
"7-8 r: xjwxkzqrrxr",
"7-10 d: kddddddddbddd",
"1-8 k: kkkkkkkkk",
"4-6 q: rhdkjsqjqvzqcpsnq",
"1-2 t: tdtt",
"5-6 l: lllwlh",
"3-5 f: pdzfff",
"7-8 s: qsswssks",
"3-5 d: dcdddd",
"1-12 r: rvlrrrwdtkrcxffr",
"2-7 d: rddcdlqtnffbdd",
"5-9 t: phmtdzfjtdb",
"9-12 x: jxxxxxxxxxxcx",
"14-16 c: fcclccccmcnccwccqccv",
"4-5 p: zxpzk",
"15-19 t: ttttttttttttfkttttl",
"5-10 k: kdmjgkkkkkblkvkkkk",
"6-15 q: wqgmcqcmcjlgxkqrdstw",
"6-7 r: rrrrrrr",
"2-6 n: ksnnnnnzn",
"16-17 g: ggggggggggggggghgg",
"11-13 k: nsgkkkkzckxtkn",
"2-5 q: jqvkqm",
"2-10 q: lpqqmqlqqqqqtqqw",
"10-20 k: dkztkkkkshkkkkkkkkdk",
"4-7 d: fddddxd",
"3-5 v: vvvvs",
"7-9 b: bbbbbbrzb",
"4-14 z: nbnzkbxbwhqpjsdlzz",
"3-14 x: xxvxxxnxxxxxxxdxktxx",
"7-9 z: qqpzzxzvsgzfzdzz",
"14-15 c: ccccccccccccccmc",
"11-12 k: kkkkkkkkkskv",
"15-16 d: ddddddddddddddddd",
"6-8 x: xkjhxwgxxzxxnzwxcxk",
"2-6 t: tmwttc",
"7-8 w: jwcwwwql",
"5-14 d: jdpddtkddrdddpq",
"9-14 t: mwctmnjxmztckt",
"4-8 l: llnlxlmjn",
"3-6 s: sssskvk",
"4-8 c: ccchcrctczt",
"4-6 s: wssnlsnsss",
"8-18 s: sfkssssbswshsvshms",
"6-7 b: bbkbcffmwblcmp",
"8-15 w: fwwmswcwwhlwjwvtlq",
"2-9 n: wnnnnmqhdpsnzn",
"1-7 x: xkzzxpz",
"5-8 x: txxxxmlxkrxsxzsx",
"7-10 t: lchndztdttgk",
"1-2 q: tqqq",
"1-9 z: nzzzzzzzz",
"1-2 l: djfmfwpnjclt",
"2-6 x: xxxxxmxxs",
"2-4 p: ppcv",
"4-10 d: dddpddddddd",
"8-11 n: nnnnnnnxnnnn",
"17-18 v: vvvvnvtvvvjvvvvvzzvv",
"5-8 h: hhhhhhhfhh",
"9-16 v: vvvvvvvbvvvvsvtq",
"3-4 r: hrhrrtrgrr",
"11-17 g: mvgggwggggggwggxw",
"3-6 r: rrnrrgrrrr",
"8-10 n: rgjntnrmkn",
"6-7 f: sffftmm",
"4-5 b: bbddn",
"4-9 d: cdrbqddsqqpzkdd",
"9-17 n: nnnnnnnnrnnnnnnnjn",
"1-4 n: knnn",
"15-16 k: kkkhkkkkkkkkkkkv",
"15-17 v: jkrddvtmgfqvqvvxk",
"10-16 j: jjjjjjjjgpsjhjjljjj",
"9-10 d: jdndwddvdrhndddd",
"5-7 x: bxxxxwmcb",
"5-7 r: mlrrdsrrrnrgwrrq",
"14-17 h: hhhlhhhhhhhhhhhhm",
"1-12 n: zpnwtpnnnnxzm",
"11-19 k: ccktkhkwthkkklkvhkmk",
"6-14 s: sfssxsscssgssqhsnssl",
"17-18 g: ggdgggggggggfgggrggg",
"4-13 k: dwddvztkhjnzk",
"17-19 k: kkkkkkkkkkkkkkkkkkx",
"5-8 q: qmqzqqqqqqqqqcqq",
"2-4 q: vqqqqhxd",
"1-13 c: fjccqcmrcjxgccdvbzr",
"8-12 h: hkhhhhhhhvhhch",
"4-10 w: jmwfwxwwkwwcnbwwftrc",
"8-11 f: fffffffbffdf",
"12-18 b: bbbbbbbbbbbcbbbbbbb",
"2-8 k: rdwwjvrkcs",
"13-14 p: pppphpnppppphpppp",
"1-3 d: nddddddddddd",
"5-8 m: mmfdkmnfmqm",
"2-9 x: xjgwxxxxxl",
"1-2 v: vhvsvv",
"11-17 r: tlrgrrrrrwrzrrrrsrr",
"1-7 c: lcclcvgk",
"3-5 s: slnkss",
"3-4 w: hqwbw",
"11-19 l: lfxllllllldlllllllq",
"4-5 t: tttbt",
"10-12 g: gggggggggsgfg",
"6-8 k: kkmkkkkmk",
"10-11 q: qqqqqqpqqpsqd",
"5-17 k: pxwkmdxkskthkkkkn",
"14-16 m: mmmmmmmmmmmmmpmmmmmm",
"14-15 k: kkkkkkkkkjkkkkt",
"13-14 c: ccccccdccccccccccccc",
"1-2 v: gvmqqnkpln",
"4-6 k: lwkkkjgwkkk",
"1-12 h: mhhthhghhhhhhhhh",
"6-7 t: ptxtwtg",
"3-9 j: zsjkcjlzj",
"5-8 q: cpzhqfhvsjx",
"5-11 s: ssbsskssgssdss",
"4-12 t: ltkttnzdvxttllttt",
"4-5 j: jjfjh",
"4-5 r: rrrprjdtrfr",
"4-8 d: ccwqskmd",
"2-9 p: npzptdhsxxpkpk",
"6-17 x: cxnxxpmxxxxhxxfhxxxx",
"1-7 q: nqqzqnqqqf",
"15-17 v: vvvvmkvjvwvscvvvv",
"12-16 d: mddddbdddjddxddbd",
"3-7 f: fxpfffff",
"6-7 d: dgdwrddwhprchmvdr",
"5-17 h: whhphdbxzwcdhhshwkkh",
"5-7 f: ffffffjw",
"10-12 s: grcsbsnssbfs",
"6-10 z: zzzzzrzzzzzjz",
"14-15 m: kdmmcmmmmmdmldm",
"6-7 m: mcxmmcmm",
"5-6 l: lmlllrlw",
"3-16 q: qqwqqqqcmqqqqqxqbqq",
"14-16 p: pppzspppppnppbppwwpp",
"10-12 q: qqqqqqqqqqqqqq",
"1-5 j: rjkjvjj",
"3-9 d: fhqwddjrdzpkgdkd",
"2-4 v: vlvw",
"1-4 w: qwcww",
"6-12 r: rhhzkrzhrwrxrkvrcbmr",
"3-5 t: xxbtr",
"5-6 x: xxxpxx",
"2-5 q: qhqqq",
"8-16 n: nnnnnknnnnnnnnnt",
"8-10 g: gdzvghxcnbq",
"4-19 m: rgmmbqmljmzswbkpkcn",
"8-12 g: ggggggmhggrgbtghg",
"13-15 t: ttttttttttttttxttt",
"1-3 n: nntn",
"3-4 h: hhxh",
"6-7 f: ffffffbf",
"2-3 t: bgtt",
"7-9 n: nnnnnnjnn",
"2-4 j: ljgj",
"12-15 c: ccccdcccccccccfccc",
"4-9 s: wssssssqlcssz",
"1-2 z: ljzjgcvg",
"6-7 q: qqqqqqs",
"1-6 d: xpddgd",
"4-14 f: ffffffffdzfffmf",
"13-14 r: rrrrrrrrrrrrwrrr",
"6-7 r: rrrcgbrrr",
"9-15 b: lkkbbbbhbsbgxpgpbb",
"3-4 f: qzfzwnffv",
"4-14 m: rkksnmbgjmqmmmc",
"8-13 n: fjnbrnnnqnnnnn",
"13-17 h: hhhhhhchhhhhhhhhz",
"8-9 n: rbtknnmpng",
"1-6 c: qgtfhqtjkw",
"2-8 m: wzfmmmmmflmdk",
"5-7 v: cnvvvvvvv",
"10-15 n: nxnnnjnsnnnnngnnknrt",
"12-13 d: ddjddddddddddddd",
"4-5 n: jncnnh",
"6-10 z: zzzznbzzzczzl",
"4-5 s: bsjsv",
"9-11 g: hvkccbpfxkg",
"1-2 b: bbqb",
"7-16 l: lllllllllllllllplll",
"1-5 l: llllml",
"3-4 f: fmsf",
"2-4 g: tgshjbgg",
"2-7 h: vlzzhhhhhphhf",
"8-9 p: pnpppppqh",
"9-11 w: wrxlwdtwnwwtqwpwxgw",
"8-10 m: mmmmmmmnmm",
"1-5 p: dpnpppzpp",
"3-5 l: bllflklcmp",
"11-19 j: jkjjjvmjjjkjljjjjfj",
"6-9 k: kkkkkkkbkk",
"2-4 r: njprlsrmtr",
"9-10 d: dxhdddddfdd",
"3-8 z: dmrqpzwzghmznc",
"2-8 r: tlgqwxcrdpj",
"10-11 z: zzzzzzzzzzhz",
"1-10 q: qqqqqqqqqsqqqqqqqq",
"2-4 x: xrwxx",
"10-11 s: zssssssssfz",
"3-9 z: rszsgfzzz",
"6-13 x: zsxwxxqtgxvbcxxbn",
"10-16 s: smsssgssshsspwxsq",
"1-2 g: ngqgc",
"4-8 l: xllllngb",
"4-7 h: rhhhhhghbm",
"1-7 v: vqvslhm",
"2-7 z: jjfmnmz",
"1-10 v: vvvvvvvvvqv",
"11-13 g: ggpgrgggggggggg",
"3-6 p: tpgqnpphpl",
"1-3 d: sddddd",
"8-9 g: gggggggvg",
"2-6 w: wtvwnw",
"1-4 m: kmmwm",
"3-4 h: mhvh",
"1-4 h: cnjhxvhkdch",
"7-8 w: wwwwwfwww",
"6-9 r: rlrrrgrrr",
"2-4 h: lggh",
"10-11 q: qqqqqqqqqlh",
"4-5 l: llllgl",
"13-16 k: kmffmjbzrpprcdkxglk",
"1-3 f: ffpf",
"19-20 n: nnnnnnnbnnnnnnnnnnnv",
"3-7 h: hhpmhjhwdhzhm",
"1-5 k: hlkkrkzkf",
"2-4 s: sssxssssssssssssssss",
"12-13 d: dddgdddddqndtdkd",
"3-14 c: cccczvcxchccccclctcl",
"2-5 b: mbgbb",
"6-8 j: jjtrtbsjnj",
"5-6 s: sssqsk",
"8-16 l: lfrlllllctllqxrpllll",
"6-12 g: grxlwlnggxvg",
"16-17 j: jjjjjjjjjjjjjjjjp",
"6-10 q: nqmzqflbhqqb",
"12-19 j: jjjjjjwjjjjkjjjjjjgt",
"8-10 s: sscssssssp",
"11-12 s: ssssssssssds",
"2-5 n: hswqnqldwwbbmnnrnht",
"4-7 p: ztpvbqpwsxrgrkp",
"3-9 h: hhlhhcjrkhwnhq",
"10-12 k: kkkkkkkkklkwk",
"14-15 w: wwwwwvwwwwkwwqwnw",
"16-20 b: bbbbbbbbbbbbbbbhbbbt",
"2-5 t: tttttftttttt",
"3-12 l: qswhtwvnfmfwn",
"11-12 b: bbbbbbbbbjgvbbbbbbz",
"8-13 w: wwwwtwwvwwwww",
"5-6 f: kgjfhfffv",
"7-17 g: qpxgkvgttkhxjhzxnv",
"2-3 n: rhffpsqknv",
"2-10 p: pkpppppppppp",
"3-15 p: rnpqjpgmcpgzkxcppk",
"12-13 d: nhdddldxdddddndpdddj",
"14-16 h: hhhhhhhhhhhhhbrhhhhh",
"4-9 r: rpzrcnrrrlx",
"2-14 f: ffffzfzffffffjfff",
"1-9 s: snhfksssxssss",
"1-14 n: bnnnnnnnnlnnnn",
"2-3 c: cwtccc",
"10-12 k: kkkkkkkkcskkkdkk",
"2-5 r: qrqsrkrk",
"3-11 k: nlkqkszttxk",
"2-3 d: vqdgpwnjprgsgsdrxwk",
"7-12 k: hkkkkkkdkkkrk",
"6-8 r: smmfvtxrhzvnrj",
"8-10 l: llrllllllmll",
"5-10 l: bpwgqlnktt",
"4-6 f: flfvjfff",
"13-14 b: bbbbbbbbbbfbqzzb",
"5-6 m: rmhmqmkmtkmjnmvdx",
"10-16 j: jtjjjjjjjdkjgjjjj",
"3-4 c: cpcc",
"10-11 v: vxgbfvqftvmc",
"5-12 n: knqlnbhdphpw",
"7-13 r: rrrrrtrrrrrrrrr",
"4-7 n: nbnnffkjnwpqnhvqnr",
"4-13 r: htrkdwrcmcndrxngd",
"1-8 h: dhhhhjhdxhh",
"4-8 b: bbbcbbbg",
"1-7 b: zqpzzqbfbwbwcbbbp",
"6-7 l: jlhllllmljvl",
"9-11 w: hwpwlcwkwcwjgkt",
"14-17 m: mmmmmmmmmmmmmmmmjm",
"6-11 r: rrrrrbrrrrr",
"1-6 c: fccxxc",
"14-15 j: jjkjjjbjjjfjjljfjj",
"15-17 q: qqqqqqqqvqqjqqqqz",
"11-14 j: qjjsjjjjjjcjjjj",
"11-13 m: mfhjhnsshfxmmm",
"6-9 z: wrsjtzzzj",
"6-19 b: lbkksbnggbcdpffqjxbb",
"1-5 w: wwwwwww",
"3-5 h: htdhh",
"5-15 n: nlfdnkvknxgbqlw",
"3-4 z: pzrz",
"7-9 h: hhslhhkhhhhh",
"11-13 n: wqnrnbnnlnjnd",
"15-17 f: ffsfffffffffffbfff",
"1-2 m: pmmt",
"8-9 z: zzzzzzzmzz",
"2-12 q: qqftqqqklxjc",
"12-13 p: pppppppppppbp",
"8-9 q: qqqqxqqlqqqqq",
"3-5 m: mhmfbq",
"3-5 j: ckpkjjf",
"7-11 k: kgkkkkkkkkkkkk",
"2-3 n: pnnnnmmnkl",
"1-6 l: lnvqjlflmp",
"3-14 t: nhzvstnltttdftt",
"2-3 s: hsrscsz",
"9-12 b: bbdbbbsbbjbgb",
"1-10 h: mlkcgnrkwhpgwjvflhgx",
"5-7 p: spnpmppwp",
"2-3 h: hrhh",
"8-11 g: fggsggqhgpg",
"5-8 n: nsxnvnlpnvn",
"9-11 f: fvffffjfffrcfff",
"6-9 q: qqqpzqmqpstrk",
"8-12 v: vmvvvvpzvrvvv",
"2-4 x: cnbx",
"3-5 h: hhqrhhh",
"6-13 t: ttttttttttttltvttt",
"2-4 v: zqvvgrxwtw",
"6-8 v: vdbvvfjv",
"16-19 g: gggggggggggggggjggg",
"4-6 m: mmwmstmpmj",
"1-11 b: bnxzhlbbgbpdvp",
"7-16 n: txfjncnhsxgbjvhh",
"5-8 m: mmtvmkmvfkmzmpmd",
"3-6 g: ggjgggg",
"8-12 l: lslllglqcnlwlll",
"2-4 l: llpqjdwxq",
"6-7 b: bbbbbvb",
"6-12 b: bbbnbbbbbkrq",
"17-18 s: msfggsssfsrdvssssdr",
"3-5 m: mmmmb",
"4-7 g: ggrwgbgggg",
"5-6 z: zzzzjpz",
"1-3 l: mrvclxrpvgnrl",
"11-13 g: gggjgggggggbgg",
"1-6 q: qqqqqjqqqz",
"3-5 d: dndnpzdmqcjrdgd",
"8-11 g: gggggggbggqggggggg",
"1-7 k: dkkkkkfkkkkkkrk",
"3-9 p: slbxznfwvjpnj",
"12-14 t: kbthtttfttrttt",
"3-6 x: xxbxxkxx",
"4-5 z: zzzdz",
"6-13 c: ccbcjccpcnscqc",
"11-14 x: xxxgmnxxxxfxhx",
"2-4 b: gjbrwk",
"3-4 l: bwmlzldj",
"10-13 d: qdcxdbrdrdddkdnddd",
"7-9 d: dddflddbwnmddd",
"12-14 f: rkgdfbdkqhnfsqjltntx",
"5-14 x: xxxxxxxxxxxxxxx",
"8-18 r: rrrrrrrlrrrrrrrrrr",
"1-19 q: qqqqqqqqqqqqqqqqqqdq",
"7-11 c: kscqhtcccctprbc",
"3-5 h: dchjkntfhrbmmkkjpnh",
"2-9 l: lllllllln",
"1-6 c: sqczzcnkpwrcgvctlrc",
"6-16 f: wcnppfpffjxpthhfxf",
"16-17 x: xxxxcxxxrxsfxxpxfq",
"7-9 q: qqqqqqqqt",
"4-6 h: hxhhkgg",
"12-20 v: pwvzsxtvvslvfxhvcvtz",
"12-17 k: tkkkkkkkcfktknkkkk",
"2-3 b: bpqr",
"4-5 m: mhppm",
"4-9 g: jrgxgqjqgrrpj",
"7-12 h: hhswhqwhhqhhhlhtkhzw",
"5-19 l: llllhlllllllllllllll",
"2-3 n: mqncngfps",
"6-15 q: qqqqqnhqqqqqqqtqq",
"1-8 k: kfkkkkkkr",
"5-10 f: pmpffbdkfpffgffcf",
"3-8 b: bbsbcbbb",
"9-12 h: hwhhhxhshhhhhc",
"1-5 r: nhcrrbrrrj",
"2-4 q: qqqsq",
"13-17 h: lrlngvrhpsdmhkhzt",
"8-17 m: rmmmmmmlmmmmqmsmmqm",
"4-8 n: njnsnkjkhnkgblg",
"9-10 d: pdwdkgcdrdzqdd",
"3-4 p: pppp",
"10-12 j: zcjjjjqwjrjj",
"1-9 d: mddgrxsdk",
"2-4 v: gsvvjv",
"5-7 h: hhhbbhjh",
"15-16 w: wwjwwwwwwwwwwwbw",
"8-10 b: cbczjdpbkhdbkpbztn",
"7-10 z: skfvjzzxzt",
"15-16 m: mmmmmmrmjzxmmmbtmmm",
"2-6 j: rjjgqb",
"4-16 d: dptndnvddgtpqdddd",
"7-8 j: jjhjjjbd",
"2-3 w: bwdr",
"4-6 g: jgngnmgggfpgcn",
"2-3 p: ppkp",
"7-8 m: mmmmmmnm",
"5-6 l: lfllln",
"3-4 r: rrrm",
"6-7 s: ssssssss",
"4-15 g: kdtgzznwrczjzgx",
"11-12 w: jhwwrwwpwwwmwwfwgww",
"13-15 w: wwwwcjjwwwwwgwwwwwf",
"4-11 f: fffxffffffff",
"3-7 g: ggggggpg",
"3-10 m: mmnmmmmmmm",
"9-11 h: hfhhhqhhhchhhwh",
"4-5 j: jjqjq",
"13-14 x: jmxnxbjrklnvxtn",
"5-6 f: zzkqnzchtfnvffqd",
"4-8 j: cxcjvfjjkjz",
"8-14 s: sssssswnrsssscsss",
"6-12 t: dftrtdvtxttt",
"3-4 p: ppmp",
"1-5 z: zzgszfrg",
"1-8 g: wbgwggdgtswrlllj",
"2-4 f: fffpf",
"16-17 t: tttrktsmtmpttttttnt",
"6-11 m: mqsxmmtfthmfwn",
"2-3 c: mcbs",
"1-3 j: xmjj",
"15-16 j: jtjjjjjjjjjjjjjxj",
"6-8 k: kkrkktckk",
"9-11 l: ltlllllsllmlz",
"17-18 s: sxmssqtjrhmzhssssk",
"9-13 k: kkkkkkkkkkkkkkkhk",
"6-9 g: kpnhsggmqklvtttgcxvl",
"5-7 z: vzrxbmzzwglvczz",
"4-10 k: khkkdkkckkkkkzkk",
"2-6 q: qsqqnqq",
"1-3 x: qxsxxxx",
"10-14 x: xxzxxtxxxjcxxx",
"4-6 z: dzzzvz",
"1-2 c: cccv",
"9-12 h: hhhhhhhhhhhc",
"13-15 z: zzgzzzzzzmzzqzzkzz",
"3-6 h: pgvjdhtpmthbz",
"10-13 x: mxqbxxwxxxhxfrxxchxx",
"2-5 b: qbbmpzrzkcjqqwbj",
"3-14 q: ltxhrqqqqzfqqq",
"6-10 j: jjjjprjkqj",
"9-15 c: dsncxxlqwvzccwc",
"12-16 m: nxrmdgmmxmscmhnm",
"4-5 p: ppppthp",
"10-13 d: ddddddddddddb",
"2-6 x: bxkwbtsx",
"5-7 j: jjjjqjjjjjj",
"8-10 d: wzdddddtdddd",
"6-9 z: dlzzzzzvwz",
"2-3 h: hhhh",
"11-13 t: ttttjtttttttxtt",
"4-5 s: sdbps",
"2-10 x: dcmxxxlxxhgxftrjbp",
"9-15 h: hhhhhhhzjzhwhrkhh",
"2-6 f: ftxhffff",
"4-5 k: kkfrkwnbkkh",
"3-5 m: mmdmm",
"5-10 z: znvxzzldzvhqztr",
"7-8 r: rrrrrrcr",
"14-16 k: kkkkkkvkkkkkkbkk",
"4-10 x: cxsxzxxxxxxxxn",
"12-13 s: ssssssssssssss",
"7-9 s: sswssssshs",
"1-3 c: ncccrc",
"7-9 r: rrrwrrtwr",
"13-14 v: vvvvvvvvvvvvnv",
"4-6 k: bkkkkx",
"7-10 r: rrrrrrrrrrrrr",
"7-8 l: llllllzll",
"3-11 v: vqvvmnkvvswgkqvmvd",
"8-10 c: cccccdcccm",
"1-9 s: sssksqsshsj",
"5-8 c: cccchmcccc",
"5-6 h: hsqhhghrhk",
"4-5 z: czzzrzlzn",
"2-4 f: fzfffj",
"14-17 p: pppppppppppppppmpp",
"4-5 x: ldqxq",
"12-16 g: gtgggggggggpgggggt",
"13-14 v: zfbmrhphzmrvqv",
"6-10 p: ppppppppphppkp",
"10-12 l: xlllklllllkwlcl",
"4-6 v: qvbvgdw",
"6-12 q: qqqsqlqqqqqq",
"3-5 s: rssgpssnb",
"1-2 g: gzlpcmbsmgrq",
"2-9 w: lpmbmfvpwggfvmzmmw",
"4-6 n: nqtfzz",
"3-4 f: fftf",
"13-17 n: nnnznkgmnnnnpnngnfn",
"8-10 p: ppppxppppppppprppsp",
"10-12 g: ggnggkggggcvg",
"3-8 l: lxrcbjnddcbpg",
"6-7 q: qkjqfqqdkkkqrqqqc",
"5-8 p: wpbpmpwpfsblpplmpp",
"2-7 n: bbrtwnhhttntqhnr",
"1-2 p: pcdxzjwmnkfjkpbj",
"1-15 n: nnnnnnnnnnnnnnznn",
"18-20 s: ssmsssssssssssssrssw",
"1-12 h: vhxhmhhhhhhhd",
"3-7 r: qkkvhvr",
"3-5 k: xkpkkkzbtwkv",
"2-4 z: zfzz",
"1-2 t: ktttt",
"2-3 p: pbwp",
"2-4 j: ljjj",
"14-15 t: pzpcktthttfttttt",
"3-4 n: nwnj",
"8-10 l: lzllllllln",
"1-12 q: qqqqqqqqqqqqq",
"6-12 z: xxltbzrpwzzmw",
"15-16 q: qqqqqqqqqqqvqqqjq",
"4-5 r: rhmrkrd",
"7-10 r: rrrrrrlrrrrrr",
"16-18 t: ttttwttttttttttttn",
"9-17 m: bmmmmmmzmmpmmhmrw",
"9-13 r: rrxfrrxrrrrrrr",
"13-18 p: ppdxprpqppbpppprpz",
"5-8 p: rprmpfpxgjphfktszplp",
"5-7 h: hhhhhhnh",
"3-7 h: rwhpshznhhh",
"9-10 x: xwxzbrxxgxrxxdxxs",
"6-7 h: hvhhhhng",
"5-6 b: bbbbwhbb",
"4-5 g: gbgggg",
"3-9 g: gsbggghggpgdgg",
"1-3 r: rxrhh",
"3-4 c: rccn",
"4-8 z: zpzzznzzzwz",
"14-17 b: bbbbbbbbbbbbbbbbbzb",
"2-4 w: rwvwrdn",
"3-6 p: pfpsgp",
"2-12 p: zpwkjpppbppjrppknh",
"5-9 t: tmttgtttn",
"2-3 v: wvvcv",
"3-5 h: bnbhhtjhk",
"15-17 f: tffwftdskgfxgfffpk",
"16-17 h: hphhhhdhhhhhxhhhrhh",
"7-8 d: ddddddtnd",
"9-20 t: tqttttttttttttttbttw",
"1-11 v: vxcgzvvvkrlqvg",
"2-6 r: ghrbwrtfksqkxx",
"8-10 w: wwwswwwmvwww",
"4-10 m: mqmmmtmmfq",
"2-3 g: gkgtgv",
"9-11 w: wwwwsqwwpwwxrwww",
"3-4 w: zwxwtcscwmwmndcw",
"8-9 q: xsqqqqzxfqfv",
"2-4 w: wwhh",
"9-18 d: ddddddhddddddddddq",
"3-4 s: sssjsvs",
"15-16 p: wphpxpppppppppppppvp",
"10-12 t: qftttqhtvttt",
"1-2 b: vbfxqgbzrktjm",
"3-4 k: lkkr",
"9-11 d: dddddkdqdttddd",
"9-11 m: mwngbfmhmcvwx",
"2-5 b: scbxbb",
"6-9 z: zzzzzzzzzzz",
"1-3 z: zzvhz",
"5-7 x: xxxxxxkxx",
"1-5 s: ssscshss",
"1-7 s: csrfvfsqjss",
"16-17 k: fwdkkkckkkkrrkkck",
"3-4 h: hhhs",
"4-8 w: wwwswwwx",
"1-10 f: fffskffsdfcfvfff",
"7-15 r: rrrrrrrrrrrrrrxr",
"1-2 k: kvxbzdcnsqrskhmx",
"2-4 s: wbvsfs",
"2-7 q: rbgqpqdq",
"15-16 f: fffffffffffffffq",
"1-3 c: bccpkm",
"5-11 g: fsvgthpglgg",
"3-5 f: ffffwf",
"5-16 j: djmwqfxsbzwjdwtj",
"3-4 p: pprpp",
"5-6 n: nhnnwj",
"8-12 s: tssssssrsssksss",
"5-8 p: pppppppppppp",
"10-15 w: wgfwwcwtmwwgwpwwh",
"12-15 l: lllllllllllplll",
"1-8 c: ccccqccd",
"3-4 z: zzzvzkzgc",
"2-10 h: swwbtfkvfhrjztdzx",
"2-7 z: zhbzkzlzz",
"2-9 q: ddqdqpkcjqkfgqtcjqq",
"9-10 l: lllmllkltlll",
"2-3 n: ngwn",
"2-3 r: rrnr",
"5-10 n: ltnnnknnvcnnn",
"7-9 p: jtpptpllpj",
"2-5 s: slssssszssssssss",
"16-17 d: dddddddddddddddlp",
"2-5 q: bbwqqbkmdhqmjhn",
"7-10 m: qmpgmmsmmmmkmmkj",
"4-7 g: vczggdgbgxgg",
]
|
QUEUES_KEY = 'rq:queues'
WORKERS_KEY = 'rq:workers'
SUSPENDED_KEY = 'rq:suspended'
QUEUE_NAMESPACE_PREFIX = 'rq:queue:'
JOB_NAMESPACE_PREFIX = 'rq:job:'
def queue_key_from_name(name):
return QUEUE_NAMESPACE_PREFIX + name
def queue_name_from_key(key):
assert key.startswith(QUEUE_NAMESPACE_PREFIX)
return key[len(QUEUE_NAMESPACE_PREFIX):]
def job_id_from_key(key):
assert key.startswith(JOB_NAMESPACE_PREFIX)
return key[len(JOB_NAMESPACE_PREFIX):]
def job_key_from_id(job_id):
return JOB_NAMESPACE_PREFIX + job_id
def children_key_from_id(job_id):
return 'rq:job:{0}:children'.format(job_id)
def parents_key_from_id(job_id):
return 'rq:job:{0}:parents'.format(job_id)
def started_registry_key_from_name(name):
return 'rq:wip:{0}'.format(name)
def finished_registry_key_from_name(name):
return 'rq:finished:{0}'.format(name)
def deferred_registry_key_from_name(name):
return 'rq:deferred:{0}'.format(name)
def worker_key_from_name(name):
return 'rq:worker:{0}'.format(name)
|
class Solution:
def search(self, nums: List[int], target: int) -> int:
if not nums:
return -1
left, right = 0, len(nums) - 1
while left <= right:
m = (left + right) // 2
if nums[m] == target:
return m
if nums[m] >= nums[left]:
if nums[left] <= target < nums[m]:
right = m - 1
else:
left = m + 1
else:
if nums[m] < target <= nums[right]:
left = m + 1
else:
right = m - 1
return -1 |
# Leia uma temeperatura em graus Celsius e apresente-a convertida em graus Fahrenheit.
# A formula de conversão é F = C * (9.0 / 5.0) + 32.0, sendo F a temperatura em Fahrenheit e C a temperatura em Celsius.
C = float(input("Digite a temperatura em Celsius: "))
F = C * (9.0 / 5.0) + 32
print(f"A temperatura em Fahrenheit é: {F}")
|
# Write your solution for 1.3 here!
n= 0
i= 0
while n <= 10000:
i = i + 1
n = n + i
print(i)
|
##
## Intro to Git, Python, and Programming Basics (bypassing XML)
##
# going over some git basics
# git --version
# git help
# Pull down a repo from somewhere
# git clone <url>
# git branches; discussed to some degree; means of doing changes off to side without affecting core code
# then we can merge this stuff in as needed
# git remote -v
# origin git@github.com:russellpope/devnet-express-dc.git (fetch)
# origin git@github.com:russellpope/devnet-express-dc.git (push)
# lets us know where we're pulling stuff from and where we make a push to
# origin in this case is an alias
# git pull
# Pulls the latest changes for the selected branch
# python -V or python --version
# note you can do this with py3 in a virtualenv or python3 --version
# python YOURSCRIPT.py
# Some python bits of note:
# indentation defining scopes (WHITESPACE CHARACTER IS IMPORTANT)
# i.e. spaces and tabs are different things
#
# Sample below; illustrates white spaces
print("Hellworld!")
num = 1
if num < 1:
print(f"I'm less than {num}!")
print("goodbye cruel world!")
# note the 'if' condition will never execute
# editorial note: I used an f string because I wanted to
print("Helloworld!")
num = 1
print(f"Value is: {num}")
print("Value is: " + str(num))
print("Value is:", num)
if num < 1:
print(f"I'm less than {num}!")
elif num == 1:
print(f"I'm {num}")
else:
print(f"{num} is something else!")
#
# tried to transcribe his example before he switched sides
# I hate his variable names because they look like java stuff
# goes through an excercise of running python from CLI
# walking through his interpreter stuff
# ran the below with expected output:
# >>> print("Hello World! How are you?")
# Hello World! How are you?
# to exit python interpreter
# >>> quit()
#
# talks about running scripts
# unix prompt below:
# #python your_script_here.py
# Covers the "shebang" line
# #!/usr/bin/python
# or you could do this which he may not cover
# #!/usr/bin/env python
# This will actually use whatever python interpreter is defined in the environment var
# Scopes, operators, conditiona statemments
# Parsing JSOn with python
sample_json = {
"first_name" : "Mike",
"last_name" : "Maas"
}
# data structure
# nice thing about it is that it maps to python dictionaries pretty nicely
# collections of key/value pairs enclosed in {}
# Can also have values be ordered lists of values
# or even ordered lists of key value pairs
sample_json_with_array = [{"first_name" : "Mike","last_name" : "Maas"},
{"first_name" : "Brett","last_name" : "Tiller"}]
# provided a more complex data structure to describe a donut to showcase the sorts of embedded stuff you can do
##
##
# REST APIs
##
##
# two major types of web services: REST or SOAP
#
# Commonly used in industry
# R in rest is Representational not resourcing
# Representation State Transfer
# Give me a look at a thing
# Here's what the thing should look like now!
# Typically over HTTP
# Several REST methods;
# GET - go get some information
# POST - Create a new thing with this information
# PUT - Update an existing thing with this information
# DELETE - Delete/destroy the thing
# These typically go to different URLs
# Lots of ways to authenticate; varies from API to API
# Basic HTTP - Username/Password
# Different status codes
# 200 "Everything is fine! Here's your data"
# 201 "I got the thing you asked me to do okay!"
# 4XX "You screwed up!"
# 5XX "I screwed up!"
# Headers; important to define ESPECIALLY WHEN POSTing or PUTing
# Body; used in POST/PUT for updates
# Using Spark API as starting point
# talking about OAUTH token; Spark makes it easy to retrieve
# Request/response; i.e. Get rooms and it responds with a list of rooms
# Example shows a GET to a regular URL
|
#----------* CHALLENGE 19 *----------
#Ask the user to enter 1, 2 or 3. If they enter a 1, display the message “Thank you”, if they enter a 2, display
#“Well done”, if they enter a 3, display “Correct”. If they enter anything else, display “Error message”.
answer = int(input("Enter 1, 2 or 3: "))
if answer == 1:
print("Thank you.")
elif answer == 2:
print("Well done.")
elif answer == 3:
print("Correct.")
else:
print("Error message.") |
#
# liberator:configuration.py
#
# The Initial Developer of the Original Code is
# Minh Minh <hnimminh at[@] outlook dot[.] com>
# Portions created by the Initial Developer are Copyright (C) the Initial Developer.
# All Rights Reserved.
#
#-----------------------------------------------------------------------------------------------------
# GLOBAL CONFIGURATION FILES
#-----------------------------------------------------------------------------------------------------
_APPLICATION = 'LIBRESBC'
_DESCRIPTION = 'Open Source Session Border Controller for Large-Scale Voice Infrastructures'
_SWVERSION = '0.5.7'
#-----------------------------------------------------------------------------------------------------
# REDIS ENDPOINT
#-----------------------------------------------------------------------------------------------------
REDIS_HOST = '{{redis.host}}'
REDIS_PORT = {{redis.port}}
REDIS_DB = {{redis.database}}
REDIS_PASSWORD = {{ ('%s')|format(redis.password)|to_json if redis.password else 'None' }}
SCAN_COUNT = 1000
REDIS_TIMEOUT = 5
#-----------------------------------------------------------------------------------------------------
# VOICE ATTRIBUTE
#-----------------------------------------------------------------------------------------------------
SWCODECS = ['ALAW', 'ULAW', 'OPUS', 'G729', 'AMR', 'AMR-WB']
_BUILTIN_ACLS_ = ['rfc1918.auto', 'nat.auto', 'localnet.auto', 'loopback.auto']
#-----------------------------------------------------------------------------------------------------
# SERVER PROPERTIES
#-----------------------------------------------------------------------------------------------------
NODEID = '{{nodeid}}'
CLUSTERS = {
'name': 'defaultname',
'members': [NODEID],
"rtp_start_port": 0,
"rtp_end_port": 0,
"max_calls_per_second": 0,
"max_concurrent_calls": 0
}
#-----------------------------------------------------------------------------------------------------
CHANGE_CFG_CHANNEL = 'CHANGE_CFG_CHANNEL'
SECURITY_CHANNEL = 'SECURITY_CHANNEL'
NODEID_CHANNEL = f'{NODEID.upper()}_CHANNEL'
#-----------------------------------------------------------------------------------------------------
# CALL ENGINE EVENT SOCKET
#-----------------------------------------------------------------------------------------------------
ESL_HOST = '127.0.0.1'
ESL_PORT = 8021
# LOG DIRECTORY
LOGDIR = '/var/log/libresbc'
#-----------------------------------------------------------------------------------------------------
# HTTPCDR DATA
#-----------------------------------------------------------------------------------------------------
HTTPCDR_ENDPOINTS = {{httpcdr.endpoints if httpcdr else 'None'}}
|
dic = {
'str' : {
'message_recevied' :
'''
@client.event
async def on_message(message):
if message.content == '봇 종료' or message.content == '봇종료':
await message.channel.send('안녀엉!')
print('봇 종료됨.')
exit()
''',
'if_message' : 'if message.content == "%_variable_%" and client.user.id != message.author.id:',
'if_startswith' : 'if message.content.startswith("%_variable_%") and client.user.id != message.author.id:',
'get_content' : 'modules.common.getcontent(message.content)',
'send_message' : 'await message.channel.send("%_variable_%")',
'send_result' : 'await message.channel.send("", embed=%_variable_%)',
'search_naver' : 'modules.common.get_fancy(modules.naver.get(%_variable_%))',
'calc' : 'modules.common.get_fancy(modules.calc.calc(%_variable_%))',
'weather' : 'modules.common.get_fancy(modules.weather.get())',
'opgg' : 'modules.common.get_fancy(modules.opgg.get(%_variable_%))'
},
're' : {
'if_message' : r'(?P<fullmatch>만약\s?메(시|세)지\s?=\s?(?P<content>(.*?))\s?:)',
'if_startswith' : r'(?P<fullmatch>만약\s?메(시|세)지\s?시작\s?부분\s?=\s?(?P<content>(.*?))\s?:)',
'get_content' : r'내용\s?가져오기\s?\(\)',
'send_message' : r'(?P<fullmatch>내용\s?보내기\s?\((?P<content>(.*?))\))',
'send_result' : r'(?P<fullmatch>결과\s?내용\s?보내기\s?\((?P<content>(.*?))\))',
'search_naver' : r'(?P<fullmatch>네이버에\s?검색\s?\((?P<content>(.*?))\))',
'calc' : r'(?P<fullmatch>계산\s?\((?P<content>(.*?))\))',
'weather' : r'날씨\s?검색(.*?)\(\)',
'opgg' : r'(?P<fullmatch>(OP\.GG|op\.gg)에\s?검색\s?\((?P<content>.*?)\))'
}
} |
#9 type c
str1=input('Enter the 1st String: ')
str2=input('Enter the 2st String: ')
if str1<str2:
print(str2)
else:
l=len(str1)
for x in range(l//2):
print(' '*x+str1[x]+' '*(l-(2*(x+1)))+str1[-(x+1)])
|
__title__ = 'freeproxies'
__description__ = 'Free proxies for humans'
__url__ = 'https://github.com/iamkamleshrangi/freeproxies'
__version__ = '0.0.1'
__author__ = 'Kamlesh Kumar Rangi'
__author_email__ = 'iamkamleshrangi@gmail.com'
__license__ = 'GPL v3'
__copyright__ = 'Copyright 2020 Kamlesh Kumar Rangi'
|
"""
Write a Python function that returns the highest number in a list.
input_list = [9,6,45,67,12]
Expected output = 67
"""
def high_num(input_list):
input_list.sort()
return input_list[-1]
|
# Sensor classes
class SensCalPoly: # Polynomial calibration curve class
def __init__(self, id, signalMin, signalMax, *args):
self.id = id
self.coeffs = []
for arg in args:
self.coeffs.append(arg)
self.signalMin = signalMin
self.signalMax = signalMax
def setCoeffs(self, *args):
self.coeffs = []
for arg in args:
self.coeffs.append(arg)
def setId(self, id):
self.id = id
def getId(self):
return self.id
def applyCal(self, signal):
if self.signalMin <= signal and signal <= self.signalMax:
calSignal = 0
degree = 0
for coeff in self.coeffs:
calSignal += coeff * signal ** degree
degree += 1
return calSignal
else:
return -1
class ADistSens:
def __init__(self, id, analog, aPin, calObj):
self.id = id
self.analog = analog[aPin]
self.aPin = aPin
self.cal = calObj
def setCal(self, calObj):
self.cal = calObj
def getObstDist(self):
return self.cal.applyCal(self.analog)
def hasObst(self, distMin, distMax):
obstDist = self.getObstDist()
if obstDist != -1 and distMin <= obstDist and obstDist <= distMax:
return True
else:
return False
class DProxSens:
def __init__(self, id, analog, aPin):
self.id = id
self.analog = analog[aPin]
self.aPin = aPin
def hasObst(self):
if self.analog < 1023:
return True
else:
return False
|
# Crie um programa que leia o nome completo de uma pessoa e mostre
# A- Nome com todas as letras maiusculas
# B- O nome com todas as letras minusculas
# C- Quantas letras ao todo(sem consideraças espaços)
# D- Quantas letras tem o primeiro nome
nome = str(input('Informe seu nome completo')).strip()
print(nome.upper())
print( nome.lower())
print(len(nome) - nome.count(' '))
print(nome.find(' '))
separa = nome.split()
print(len(separa[0]))
|
num = 50
flag = True
for i in range(2, num-1):
if(num % i == 0):
flag = False
break
if(flag == True):
print("Prime number.")
if(flag == False):
print("Not a prime number.")
|
# This program is used to make a fibonacci sequence in a certain terms
def fibonacci(term) :
n1 = 0
n2 = 1
if(term <= 0) :
print("Please, print with positive integer")
elif(term == 1) :
print(n1)
else :
print(n1)
print(n2)
count = 1
while(count <= term-2) :
n_update = n1 + n2
# Update number
n1 = n2
n2 = n_update
print(n2)
count += 1
input_number = int(input("How many terms? "))
fibonacci(input_number) |
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: otp.distributed.PotentialShard
class PotentialShard:
__module__ = __name__
def __init__(self, id):
self.id = id
self.name = None
self.population = 0
self.welcomeValleyPopulation = 0
self.active = 1
self.available = 1
return |
class Move:
def __init__(self, start_row, start_column, end_row, end_column):
self.start_row = start_row
self.start_column = start_column
self.end_row = end_row
self.end_column = end_column
|
"""
给出`R`行`C`列的矩阵,其中单元格的整数坐标是`(r, c)` 满足`0 <= r < R` 且`0 <= c < C`
另外,我们在该矩阵中给出了一个坐标为`(r0, c0)` 的单元格
返回矩阵中所有单元格的坐标,并按照`(r0, c0)`的距离从小到大的排序,其中,
两单元格`(r1, c1)` 和`(r2, c2)`之间的距离是曼哈顿距离: `| r1 - r2 | + |c1 - c2|`
**test case**
>>> R, C, r0, c0 = 1, 2, 0, 0
>>> allCellsDistOrder(R, C, r0, c0)
[[0, 0], [0, 1]]
>>> R, C, r0, c0 = 2, 2, 0, 1
>>> allCellsDistOrder(R, C, r0, c0)
[[0, 1], [0, 0], [1, 1], [1, 0]]
>>> R, C, r0, c0 = 2, 3, 1, 2
>>> allCellsDistOrder(R, C, r0, c0)
[[1, 2], [0, 2], [1, 1], [0, 1], [1, 0], [0, 0]]
"""
def allCellsDistOrder(R, C, r0, c0):
matrix = [[i, j] for i in range(R) for j in range(C)]
matrix.sort(key=lambda x: abs(x[0] - r0) + abs(x[1] - c0))
return matrix
# if __name__ == '__main__':
# R, C, r0, c0 = 1, 2, 0, 0
# print(allCellsDistOrder(R, C, r0, c0))
# R, C, r0, c0 = 2, 2, 0, 1
# print(allCellsDistOrder(R, C, r0, c0))
|
print(EvolutionPhonetique.evolution_phonetique("AB")) # a
print(EvolutionPhonetique.evolution_phonetique("A COSTÚDMÁRU")) # acotumé
print(EvolutionPhonetique.evolution_phonetique("A DỌNC")) # adonc
print(EvolutionPhonetique.evolution_phonetique("HÁBYO")) # ai
print(EvolutionPhonetique.evolution_phonetique("ÁNTS")) # ainz
print(EvolutionPhonetique.evolution_phonetique("ÁYT")) # ait
print(EvolutionPhonetique.evolution_phonetique("ALÁTS")) # alez
print(EvolutionPhonetique.evolution_phonetique("AMĘN")) # amen
print(EvolutionPhonetique.evolution_phonetique("AMÁBAT")) # amoit
print(EvolutionPhonetique.evolution_phonetique("AMỌNT")) # amont
print(EvolutionPhonetique.evolution_phonetique("ANGẸLLU")) # angel
print(EvolutionPhonetique.evolution_phonetique("APPĘLLARMUS")) # apelleront
print(EvolutionPhonetique.evolution_phonetique("A PǪRTAT")) # aporta
print(EvolutionPhonetique.evolution_phonetique("APPRĘSSU")) # après
print(EvolutionPhonetique.evolution_phonetique("A RE TENÚTS")) # aretenuz
print(EvolutionPhonetique.evolution_phonetique("ALTRE")) # autre
print(EvolutionPhonetique.evolution_phonetique("ALTRES")) # autres
print(EvolutionPhonetique.evolution_phonetique("APĘC")) # avec
print(EvolutionPhonetique.evolution_phonetique("A VÍSU")) # avis
print(EvolutionPhonetique.evolution_phonetique("ABĘT")) # avoit
print(EvolutionPhonetique.evolution_phonetique("AWWST")) # aüst
print(EvolutionPhonetique.evolution_phonetique("BELLU")) # bel
print(EvolutionPhonetique.evolution_phonetique("BENẸDITA")) # beneoite
print(EvolutionPhonetique.evolution_phonetique("BENẸDITS")) # beneoiz
print(EvolutionPhonetique.evolution_phonetique("BENẸDIRE")) # beneïr
print(EvolutionPhonetique.evolution_phonetique("BENẸDICT")) # beneït
print(EvolutionPhonetique.evolution_phonetique("BĘNE")) # bien
print(EvolutionPhonetique.evolution_phonetique("BONA")) # bone
print(EvolutionPhonetique.evolution_phonetique("CESTU")) # cest
print(EvolutionPhonetique.evolution_phonetique("CANTÁRE")) # chanter
print(EvolutionPhonetique.evolution_phonetique("CASCÚN")) # chascun
print(EvolutionPhonetique.evolution_phonetique("CASCÚNA")) # chascune
print(EvolutionPhonetique.evolution_phonetique("CASCÚNUS")) # chascuns
print(EvolutionPhonetique.evolution_phonetique("CARA")) # cher
print(EvolutionPhonetique.evolution_phonetique("CÍSTU")) # cist
print(EvolutionPhonetique.evolution_phonetique("COMẸNTYAVĪ")) # comencié
print(EvolutionPhonetique.evolution_phonetique("COMPÁNYA")) # compaigni
print(EvolutionPhonetique.evolution_phonetique("COMPÁNYỌNS")) # compaignons
print(EvolutionPhonetique.evolution_phonetique(" ")) # contrit
print(EvolutionPhonetique.evolution_phonetique("CǪRE")) # cuer
print(EvolutionPhonetique.evolution_phonetique("COSTÚDME")) # costume
print(EvolutionPhonetique.evolution_phonetique("CREÁTTǪRE")) # creator
print(EvolutionPhonetique.evolution_phonetique("CRISTO")) # crist
print(EvolutionPhonetique.evolution_phonetique("DỌMNA")) # dame
print(EvolutionPhonetique.evolution_phonetique("DE")) # de
print(EvolutionPhonetique.evolution_phonetique("DĘU")) # deu
print(EvolutionPhonetique.evolution_phonetique("DESÍDRUNT")) # desiront
print(EvolutionPhonetique.evolution_phonetique("DEVÁNT")) # devant
print(EvolutionPhonetique.evolution_phonetique("DE VERSU")) # dever
print(EvolutionPhonetique.evolution_phonetique("DEVỌTTAMẸNTE")) # devotement
print(EvolutionPhonetique.evolution_phonetique("DIE")) # di
print(EvolutionPhonetique.evolution_phonetique("DÍRA")) # dira
print(EvolutionPhonetique.evolution_phonetique("DÍRÁ")) # dirai
print(EvolutionPhonetique.evolution_phonetique("DIXÍT")) # disit
print(EvolutionPhonetique.evolution_phonetique("DIXĘT")) # disoit
print(EvolutionPhonetique.evolution_phonetique("DIT")) # dit
print(EvolutionPhonetique.evolution_phonetique("DITTAS")) # dites
print(EvolutionPhonetique.evolution_phonetique("DEBĘT")) # doit
print(EvolutionPhonetique.evolution_phonetique("DOMẸNTRAS")) # domentres
print(EvolutionPhonetique.evolution_phonetique("DỌNT")) # dont
print(EvolutionPhonetique.evolution_phonetique("DORMÍRE")) # dormir
print(EvolutionPhonetique.evolution_phonetique("DORMĘT")) # dormoit
print(EvolutionPhonetique.evolution_phonetique("DỌLCA")) # douce
print(EvolutionPhonetique.evolution_phonetique("DỌLCAMẸNTE")) # doucement
print(EvolutionPhonetique.evolution_phonetique("EN")) # en
print(EvolutionPhonetique.evolution_phonetique("ENDǪRMÍS")) # endormis
print(EvolutionPhonetique.evolution_phonetique("ẸN OÁTS")) # enoez
print(EvolutionPhonetique.evolution_phonetique("ENTẸNDĘT")) # entendoit
print(EvolutionPhonetique.evolution_phonetique("ẸN TEGRÍNAMẸNTE")) # enterinement
print(EvolutionPhonetique.evolution_phonetique("ẸN TEGRÍNAS")) # enterines
print(EvolutionPhonetique.evolution_phonetique("ẸNTỌR")) # entor
print(EvolutionPhonetique.evolution_phonetique("ẸNTRA")) # entre
print(EvolutionPhonetique.evolution_phonetique("ERUNT")) # eront
print(EvolutionPhonetique.evolution_phonetique("ERIT")) # ert
print(EvolutionPhonetique.evolution_phonetique("ES")) # es
print(EvolutionPhonetique.evolution_phonetique("ESFǪRTYAT")) # esforça
print(EvolutionPhonetique.evolution_phonetique("ES GARDAT")) # esgardé
print(EvolutionPhonetique.evolution_phonetique("EST")) # est
print(EvolutionPhonetique.evolution_phonetique("ESTĘT")) # estoit
print(EvolutionPhonetique.evolution_phonetique("ESVẸGLATS")) # esveillez
print(EvolutionPhonetique.evolution_phonetique("ET")) # et
print(EvolutionPhonetique.evolution_phonetique("ỌCLOS")) # euz
print(EvolutionPhonetique.evolution_phonetique("EPẸSCPOS")) # evesques
print(EvolutionPhonetique.evolution_phonetique("EPẸSCPU")) # evesquë
print(EvolutionPhonetique.evolution_phonetique("FÁCRE")) # faire
print(EvolutionPhonetique.evolution_phonetique("FẸMNAS")) # fames
print(EvolutionPhonetique.evolution_phonetique("FÍLYU")) # fil
print(EvolutionPhonetique.evolution_phonetique("FOÍTS")) # foiz
print(EvolutionPhonetique.evolution_phonetique("FRỌYTS")) # fruiz
print(EvolutionPhonetique.evolution_phonetique("FÚT")) # fu
print(EvolutionPhonetique.evolution_phonetique("FÚRUNT")) # furent
print(EvolutionPhonetique.evolution_phonetique("GÁRDA")) # garda
print(EvolutionPhonetique.evolution_phonetique("GENÍTRÍXA")) # genitrix
print(EvolutionPhonetique.evolution_phonetique("GLORÍỌSSA")) # glorïouse
print(EvolutionPhonetique.evolution_phonetique("GRATYAS")) # gracias
print(EvolutionPhonetique.evolution_phonetique("GRATYA")) # gratia
print(EvolutionPhonetique.evolution_phonetique("HABET")) # ha
print(EvolutionPhonetique.evolution_phonetique("HORAS")) # hores
# print(EvolutionPhonetique.evolution_phonetique("IL")) # il
print(EvolutionPhonetique.evolution_phonetique("EXÍT")) # issi
print(EvolutionPhonetique.evolution_phonetique("GAUDYǪSAMẸNTE")) # joiosement
print(EvolutionPhonetique.evolution_phonetique("DYǪRNU")) # jor
print(EvolutionPhonetique.evolution_phonetique("DYǪRNOS")) # jorz
print(EvolutionPhonetique.evolution_phonetique("LAÚDAS")) # laudes
print(EvolutionPhonetique.evolution_phonetique("ILLE")) # le
print(EvolutionPhonetique.evolution_phonetique("ILLOS")) # les
print(EvolutionPhonetique.evolution_phonetique("LEVĘTS")) # levez
print(EvolutionPhonetique.evolution_phonetique("LAUDARĘT")) # loerai
print(EvolutionPhonetique.evolution_phonetique("LAUDAS")) # loes
print(EvolutionPhonetique.evolution_phonetique("LUÍ")) # lui
print(EvolutionPhonetique.evolution_phonetique("MERCẸYDE")) # marcis
print(EvolutionPhonetique.evolution_phonetique("MARÍA")) # marie
print(EvolutionPhonetique.evolution_phonetique("MATTÍNAS")) # matines
print(EvolutionPhonetique.evolution_phonetique("MEYLYỌRA")) # meillura
print(EvolutionPhonetique.evolution_phonetique("MENERÁ")) # menrai
print(EvolutionPhonetique.evolution_phonetique("MÁTRE")) # mere
print(EvolutionPhonetique.evolution_phonetique("MẸSSTĘRU")) # mester
print(EvolutionPhonetique.evolution_phonetique("MIRÁCCLU")) # miracle
print(EvolutionPhonetique.evolution_phonetique("MÍSSU")) # mis
print(EvolutionPhonetique.evolution_phonetique("MẸ")) # moi
print(EvolutionPhonetique.evolution_phonetique("MỌNYCU")) # moino
print(EvolutionPhonetique.evolution_phonetique("MỌNYCOS")) # moines
print(EvolutionPhonetique.evolution_phonetique("MOLTU")) # mout
print(EvolutionPhonetique.evolution_phonetique("MON")) # mon
print(EvolutionPhonetique.evolution_phonetique("MOSTĘRYU")) # mostier
print(EvolutionPhonetique.evolution_phonetique("MỌTTU")) # mot
print(EvolutionPhonetique.evolution_phonetique("NETA")) # nete
print(EvolutionPhonetique.evolution_phonetique("NOS")) # nos
print(EvolutionPhonetique.evolution_phonetique("NOSTRO")) # nostron
print(EvolutionPhonetique.evolution_phonetique("NǪCTE")) # nuit
print(EvolutionPhonetique.evolution_phonetique("NỌMME")) # num
print(EvolutionPhonetique.evolution_phonetique("ÁWWUNT")) # ont
print(EvolutionPhonetique.evolution_phonetique("ORGANU")) # orgen
print(EvolutionPhonetique.evolution_phonetique("ÁWWIT")) # ot
print(EvolutionPhonetique.evolution_phonetique("AUDÍ")) # oï
print(EvolutionPhonetique.evolution_phonetique("PAR")) # par
print(EvolutionPhonetique.evolution_phonetique("PARLAT")) # parlé
print(EvolutionPhonetique.evolution_phonetique("PARTÍT")) # partit
print(EvolutionPhonetique.evolution_phonetique("PAS")) # pas
print(EvolutionPhonetique.evolution_phonetique("PLẸNA")) # plena
print(EvolutionPhonetique.evolution_phonetique("POR")) # por
print(EvolutionPhonetique.evolution_phonetique("PRECÍỌSSA")) # precïose
print(EvolutionPhonetique.evolution_phonetique("PRÍST")) # prist
print(EvolutionPhonetique.evolution_phonetique("PROPHĘTTA")) # prophete
print(EvolutionPhonetique.evolution_phonetique("PǪYS")) # puis
print(EvolutionPhonetique.evolution_phonetique("PURA")) # pure
print(EvolutionPhonetique.evolution_phonetique("QWÁNTU")) # quant
print(EvolutionPhonetique.evolution_phonetique("CANTÍQWOS")) # quantiques
print(EvolutionPhonetique.evolution_phonetique("CAR")) # quar
print(EvolutionPhonetique.evolution_phonetique("QUE")) # quë
print(EvolutionPhonetique.evolution_phonetique("QUI")) # qui
print(EvolutionPhonetique.evolution_phonetique("RE GARDÁ")) # reguardé
print(EvolutionPhonetique.evolution_phonetique("REND")) # rent
print(EvolutionPhonetique.evolution_phonetique("RESPǪNDÍT")) # respondit
print(EvolutionPhonetique.evolution_phonetique("REVĘRTÍT")) # revertit
print(EvolutionPhonetique.evolution_phonetique("SACRAS")) # sacrez
print(EvolutionPhonetique.evolution_phonetique("SÁNCTU")) # saint
print(EvolutionPhonetique.evolution_phonetique("SÁNCTA")) # sainte
print(EvolutionPhonetique.evolution_phonetique("SÁNCTOS")) # sainz
print(EvolutionPhonetique.evolution_phonetique("SALÚTE")) # salu
print(EvolutionPhonetique.evolution_phonetique("SALÚA")) # salua
print(EvolutionPhonetique.evolution_phonetique("SE")) # se
print(EvolutionPhonetique.evolution_phonetique("SEDĘNT")) # seent
print(EvolutionPhonetique.evolution_phonetique("SENYǪR")) # seignor
print(EvolutionPhonetique.evolution_phonetique("SENĘSSTRA")) # senestre
print(EvolutionPhonetique.evolution_phonetique("SERVÍRE")) # servir
print(EvolutionPhonetique.evolution_phonetique("SERVÍS")) # servis
print(EvolutionPhonetique.evolution_phonetique("SES")) # ses
print(EvolutionPhonetique.evolution_phonetique("SÍDĘT")) # sidoit
print(EvolutionPhonetique.evolution_phonetique("SĘES")) # soies
print(EvolutionPhonetique.evolution_phonetique("SON")) # son
print(EvolutionPhonetique.evolution_phonetique("SONATS")) # sonez
print(EvolutionPhonetique.evolution_phonetique("SOPLÍĘT")) # soplioit
print(EvolutionPhonetique.evolution_phonetique("SỌBẸNDE")) # sovent
print(EvolutionPhonetique.evolution_phonetique("TANTỌST")) # tantost
print(EvolutionPhonetique.evolution_phonetique("TE")) # te
print(EvolutionPhonetique.evolution_phonetique("TON")) # ton
print(EvolutionPhonetique.evolution_phonetique("TORNA")) # torna
print(EvolutionPhonetique.evolution_phonetique("TOT")) # tot
print(EvolutionPhonetique.evolution_phonetique("TOTTUS")) # toz
print(EvolutionPhonetique.evolution_phonetique("TRES")) # tres
print(EvolutionPhonetique.evolution_phonetique("TU")) # tu
print(EvolutionPhonetique.evolution_phonetique("UNU")) # un
print(EvolutionPhonetique.evolution_phonetique("UNA")) # une
print(EvolutionPhonetique.evolution_phonetique("VẸGYLÁRE")) # veiller
print(EvolutionPhonetique.evolution_phonetique("VẸGYLĘT")) # veilloit
print(EvolutionPhonetique.evolution_phonetique("VENÍRE")) # venir
print(EvolutionPhonetique.evolution_phonetique("VENÍTA")) # venite
print(EvolutionPhonetique.evolution_phonetique("VENĘT")) # venoit
print(EvolutionPhonetique.evolution_phonetique("VENTRU")) # ventre
print(EvolutionPhonetique.evolution_phonetique("VENÚ")) # venue
print(EvolutionPhonetique.evolution_phonetique("VERSU")) # vers
print(EvolutionPhonetique.evolution_phonetique("VITA")) # vie
print(EvolutionPhonetique.evolution_phonetique("VĘNIT")) # vient
print(EvolutionPhonetique.evolution_phonetique("VIRGA")) # virgë
print(EvolutionPhonetique.evolution_phonetique("VĘSU")) # vois
print(EvolutionPhonetique.evolution_phonetique("VITU")) # vit
print(EvolutionPhonetique.evolution_phonetique("VĘSUT")) # voit
print(EvolutionPhonetique.evolution_phonetique("VOCES")) # voiz
print(EvolutionPhonetique.evolution_phonetique("VEDẸRE")) # vooir
print(EvolutionPhonetique.evolution_phonetique("VOS")) # vos
print(EvolutionPhonetique.evolution_phonetique("VỌTA")) # vout
|
"""
You are given two sets, and .Your job is to find whether set is a subset of set .If set is subset of set , print True.
If set is not a subset of set , print False.
Input Format
The first line will contain the number of test cases, .
The first line of each test case contains the number of elements in set .
The second line of each test case contains the space separated elements of set .
The third line of each test case contains the number of elements in set .
The fourth line of each test case contains the space separated elements of set .
Sample Input
3
5
1 2 3 5 6
9
9 8 5 6 3 2 1 4 7
1
2
5
3 6 5 4 1
7
1 2 3 5 6 8 9
3
9 8 2
Sample Output
True
False
False
"""
T = int(input())
for i in range(T):
Set_A = int(input())
arrA = set(input().split())
Set_B = int(input())
arrB = set( input().split())
print(arrA.issubset(arrB))
|
'''This file holds the version of the project, according to Jira'''
# starting ml modelling
__version__ = '0.2.4'
|
"""
DoF - Deep Model Core Output Framework
--------------------------------------
Copyright rixel 2021
Distributed under the MIT License.
See accompanying file LICENSE.
"""
# Modul level constants
__author__ = ['Axel Ország-Krisz Dr.', 'Richárd Ádám Vécsey Dr.']
__copyright__ = "Copyright 2021, DoF - Deep Model Core Output Framework"
__credits__ = ['Axel Ország-Krisz Dr.', 'Richárd Ádám Vécsey Dr.', 'rixel']
__license__ = 'MIT'
__version__ = '2.0'
__status__ = 'final'
|
"""
Для чисел в пределах от 20 до 240 найти числа, кратные 20 или 21. Необходимо решить задание в одну строку.
Подсказка: использовать функцию range() и генератор.
"""
def main():
new_list = [i for i in range(20, 241) if i % 20 == 0 or i % 21 == 0]
print(new_list)
print("Программа завершена")
if __name__ == "__main__":
main()
|
#LeetCode problem 572: Subtree of Another Tree
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isSubtree(self, s: TreeNode, t: TreeNode) -> bool:
res1=[]
res2=[]
res1=self.getInorder(s,res1)
res2=self.getInorder(t,res2)
s1=''
for i in range(len(res1)):
s1+=res1[i]
s2=''
for i in range(len(res2)):
s2+=res2[i]
print(s1,s2)
return s2 in s1
def getInorder(self, root:TreeNode,res):
if root is None:
res.append("null")
return
if root.left is None:
res.append("lnull")
elif root.right is None:
res.append("rnull")
self.getInorder(root.left,res)
res.append(str(root.val))
self.getInorder(root.right,res)
return res
|
characterMapSean = {
"sean_base_001": "sean_base_001", # Auto: Edited
"sean_base_y_001": "", # Auto: Deleted
"sean_ex_001_001": "sean_ex_001_001", # Auto: Edited
"sean_ex_002_001": "sean_ex_002_001", # Auto: Edited
"sean_ex_003_001": "sean_ex_003_001", # Auto: Edited
"sean_ex_004_001": "sean_ex_004_001", # Auto: Edited
"sean_ex_005_001": "sean_ex_005_001", # Auto: Edited
"sean_ex_006_001": "sean_ex_006_001", # Auto: Edited
"sean_ex_007_001": "sean_ex_007_001", # Auto: Edited
"sean_ex_008_001": "sean_ex_008_001", # Auto: Edited
"sean_ex_009_001": "sean_ex_009_001", # Auto: Edited
"sean_ex_010_001": "sean_ex_010_001", # Auto: Edited
"sean_ex_011_001": "sean_ex_011_001", # Auto: Edited
"sean_ex_012_001": "sean_ex_012_001", # Auto: Edited
"sean_ex_013_001": "", # Auto: Deleted
"sean_ex_014_001": "", # Auto: Deleted
"sean_ex_y_001_001": "", # Auto: Deleted
"sean_ex_y_002_001": "", # Auto: Deleted
"sean_ex_y_003_001": "", # Auto: Deleted
"sean_ex_y_004_001": "", # Auto: Deleted
"sean_ex_y_005_001": "", # Auto: Deleted
"sean_ex_y_006_001": "", # Auto: Deleted
"sean_ex_y_007_001": "", # Auto: Deleted
"sean_ex_y_008_001": "", # Auto: Deleted
"sean_ex_y_009_001": "", # Auto: Deleted
"sean_ex_y_010_001": "", # Auto: Deleted
"sean_ex_y_011_001": "", # Auto: Deleted
"sean_ex_y_012_001": "", # Auto: Deleted
"sean_ex_y_013_001": "", # Auto: Deleted
"sean_ex_y_014_001": "", # Auto: Deleted
}
|
def getMinimumCost(k, c):
n = len(c)
x = n // k
price = 0
for i in range(1 , x + 1):
for _ in range(k):
max_c = max(c)
price += max_c * i
c.remove(max_c)
for j in c:
price += j * (i + 1)
return price
print(getMinimumCost(3 , [2, 5 , 6]))
|
class InvalidResponseError(Exception):
"""APIレスポンスが想定外の場合に発行される例外
Parameters
----------
Exception : [type]
APIレスポンスが想定外
"""
pass
|
PATH = "path"
SRC_PATH = "src_path"
CONFIG_PATH = "config_path"
USERNAME = "username"
EMAIL = "email"
ASSUMPTIONS_PATH = "ass_path"
NOTES_PATH = "notes_path"
TODOS_PATH = "todos_path"
CONFIG_FILENAME = "config.json"
ASSUMPTIONS_DIRNAME = "assumptions"
NOTES_DIRNAME = "notes"
TODOS_DIRNAME = "todos"
INITIALIZED_FLAG = "initialized" |
# sender, recipent and mail subject
sender = 'sender@mail.com'
recipent = 'recipent@mail.com'
subject = 'New public IP address'
# SMTP url and port
smtpServer = 'smtp.mail.com:587'
# credentials for your mail account
username = 'sender@mail.com'
password = 'password' |
pizzas = ['Popcorn Shrimp Pizza ', 'Surf&Turf Pizza', 'BBQ Sausage Pizza']
for pizza in pizzas:
print("I like " + pizza)
print("I really love pizza!") |
str = '懵萌猛梦'
str = '这是添加的新内容'
num =20
str = '这是在分支中修改的内容2'
|
""" Defines the template of a format handling backend
Mainly a generic template to read and write functions.
The registery of backends is located in backends/__init__.py
"""
#==============================================================================
class BaseBackend(object):
""" Template class for managing access to table files
The aim of this class is to propose various format managers by
simply providing reading and writing methods
Define any format manager by deriving this class and defining
the two followin method:
read -- reading from the considered format
write -- export to the considered format
then you can register this format manager by using the
register_extension function
"""
#==============================================================================
def __init__(self, tableType, readerFunction = None, writerFunction = None):
""" constructor """
self.tableType = tableType
if readerFunction:
del self.read
self.read = readerFunction
if writerFunction:
del self.write
self.write = writerFunction
def read(self,*args, **kwargs):
""" to be overwritten """
pass
def write(self, *args, **kwargs):
""" to be overwritten """
pass
|
nome = str(input('Digite seu nome completo: ')).strip()
print(f'Seu nome em maiúsculas é {nome.upper()}.')
print(f'Seu nome em minúsculas é {nome.lower()}.')
print(f"Seu nome tem ao todo {len(nome)-nome.count(' ')} letras.")
print(f"Seu primeiro nome tem {nome.find(' ')} letras")
''' É possível fazer o último print desta forma:
separa = nome.split()
print(f'Seu primeiro nome é {nome} e tem {separa[0], len(separa[0]})) '''
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.