content stringlengths 7 1.05M |
|---|
kbm_text_map = {
'ConceptMouseRecenter':'Mouse Recenter',
'ConceptContextualInteraction':'Contextual Interaction',
'ConceptPitch_P':'Pitch Up',
'ConceptPitch_N':'Pitch Down',
'ConceptYaw_P':'Yaw Right',
'ConceptYaw_N':'Yaw Left',
'ConceptRoll_P':'Roll Right',
'ConceptRoll_N':'Roll Left',
'ConceptThrottle_P':'Throttle I... |
# *************************** LISTS FUNCTIONS *******************************
evenNum = [16, 4, 6, 8, 10, 12, 2 , 13]
animalsPet = ["Cow","Rat","Cat","Goat","Goat"]
animalsWild = ["Lion", "Tiger" , "Elephant"]
print(evenNum)
print(animalsPet)
print(animalsWild)
#Extend Function = it is use to extend or merge... |
class Solution:
def isPowerOfThree(self, n: int) -> bool:
if n<=0:
return False
while(n>1):
if n%3==0:
n/=3
else:
return False
return True
|
limit = 10000
sum_divisors = 0
val = [0, 0]
for number in range(2, limit):
sum_divisor = 0
for number2 in range(1, int(number / 2) + 1):
if (number % number2 == 0):
sum_divisor += number2
val.append(sum_divisor)
sum_amicable_numbers = 0
for number in range(2, limit):
if (val[number]... |
"""Flask configuration"""
class Config:
"""Setting up config variables"""
# General
FLASK_ENV = "development"
TESTING = True
# Database
SQLALCHEMY_DATABASE_URI = "sqlite:///sqlite_db/catalogue.db"
SQLALCHEMY_TRACK_MODIFICATIONS = False
# JWT
JWT_SECRET_KEY = 'super-secret'
... |
peso_maior = 0
peso_menor = 0
for c in range(1, 6):
peso = float(input("Informe o peso da {0} pessoa: ".format(c)))
if(c == 1):
peso_maior = peso
peso_menor = peso
else:
if(peso > peso_maior):
peso_maior = peso
if(peso < peso_menor):
peso_menor = peso... |
class Cache:
"""
Class used for storing a data
from one instance and allow
a different class instance to
access this data.
"""
_state: dict = {
'Data': ''
}
def __new__(cls, *args, **kwargs):
obj = super().__new__(cls)
obj.__dict__ = cls._state
return... |
# 전처리 과정 - 불 반전 갯수 계산
segment = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f]
number = [[0 for _ in range(10)] for _ in range(10)]
for i in range(10):
for j in range(10):
xor = segment[i] ^ segment[j]
while xor:
number[i][j] += (xor % 2)
xor //= 2
# 입출력 - 경우의 ... |
#Tokenizer of Expression
#Example Expression: ~(T & F) | T
def tokenize(expr):
ac = ["T", "F", "(", ")", "~", "&", "|", " ", "\t"]
ls = []
for i in range(0, len(expr)):
if expr[i] not in ac:
raise Exception("invalid expression")
if expr[i] != " ":
ls.append(expr[i])
... |
'''
this is used to add a comment line
or a set of lines that the computer ignores
'''
# this is used to add a single comment line
print("this is used to" + " concatenate 2 strings")
'''
a string and a number cannot be concatenated this way
instead we can use a comma to separate the two different data types... |
'''
Created on 11 juni 2017
@author: Wilma
'''
|
"""
* If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
* Find the sum of all the multiples of 3 or 5 below 1000.
"""
def sum_multiples(mul, below):
first = mul # First multiple of mul
last = ((below - 1)... |
num=grt=1
def collatz(no):
if no==1:
return 1
else:
if no%2==0:
return 1+collatz(int(no/2))
else:
return 1+collatz((3*no)+1)
for i in range(2, 1000000, 1):
a=collatz(i)
if (a>grt):
num=i
grt=a
if (i%1000==0):
print(i)
print(num) |
"""
Three in One: Describe how you could use a single array to implement three stacks.
"""
class Stack:
def __init__(self, start, parent):
self.start = start
self.count = 0
self.parent = parent
def push(self, value):
return self.parent.push(self, value)
def pop(self):
... |
"""
The MIT License (MIT)
Copyright (c) Serenity Software, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, m... |
"""
Types Base
==========
Provides the base types on top of which user visible types will be built.
"""
# pylint: disable=too-few-public-methods
class CFFICDataWrapper(object):
"""
Base class for exposing Python types and interfaces to pywincffi users:
* Wraps a CFFI cdata object in self._cdata.
* D... |
# Utilities related to colors.
# A standard color-blind palette, with equalized luminance, adding another a blue.
colors = [
((165, 54, 0, 255), ["orange", "brown"]),
((179, 45, 181, 255), ["pink"]),
((0, 114, 178, 255), ["blue", "lightBlue", "blue1"]),
((144, 136, 39... |
class Foo:
def say(self):
return 'bar'
|
#########################
# 162. Find Peak Element
#########################
class Solution:
def findPeakElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums)==1:
peak = 0
return peak
else:
if nums[0]>nums[1]:
... |
#works reguardless the size of the strings
def compare(_firstString, _secondString):
_list = list(set(_firstString.lower()) - set(_secondString.lower()))
print("The Non-Common Charecters are: ")
for i in _list:
print(i)
# works only for equal length strings
def COMPARE(_firstString, _secondString)... |
class Student(object):
def __init__(self, name, score):
self.__name = name
self._score = score
def print_score(self):
print('%s: %s' % (self.__name, self.__score))
bart = Student("Zero", 32)
print(bart)
|
def rearrange_sorted_list_in_max_into_set(lst):
result = []
for i in range(len(lst)//2):
result.append((lst[i], lst[-i - 1]))
if len(lst) % 2 == 1:
result.append(lst[len(lst)//2])
return result
|
# Students dictionary
students = {"Ahmed" : 87, "Waleed" : 69, "Hesham" : 92}
# Khaled grades
kh_grades = {"Math": 86, "English": 74}
#1 Add Khaled and his grades to students
students[________] = _________
# Print out students
print(students)
#2 Print out Khaled grade in English
print(_____________________________)... |
load("@com_github_pybind_bazel//:build_defs.bzl", "pybind_extension")
def pybind_py_library(name,
cc_so_name = None,
copts = [],
features = [],
tags = [],
cc_srcs = [],
cc_deps = [],
py_library_rule = native.py_library,
py_srcs = [],
py_deps = [],... |
A, P = map(int,input().split())
data = set([A])
repeat = set([])
for _ in range(10000):
rem = 0
while A:
rem += (A%10)**P
A = int(A/10)
A = rem
if A in data:
repeat.add(A)
data.add(A)
print(len(data-repeat))
'''
일정 수부터 규칙적으로 반복되는 반복수열 같다.
랜덤으로 같은 숫자가 반복적으로 만들어진다는 줄 알고 set... |
n = 10000
df = pd.DataFrame({'x': np.random.randn(n),
'y': np.random.randn(n)})
ax = df.plot.hexbin(x='x', y='y', gridsize=20)
|
def do_stuff(num):
"""Adds 5 to passed int"""
try:
return int(num) + 5
except ValueError as err:
return err
|
#
### Begin group: DEFAULT
# plugins
# 已安装的插件
plugins = cPickle.loads('\x80\x02}q\x01.')
# filetype mapping
# 关联插件文件类型
filetype_mapping = cPickle.loads('\x80\x02}q\x01.')
# plugin customization
# 自定义本地插件
plugin_customization = cPickle.loads('\x80\x02}q\x01.')
# disabled plugins
# 已禁用的插件
disabled_plugins = cPi... |
#
# Py Word Permutations
#
# Author: Afaan Bilal
# URL: https://afaan.ml
#
# Display all possible permutaions for a set of characters.
#
# (c) 2016 Afaan Bilal
# Released under the MIT License
#
def base_convert(number, fromBase, toBase):
''' Convert numbers to and from decimal '''
... |
temperature = 35
if temperature == 30:
print("It's a hot day.")
else:
print("It's not a hot day.")
# Exercise
name = input("Enter name: ")
if len(name) < 3:
print("Name must be at least 3 characters.")
elif len(name) > 20:
print("Name must be a maximum of 20 characters.")
else:
print("Name looks... |
'''
Given an array, rotate the array to the right by k steps, where k is non-negative.
Example 1:
Input: [1,2,3,4,5,6,7] and k = 3
Output: [5,6,7,1,2,3,4]
Explanation:
rotate 1 steps to the right: [7,1,2,3,4,5,6]
rotate 2 steps to the right: [6,7,1,2,3,4,5]
rotate 3 steps to the right: [5,6,7,1,2,3,4]
Example 2:
In... |
#!/usr/bin/python3
# @JUDGE_ID: mobluse 11044 Python 3 "Closed-form expression"
t = int(input())
for i in range(t):
n, m = [int(x) for x in input().split()]
print((n//3)*(m//3))
|
print("This file tests Elif.")
a=99
if a<=0:
print("Plese enter a correct number")
if a<=60:
print('E')
elif a<=70:
print("D")
elif a<=80:
print("C")
elif a<=90:
print("B")
elif a<=95:
print("A")
elif a<=99:
print("A+")
else:
print("A++") |
#!/usr/bin/env python3
# The MIT License
# Copyright (c) 2016 Estonian Information System Authority (RIA), Population Register Centre (VRK)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software ... |
#!/usr/bin/env python
def fac(n):
'''compute the factorial of given number'''
assert type(n) == int, 'argument must be integer'
assert n >= 0, 'argument must be positive'
if n > 1:
return n*fac(n - 1)
else:
return 1
if __name__ == '__main__':
for i in range(5):
print('{... |
bjobTemplate="""#!/bin/tcsh
cd $CMSSW_BASE/src
eval `scramv1 runtime -csh`
source /afs/cern.ch/cms/caf/setup.csh
cd -
xrdcp {inputFile} reco.root
cmsRun $CMSSW_BASE/src/Alignment/APEEstimation/test/cfgTemplate/apeEstimator_cfg.py {inputCommands}
rm -- "$0"
"""
submitJobTemplate="""
bsub -J {jobName} -e {errorFil... |
# Demonstrate how to use set comprehensions
def main():
# define a list of temperature data points
ctemps = [5, 10, 12, 14, 10, 23, 41, 30, 12, 24, 12, 18, 29]
# TODO: build a set of unique Fahrenheit temperatures
# TODO: build a set from an input source
if __name__ == "__main__":
main()
|
been_called = False
def example2():
global been_called
been_called = True
# example2()
# print(been_called)
def sort_words_by_length():
fin = open('words.txt')
lt = []
for line in fin:
line = line.strip()
lt.append((len(line), line))
lt.sort(reverse=True)
res = []
for ... |
#!/usr/bin/env python
# Copyright (c) 2005-2009 Jaroslav Gresula
#
# Distributed under the MIT license (See accompanying file
# LICENSE.txt or copy at http://jagpdf.org/LICENSE.txt)
#
# names generator
# http://www.neoprogrammics.com/randomisers/random_names_generator/
names_str="""Steven Eden
Madelyn E. Vinci
Cor... |
# Using the seive of Eratosthenes https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
def sum_primes(n):
sum = 0
sieve = [True] * n
for i in range(2, n):
if sieve[i]:
sum += i
for j in range(i**2, n, i):
sieve[j] = False
return sum
if __name__ == "__mai... |
ans=0
x1,y1,r1=map(int,input().split())
x2,y2,r2=map(int,input().split())
x3,y3,r3=map(int,input().split())
for i in range(23001):
for j in range(23001):
if (x1-i/230+0.0022)**2+(y1-j/230+0.0022)**2<=r1*r1: ans+=1
elif (x2-i/230+0.0022)**2+(y2-j/230+0.0022)**2<=r2*r2: ans+=1
elif (x3-i/230+0.0022)**2+(y3-... |
# -*- coding: UTF-8 -*-
#Exercício Python 55: Faça um programa que leia o peso de cinco pessoas. No final, mostre qual foi o maior e o menor peso lidos.
pesoAtual = 0
pesoMenor = 0
pesoMaior = 0
for cont in range (1, 6):
pesoAtual = float(input(f"PESO DA [{cont}º] PESSOA: "))
if cont == 1:
pesoMaior =... |
num = int(input("enter any Number"))
rev = 0
while num > 0:
Rem = num % 10
num = num // 10
rev = rev * 10 + Rem
print("The Reverse of the number", rev)
##################
# could also simply do this another way
num = input()
print(int(num[::-1]))
|
n1 = float(input("Insira o primeiro valor: "))
n2 = float(input("Insira o segundo valor: "))
media = (n1 + n2) / 2
print('A média entre {} e {} é igual a {:.1f}: '.format(n1,n2,media)) |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Softw... |
class Node:
def __init__(self,name):
self.name = name
self.left = None
self.right = None
self.visit = False
def insert(self, name):
if name < self.name:
if self.left is None:
self.left = Node(name)
else:
self.le... |
# fixed constants
WEIERSTRASS = 0
EDWARDS = 1
MONTGOMERY = 2
D_TYPE = 0
M_TYPE = 1
NEGATIVEX = 0
POSITIVEX = 1
BN = 0
BLS = 1
ECDH_INVALID_PUBLIC_KEY = -2
ECDH_ERROR = -3
|
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# Redis配置
Redis_ip = "127.0.0.1"
Redis_port = 6379
Redis_db = 3
# Mongodb配置
Mongodb_ip = "127.0.0.1"
Mongodb_port = 27017
#设置当前爬虫服为主进程,master表示主节点
identity = 'master' # slaver
|
def actuator_add(type='', name="", object=""):
'''Add an actuator to the active object
:param type: Type, Type of actuator to add
:type type: enum in [], (optional)
:param name: Name, Name of the Actuator to add
:type name: string, (optional, never None)
:param object: Object, Name of the Ob... |
def xoppy_calc_black_body(TITLE="Thermal source: Planck distribution",TEMPERATURE=1200000.0,E_MIN=10.0,E_MAX=1000.0,NPOINTS=500):
print("Inside xoppy_calc_black_body. ")
return(None)
def xoppy_calc_mlayer(MODE=0,SCAN=0,F12_FLAG=0,SUBSTRATE="Si",ODD_MATERIAL="Si",EVEN_MATERIAL="W",ENERGY=8050.0,THETA=0.0,S... |
SS
array = [1,1,2,2]
array1 = set(array)
print(array1)
for a in array1:
print(a)
|
def calculo_cripto_price():
print("**************************************************************************************")
print("Calculadora para encontrar PREÇO de uma Cripto Baseado em um futuro Suply e Market Cap")
print("********************************************************************************... |
midiccionario = {
"Alemania":"Berlin",
"Francia":"Paris",
"Reino Unido":"Londres",
"España":"Madrid"
}
print(midiccionario)
print(midiccionario["España"])
midiccionario["Italia"]="Lisboa"
print(midiccionario)
midiccionario["Italia"]="Roma"
print(midiccionario)
del midiccionario["Reino Unido"]
print(midi... |
# Humanoid A (2111003) | Magatia (261000000)
snowfieldRose = 3335
snowRoseGrows = 926120300
if sm.hasQuest(snowfieldRose):
response = sm.sendAskYesNo("Are you ready to grow the Snow Rose?")
if response:
sm.warpInstanceIn(snowRoseGrows, False)
else:
sm.sendSayOkay("Remember to bring #bMay M... |
class Algo(object):
def generate(self, interface):
# TODO: Write algorithm here
pass
|
class SnakesistError(Exception):
"""Snakesist base exception class"""
pass
class SnakesistConfigError(SnakesistError):
"""Raised if the database connection is improperly configured"""
pass
class SnakesistReadError(SnakesistError):
"""Raised if a writing operation fails"""
pass
class Sna... |
"""
Given an array of elements of length N, ranging from 0 to N – 1.
All elements may not be present in the array. If element is not
present then there will be -1 present in the array.
Rearrange the array such that A[i] = i and if i is not present, display -1 at that place.
"""
def rearrange(arr: list) -> list:
l... |
width = 17
height = 12.0
print(width//2) # should return the quotient
print(width/2.0) # should return the quotient in float
print(height/3.0) # should return the quotient in float
ans = 1 + 2 * 5 # should return 11
print(ans)
|
"""
|||||||||||||||||||||||||||| DECISION THEORY MODEL |||||||||||||||||||||
"""
def dt_model_speed_and_distances(self, plot=False, sqrt=True):
speed = stats.norm(loc=self.speed_mu, scale=self.speed_sigma)
if sqrt: dnoise = math.sqrt(self.distance_noise)
else: dnoise = self.distance_noise
d... |
# Copyright 2014 The Bazel Authors. 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 la... |
d = {"a": 1, "b": 2, "c": 3}
newDict={}
for (key,value) in d.items():
if(value<=1):
newDict[key]=value
# for key,values in d.items():
# if values>1:
# d.pop[key]
print(newDict)
|
# -*- coding: utf-8 -*-#
'''
@Project : ClassicAlgorighthms
@File : ReverseBits.py
@USER : ZZZZZ
@TIME : 2021/5/17 21:23
'''
class ReverseBits():
def __init__(self):
pass
def Solution(self, num):
'''
将十进制数的二进制表示翻转
:param num: 待翻转数字
:return: ... |
__docformat__ = "restructuredtext"
__version__ = "0.2.7"
__doc__ = """
This<https://github.com/WinVector/wvpy> is a package of example files for teaching data science.
"""
|
#!/usr/bin/env python3
# imports go here
#
# Free Coding session for 2015-04-02
# Written by Matt Warren
#
class MyClass(object):
def __init__(self):
self.meta = self.Meta()
class Meta:
CONSTANT = 'HELLO'
def do_something(self):
print(self.meta.CONSTANT)
class MySubclass(MyCl... |
# coding=utf-8
class Context(object):
is_finished = False
text = None
state = None
current_index = 0
is_pair_sign_opened = False
has_split_sign = False
pair_sign = None
back_pair_sign = None
token_num = 0
char_num = 0
def __init__(self,
text,
... |
class Solution:
def sortArrayByParity(self, A: List[int]) -> List[int]:
j=0
for i in range(len(A)):
if (A[i]%2)==0:
temp = A[i]
A[i]=A[j]
A[j]=temp
j+=1
return A
|
def solve(prices, fee):
t_i_k_0 = 0
t_i_k_1 = -float('inf')
for price in prices:
t_i_k_0 = max(t_i_k_0, t_i_k_1 + price - fee)
t_i_k_1 = max(t_i_k_1, t_i_k_0 - price)
return t_i_k_0
A = [1, 3, 2, 8, 4, 9]
B = 2
print(solve(A, B))
|
class ObjectFactory:
'''Generic object factory. Maintains a dictionary of provider objects,
which can be created and returned on demand.
'''
def __init__(self):
self._providers = {}
def register_provider(self, key, provider):
'''Register a new provider for future use. The `key` valu... |
def test_grade_above_1_is_passing(passing_grade):
assert passing_grade.is_passing() is True
def test_grade_below_2_is_failing(failing_grade):
assert failing_grade.is_passing() is False
|
# .split() breaks a string at specified character into a list of strings
my_string = "Boulder,CO,80304,106392"
my_split_string = my_string.split(",")
print(my_split_string)
# .strip() will remove leading or trailing whitespace
white_str = " Boulder,CO,80304,106392\n"
strip_split_str = white_str.split(",").strip()... |
# SPDX-License-Identifier: MIT
# Map the entire MMIO range as traceable
map_sw(0x2_00000000,
0x2_00000000 | hv.SPTE_TRACE_READ | hv.SPTE_TRACE_WRITE,
0x5_00000000)
# Skip some noisy devices
try:
trace_device("/arm-io/usb-drd0", False)
except KeyError:
pass
try:
trace_device("/arm-io/usb-drd1... |
class AdjNode:
def __init__(self, value):
self.value = value
self.next = None
class AdjListGraph:
def __init__(self, num_vertices):
self.storage = [None] * num_vertices
self.num_vertices = num_vertices
def add_edge(self, v, w):
new_adj_node = AdjNode(w)
ne... |
# -*- coding: utf-8 -*-
db.define_table('MESSAGE_BOARD',
Field('sender', 'text'),
Field('receiver', 'text'),
Field('message_content', 'text'),
# Field('sent_time', 'datetime', requires=IS_DATE(format='%d-%m-%Y %H:%M:%S')),
Field('sent_time'... |
BASE_AUTH = "bemullen_crussack_dharmesh_vinwah"
CONTRIBUTOR = "bemullen_crussack_dharmesh_vinwah"
BASE_NAME = "bemullen_crussack_dharmesh_vinwah"
def setBaseName(baseAuth):
global BASE_AUTH
global BASE_NAME
global CONTRIBUTOR
BASE_AUTH = baseAuth
CONTRIBUTOR = baseAuth
BASE_NAME = baseAuth |
class Solution(object):
def numWays(self, n, k):
"""
:type n: int
:type k: int
:rtype: int
"""
if not n or not k:
return 0
if n == 1:
return k
dp = [0] * (n+1)
dp[1] = k
dp[2] = k*(k-1) + k
for i in range... |
def grade(key, submission):
if submission == "it_is_only_uphill_from_here_%s" % str(key):
return True, "Good luck!"
else:
return False, "Ask Julius again..."
|
class Solution:
def solve(self, source, target):
locs = defaultdict(list)
for i,char in enumerate(source):
locs[char].append(i)
ans = 0
cur = len(source)
for char in target:
if char not in locs:
return -1
nxt = bisect_le... |
def encripter(key,entrada):
alfabeto = ["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"]
mapa = [["X0","X1","X2","X3","X4"],["X0","X1","X2","X3","X4"],["X0","X1","X2","X3","X4"],["X0","X1","X2","X3","X4"],["X0","X1","X2","X3","X4"]]
x = 0 # index pa... |
# class TreeNode():
# def __init__(self, val=None, left_ptr=None, right_ptr=None):
# self.val = val
# self.left_ptr = left_ptr
# self.right_ptr = right_ptr
# complete the function below
traversal = []
PRE = 1
PROCESS = 2
POST = 3 # not used
def postorderTraversal(root):
def postorderHe... |
expected_output = {
"FiveGigabitEthernet1/0/48": {
"service_policy": {
"output": {
"policy_name": {
"PWRED-CHILD": {
"class_map": {
"CWRED": {
"afd_wred_stats": {
... |
k_list = [0] * 100
k_list[0] = 1
for i in range(1,100):
k_list[i] = k_list[i-1]+i
print('100 刀最多切 %d块' %k_list[99])
|
#
# @lc app=leetcode id=4 lang=python3
#
# [4] Median of Two Sorted Arrays
#
# @lc code=start
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
for element in nums2:
nums1.append(element)
nums1.sort()
lenth = len(nums1)
... |
"""
NeoTrellis M4 Express MIDI synth
Adafruit invests time and resources providing this open source code.
Please support Adafruit and open source hardware by purchasing
products from Adafruit!
Written by Dave Astels for Adafruit Industries
Copyright (c) 2018 Adafruit Industries
Licensed under the MIT license.
All te... |
#
# @lc app=leetcode.cn id=860 lang=python3
#
# [860] 柠檬水找零
#
# @lc code=start
class Solution:
def lemonadeChange(self, bills: List[int]) -> bool:
money = {
5: 0,
10: 0
}
for bill in bills:
if bill == 5:
money[5] += 1
elif bil... |
r,g,b = map(int,input().split())
l=[]
for i in range(min(r+1,g+1,b+1,3)):
l.append(i+(r-i)//3+(g-i)//3+(b-i)//3)
print(max(l)) |
"""
This script encrypt http and transfer it to port 443.
By Olivier Soucy.
"""
def request(context, flow):
flow.request.port = 443
flow.request.scheme = "https"
|
'''
formatando valores com modificadores
:s - texto - string
:d - inteiros - int
:f - numeros ponto flutuante - float
:.(numero)f - quantidade de dasas decimais - float
:(caractere) (> ou < ^) (quantidade) (tipos - s, d ou f)
> - esquerda
< - direita
^ - centro
'''
#:.(numero)f - quantidade de dasas decimais - float... |
'''
class Lanzamiento:
# ------------------------------
# Función principal del juego
# ------------------------------
def lanzamiento(botonamarillo,botonnaranja,botonmorado,aux):
# se define la letra por defecto
fuente = Textos.fuentes(None, 50)
prueba = 0
... |
#!/usr/bin/env python
NAME = 'Comodo WAF'
def is_waf(self):
return self.matchheader(('server', "Protected by COMODO WAF"))
|
def read_groups(full_text: str) -> []:
"Separate groups from newlines and join answers."
lines = full_text.splitlines()
groups = []
group = []
for line in lines:
line = line.strip()
if line != '':
group += [line]
else:
groups.append(group)
... |
"""
@author: Anirudh Sharma
"""
# Example #1
def sum_of_list_elements(L):
total = 0
for i in L:
total += L[i - 1]
return total
L = [1, 2, 3, 4, 5, 6]
print(sum_of_list_elements(L))
# Example #2
def list_operations(L1, L2):
L3 = L1 + L2
print("L1 + L2: ", L3)
L1.remove(2)
... |
number1 = int(input("Введите первое число:"))
number2 = int(input("Введите второе число:"))
number3 = int(input("Введите третье число:"))
number4 = int(input("Введите четвертое число:"))
sum1 = number1 + number2
sum2 = number3 + number4
result = sum1 / sum2
print(result)
|
X, N = [int(x) for x in input().split()]
PS = [int(x) for x in input().split()]
mindist = 1e+99
for p in PS:
dist = abs(X - p)
if dist < mindist:
mindist = dist
answer = p
elif dist == mindist:
if p < answer:
ansewr = p
print(answer)
|
'''
8-8. User Albums: Start with your program from Exercise 8-7. Write a while loop that allows users to enter an album’s artist and title.
Once you have that information, call make_album() with the user’s input and print the dictionary that’s created.
Be sure to include a quit value in the while loop.
'''
def make... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
@author: Jesus Salgado
@contact: jesusjuansalgado@gmail.com
European Space Astronomy Centre (ESAC)
European Space Agency (ESA)
Created on 15 July 2020
"""
|
N = int(input())
A = list(map(int, input().split()))
result = []
for i in range(N):
x = i
j = 1
x = A[x] - 1
while x != i:
x = A[x] - 1
j += 1
result.append(j)
print(*result)
|
def increasing_or_decreasing(seq):
is_up = False
is_down = False
length = len(seq)
if length == 1:
return False
if seq[0] > seq[1]:
is_down = True
elif seq[0] < seq[1]:
is_up = True
for i in range(1, length - 1):
if(seq[i] > seq[i + 1] and is_up) or \
(seq[i] < seq[i + 1] and is_down) or \
... |
# errors from Transition function
TransitionComplete = 10
TransitionDbConnectionFailed = 11
TransitionDbRetrieveFailed = 12
TransitionFunctionException = 13
# errors from JobStatusReceiver
JobStatusReceiverRetrieveArgoSubJobFailed = 21
JobStatusReceiverRe... |
# -*- coding: utf-8 -*-
DATA_SET = [
(
[u"123", u"12345"],
[1, 3],
([3, 5], [3, 5])
),
(
[u"123", u"12345"],
[4, 3],
([3, 5], [4, 5])
),
(
[u"123", u"12345"],
[5, 8],
([3, 5], [5, 8])
),
(
[u"123", u"12345", ... |
def cep(*args):
try:
telaPrincipal = args[0]
telaErro = args[1]
pycep_correios = args[2]
cep = telaPrincipal.cep.text()
end = pycep_correios.get_address_from_cep(cep)
telaPrincipal.end.setText(end['logradouro'])
telaPrincipal.bairro.setText(end['bairro'])
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.