content stringlengths 7 1.05M |
|---|
module_name = "Contribute"
priority = 10
# Markdown path for contribute
contribute_markdown_path = "content/pages/resources"
# String template for contribution index page
contribute_index_md = ("Title: Contribute\n"
"Template: contribute/contribute\n"
"save_as: resources... |
# 顺序查找
def sequence_search(list_a, v):
for i in list_a:
if v == list_a[i]:
return i
return -1
# 二分查找
def binary_search(list_a, v):
n = len(list_a)
start = 0
end = n - 1
while start <= end:
mid = int((start + end) / 2)
if list_a[mid] == v:
return mid
elif list_a[mid] > v:
... |
# -*- coding: utf-8 -*-
# Do not change the format of this next line. Doing so risks breaking
# setup.py and docs/conf.py
"""Version information for dictdiffer package."""
__version__ = '0.8.1'
|
####
#### Helper functions to support page retrieval.
#### These are mostly going to be Selenium.
####
# from behave import *
###
### TODO: Not much here yet...
###
def hello():
pass
|
def baum(x):
if x<5: return #Abbruch der Rekursion
else:
forward(x)
left(90)
baum(x/2) #Rekursiver Aufruf: Links wird ein kleinerer Binärbaum gezeichnet.
right(180)
baum(x/2) #Rekursiver Aufruf: Rechts wird ein kleinerer Binärbaum gezeichnet
le... |
BOT_NAME = 'mtianyanSpider'
SPIDER_MODULES = ['mtianyanSpider.spiders']
NEWSPIDER_MODULE = 'mtianyanSpider.spiders'
ROBOTSTXT_OBEY = False
COOKIES_ENABLED = False
ITEM_PIPELINES = {
'mtianyanSpider.pipelines.ElasticSearchPipeline': 400,
}
RANDOM_UA_TYPE = "random"
SQL_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
SQL_... |
# MMLTBL - some common tables shared by multiple MML tools
# *** READ THIS BEFORE EDITING THIS FILE ***
# This file is part of the mfvitools project.
# ( https://github.com/emberling/mfvitools )
# mfvitools is designed to be used inside larger projects, e.g.
# johnnydmad, Beyond Chaos, Beyond Chaos Gaiden, or potenti... |
#!/usr/bin/env python
#coding: utf-8
# Definition for a binary tree node
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def _valid(self, root):
if not root: return 0, 0, True
if not root.left and not root.right:
... |
class Unprintable:
def __repr__(self):
raise ValueError("please don't print me")
def f(n: int) -> int:
s1 = 'short string with n: {}'.format(n)
l1 = 'long string with 0..n: {}'.format(', '.join(map(str, range(n))))
us = [Unprintable(), Unprintable(), Unprintable()]
if n % 10 == ... |
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for i in x:
if i in y:
print(i,end = ' ')
|
#
# naive integration
#
def integrate(f, x1, x2, delta=1e-6):
'''
function to integrate f from x1 to x2, with slice width delta
'''
totArea = 0 # variable keeping track of total area
x = x1 # starting point
while x <= x2:
sliceArea = f(x) * delta # area of the tiny slice
t... |
"""
Given an array of integers, return indices of the two numbers such that they add
up to a specific target.
You may assume that each input would have exactly one solution.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
UPDATE (2016/2/13):
The return format ... |
# 392. Is Subsequence
# Runtime: 104 ms, faster than 6.10% of Python3 online submissions for Is Subsequence.
# Memory Usage: 15 MB, less than 9.86% of Python3 online submissions for Is Subsequence.
class Solution:
# Dynamic Programming | Edit Distance
def isSubsequence(self, s: str, t: str) -> bool:
... |
input = """
3 20 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 0 0
8 2 22 23 0 0
8 2 24 25 0 0
8 2 26 27 0 0
1 28 2 0 26 24
1 23 1 0 28
1 25 1 0 28
1 24 1 0 28
1 26 1 0 28
1 27 1 0 28
8 2 29 30 0 0
1 28 3 0 30 26 25
1 30 1 0 28
1 29 1 0 28
8 2 31 32 0 0
1 28 4 1 20 32 30 26
1 28 4 1 20 32 30 26
1 28 3 0 32 26 25
... |
#crie um programa que tenha uma tuplatotalmente preenchida com uma contagem por extenso de zero a 10. Seu progrma deverá ler um numero entre 0 e 10 e mostra-lo por extenso
cont=('zero', 'um','dois','tres','quatro', 'cinco', 'seis','sete', 'oito',
'nove','dez')
while True:
num=int(input('Leia um numero de 0 a... |
"""
Python Challenge Authentication
Contains tuples for user, pass
"""
# Levels 9 to 18
AUTH_01 = ("huge", "file")
# Levels 19
AUTH_02 = ("butter", "fly") |
vacation_time = int(input())
total_amount_of_time = 365
play_per_day_when_work = 63
play_per_day_when_vacation = 127
total_work_time = total_amount_of_time - vacation_time
total_play_time = total_work_time * play_per_day_when_work + \
vacation_time * play_per_day_when_vacation
diff = 30000 - total_pl... |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-ServerAccessRsaMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-ServerAccessRsaMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:21:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.... |
"""
Given a string, convert it to an integer without using the builtin str function. You
are allowed to use ord to convert a character to ASCII code.
Consider all possible cases of an integer. In the case where the string is not a
valid integer, return None
"""
# Time: O(n)
# Space: O(1)
def convert_to_int(s):
i... |
"""
File:
ex_cdagui.py
Description:
Example of how to use cdagui.
Since this is a GUI, we only print the instructions here.
You have to follow these instructions on a python command line,
for example the Spyder console in Anaconda.
"""
def ex_cdagui():
# Import pyspedas
# Run the fo... |
class Bar():
def __init__(self, event_instance_history = {}):
object.__setattr__(self, '_Bar__dic', event_instance_history)
class Foo():
def __init__(self, event_instance_history = {}):
object.__setattr__(self, '_Foo__dic', event_instance_history)
self.a = 5
self.b = 10
... |
class Stacks(object):
def __init__(self, num_stacks, stack_size):
self.num_stacks = num_stacks
self.stack_size = stack_size
self.stack_pointers = [-1] * self.num_stacks
self.stack_array = [None] * self.num_stacks * self.stack_size
def abs_index(self, stack_index):
retur... |
"""
A huge map of every Twitter API endpoint to a function definition in Twython.
Parameters that need to be embedded in the URL are treated with mustaches, e.g:
{{version}}, etc
When creating new endpoint definitions, keep in mind that the name of the mustache
will be replaced with the keyword t... |
# Given a collection of candidate numbers (candidates) and a target number (target),
# find all unique combinations in candidates where the candidate numbers sums to target.
# Each number in candidates may only be used once in the combination.
# Note:
# All numbers (including target) will be positive integers.
# The s... |
def is_valid_ipv4(ip):
pattern = re.compile(r"""
^
(?:
# Dotted variants:
(?:
# Decimal 1-255 (no leading 0's)
[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}
|
0x0*[0-9a-f]{1,2} # Hexadecimal 0x0 - 0xFF (possible leading 0's)
|
... |
def fatorial(N):
cont = N-1
fat = N
if(N == 0):
fat = 1
else:
while(cont>1):
fat = fat * cont
cont -=1
return fat
N = int(input())
print(fatorial(N))
|
class ColumnAttachment(object,IDisposable):
"""
An object representing the attachment of the top or bottom of a column to some target:
a floor,roof,ceiling,beam,or brace.
"""
@staticmethod
def AddColumnAttachment(doc,column,target,baseOrTop,cutColumnStyle,justification,attachOffset):
"""
AddColum... |
"""!
@brief Examples of usage of various utils.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
""" |
"""
75. How to split a text column into two separate columns?
"""
"""
Difficulty Level: L2
"""
"""
Split the string column in df to form a dataframe with 3 columns as shown.
"""
"""
Input
"""
"""
df = pd.DataFrame(["STD, City State",
"33, Kolkata West Bengal",
"44, Chennai Tamil Nadu",
"40, Hyderabad Teleng... |
WRITE_CODE = False
# 1. 곱셈 함수(꼬리 재귀)
def mult1(m,n):
def loop(n,ans):
if (n>0):
return loop(n-1,m+ans)
else:
return ans
return loop(n,0)
# 2. 곱셈 함수(while문)
def mult2(m,n):
ans = 0
while (n>0):
ans += m
n = n-1
return ans
###################
# 수정 X #
# 곱셈 함수 보조 함수 #
def double(n): #... |
class EncryptedCredentials:
"""This class contains data required for decrypting and authenticating :ref:`object_encrypted_passport_element`\
See https://core.telegram.org/passport#receiving-information for further information
:param data: Base64 encoded encrypted JSON-serialized data with unique user's pay... |
"""
This calculation feature/object
for calculating some math
"""
class calculation:
def __init__(self):
pass
def addition(self,a,b):
return a + b
def subtraction(self,a,b):
return a - b
|
def minPathSum(self, grid: [[int]]) -> int:
for i in range(len(grid)):
for j in range(len(grid[0])):
if i == j == 0: continue
elif i == 0: grid[i][j] = grid[i][j - 1] + grid[i][j]
elif j == 0: grid[i][j] = grid[i - 1][j] + grid[i][j]
else: grid[i][j] = m... |
class DataframeTypeHolder:
"""
Seperates the features based off of dtypes
to better keep track of feature changes over time.
Should only be used for manipulation of features.
"""
def __init__(self, df):
self.__bool_features = set(df.select_dtypes(include=["bool"]).columns)... |
# Ask for a sentence
# Print the length of the sentence
# Ask for a file name (.txt)
# Write the sentence to the file
# Run the program from your command line
sentence = input("Enter a sentence: ")
sentence_length = len(sentence)
print(sentence_length)
file_name = input("Enter a file name: " )
file_name = f"{file_nam... |
obj_dict = dict( {'a':{'b':{'c':'d'}}})
keys_str = input("Enter the key for which value to be fetched : (use '/' as delemeter ) \n")
keys = keys_str.split("/")
# ['a', 'b', 'c']
val = obj_dict
isFound = True
for key in keys:
val = val.get(key, None)
if val == None:
isFound = False
break
... |
# Тест: Ввод логина и разлогин
def test_login(app2):
app2.login.correct_user()
assert "Столото S3" in app2.wd.title
app2.login.enter_button()
app2.login.user_in_main_page()
assert app2.session.assertion_current_page() == "http://localhost:9999/"
app2.session.exit_s3() |
class Settings:
"""A class to manage game settings."""
card_values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
card_suits = ["Spades", "Clubs", "Hearts", "Diamonds"]
card_names = ["ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN",
"EIGHT", "NINE", "TEN", "KNIGHT", "QUEEN", "KING"... |
dist = float(input('Qual a distância da viagem em Km? '))
tarif1 = 0.50
tarif2 = 0.45
if dist <= 200:
print('A passagem será de R${:.2f}'.format(dist * tarif1))
else:
print('A passagem será de R${:.2f}'.format(dist * tarif2))
|
# start by creating lists for the quadrants. we'll learn a better way to do this next lesson.
nw_addresses = []
ne_addresses = []
sw_addresses = []
se_addresses = []
no_quadrant = []
for entry in range(3): # do this three times:
address = raw_input("What is your DC address? ") # get the address from the user
... |
"""
paper: Independently Recurrent Neural Network (IndRNN): Building A Longer and Deeper RNN
authors: Shuai Li, Wanqing Li, Chris Cook, Ce Zhu, Yanbo Gao
paper link: https://arxiv.org/pdf/1803.04831.pdf
code: https://github.com/batzner/indrnn
"""
# TODO. copy cell
|
BASE = 2**30
class BigUInt:
def __init__(self, digits=[]):
for digit in digits:
if digit >= BASE:
raise ValueError("digit is too large!")
self.digits = digits
def __int__(self):
total = 0
for i, digit in enumerate(self.digits):
total += digit * (BASE ** i)
return total
def __str... |
# check if dependencies are available
hard_dependencies = ('numpy','cv2','skimage','scipy')
missing_dependencies = []
for dependency in hard_dependencies:
try:
__import__(dependency)
except ImportError as e:
missing_dependencies.append(f"{dependency}: {e}")
if missing_dependencies:
raise ... |
"""
Meme-module for "efficiently" checking whether a given day is a weekday/weekend, with multi-language support.
Languages supported:
-English
-German
-Spanish
-French
"""
def weekday(day: str) -> bool:
"""
Checks if a string is the name of a weekday in the supported languages.
:param day: Any string, id... |
def clamp(value, max_value, min_value):
value = min(value, max_value)
value = max(value, min_value)
return value
|
__author__ = 'wenqihe'
class AbstractFeature(object):
def apply(self, sentence, mention, features):
raise NotImplementedError('Should have implemented this')
|
# PROGRAM : To accept some inputs of different types and print them using positional parameters format i.e. {}
# FILE : positionalParameter.py
# CREATED BY : Santosh Hembram
# DATED : 16-09-20
x = int(input("Enter an integer value: "))
y = float(input("Enter a float value: "))
z = (input("Enter a string: ")... |
def number_increment(numbers):
def increase():
return [x+1 for x in numbers]
return increase()
|
def _convert_playlist_url_to_embed(url):
return url.replace("/playlist/", "/embed/playlist/")
def transform_spotify_playlist_to_thisdayinmusic_playlist(playlist):
url_embed = _convert_playlist_url_to_embed(playlist["external_urls"]["spotify"])
return {"id": playlist["id"], "url": url_embed}
def transfo... |
"""
Create-dist
Generates compiled files to dist/
@licence MIT
@author Pablo Pizarro @ppizarror.com
"""
"""
Genenerates a compiled file
"""
def generate_file(main, files):
w = open(main, 'w')
for i in files:
f = open(i, 'r')
for j in f:
w.write(j)
f.close()
w.close()
#... |
# ScriptName: functions.py
# Author: Brendon Purchase 119473576
# template for calling functions in another file
def print_function():
print("I'm in another file :)")
def count(list, value):
'''
function - count how many times <value> occurs in <list>
:param list: - <list> input
:param value: -... |
points = [(1.0, 2.0), (3.0, 1.0), (1.0, 1.0), (2.0, 2.0), (4.0, 2.0)]
lines = [
(points[1], points[4]), (points[3], points[4]), (points[1], points[2]), (points[2], points[3]),
(points[0], points[3])
]
xrefs = {p: [l for l in lines if p in l] for p in points}
starts = [k for k in xrefs.keys() if len(xrefs[k]) =... |
class ProductionConfig():
TESTING = False
SQLALCHEMY_DATABASE_URI = 'sqlite:///../app.db'
SQLALCHEMY_ECHO = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = '12345567890' # Unsecure default, overridden in secret_key.py
WTF_CSRF_ENABLED = False
class TestingConfig():
TESTING = Tru... |
# This is a an example file to be tokenized
def two():
return 1 + 1
|
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500*i + 100*j + 50*k == X:
count += 1
print(count)
|
#!/usr/bin/env python3
################################################################
# Text
################################################################
# common string operators
string = 'Gerry'
# concatenation
string +' LastName'
#'Gerry LastName'
# repetition
string*5
#'GerryGerryGerryGerryGerry'
# acces... |
class Temperature_convertedersion:
'''Convert given temperature to celsius, fahrenheit or kelvin'''
def __init__(self, temp):
self.temp = temp
def celsius_to_fahrenheit(self):
converted = (9 / 5) * self.temp + 32
return f'{self.temp}C = {converted}F'
def celsius_to... |
# Copyright (c) Microsoft Corporation and contributors.
# Licensed under the MIT License.
_PRECISION = 1e-8
_LINE = "_" * 9
_INDENTATION = " " * 9
# Explicit optimization parameters of ExponentiatedGradient
# A multiplier controlling the automatic setting of nu.
_ACCURACY_MUL = 0.5
# Parameters controlling adaptiv... |
data = [
[775, 785, 361],
[622, 375, 125],
[297, 839, 375],
[245, 38, 891],
[503, 463, 849],
[731, 482, 759],
[ 29, 734, 734],
[245, 771, 269],
[261, 315, 904],
[669, 96, 581],
[570, 745, 156],
[124, 678, 684],
[472, 360, 73],
[174, 251, 926],
[406, 408, 976],
[413, 238, 571],
[375,... |
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def upb_deps():
maybe(
http_archive,
name = "com_google_absl",
url = "https://github.com/... |
base_request = {
'route': {
'type': 'string',
'required': True
},
'type': {
'type': 'string',
'required': True,
'allowed': ['open', 'close']
},
'stream': {
'type': 'string',
'required': True
},
'session': {
'type': 'string',
... |
set_name(0x801379C4, "PresOnlyTestRoutine__Fv", SN_NOWARN)
set_name(0x801379EC, "FeInitBuffer__Fv", SN_NOWARN)
set_name(0x80137A14, "FeAddEntry__Fii8TXT_JUSTUsP7FeTableP5CFont", SN_NOWARN)
set_name(0x80137A88, "FeAddTable__FP11FeMenuTablei", SN_NOWARN)
set_name(0x80137B04, "FeDrawBuffer__Fv", SN_NOWARN)
set_name(0x8013... |
def get_ticket_status(ticket_num, ticket_desc_str, e1):
status_ticketnum_count = ticket_desc_str.count(ticket_num)
if(status_ticketnum_count == 1):
status_startpos = ticket_desc_str.index(ticket_num,0,len(ticket_desc_str))
endpos = status_startpos
e = 3
while(e != 0):
... |
'''Aprimore o desafio anterior, mostrando no final:
A) A soma de todos os valores pares digitados.
B) A soma dos valores da terceira coluna.
C) O maior valor da segunda linha.'''
matriz = [[], [], []]
soma_par = soma_3acol = maior_2alin = 0
for lin in range(0, 3):
for col in range(0, 3):
num = int... |
class BaseVisualizer(object):
"""Base saliency visualizer"""
def visualize(self, *args, **kwargs):
"""Main visualization routine
Each concrete subclass should implement this method
"""
raise NotImplementedError
|
'''
a = Yellow Crystal
b = Blue Crystal
P = Yellow Ball
Q = Green Ball
R = Blue Ball
'''
a, b = list(map(int, input().split()))
P, Q, R = list(map(int, input().split()))
# the problem states that P = 2a | Q = ab | R = 3b
print(max(2*P+Q-a,0)+max(3*R+Q-b, 0))
|
# START LAB EXERCISE 02
print('Lab Exercise 02 \n')
# BACKGROUND
# On Wednesday, August 28, 1963, a march to advocate for the civil and economic rights
# of African Americans was held in Washington, D.C. It was called
# the March on Washington for Jobs and Freedom and was organized by A. Philip Randolph
# and Bayard ... |
#!/usr/bin/ptyhon
#-*- coding:utf-8 -*-
__author__ = 'Francics'
INFILETYPE = {0:'Tlog',1:'Nmon',2:'EveryCheck'}
OUTFILETYPE = {0:'volume',1:'txnid',2:'sysrscday',3:'sysrsctotal'}
###OUT_BUSINESS_SEQNO 与 OUT_BUSENESS_NAME 在顺序上是对应关系
OUT_BUSINESS_SEQNO = ('adpk','adts','call','draf','feb0','ipay','msgt','smng')
OUT_BUS... |
class ResourceDirectoryManager:
def addResource (self, fileInfo):
raise NotImplementedError
def getResourceInfo (self, fileUID):
raise NotImplementedError
def getResourceList (self):
raise NotImplementedError
def appendFileInfo2CacheControlFile (self, fileInfo = False)... |
class Solution:
def maxIncreaseKeepingSkyline(self, grid: List[List[int]]) -> int:
row_maxes = [max(row) for row in grid]
col_maxes = [max(col) for col in zip(*grid)]
return sum(min(row_maxes[r], col_maxes[c]) - val
for r, row in enumerate(grid)
for c, ... |
def foo(num):
for i in range(1,num+1):
if(i%105==0):
print('Fizz Buzz Fun')
elif(i%15==0):
print('Fizz Buzz')
elif(i%21==0):
print('Fizz Fun')
elif(i%35==0):
print('Buzz Fun')
elif(i%3==0):
print('Fizz')
elif(i%5==0):
print('Buzz')
elif(i%7==0):
print('Fun')
else:
print(i)
if __... |
def selection_sort(input_list):
for i in range(len(input_list)):
min_idx = i
for j in range(i+1, len(input_list)):
if input_list[min_idx] > input_list[j]:
min_idx = j
input_list[i], input_list[min_idx] = input_list[min_idx], input_list[i]
return input_list
|
a = 0
a *= 1 + 3
a += 2
a += a + 20 + 2
|
#
# PySNMP MIB module HPN-ICF-VOICE-DIAL-CONTROL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-VOICE-DIAL-CONTROL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:41:52 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... |
n1 = int(input('Digite um número: '))
n2 = int(input('Digite outro número: '))
n3 = int(input('Digite mais um número: '))
n4 = int(input('Digite o último número: '))
tup = (n1,n2,n3,n4)
print(f'Você digitou os números {tup}.')
print(f'O número 9 apareceu {tup.count(9)} vezes.')
if 3 in tup:
print(f'O valor 3 apar... |
'''
Um novo conjunto de autenticação será implementado no Instituto Federal do Sul de Minas, campus Muzambinho.
Bom, o novo serviço de autenticação é seguro, sem bugs e dores de cabeça mesmo porque estamos no final de semestre. Ele permitirá que sua senha tenha espaços, mas não números ou caracteres especiais. A atual... |
x=float(input("Ingrese el primer número: "))
y=float(input("Ingrese el segundo número: "))
suma=x+y
print("La suma de los valores ingresados es: ",suma)
'''
if suma>20:
def sumar(x,y):
def sumar (x + y) o solo sumar(x+y)
''' |
{
"includes": [
"../common.gypi"
],
"targets": [
{
"target_name": "libgdal_ogr_gtm_frmt",
"type": "static_library",
"sources": [
"../gdal/ogr/ogrsf_frmts/gtm/gtm.cpp",
"../gdal/ogr/ogrsf_frmts/gtm/gtmtracklayer.cpp",
"../gdal/ogr/ogrsf_frmts/gtm/gtmwaypointlayer.cpp",
"../gdal/ogr/ogrsf_... |
def errorbar(ax, y, yerr, barlabels, convertlabels=True, **kwargs):
sizedata = len(barlabels)
mykwargs = {"alpha":1., "lw":1.5, "color":'goldenrod',
"ecolor":'k', 'error_kw':{'lw':1.5}, "align":"center"}
# We overwrite these mykwargs with any user-specified kwargs:
mykwargs.update(kwargs)
ax.yaxis.grid(Tr... |
def add_argument(group):
group.add_argument('--input_dim_a', type=int, default=3, help='# of input channels for domain A')
group.add_argument('--input_dim_b', type=int, default=3, help='# of input channels for domain B')
group.add_argument('--gen_norm', type=str, default='Instance', help='normalization laye... |
people = []
# people.append("Joe")
# people.append("Max")
# people.append("Martha")
# people.insert(2, "Gloria")
# people.pop(1)
#
# print(people)
counter = 0
while counter < 4:
counter += 1
print("Give me a name:")
name = input("> ")
people.append(name)
print(people) |
a=int(input())
b=int(input())
# The first line should contain the result of integer division, a//b . The second line should contain the result of float division, a/b .
print(a//b)
print(a/b)
|
"""Narrative API documentation."""
BEGINNING_IMAGE_NUMBER = '''
Unique identifier for the electronic or paper report. This number is used to construct
PDF URLs to the original document.
'''
CANDIDATE_ID = '''
A unique identifier assigned to each candidate registered with the FEC.
If a person runs for several offices,... |
dia = input ('Que dia nasceu?')
mes = input ('Qual foi o mês?')
ano = input ('De qual ano?')
print('Você nasceu no dia',dia,'de',mes,'de',ano,'. Correto?!!')
|
class Dyn(object):
def __repr__(self):
return str(self)
def __eq__(self, other):
if not isinstance(other, Dyn):
return False
if (self.A() != other.A()).any() or (self.b() != other.b()).any():
return False
return True
|
# -*- coding: utf-8 -*-
#########################################################################
## Customize your APP title, subtitle and menus here
#########################################################################
#response.title = request.application
response.subtitle = T('Capture bolhas e ganhe prêmios!... |
_params = {
"unicode": True,
}
def rtb_set_param(param, value):
_params[param] = value
def rtb_get_param(param):
return _params[param] |
"""
Given an integer, , print the following values for each integer from to :
Decimal
Octal
Hexadecimal (capitalized)
Binary
The four values must be printed on a single line in the order specified above for each from to . Each value should be space-padded to match the width of the binary value of .
Input Format
... |
class DeviceType:
HUB = "Hub"
HUB_PLUS = "Hub Plus"
HUB_MINI = "Hub Mini"
BOT = "Bot"
CURTAIN = "Curtain"
PLUG = "Plug"
PLUG_MINI_US = "Plug Mini (US)"
PLUG_MINI_JP = "Plug Mini (JP)"
METER = "Meter"
MOTION_SENSOR = "Motion Sensor"
CONTACT_SENSOR = "Contact Sensor"
COLOR_... |
#Desafio 003 "Crie um programa que leia dois npumeros e mostre a soma entre eles.
n1 = int(input('Digite um número: '))
n2 = int(input('Digite outro número: '))
s = n1+n2
print('A soma entre {1} e {0} é igual a {2}'.format(n1, n2, s))
|
class ScheduleType:
# Remind the next time the parametric transformer is ready
PARAMETRIC_TRANSFORMER = "parametric"
# Remind to do a task at a specific time
ONCE = "simple"
# Remind to do a task every so often
REPEAT = "recurrent"
|
class StatsEvents:
# common
ERROR = 'error'
# voteban
SELF_BAN = 'self-ban'
VOTEBAN_CALL = 'voteban-call'
VOTEBAN_CONFIRM = 'voteban-confirm'
VOTEBAN_VOTE = 'voteban-vote'
VOTEBAN_UNVOTE = 'voteban-unvote'
ADMIN_BAN = 'admin-ban'
ADMIN_KICK = 'admin-kick'
# nsfw
NSFW = ... |
#
# @lc app=leetcode id=1305 lang=python3
#
# [1305] All Elements in Two Binary Search Trees
#
# https://leetcode.com/problems/all-elements-in-two-binary-search-trees/description/
#
# algorithms
# Medium (78.63%)
# Likes: 1498
# Dislikes: 49
# Total Accepted: 118.2K
# Total Submissions: 150K
# Testcase Example: ... |
valor = int(input("Digite um número para ver a sua tabuada: "))
v1 = valor*1
v2 = valor*2
v3 = valor*3
v4 = valor*4
v5 = valor*5
v6 = valor*6
v7 = valor*7
v8 = valor*8
v9 = valor*9
v10 = valor*10
print(f"{'='*20}\n {valor} X 1 = {v1} \n {valor} X 2 = {v2} \n {valor} X 3 = {v3} \n {valor} X 4 = {v4}\n {valor} X 5 = {... |
# <auto-generated>
# This code was generated by the UnitCodeGenerator tool
#
# Changes to this file will be lost if the code is regenerated
# </auto-generated>
def to_talbot(value):
return value * 3600.0
def to_lumen_minute(value):
return value * 60.0
def to_lumen_second(value):
return value * 3600.0
|
GAME_TABLE = "- - -\n- - -\n- - -"
the_turn = 1
#def draw_game_table():x
#print(GAME_TABLE)
def user_input():
global the_turn
global GAME_TABLE
the_turn += 1
if the_turn % 2 == 0:
player_input = int(input("Mängija 1 kirjuta oma valik (1-9): ")) * 2
GAME_TABLE = GAME_TABLE[:playe... |
# -*- coding: utf-8 -*-
class ContentConfigurator(object):
""" Base OP Content Configuration adapter """
name = "Base Openprocurement Content Configurator"
def __init__(self, context, request):
self.context = context
self.request = request
def __repr__(self):
return "<Configur... |
n1 = int(input('Digite um número e saiba se ele é primo: '))
while n1 <= 0:
n1 = int(input('Valor inválido, por favor digite outro: '))
cont = 0
for c in range(1, n1+1):
if n1 % c == 0:
cont += 1
if c == n1:
print('\033[33m {}\033[m'.format(c))
else:
print('\033[3... |
# coding=utf-8
class cached_property(object):
"""
# 从django抄的详见同名函数
"""
def __init__(self, func, name=None):
self.func = func
self.__doc__ = getattr(func, '__doc__')
self.name = name or func.__name__
def __get__(self, instance, type=None):
if instance is None:
... |
side_a = int(input())
side_b = int(input())
area = side_a * side_b
print(area) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.