content stringlengths 7 1.05M |
|---|
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'voicex_dev', # Or path to database file if using sqlite3.
'USER': 'postgres', # Not used with sqlite3... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == '__main__':
a = tuple(map(float, input().split()))
C = float(input())
count = 0
for elem in a:
if elem > C:
count += 1
print("Количество чисел больших С:", count)
max_elem = 0
for i, item in enumerate(a):
... |
#Why is the error and how to fix it?
#A: A TypeError menas you are using the wrong type to make an operation. Change print(a+b) to return a+b
def foo(a, b):
print(a + b)
x = foo(2, 3) * 10
|
n=int(input('enter a program : '))
for i in range(n):
for j in range(n-1,i,-1):
print(' ',end=' ')
for k in range(0,i):
print(chr(65+k),end=' ')
print() |
# Aula de Condicionais
# se carro.esquerda() if carro.esquerda():
# bloco_V_ bloco True
# senão else:
# bloco_F_ bloco False
n1 = float(input('Digite a primeira nota:'))
n2 = float(input('Digite a segunda nota:'))
m = (n1 + n2) / 2
print('A sua médi... |
notes = [4,5,3,3,1]
students=["Harry", "Ron","Hemrine", "Ginny", "Draco"]
for i in range(len(students)):
print(f'{students[i]} hat im Fach Zaubertranke die Note {notes[i]} erhalten.') |
def dfs(numbers, target, current_value, index):
if index == len(numbers):
if current_value == target:
return 1
return 0
number = numbers[index]
return dfs(numbers, target, current_value + number, index + 1) + \
dfs(numbers, target, current_value - number, index + 1)
... |
file = open("/home/matheus/Documentos/Repositorios_Linux/Exercicios-Python/Curso Udemy 2022/Nova_organizacao/aula_89_criando-lendo-escrevendo-apagando.py/abc.txt","w+") # w = escrita; + permite leitura e escrita
file.write("Linha 01 \n")
file.write("Linha 02 \n")
file.write("Linha 03 \n")
file.write("Linha 04 \n")
fi... |
class Thesis():
""" Used to define all the characteristics of a thesis.
Args:
thesis_id (int): thesis identifier
title (str): thesis title
authors (list): list of the authors who writed the thesis
advisors (list): list of advisors who helped this theses
url (str): url to... |
#
# Automatically generated
#
class RTOpcodes(object):
pass
RTOpcodes.JSR = 0x00
RTOpcodes.IMMSHORT = 0x00
RTOpcodes.IMMLONG = 0x10
RTOpcodes.VARSHORT = 0x20
RTOpcodes.VARLONG = 0x30
RTOpcodes.ABS = 0x40
RTOpcodes.LDR = 0x80
RTOpcodes.AND = 0x81
RTOpcodes.ORR = 0x82
RTOpcodes.XOR = 0x83
RTOpcodes.ADD = 0x84
RTOpcod... |
# The probability that a person with certain symptoms has hepatitis is 0.75.
# The blood test used to confirm this diagnosis gives positive results for 91% of people with the disease and 5% of those without the disease.
# What is the probability that an individual who has the symptoms and who reacts positively to t... |
"""django-sendgrid"""
VERSION = (1, 0, 1)
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Ryan Balfanz"
__contact__ = "ryan@ryanbalfanz.net"
__homepage__ = "http://ryanbalfanz.github.com/django-sendgrid/"
__docformat__ = "restructuredtext"
# __license__ = "BSD (3 clause)"
|
"""
PASSENGERS
"""
numPassengers = 19150
passenger_arriving = (
(4, 5, 4, 9, 0, 2, 3, 0, 2, 1, 0, 1, 0, 4, 2, 4, 3, 4, 1, 2, 0, 0, 1, 1, 1, 0), # 0
(7, 6, 6, 3, 2, 3, 0, 1, 2, 1, 0, 1, 0, 2, 4, 2, 5, 5, 3, 2, 0, 3, 2, 1, 2, 0), # 1
(9, 5, 5, 2, 3, 1, 1, 2, 4, 3, 0, 0, 0, 6, 10, 2, 4, 5, 5, 2, 2, 2, 2, 1, 0, 0),... |
## 99 bottles using while loop..
n = 99
while n > 0:
print(n,"bottles of beer on the wall,","Take one down, pass it around,")
n = n - 1
print('No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall…')
"""
# 99 bottles usin... |
# model settings
_base_ = './hv_pointpillars_secfpn_6x8_160e_kitti-3d-3class.py'
voxel_size = [0.16, 0.16, 4]
point_cloud_range = [0, -39.68, -3, 69.12, 39.68, 1]
model = dict(
voxel_encoder=dict(
type='PillarFeatureNet',
in_channels=4,
feat_channels=[64],
with_distance=False,
... |
"""
This module contains third-party libraries that usually have different licensing than
Binary Refinery itself.
"""
|
def for_Q():
""" Pattern of Captital Alphabet: 'Q' using for loop"""
for i in range(7):
for j in range(6):
if i%4==0 and j in(1,2,3) or j%4==0 and i in(1,2,3) or i==j and i>1:
print('*',end=' ')
else:
... |
numstr=''
sumnum=0
strng=input('Enter a string:')
for a in strng:
if a.isdigit():
numstr+=a
sumnum+=int(a)
if sumnum==0:
print(strng,'has no digits.')
else:
print(strng,'has digits',numstr,'that sum to',sumnum)
|
# -*- coding: utf-8 -*-
"""autoproto
A package for making the process of reading a binary packet much easier.
"""
__author__ = 'andreas@blixt.org (Andreas Blixt)'
__license__ = 'MIT'
__version__ = '0.1a'
|
#!/usr/bin/env python2
#!coding=utf-8
basic_command = [
('help', 'Show this help'),
('login', 'Login using Baidu account'),
('download', 'Download file from the Baidu pan link'),
('show', 'Show the Baidu pan real link and filename'),
('export', 'export link to aria2 json... |
#! /usr/bin/python2.7
"""Base 41 Data encoding"""
def base41_decode(input):
"""Decode a Base41 string.
input is the string to decode.
The decoded data is returned. A TypeError is raised if input
is not valid (odd number of chars, non-alphabet character present,
invalid word).
"""
rslt =... |
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
result = 0
for char in s:
result ^= ord(char)
for char in t:
result ^= ord(char)
return chr(result) |
## 1. Análise de Vendas
# Nesse exercício vamos fazer uma "análise simples" de atingimento de Meta.
# Temos uma lista com os vendedores e os valores de vendas e queremos identificar (printar) quais os vendedores que bateram a meta e qual foi o valor que eles venderam.
meta = 10000
vendas = [
('João', 15000),
... |
"""Guarde en lista `naturales` los primeros 100 números naturales (desde el 1)
usando el bucle while
"""
S = 1
naturales = []
while S < 101:
naturales.append(S)
S += 1
print("\n\tLos primeros 100 números naturales desde 1 ==> ",naturales)
"""Guarde en `acumulado` una lista con el siguiente patrón:
['1','1... |
#Given the year number. You need to check if this year is a leap year. If it is, print LEAP, otherwise print COMMON.
year = int(input("year=?"))
if year % 4 == 0 and year % 100 != 0:
print("It is a leap year!")
elif year % 400 == 0:
print("it is a leap year!")
else:
print("It is not a leap year")
|
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 7 09:39:00 2020
@author: Andrea Gerardo Russo, Biomedical Engineer
PhD candidate in Neuroscience
University of Salerno, Fisciano, Italy
"""
|
def two_fer_va(name=None):
if name is None:
name = 'you'
return f'One for {name}, one for me.'
def two_fer_vb(name=None):
return f'One for {"you" if name is None else name}, one for me.'
def two_fer_vc(name=None):
return f'One for {name or "you"}, one for me.'
def two_fer_vd(name='you'):
... |
'''
You can think of a Bernoulli trial as a flip of a possibly biased coin. Specifically, each coin flip has a probability p of landing heads (success) and probability 1−p of landing tails (failure). In this exercise, you will write a function to perform n Bernoulli trials, perform_bernoulli_trials(n, p), which returns... |
# Find the Ascii value of user input string.
# define ASCII_value() function with user-input string as argument.
def ASCII_value(charInput):
print("\nASCII value :", end = ' ')
#Getting each character of the user input string
for i in range(len(charInput)):
#Finding the ASCII value of ea... |
"""
Support for local Luftdaten sensors.
Copyright (c) 2019 Mario Villavecchia
Licensed under MIT. All rights reserved.
https://github.com/lichtteil/local_luftdaten/
"""
|
n,k=map(int,input().split())
for i in range(1,10):
rem=(n*i)%10
if(rem==0 or rem==k):
print(i)
break
|
student = {
"name": "Mark",
"student_id": 15163,
"feedback": None
}
student["last_name"] = "Kowalski"
try:
last_name = student["last_name"]
numbered_last_name = 3 + last_name
except KeyError:
print
except TypeError as error:
print("I can't add these two together!")
print(error)
print(... |
# use your username and password
USERNAME = ''
PASSWORD = ''
# URL = 'http://192.168.168.6/sess/Start.aspx'
URL = 'http://pershiess.fasau.ac.ir/sess/Start.aspx'
# # Changing user agent to trick websites (for headless use)
# # with phantomjs (for headless use)
# DCAP = dict("")
# DCAP["phantomjs.page.settings.userAge... |
# (C) 2020 Tim Churchard
# Settings
DEFAULT_DEPTH = 10
# Example xpubs
EXAMPLE_XPUBS = (
'xpub6CPkcptFb3VQudKr4FytZfY1GumgV29pUjBqYyx2GPpX5qirZULBg5U7ynEFHriZU5LXvdoMGQWPMK8LBAeR35f32FQNEAZHG8mNsS3oFwJ',
'ypub6X9tfM9t5GxhZwZWdAepwURh3X6JYfwbi8JtpCQB1eQGbjzyXpagoqZRxsjowgzqUhdVpoZwyrEMXUxZvYxYxuYNSyrvpKVZNjjR8... |
#!/usr/bin/env python
# encoding:utf-8
# file: homework.py
# 自己实现python自带的map、zip和filter函数
# 还没学到 yield语法不熟 先简单实现
# 实现map函数
def my_map(*args):
"""文档字符串位置
"""
if len(args) < 2:
# 先不用异常的方式处理 只是打印
print('map()至少需要两个参数')
else:
# 判断是否为可迭代对象 先不处理
fnc_nme = args[0]
n... |
def generate_permutations(L,i=None,n=None):
if i==None:
i=0
if n==None:
n=len(L)-1
if i==n:
print(L)
else:
for j in range(i,n+1):
L[i],L[j]=L[j],L[i]
generate_permutations(L,i=i+1,n=n)
L[i],L[j]=L[j],L[i]
L=["a","b","c","d","e"]
generate_permutations(L)
|
def int_to_bit(n, nbits, lsb0=True):
'''
convert the integer into a bit string of the number of bits specified.
e.g. if n is in bit is "0111",
if nbits is 5 and lsb0 is True, then it's gonna be "00111".
if lsb0 is False, then its' gonna be "11100".
if nbits is less than n in bit, omit the bits.... |
#py_binary_operations.py
base_10_number = 12
fmt = "{:<20} {:<30}"
print("Base 2 operations: left shift increases by powers of 2")
for i in range(3):
print(fmt.format("mybin_1000: ", bin(base_10_number << i)))
print()
print("Base 2 operations: right shift reduces by powers of 2")
for i in range(3):
print(... |
def linhas():
print('='*30)
print('CADASTRE UMA PESSOA')
tot18 = masc = fem20 = 0
while True:
idade = int(input('Idade: '))
sexo = ' '
while sexo not in 'MF':
sexo = str(input('Sexo: [M/F]')).upper()[0].strip()
if idade >= 18:
tot18 += 1
if sexo == 'M':
masc += 1
if ... |
#Crie um programa que tenha uma tupla com várias palavras (não usar acentos). Depois disso, você deve mostrar, para cada palavra, quais são as suas vogais.
p = ('cavalo', 'mamadeira', 'violino')
for c in p:
print(f'\nPara a palavra {c.upper()} temos ', end='')
for l in c:
if l in 'aeiou':
pr... |
"""
Escriba una clase Flowers que tiene tres propiedades, de tipo int, str
y float, que respectivamente representa el nombre de la flor, su
cantidad de pétalos y su precio. La clase debe incluir un método
constructor que inicialice cada variable con su valor apropiado, y la
clase debe incluir métodos para establecer el... |
{
"targets": [
# the only purpose of this target is to share settings between celt
# and silk targets.
{
"target_name": "opus_common_settings",
"type": "none",
"direct_dependent_settings" : {
"include_dirs": [
"... |
def max_point(strA, left, right):
if right < left:
return -1
mid = (left + right) // 2
if strA[mid] > strA[mid -1] and strA[mid] > strA[mid + 1]:
return strA[mid]
elif strA[mid] > strA[mid -1] and strA[mid] < strA[mid + 1]:
return max_point(strA, mid, right)
elif strA[mid] < strA[mid -1] and strA[mid] >... |
palette = {
"none": "",
"text": "rgb(40, 40, 40)",
"comment": "rgb(130, 130, 130)",
"string": "rgb(30, 100, 0)",
"function": "rgb(50, 50, 200)",
"value": "rgb(200, 0, 0)",
"type": "rgb(0, 110, 120)",
"reserved": "rgb(80, 0, 0)",
"operator": "rgb(100, 100, 0)",
"call": "rgb(0, 50,... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.messages',
'django.contrib.sites',
'djangocms_camerasli... |
class Agent(object):
def train(self, batch):
raise NotImplementedError
def act(self, observation):
raise NotImplementedError
|
# WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
class BankDetailsLookup(object):
"""A thin wrapper around a bank_details_lookup, providing easy access to its
attributes.
Example:
bank_details_lookup = client.bank_details_lookups.get()
... |
# this is a list of skills which are not one-lines
ACTIVE_SKILLS = [
"book_skill",
"christmas_new_year_skill",
"dff_coronavirus_skill",
"dummy_skill_dialog",
"emotion_skill",
"game_cooperative_skill",
"meta_script_skill",
"dff_movie_skill",
"news_api_skill",
"oscar_skill",
"p... |
in_min=136818
in_max=685979
def includes_duplicates(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n] == str_num[n + 1]:
return True
return False
def monotonic_increase(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n + 1] < str_num[n]:
return False
return... |
# 1. 변수 선언 및 사용
# name 변수에 "홍길동" 문자열 대입
name = "홍길동"
# age 변수에 정수 10 대입
age = 10
# height 변수에 150.24 실수 대입
height = 150.24
# family 변수에 리스트 저장
family = ["엄마", "아빠", "누나"]
# score 변수에 딕셔너리 저장
score = {
"국어": 98,
"수학": 100,
"영어": 82
}
# hands 변수에 튜플 저장
# 튜플은 값을 변경할 수 없습니다.
hands = (3, 7)
# ==========... |
class Solution:
def findMaximumXOR(self, nums: List[int]) -> int:
mx = 0
for i in reversed(range(31)):
prefixes = set(num >> i for num in nums)
mx <<= 1
cand = mx + 1
for prefix in prefixes:
if (cand ^ prefix) in prefixes:
... |
class TreeNode:
def __init__(self, **kwargs):
self.children = dict()
def get(self, key):
return self.children.get(key, None)
def get_children(self, sort=False):
if sort:
return sorted(self.children.values())
return self.children.values()
def add(self, key, ... |
#add your reddit credentials here
username = "" #username
password = "" #password
client_id = "" #client id
client_secret = "" #client password
subreddits = "memes+dankmemes+me_irl" #subreddits you want to get memes from, it is important not to include spaces b/w '+'
min_upvotes = 150 #minimum number of upvotes
debug =... |
# -*- coding: utf-8 -*-
def parseGroupWriting_3(lexicalItem):
#add indicator beginning (#) / end ($) of word
lexicalItem = "#." + lexicalItem + ".$"
lexicalItem = lexicalItem.replace("#.#", "#.").replace("$.$", ".$")
groupsRaw = lexicalItem.split(".")
itemCleaned = ""
# ] = no vowel after... |
# 7. Perfect Number
# Write a function that receives an integer number and returns if this number is perfect or NOT.
# A perfect number is a positive integer that is equal to the sum of its proper positive divisors.
# That is the sum of its positive divisors excluding the number itself (also known as its aliquot sum).
... |
def conv_output_length(input_length, filter_size,
padding, stride, dilation=1):
if input_length is None:
return None
assert padding == "same"
output_length = input_length
return (output_length + stride - 1) // stride
def same_padding_length(input_length, filter_size, stri... |
# This is sample in Python language for
# MCS - Most Common (Even/Uneven) Sum
# for given list, size and mode(even/uneven)
# created by https://github.com/trolit
# Press Shift+F10 to execute it.
def get_biggest_sum_depending_on_mode(list_numbers, var_size, var_mode):
# Use a breakpoint in the code line below to d... |
"""
可迭代对象工具集
"""
class IterableHelper:
"""
可迭代对象助手类
"""
# 静态方法:不需要操作实例与类成员
# 语义:工具函数(常用且独立)
@staticmethod
def find_all(iterable, condition):
"""
在可迭代对象中,根据任意条件查找满足的所有元素
:param iterable:可迭代对象
:param condition:函数类型,查找条件
:return:生成器,推算满足条件的... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
def print_color(code: int, message: str) -> None:
print(f"\033[{code}m{message}\033[00m")
def print_green(message: str) -> None:
pr... |
# scoping.level.1.py
def my_function():
test = 1 # this is defined in the local scope of the function
print('my_function:', test)
test = 0 # this is defined in the global scope
my_function()
print('global:', test)
|
_base_ = [
'../_base_/models/lcgn_config.py',
'../_base_/datasets/gqa_dataset.py',
'../_base_/schedules/schedule_vqa.py',
'../_base_/default_runtime.py'
] # yapf:disable
|
#
class BaseConfig(object):
DEBUG = True
class TestConfig(BaseConfig):
DEBUG = False
TESTING = True
|
class ArpeggioError(Exception):
"""
Base class for arpeggio errors.
"""
def __init__(self, message: str) -> None:
self.message = message
def __str__(self) -> str:
return repr(self.message)
class GrammarError(ArpeggioError):
"""
Error raised during parser building phase use... |
class Makieta:
def __init__(self, dane):
self.dane = dane
|
# -*- coding: utf-8 -*-
# Kurs: Python: Grundlagen der Programmierung für Nicht-Informatiker
# Semester: Herbstsemester 2018
# Homepage: http://accaputo.ch/kurs/python-uzh-hs-2018/
# Author: Giuseppe Accaputo
# Aufgabe: 6.3
def durchschnitt(zahlen):
# Um den Durchschnitt zu berechnen, be... |
class Walking_HabitsBaseException(Exception):
pass
class InvalidLayoutError(Walking_HabitsBaseException):
pass
|
"""
monobit.constants
(c) 2019--2021 Rob Hagemans
licence: https://opensource.org/licenses/MIT
"""
DEFAULT_FORMAT = 'yaff'
VERSION = '0.20'
CONVERTER_NAME = f'monobit v{VERSION}'
|
"""
Closes all the sub windows that are currently open in the Weasel GUI.
"""
def main(weasel):
weasel.close_subwindows()
|
"""
.. module:: check_is_version_string
:synopsis: Given a string, checks if it looks like a version string.
.. moduleauthor:: Scott W. Fleming <fleming@stsci.edu>
"""
#--------------------
def check_is_version_string(istring):
"""
Checks if the string looks like a version.
:param istring: The strin... |
text = """
Formula 1 is to abandon plans to race in the Americas this year, with new races at Imola, the Nurburgring and Algarve
now set to join the calendar. The sport's owner Liberty Media has been weighing up how best to fill out its schedule,
with the coronavirus pandemic still moving at different speeds around t... |
def calcula_nota(conceito):
if conceito.upper() == 'A':
return 4*credito
elif conceito.upper() == 'B':
return 3*credito
elif conceito.upper() == 'C':
return 2*credito
elif conceito.upper() == 'D':
return 0
pergunta = input('Já possúi CR? (S/N)')
if pergunta.upper() == 'N'... |
# encoding: utf-8
MOCK_QUERY_RESULT = "QUERY_RESULT"
def mock_connection(execution_function=lambda x, y: None,
fetch_function=lambda x: None):
cursor = type('cursor', (object, ), {
'execute': execution_function,
'fetchall': fetch_function
})
def cursor_call(*args, **... |
b = bytes(range(20))
il = int.from_bytes(b, "little")
ib = int.from_bytes(b, "big")
print(il)
print(ib)
print(il.to_bytes(20, "little"))
|
'''
Now You Code 4: Reddit News Sentiment Analysis
In this assignment you're tasked with performing a sentiment analysis on top Reddit news articles. (https://www.reddit.com/r/news/top.json)
You should perform the analysis on the titles only.
Start by getting the Reddit API to work, and extracting a list of titles on... |
# coding: utf-8
class PVWattsError(Exception):
"""
Base class for PVWatts errors
"""
def __init__(self, message):
Exception.__init__(self, message)
class PVWattsValidationError(PVWattsError):
"""
Validation error on request
"""
def __init__(self, message):
PVWattsError.... |
# constants.py
# Copyright (c) 2013-2019 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0111,C0302,W0105
###
# Global variables
###
AXIS_TICKS_FONT_SIZE = 14
"""
Axis tick labels font size in points
:type: integer
"""
AXIS_LABEL_FONT_SIZE = 18
"""
Axis labels font size in points
:type: integer... |
# lst1 = [8,3,9,6,4,7,5,2,1]
# lst2 = [10,11,12,8,3,9,6,4,7,5,2,1]
# lst3 = [8,9,3,6,7,4,5,2,1]
# lst4 = [8,3,9,6,4,7,5,2,1]
# lst = [7, 2, 6, 4, 2, 3, 2, 1]
# lst5 = [14, 4, 8, 17, 16, 2, 12, 6, 18, 3, 10, 13, 9, 5, 1, 11, 19, 15, 7, 20]
# lst6 = [1, 17, 11, 20, 7, 15, 13, 10, 6, 16, 12, 19, 8, 18, 5, 3, 4, 14, 9, 2]
... |
# 입력
B = int(input())
# 출력
res = 5*B - 400
print(res)
if res < 100:
print(1)
elif res == 100:
print(0)
else:
print(-1)
|
a = "dog\ndog\tdog"
b = 'cat'
c = '🐱'
print(f"001 {a}{b}{c}")
print(f'002 {a}{b}{c}')
print(f"""003 {a}{b}{c}""")
print(f"005 string {a!s} {b!s} {c!s}")
#broken print(f"006 ascii {a!a} {b!a} {c!a}")
d = -177
print(f"int: {d}")
e = (1, 3, 5)
print(f'tuple: {e}')
print(f'tuple: {e!s}')
print(f'tuple: {e!r}')
#prin... |
#
# PySNMP MIB module CISCO-ENTITY-PROVISIONING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ENTITY-PROVISIONING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:39:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... |
le = [1,12,2,3,1,1,2,3,1,3,4,3,1,5,0,3,2,1,9,19,1,19,5,23,1,13,23,27,1,27,6,31,2,31,6,35,2,6,35,39,1,39,5,43,1,13,43,47,1,6,47,51,2,13,51,55,1,10,55,59,1,59,5,63,1,10,63,67,1,67,5,71,1,71,10,75,1,9,75,79,2,13,79,83,1,9,83,87,2,87,13,91,1,10,91,95,1,95,9,99,1,13,99,103,2,103,13,107,1,107,10,111,2,10,111,115,1,115,9,119,... |
def tri_recursion(k):
if(k > 0):
result = k + tri_recursion(k - 1)
print(result,k)
else:
result = 0
return result
print("\n\nRecursion Example Results")
tri_recursion(6) |
extracted_data = {"contractor": "",
"contractee": "",
"duration": None,
"intervalPayment": None,
"interval": None,
"amount": None,
"numberOfPerformanceObligations": 0,
"poi": []
... |
# Copyright (c) 2009 - 2015 Tropo, now part of Cisco
# Released under the MIT license. See the file LICENSE
# for the complete license
# --------------------------------------
# Sample Tropo app
# --------------------------------------
answer()
event=ask("where are you heading?",
{'repeat':3,'choices':"1st Floor ... |
"""
Diccionario que almacena los diferentes mensajes que se mostrarán en formato Flash en la aplicación.
"""
msg = {
'INTERNAL_ERROR':"Ha ocurrido algún error interno.",
'FORMAT_ERROR':"El formato no es correcto.",
'JOB_NOT_FOUND_ERROR':"El job_id no existe o ha caducado.",
'PROCESSING_ERROR':"Se ha pr... |
try:
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
set1=list(set(a))
print(len(set1))
except:
pass |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Chris Hoffman <choffman@chathamfinancial.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... |
# File generated by contrib/scrape-ec2-sizes.py script - DO NOT EDIT manually
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to... |
#!/usr/bin/env python
# encoding: utf-8
name = "R_Addition_MultipleBond/groups"
shortDesc = u""
longDesc = u"""
The reaction site *3 should be a triplet, otherwise it will react via the 1+2_Cycloaddition family instead.
"""
template(reactants=["R_R", "YJ"], products=["RJ_R_Y"], ownReverse=False)
reverse = "Beta_Scis... |
# SPDX-License-Identifier: GPL-3.0-only
def make_parser_struct(cpp_struct_value, all_enums, all_bitfields, all_used_structs, all_used_groups, hpp, struct_name, read_only, struct_title):
hpp.write(" private:\n".format(struct_name))
hpp.write(" std::vector<ParserStructValue> get_values_internal() overr... |
# Copyright 2021 Zilliz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
lychrels = 0
for i in range(0, 10001):
s = str(i)
n = i
indicator = 0
for j in range(0, 50):
n = n + int(s[::-1])
s = str(n)
l = len(s)
if l % 2 == 0:
p1 = s[0:int(l/2)]
p2 = s[int(l/2):][::-1]
else:
p1 = s[0:int(l/2)+1]
... |
# lowercased special tokens
UNK = '<unk>'
PAD = '<pad>'
START = '<bos>'
STOP = '<eos>'
# special tokens id (don't edit this order)
UNK_ID = 0
PAD_ID = 1
# this should be set later after building fields
TAGS_PAD_ID = 0
# output_dir
OUTPUT_DIR = 'runs'
# default filenames
CONFIG = 'config.json'
DATASET = 'dataset.tor... |
DETAIL_FILE = "詳細はhttps://github.com/Kdy0115/agent-simulation-system を参照して下さい。"
ENV_ERROR = """Error:実行環境エラー
マルチプロセスと非バッチ処理は対応していません。マルチプロセスを行う場合はバッチ処理に設定してください。
./controllers/env.pyの実行環境設定ファイルを編集してください。
{}""".format(DETAIL_FILE)
FILE_NOT_FIND_ERROR = """ファイルが正しく読み込まれませんでした。正しいパス名を選択してください。
./config/config.ini内のパスを正し... |
def test_mysql_process(host):
assert host.service("my_db-mysql").is_running
assert host.service("my_db-mysql").is_enabled
def test_check_mysql_access(host):
assert host.run("mysql --protocol=tcp -h 127.0.0.1 -u u1 -P 13306 -ppassword1 db1").succeeded
assert host.run("mysql --protocol=tcp -h 127.0.0.1 -... |
# This file contains all the constants in use by the tetration modules
# defining tetration constants
TETRATION_API_INVENTORY_TAG = '/inventory/tags'
TETRATION_API_ROLE = '/roles'
TETRATION_API_USER = '/users'
TETRATION_API_SENSORS = '/sensors'
TETRATION_API_INVENTORY_FILTER = '/filters/inventories'
TETRATION_API_SCOP... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-Today OpenERP S.A. (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the term... |
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def levelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if not root:
... |
def main():
print("I am a webscraper")
if __name__ == "__main__":
return main()
class Website(object):
#create a function that gets URL (def URL)
#create a function that turns HTML elements into an array of strings based on white space or '<> (def elements)
#create a function that uses REGEX to find links tha... |
# from https://linked.data.gov.au/dataset/bdr/conservation-status-taxa-wa
# in the sop_recipe_abis_model datagraphs
CONSERVATION_STATUS_TAXA = [
"https://test-idafd.biodiversity.org.au/name/afd/70162908",
"https://test-idafd.biodiversity.org.au/name/afd/70162916",
"https://test-idafd.biodiversity.org.au/nam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.