content stringlengths 7 1.05M |
|---|
# Exact copy of global values in extensions.tg_filters
SPA = "spa"
WEBAPP = "webapp"
ALPINE = "alpine"
DEBIAN = "debian"
YES = 'yes'
NO = 'no'
S3 = 'S3'
GCS = 'GCS'
|
GRPC_SERVER_PORT = 50051
GRPC_MAX_WORKERS = 2
WEB_SERVER_PORT = 8080
SQLITE_DATABASE_PATH = 'data/db.sqlite'
AUTHENTICATION_TOKEN = 'abc'
COMMAND_PASSPHRASE = 'abc'
NUMBER_OF_DAYS_TO_KEEP_STATUS = 7
TEMPLATE_FILE = 'index.html'
PORT_SSH = 11734
PORT_VIDEO = 11735
WATER_DURATION_EQUAL_100_PERCENT = 120
WEB_SERVER_NEW_CO... |
def max_profit(price_list):
values = []
min_number = price_list[0]
for i in range(len(price_list)):
if price_list[i]<min_number:
min_number=price_list[i]
values.append(0)
else:
values.append(price_list[i]-min_number)
return max(values)
a = max_profit([7, 1, 5, 3, 6, 4])
print(a) |
class Child:
def __init__(self):
pass
def __str__(self):
return "c"
def __hash__(self):
return self.x ** self.y
class Cradle:
def __init__(self):
self.child = None
@property
def with_child(self):
return self.child != None
def __str__(self):
... |
c = ' '
ct = 0
sm = 0
maiorv = 0
menorv = 0
while c not in 'N':
v = float(input('Digite uma valor: '))
ct = ct + 1
sm = sm + v
if ct == 1:
maiorv = v
menorv = v
else:
if v > maiorv:
maiorv = v
if v < menorv:
menorv = v
c = str(input('Deseja... |
"""
@file : binheap.py
@brief : Binary Heap
@details : BinHeap
@author : Ernest Yeung ernestyalumni@gmail.com
@date : 20170918
@ref : cf. http://interactivepython.org/runestone/static/pythonds/Trees/SearchTreeImplementation.html
https://github.com/bnmnetp/pythonds/blob/master/tre... |
def main():
# input
x, y = map(int, input().split())
# compute
# output
print('Better' if x<y else 'Worse')
if __name__ == '__main__':
main()
|
class Enum1(set):
def __getattr__(self, name):
if name in self:
return name
raise AttributeError
Token = Enum1(['Error',
'End',
'Id',
'Integer',
'Keyword',
'Operator',
'Other',
... |
# → list comprehension = a way to create a new list with less syntax;
# can mimic certain lambda functions, easier to read;
# list = [expression for item in iterable]
# list = [expression for item in iterable if conditional]
# l... |
"""*****************************************************************************
* Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to ... |
names = dict()
while True:
inp = input()
if inp == 'end':
break
name, value = inp.split(' = ')
if value in names:
names[name] = names[value]
elif value.isdigit():
names[name] = int(value)
for key, value in names.items():
print(f'{key} === {value}') |
class color:
BOLD = '\033[1m\033[48m'
END = '\033[0m'
ORANGE = '\033[38;5;202m'
BLACK = '\033[38;5;240m'
def print_logo(subtitle="", option=2):
print()
print(color.BOLD + color.ORANGE + " .8. " + color.BLACK + " 8 888888888o " + color.ORANGE + "8 8888888888 `8.`8888.... |
class TemperatureFactory:
"""
Returns a formula to use to do the required temperature conversion.
Given how simple these conversions are, an alternative approach would have been
to just make a lookup table and a generic function (similar to what was done in
temperature_service_test,... |
class Solution:
def findMaxLength(self, nums):
count = 0
map = {0:-1}
maxlen = 0
for i, number in enumerate(nums):
if number:
count += 1
else:
count -= 1
if count in map:
maxlen = max(maxlen, (i-ma... |
#n1 = int(input('digite um valor: '))
#n2 = int(input('digite outro valor: '))
#s = n1 + n2
#m = n1 * n2
#d = n1 / n2
#p = n1 ** n2
#print('A soma é igual a {} a potência é {}'.format(s, p))
#print('a multiplicação é igual a {} e a divisão igual a {}'.format(m, d))
n1 = int(input('Digite um valor: '))
n2 = int(input(... |
##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2017
# Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8
# Primeira reimpressão - Outubro/2011
# Segunda reimpressão - ... |
def ComesBefore(n, lines):
result = []
s = str(n)
for line in lines:
position = line.find(s)
if position > 0:
for d in range(0,position):
c = int(line[d])
if c not in result:
result.append(c)
result.sort()
return result
... |
courts = [
{
"name": "United Kingdom Supreme Court",
"href": "/judgments/advanced_search?court=uksc",
"years": "2014 – 2022",
},
{
"name": "Privy Council",
"href": "/judgments/advanced_search?court=ukpc",
"years": "2014 – 2022",
},
{
... |
########################################
# User Processing Server configuration #
########################################
core_session_type = 'Memory'
core_coordinator_db_username = 'weblab'
core_coordinator_db_password = 'weblab'
weblab_db_username = 'weblab'
weblab_db_password = 'weblab'
core_coordinator_laborat... |
#!/usr/bin/python3
# -*- coding: utf8 -*-
# Default settings screen
screen = {
"screensize": "1920x1080",
"fullscreen": False,
"title": "Python Project",
"resizable": {"height": True, "width": True},
}
# True is use default template in first
default_template = True
# set time refresh in ms
refresh = ... |
class WigikiError(Exception):
pass
class WigikiConfigError(WigikiError):
def __init__(self, msg=None):
self.code = 2
self.msg = msg or "Configuration error, try the --help switch"
def __str__(self):
return self.msg
class WigikiParserError(WigikiError):
def __init__(self, msg... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 2 22:04:55 2021
@author: aboisvert
"""
#%% Day 3
"""
The submarine has been making some odd creaking noises, so you ask it to produce a diagnostic report just in case.
The diagnostic report (your puzzle input) consists of a list of binary number... |
# Copyright Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" fil... |
settings = {
'DB_HOST': '[RDS_ID_DATABASE].[AWS_REGION].rds.amazonaws.com',
'DB_USER': 'teste',
'DB_NAME': 'teste',
'DB_PASSWORD':'my_password'
} |
# LONE_SUM
def lone_sum(a, b, c):
if a==b: return 0 if b==c else c
elif b==c: return 0 if a==c else a
elif a==c: return 0 if b==c else b
else: return a+b+c |
#
# PySNMP MIB module ELFIQ-INC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELFIQ-INC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:45:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
class A:
def bestaande_functie():
pass
A.bestaande_functie()
|
def open_chrome():
opts = Options()
# # opts.add_argument('headless')
# chrome_options = Options()
# chrome_options.binary_location = os.environ['GOOGLE_CHROME_BIN']
# chrome_options.add_argument('--disable-gpu')
# chrome_options.add_argument('--no-sandbox')
# browser = Chrome(executable_pat... |
S = input()
K = 'oda' if S == 'yukiko' else 'yukiko'
B = [input() for _ in range(8)]
print(S if sum(len([x for x in row if x in 'bw']) for row in B) % 2 == 0 else K)
|
# Problem: https://www.hackerrank.com/challenges/string-validators/problem
# Score: 10
s = input()
print(any([char.isalnum() for char in s]))
print(any([char.isalpha() for char in s]))
print(any([char.isdigit() for char in s]))
print(any([char.islower() for char in s]))
print(any([char.isupper() for char in s]))
|
# coding=utf-8
# Author: Han
# Question: 313. Super Ugly Number
# Date: 2017-03-09
# Complexity: O(N) O(N)
class Solution(object):
def nthSuperUglyNumber(self, n, primes):
"""
:type n: int
:type primes: List[int]
:rtype: int
"""
ugly = [1]
iprime = [0] * le... |
class Solution:
def XXX(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
results = []
self.__XXX(nums, 0, [], results)
return results
def __XXX(self, nums, i, subset, results):
results.append(subset)
... |
class BOOL:
""" Boolean container -- supports global boolean variables """
def __init__(self, v: bool) -> None:
self.v = v
def __bool__(self):
return self.v
def __str__(self):
return str(self.v)
GLOBAL_STRICT = BOOL(True)
def strict() -> bool:
""" Switch to global st... |
try:
with open('./book.text') as book:
content = book.read()
except FileNotFoundError:
msg = '没有找到文件'
print(msg)
else:
words = content.split()
num_words = len(words)
print(str(num_words))
with open('./space.text', 'a') as line:
for word in words:
line.write(word + ' ')
|
class Solution(object):
def shortestPalindrome(self, s):
"""
:type s: str
:rtype: str
"""
"""
Find the max length of palindom start from 0, and add the reverse part in the previous
The smartest way to solve this problem is combine kmp and reverse
... |
""" Lab 04 """
this_file = __file__
def skip_add(n):
""" Takes a number n and returns n + n-2 + n-4 + n-6 + ... + 0.
>>> skip_add(5) # 5 + 3 + 1 + 0
9
>>> skip_add(10) # 10 + 8 + 6 + 4 + 2 + 0
30
>>> # Do not use while/for loops!
>>> from construct_check import check
>>> # ban itera... |
AUTH_BASIC_LOGIN = '/users/login'
AUTH_LOGOUT = '/users/logout'
AUTH_STEP_START = '/auth/login/multi_step/start'
AUTH_STEP_CHECK_LOGIN = '/auth/login/multi_step/check_login'
AUTH_STEP_CHECK_PASSWORD = '/auth/login/multi_step/commit_pwd'
AUTH_STEP_FINISH = '/auth/login/multi_step/finish'
PASSWD_START = '/auth/restore_... |
class Solution:
def canConstruct(self, s: str, k: int) -> bool:
digit_count = {}
if len(s) < k:
return False
elif len(s) == k:
return True
else:
odd = 0
for i in set(s):
digit_count[i] = s.count(i)
... |
class can_id:
def __init__ (self, can_id, description, attributes):
self.can_id = can_id.upper()
self.pgn = self.get_pgn(can_id)
self.description = description
self.attributes = attributes
def get_pgn(self, can_id):
if(can_id[2].upper() == 'E'):
return int(can_id[2:4], 16)
else:
return int(can_id[... |
# Copyright 2015 Rackspace US, Inc.
#
# 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 agreed to in wri... |
class LyricsNotFoundError(Exception):
pass
class ExistingLyricsError(Exception):
pass
class UnsupportedTypeError(Exception):
pass
class UnknownTypeError(Exception):
pass |
# Exercise 073 - Tuples with Soccer Teams
"""Create a tuple filled with the top 20 of the Brazilian Football Championship Table,
in order of placement. Then show:
a) The first 5 teams.
b) The last 4 placed.
c) Teams in alphabetical order.
"""
teams = (
"América-MG",
"Athletico-PR",
"Atlético-GO",
"A... |
"""Day 16: Dragon Checksum
https://adventofcode.com/2016/day/16
"""
def dragon_step(a):
"""
Call the data you have at this point "a".
Make a copy of "a"; call this copy "b".
Reverse the order of the characters in "b".
In "b", replace all instances of 0 with 1 and all 1s with 0.
The resulting ... |
def Hypno(thoughts, eyes, eye, tongue):
return f"""
{thoughts}
___ _--_
/ - / \\
( {eyes} \\ ( {eyes} )
| {eyes} _;\\-/| {eyes} _|
\\___/######\\___/\\
/##############\\
/ ###### ## #|
/ ##@##@## |
/ ###### ## \\
<______-------___\\ ... |
# https://wiki.haskell.org/99_questions/Solutions/39
# Finding prime numbers in a range. (Using Sieve of Eratosthenes)
#
# Author: Bedir Tapkan
def sieve_of_eratosthenes(n):
"""
Sieve of Eratosthenes implementation
"""
primes = [True] * (n + 1)
primes[0] = False
primes[1] = False
results = ... |
def lambda_handler(event, context):
if 'Arg1' not in event or 'Arg2' not in event:
raise ValueError("Missing Argument")
else:
return "%s: %s" % (event['Arg1'],event['Arg2']) |
'''
Created on Jan 14, 2016
@author: Dave
This module does not actually *do* anything. It just gives an import hook, so that we can find the
package location in the filesystem.
'''
|
input_data = open("output", 'rb').read()
input_data = input_data[0x2c:]
flag = ""
for i in range(0, len(input_data), 2):
flag += str(1 - input_data[i + 1] & 0x1)
flag += str(1 - input_data[i] & 0x1)
print(bytes.fromhex(hex(int(flag[:216], 2))[2:])) |
# Author: Elaine Laguerta
# Date: 11 March 2020
# Description: Portfolio project for CS162 W2020.
# Implements a two-player version of Xiangqi, Chinese chess.
# Supports checking for legal moves based on specific piece type, and disallows moves that place one's self in check.
# Supports stalemate and checkmate endgames... |
COIN_STPT = "STPT"
COIN_MXN = "MXN"
COIN_UGX = "UGX"
COIN_RENBTC = "RENBTC"
COIN_GLM = "GLM"
COIN_NEAR = "NEAR"
COIN_AUDIO = "AUDIO"
COIN_HNT = "HNT"
COIN_ADADOWN = "ADADOWN"
COIN_CDT = "CDT"
COIN_SPARTA = "SPARTA"
COIN_SUSD = "SUSD"
COIN_AION = "AION"
COIN_NPXS = "NPXS"
COIN_DGB = "DGB"
COIN_ZRX = "ZRX"
COIN_BCD = "BC... |
# Using python list
def add_one(nums):
carry = 1
for num in nums:
sums, carry = (num+carry)%10, (num+carry)//10
nums[-1] = sums
if carry == 0:
return nums
if carry == 1:
return [1] + nums
# Using linked list
def add_one(head):
# Reverse
rev_head = re... |
""" Here are the blueprint module /这里是蓝图模块 """
class BluePrint:
"""
实现一个类似与CtpBee的管理机制
从而实现分组
"""
def __init__(self, info, mode, group, action_class, logger_class, refresh):
pass
def add_extension(self, extension):
pass
def suspend_extension(self, extension_name):
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@AUTHOR:Joselyn Zhao
@CONTACT:zhaojing17@foxmail.com
@HOME_PAGE:joselynzhao.top
@SOFTWERE:PyCharm
@FILE:jisuan.py
@TIME:2020/4/29 20:58
@DES: 对字典做计算
'''
price= {
'xiaomi':899,
'huawei':1999,
'sanxing':5999,
'guge':4999
}
k = zip(price.values(),price.keys())... |
#!/usr/bin/env python
#
# Given 2 sorted lists, merge them in sequential order using least
# number of iterations/compute power.
#
l1 = [1, 3, 6, 7, 15, 22]
l2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100]
len1 = len(l1)
len2 = len(l2)
i,j = 0, 0
merged = []
while i < len1 and j < len2:
if l1[i] < l2[j]:
if l1... |
class Cuid(str):
# de.arago.graphit.server.api.graph.GraphIdGenerator
# https://github.com/ericelliott/cuid
# https://github.com/prisma/cuid-java
# https://github.com/necaris/cuid.py
@property
def valid(self) -> bool:
if self.identifier != 'c':
raise ValueError(f"""Expected ... |
'''
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each operand may be an integer or another expression.
Note:
Division between two integers should truncate toward zero.
The given RPN expression is always valid. That means the expression... |
{
"targets": [
{
"target_name": "modexp_postbuild",
"dependencies": ["modexp"],
"conditions": [
['OS=="win"', {
'copies': [{
'destination': '<(PRODUCT_DIR)',
'files': [
'<(module_root_dir)/openssl-1.1.1g-win64-mingw/libcrypto-1_1-x64.dll',
... |
'''
| Write a program to input 3 sides of a triangle and prints whether it is an equilateral, isosceles or scale triangle |
|---------------------------------------------------------------------------------------------------------------------|
| Boolean comparision ... |
"""Convert ABNF grammars to Python regular expressions."""
# Do not forget to update in setup.py!
__version__ = "1.0.0"
__author__ = "Marko Ristin"
__license__ = "License :: OSI Approved :: MIT License"
__status__ = "Production/Stable"
|
print(dict([(1, "foo")]))
d = dict([("foo", "foo2"), ("bar", "baz")])
print(sorted(d.keys()))
print(sorted(d.values()))
try:
dict(((1,),))
except ValueError:
print("ValueError")
try:
dict(((1, 2, 3),))
except ValueError:
print("ValueError")
|
"""An unofficial Python wrapper for the OKEx exchange API v3
.. moduleauthor:: gx_wind
"""
|
instructions = [
[[6, 6, 6, 6, 1, 1, 1, 1, 1, 6, 6, 6, 2, 2, 2, 2],
[6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 6, 6, 2, 2, 2, 2],
[6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 6, 6, 2, 2, 2],
[6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 2],
[6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 2],
[6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6],
[6... |
'''CORES NO TERMINAL using the standard ANSI >>> Example "/033[0:30:40m"
STYLE:
0 = None;
1 = Bold;
4 = Underline;
7 = Negative.
TEXT COLOR:
30 = White;
31 = Red;
32 = Green;
33 = Yellow;
34 = Blue;
35 = Purple;
36 = Agua;
37 = Gray.
BACK COLOR:
40 = White;
41 = R... |
description = 'presets for the detector position'
group = 'configdata'
# Assigns presets for the detector z position and x/y displacement of the
# beamstop for each selector preset.
#
# When you add a new detector z position, make sure to add a real offset as
# well in the DETECTOR_OFFSETS table below.
FIXED_X = 0.0
... |
def sum_dicts(
*dict_arguments
) -> dict:
result = {}
for dict_argument in dict_arguments:
for key, value in dict_argument.items():
if key not in result:
result[key] = []
result[key].append(value)
for key, value in result.items():
if len(value) =... |
legend = {
9: ("positive very high", "#006400"),
8: ("positive high", "#228b22"),
7: ("positive medium", "#008000"),
6: ("positive low", "#98fb98"),
1: ("no change", "#f5f5dc"),
2: ("negative low", "#ffff00"),
3: ("negative medium", "#ffa500"),
4: ("negative high", "#ff0000"),
5: ("n... |
l1=[]
for i in range(0,3):
l2=list(map(int,input().split()))
l1.append(l2)
l3=[]
for i in range(0,3):
l3.append(l1[i][0]+l1[i][1]+l1[i][2])
for i in range(0,3):
l3.append(l1[0][i]+l1[1][i]+l1[2][i])
l3.append(l1[0][2]+l1[1][1]+l1[2][0])
c=max(l3)
j=1
while l1[0][2]+l1[1][1]+l1[2][0]!=l1[0][0]+l1[1][1]+l1[2][2... |
class Color:
# https://www.mm2d.net/main/prog/c/console-02.html
黒 = "\033[30m"
赤 = "\033[31m"
緑 = "\033[32m"
黄 = "\033[33m"
青 = "\033[34m"
紫 = "\033[35m"
水 = "\033[36m"
灰 = "\033[37m"
背景黒 = "\033[40m"
背景赤 = "\033[41m"
背景緑 = "\033[42m"
背景黄 = "\033[43m"
背景青 = "\03... |
class RNode:
def __eq__(self, other):
if not isinstance(other, (RNode,)):
return False
if hasattr(self, 'id') and hasattr(other, 'id'):
return self.id == other.id
|
# @Title: 被围绕的区域 (Surrounded Regions)
# @Author: KivenC
# @Date: 2020-08-11 17:36:02
# @Runtime: 48 ms
# @Memory: 15.2 MB
class Solution:
def solve(self, board: List[List[str]]) -> None:
"""
Do not return anything, modify board in-place instead.
"""
# # bfs
# stack = []
... |
#Cities:
def describe_city(name, country='india'):
print(name,"is in",country+".")
describe_city('newyork','USA')
describe_city('mumbai')
describe_city(name = 'paris',country='France') |
def bubble_sort(vetor):
troca = False
ultimo = len(vetor)-1
while True:
for i in range(0,ultimo):
troca = False
if vetor[i]>vetor[i+1]:
print('Troca ', vetor[i], 'com ', vetor[i+1])
aux = vetor[i]
vetor[i] = vetor[i+1]
... |
# Codes and tutorials are from: https://www.tutorialsteacher.com/python/property-function
class person:
def __init__(self):
self.__name = ''
def setname(self, name):
print('setname() called')
self.__name = name
def getname(self):
print('getname() called')
return sel... |
def set_authorize_current_user():
pass
def check_update_order_allowed():
pass |
maior_idade=0
idades=[int(input("idade1:")),
int(input("idade2:")),
int(input("idade3:"))]
for idade in idades:
if idade>maior_idade:
maior_idade=idade
print("maior idade: ", maior_idade)
|
class Http_denied(Exception):
"""
If https is denied for some reason, it will post out status code such as 404, 400, 504 etc and print out content for giving reason
"""
def __init__(self,status,content):
self.status = status
self.content = content
class Unverify_account(Exception):
... |
#!/usr/bin/python3
with open('input.txt') as f:
input = f.read().splitlines()
def execute(instructions):
accumulator = 0
ip = 0
ip_visited = []
while ip < len(instructions):
if ip in ip_visited:
raise Exception()
ip_visited.append(ip)
instruction = instructions[ip]
op = instruction[:3... |
# coding: utf-8
"""
Default configuration values for service gateway package.
Copy this file, rename it if you like, then edit to keep only the values you
need to override for the keys found within.
To have the programs in the package override the values with the values
found in this file, you need to set the enviro... |
def bina(n):
l1=[]
num=n
rem=0
while(num>0):
rem=num%2
num=num//2
l1.append(str(rem))
l1.reverse()
str1="".join(l1)
return str1
def octa(n):
l1=[]
num=n
rem=0
while(num!=0):
rem=num%8
num=num//8
l1.append(str(rem))
l1.rever... |
#import sys
#a=sys.stdin.read().split()
f = open("i.txt",'r')
a=f.read().split()
sum=0
t={0}#set only with value 0
while(True):
for x in a:
sum+=int(x)
if(sum in t):
print(sum)
exit()
else:
t.add(sum)
|
def near_hundred(n):
if abs(100 - n) <= 10 or abs(200 - n) <= 10:
return True
return False
|
PINK = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def underline(s):
return UNDERLINE + s + ENDC
def errmsg(s):
return FAIL + s + ENDC
def cyan(s):
return OKCYAN + s + ENDC
def blue... |
#RADAR ELETRÔNICO
velocidade = float(input('Velocidade do veículo: '))
if velocidade > 80:
print('MULTADO! Você excedeu o limite de 80 Km/h.')
multa = (velocidade - 80) * 7 #ultrapassou de 80|vezes 7 reais para cada km acima
print('Você deverá pagar uma multa de R${:.2f}.'.format(multa))
else:
print('Te... |
models = {
"BODY_25": {
"path": "pose/body_25/pose_deploy.prototxt",
"body_parts": ["Nose", "Neck", "RShoulder", "RElbow", "RWrist", "LShoulder", "LElbow", "LWrist", "MidHip",
"RHip", "RKnee", "RAnkle", "LHip", "LKnee", "LAnkle", "REye", "LEye", "REar", "LEar", "LBigToe",
... |
class LogicalPlanner:
def __init__(self, operation, planning_svc, stopping_conditions=[]):
self.operation = operation
self.planning_svc = planning_svc
self.stopping_conditions = stopping_conditions
self.stopping_condition_met = False
async def execute(self, phase):
for ... |
anzahlEinzelStuecke = int(input("Anzahl Einzelstücke N: "));
anzahlGros = anzahlEinzelStuecke // 144;
rest = anzahlEinzelStuecke % 144;
anzahlSchock = rest // 60;
rest = rest % 60;
anzahlDutzend = rest // 12;
rest = rest % 12;
anzahlStueck = rest;
print("Anzahl Einzelstücke N: ", anzahlEinzelStuecke);
print("Anzah... |
b = int(input("Input the base : "))
h = int(input("Input the height : "))
area = b*h/2
print("area = ", area) |
def handler(event, context):
# --- Add your own custom authorization logic here. ---
print(event)
return {
"principalId": "my-user",
"policyDocument": {
"Version": "2012-10-17",
"Statement": [{
"Action": "execute-api:Invoke",
"Effect": ... |
#
# PySNMP MIB module DELL-NETWORKING-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DELL-NETWORKING-SMI
# Produced by pysmi-0.3.4 at Wed May 1 12:37:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
print("Arithmetic Progression V3.0")
print("-"*27)
num1 = int(input("First number: "))
num2 = int(input("Second number: "))
c = 1
total = 0
plus = 10
while plus != 0:
total = total + plus
while c < total:
print(num1)
num1 = num1 + num2
c +=1
plus = int(input("How many you want to sh... |
""" 16 - Crie um programa que leia um número Real qualquer pelo teclado e mostre na tela a sua porção Inteira."""
'''from math import trunc
n = float(input('Digite um valor: '))
print(f'O valor digitado foi {n} e a sua porção inteira é {trunc(n)}.')'''
n = float(input('Digite um valor: '))
print(f'O valor digitato fo... |
print(True and True) # True
print(True and False) # False
print(False and False) # False
print("------")
print(True or True) # True
print(True or False) # True
print(False or False) # False |
"""
# PROBLEM 16
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
"""
print(sum(int(digit) for digit in str(2**1000)))
|
# coding:utf-8
def get_all_interval(begin_time, end_time):
'''
返回开始时间和结束时间的间隔,单位:s
'''
hour_interval = (end_time.hour - begin_time.hour) * 60 * 60
minute_interval = (end_time.minute - begin_time.minute) * 60
second_interval = end_time.second - begin_time.second
return hour_interval + minute_... |
# -*- python -*-
load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_package",
)
def nix_gflags():
nixpkgs_package(
name = "nix-gflags",
attribute_path = "gflags",
repositories = {"nixpkgs": "@nixpkgs"},
build_file_content = """
package(default_visibility = ["//v... |
# Texture generator
ctx.params_gen_texture = cell(("cson", "seamless", "transformer_params"))
link(ctx.params_gen_texture, ".", "params_gen_texture.cson")
if not ctx.params_gen_texture.value: ### kludge: to be fixed in seamless 0.2
ctx.params_gen_texture.set("{}")
ctx.gen_texture = transformer(ctx.params_gen_textur... |
PROJECT = 'my-first-project-238015'
DATASET = 'waste'
TABLE_WEIGHT = 'weight'
TABLE_ROUTE = 'route'
TABLE_MERGE = 'merge'
BQ_TABLE_WEIGHT = '.'.join([DATASET, TABLE_WEIGHT])
BQ_TABLE_ROUTE = '.'.join([PROJECT, DATASET, TABLE_ROUTE])
BQ_TABLE_MERGE = '.'.join([DATASET, TABLE_MERGE])
BUCKET = 'austin_waste'
FOLDER_DAT... |
# Using conditionals (if-then statements) in Python
age = int(input("How old are you? > ")) # variable age equals the input converted into an integer
if age >= 18: # if age is greater than or equal to 18:
print("You are an adult")
if age <= 19 and age >= 13: # if age is less than or equal to 19 and age is greate... |
_base_ = [
'../_base_/models/hv_pointpillars_fpn_nus.py',
'../_base_/datasets/nus-3d.py', '../_base_/schedules/schedule_2x.py',
'../_base_/default_runtime.py'
]
# pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa
voxel_size = [0.25, 0... |
# Escreva um programa que leia um valor em metros e o exiba convertido em centimetros e milimetros
metros = float(input('Quantos metros deseja converter? '))
centimentros = metros * 100
milimetros = metros * 1000
print('{} metros convertidos em centimetros é igual á : {} '.format(metros, centimentros))
print('{} met... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.