content stringlengths 7 1.05M |
|---|
"""Custom exceptions for the punter package."""
class PunterException(Exception):
def __init__(self, *args, **kwargs):
super(PunterException, self).__init__(*args, **kwargs)
class InvalidAPIKeyException(PunterException):
pass
class InvalidQueryStringException(PunterException):
pass
|
n, q = map(int, input().split())
d = {}
init = input().split()
for i in range(1, n+1):
d[i] = init[i-1]
for j in range(q):
line = input().split()
req = line[0]
if req == '1':
d[int(line[1])] = line[2]
else:
print(abs(int(d[int(line[1])]) - int(d[int(line[2])]))) |
"""Work in Progress Template based on Shoelace"""
# import pathlib
# import jinja2
# import panel as pn
# ROOT = pathlib.Path(__file__).parent
# JS = (ROOT / "index.js").read_text()
# CSS = (ROOT / "index.css").read_text()
# TEMPLATES_FOLDER = str(ROOT / "templates")
# bokehLoader = jinja2.PackageLoader... |
# Link to problem : https://leetcode.com/problems/remove-element/
class Solution:
def removeElement(self, nums ,val):
count = 0
for i in range(len(nums)):
if(nums[i] != val):
nums[count] = nums[i]
count += 1
return count |
'''
x 的平方根
实现 int sqrt(int x) 函数。
计算并返回 x 的平方根,其中 x 是非负整数。
由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。
'''
'''
解题思路1,暴力搜索,使用4则运算,从1开始搜索,直至i*i<=x and (i+1)*(i+1)>x 返回i
时间复杂度:O(求根n)
解题思路2,牛顿法,使用4则运算,每次求guess和x/guess的平均值来渐进
时间复杂度:O(log(n))
'''
class Solution:
# 思路1
def mySqrt1(self, x: int) -> int:
a, b = 0, 0
... |
"""
@file
@brief Shortcut to *parsers*.
"""
|
while True:
n = int(input())
if not n: break
s = 0
for i in range(n):
s += [int(x) for x in input().split()][1] // 2
print(s//2)
|
new_minimum_detection = input("What is the minimum confidence?: ")
with open('object_detection_webcam.py', 'r') as file:
lines = file.readlines()
for line in lines:
if line[0:18] == ' min_detection_':
line = ' min_detection_confidence = '+new_minimum_detection+' ###EDITE... |
# 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))
class Student(object):
def __init__(self, name, score):
self.__name = name
self.__score = score... |
"""Demonstrate module statements being executed on first import."""
print("Initialise", __name__)
def fib(n: int) -> None:
"""Write Fibonacci series up to n."""
a, b = 0, 1
while a < n:
print(a, end=" ")
a, b = b, a + b
print()
|
#
# 359. Logger Rate Limiter
#
# Q: https://leetcode.com/problems/logger-rate-limiter/
# A: https://leetcode.com/problems/logger-rate-limiter/discuss/473779/Javascript-Python3-C%2B%2B-hash-table
#
class Logger:
def __init__(self):
self.m = {}
def shouldPrintMessage(self, t: int, s: str) -> bool:
... |
"""
dp[i][k] := the minimal number of characters that needed to change for s[:i] with k disjoint substrings
"""
class Solution(object):
def palindromePartition(self, s, K):
def count(r, l):
c = 0
while r>l:
if s[r]!=s[l]: c += 1
r -= 1
... |
for t in range(int(input())):
a=int(input())
s=input()
L=[]
for i in range(0,a*8,8):
b=s[i:i+8]
k=0
for i in range(8):
if b[i] == 'I':
k += 2**(7-i)
L.append(k)
print("Case #"+str(t+1),end=": ")
for i in L:
print(chr(i),end="")
... |
# A program to display a number of seconds in other units
data = 75475984
changedData = data
years = 0
days = 0
hours = 0
minutes = 0
seconds = 0
now = 0
if data == 0:
now = 1
for i in range(100):
if changedData >= 31556952:
years += 1
changedData -= 31556952
for i in range(365):
if cha... |
#1 2 3 4 5 可以组成多少的不重复的三位数
count=0
for a in range(1,6):
for b in range(1,6):
for c in range(1,6):
if a!=b and b!=c and c!=a:
number=a*100+b*10+c
count+=1
print("找到了三位数 {} 。".format(number))
print("一共找到了 {} 个不重复的三位数。".format(count))
|
nombre=input("nombre del archivo? ")
f=open(nombre,"r")
palabras=[]
for linea in f:
palabras.extend(linea.split())
print(palabras)
|
# %% [278. First Bad Version](https://leetcode.com/problems/first-bad-version/)
class Solution:
def firstBadVersion(self, n):
lo, up = 0, n
while up - lo > 1:
mid = (lo + up) // 2
if isBadVersion(mid):
up = mid
else:
lo = mid
... |
# dataset settings
data_root = 'data/'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
crop_size = (256, 512)
train_pipeline = [
dict(type='LoadImageFromFile_Semi'),
dict(type='LoadAnnotations_Semi'),
dict(type='RandomCrop_Semi', crop_size=crop_size, cat_max_rat... |
"""
You are going to be given a word. Your job is to return the middle character of the word.
If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters.
Kata.getMiddle("test") should return "es"
Kata.getMiddle("testing") should return "t"
Kata.getMiddle("m... |
P, T = map(int, input().split())
solved = 0
for _ in range(P):
flag = True
for _ in range(T):
test1 = input().strip()
test = test1[0].lower() + test1[1:]
if test == test1.lower():
continue
else:
flag = False
if flag:
solved += 1
print(solved) |
# accounts.tests
# Tests for the account app
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Wed May 02 15:41:44 2018 -0400
#
# ID: __init__.py [0395481] benjamin@bengfort.com $
"""
Tests for the account app
"""
|
def nb_year(p0, percent, aug, p):
year = 0
while p0 < p:
p0 = int(p0 + p0*(percent/100) + aug)
year += 1
print(p0)
return year
print(nb_year(1000, 2, 50, 1200)) |
# custom exceptions for ElasticSearch
class SearchException(Exception):
pass
class IndexNotFoundError(SearchException):
pass
class MalformedQueryError(SearchException):
pass
class SearchUnavailableError(SearchException):
pass
|
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 14 08:35:11 2019
@author: NOTEBOOK
"""
def main():
print ('First Rectangle Details')
length1 = float(input('Enter length: '))
width1 = float(input('Enter width: '))
area_1 = length1 * width1
print('The area of the Rectangle is',format(area_1,'.2f'))
... |
print("Digite um numero...")
numero = int(input()); numero
numeroSucessor = print(numero + 1);
numeroAntecessor = print(numero - 1);
print("o seu valor eh {}, seu sucessor eh {} e o seu antecessor eh {}".format(numero, numeroSucessor, numeroAntecessor));
|
host_='127.0.0.1'
port_=8086
user_='user name'
pass_ ='user password'
protocol='line'
air_api_key="air api key"
weather_api_key="weather_api_key" |
MASTER_KEY = "masterKey"
BASE_URL = "http://127.0.0.1:7700"
INDEX_UID = "indexUID"
INDEX_UID2 = "indexUID2"
INDEX_UID3 = "indexUID3"
INDEX_UID4 = "indexUID4"
INDEX_FIXTURE = [
{"uid": INDEX_UID},
{"uid": INDEX_UID2, "options": {"primaryKey": "book_id"}},
{"uid": INDEX_UID3, "options": {"uid": "wrong", "pr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Inyourshoes(object):
def __init__(self, nlp, object):
self.object = object
self.matcher = object.matcher.Matcher(nlp.vocab)
self.matcher.add("Inyourshoes", None,
#what i would do
[{'LOWER': 'what'... |
# Exercicio 3 - Lista 2
nome = input("informe o seu nome: ")
auxAno = input("Ano de Nascimento: ")
anoNascimento = int(auxAno)
idade = 2022 - anoNascimento
print(nome, "tem/terá", idade, "anos até o fim de 2022") |
"""
一、程序错误:
1. 程序编写的时候有问题-bug
2. 用户输入脏数据-通过检查校验来对用户输入进行处理
3. 程序运行过程中无法预测的,比如:网络问题, 磁盘问题等-异常
4. 业务问题
程序中所有的错误都需要进行处理
二、程序调式:
跟踪程序的执行,查看相应变量的值
三、程序测试:
测试人员:程序上生产(production)之前,会通过多个测试环境(test, uat, stg)
开发人员:单元测试(开发环境)
"""
# 获取python自带异常错误类
# import re
# list_a = dir(__builtins__)
# list_b = [i for i in list_a if re.matc... |
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
max_len = start = 0
m = {}
for end, char in enumerate(s):
if m.get(char, -1) >= start: # if in the current range
start = m[char] + 1
max_len = max(max_len, end - start + 1)
... |
if __name__ == "__main__":
null = "null"
placeholder = null
undefined = "undefined"
|
# optimized_primality_test : O(sqrt(n)) - if x divide n then n/x = y which divides n as well, so we need to check only
# numbers from 1 to sqrt(n). sqrt(n) is border because sqrt(n) * sqrt(n) gives n, which then implies that values after
# sqrt(n) need to be multiplied by values lesser then sqrt(n) which we already che... |
Elements_Symbols_Reverse = {
"H":"Hydrogen",
"He":"Helium",
"Li":"Lithium",
"Be":"Beryllium",
"B":"Boron",
"C":"Carbon",
"N":"Nitrogen",
"O":"Oxygen",
"F":"Fluorine",
"Ne":"Neon",
"Na":"Sodium",
"Mg":"Magnesium",
"Al":"Aluminium",
"Si":"Silicon",
"P":"Phosphorus",
"S":"Sulphur",
"Cl":"Chlorine",
"Ar":"Argon",
"K":"Pota... |
# 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 you under the Apache License, Version 2.0 (the
# "License"); you may not ... |
def even_numbers(numbers):
even = []
for num in numbers:
if num % 2 == 0:
even.append(num)
return even
def odd_numbers(numbers):
odd = []
for num in numbers:
if num % 2 != 0:
odd.append(num)
return odd
def sum_numbers(numbers):
sum = 0
for num ... |
'''
disjoint set forest implementation, uses union by rank and path compression
worst case T.C for find_set is O(logn) in first find_set operation
T.C for union and create_set is O(1)
'''
class Node:
# the identity of node(member of set) is given by data, parent_link, rank
def __init__(self, data=None, rank=N... |
'''# from app.game import determine_winner
# FYI normally we'd have this application code (determine_winner()) in another file,
# ... but for this exercise we'll keep it here
def determine_winner(user_choice, computer_choice):
return "rock" # todo: write logic here to make the tests pass!
if user_choice == com... |
N = int(input())
a = list(map(int, input().split()))
for i, _ in sorted(enumerate(a), key=lambda x: x[1], reverse=True):
print(i + 1)
|
class Environment:
def __init__(self, width=1000, height=1000):
self.width = width
self.height = height
self.agent = None
self.doors = []
def add_door(self, door):
self.doors.append(door)
def get_env_size(self):
size = (self.height, self.width)
return size
|
# custom exceptions
class PybamWarn(Exception):
pass
class PybamError(Exception):
pass
|
################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless... |
'''Given a binary string s, return true if the longest contiguous segment of 1s is strictly longer than the longest contiguous segment of 0s in s. Return false otherwise.
For example, in s = "110100010" the longest contiguous segment of 1s has length 2, and the longest contiguous segment of 0s has length 3.
Note that ... |
class UndergroundSystem(object):
def __init__(self):
# record the customer's starting trip
# card ID: [station, t]
self.customer_trip = {}
# record the average travel time from start station to end station
# (start, end): [t, times]
self.trips = {}
def checkIn(... |
# Black list for auto vote cast
Blacklist_team = ["Royal Never Give Up", "NAVI"]
Blacklist_game = ["CSGO"]
Blacklist_event = []
# Program debug
debugLevel = 0
# Switch of auto vote cast function
autoVote = True
# Cycle of tasks (seconds)
cycleTime = 1800
|
print("Calorie Calulator")
FAT = float(input("Enter grams of fat: "))
CARBOHYDRATES = float(input("Enter grams of Carbohydrates: "))
PROTEIN= float(input("Enter grams of Protein: "))
Fatg = 9 * FAT
print("Number of calories from Fat is: " + str(Fatg))
Protieng = 4 * PROTEIN
print("Number of calories from Prote... |
# sudoku solver with backtracking algorithm...
board = [[4,0,0,0,1,0,3,0,0],
[0,6,0,4,0,7,0,0,0],
[0,5,0,0,3,2,1,4,0],
[9,0,4,0,0,1,0,8,5],
[0,0,6,0,0,0,9,0,0],
[3,1,0,7,0,0,6,0,4],
[0,4,9,5,7,0,0,3,0],
[0,0,0,1,0,4,0,7,0],
[0,0,1,0,9,0,0,0,2]]
... |
# https://www.hackerrank.com/challenges/ctci-is-binary-search-tree
""" Node is defined as
class node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
"""
def check_binary_search_tree_(root):
# To check if its a binary search tree, do an inorder search
#... |
class Solution(object):
def searchInsert(self,nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
length=len(nums)
l=0
r=length-1
while l<=r:
if l==r:
return l if nums[l]>=target else l+1
... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T E X A M P L E S
#
# Copyright (c) 2017 Thom Janssen <https://github.com/thomgb>
# www.pagebot.io
# Licensed under MIT conditions
#
# Supporting DrawBot, w... |
# import math
# import numpy as np
def lagrange(f, xs, x):
ys = [f(i) for i in xs]
n = len(xs)
y = 0
for k in range(0, n):
t = 1
for j in range(0, n):
if j != k:
s = (x - xs[j]) / (xs[k] - xs[j])
t = t * s
y = y + t * ys[k]
retur... |
def find_neighbors(index, width, height, costmap, orthogonal_step_cost):
"""
Identifies neighbor nodes inspecting the 8 adjacent neighbors
Checks if neighbor is inside the map boundaries and if is not an obstacle according to a threshold
Returns a list with valid neighbour nodes as [index, step_cost] pairs
""... |
#! /usr/bin/env python3
'''
Problem 52 - Project Euler
http://projecteuler.net/index.php?section=problems&id=052
'''
def samedigits(x,y):
return set(str(x)) == set(str(y))
if __name__ == '__main__':
maxn = 6
x = 1
while True:
for n in range(2, maxn+1):
if not samedigits(x, x * n):
... |
##Write code to assign the number of characters in the string rv to a variable num_chars.
rv = """Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore,
While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapp... |
"""
Leetcode
209. Minimum Size Subarray Sum
Given an array of positive integers nums and a positive integer target, return the minimal length
of a contiguous subarray [numsl, numsl+1, ..., numsr-1, numsr] of which the sum is greater than
or equal to target. If there is no such subarray, return 0 instead.
... |
# 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 you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
'''
Given an array of integers what is the length of the longest subArray containing no more than two
distinct values such that the distinct values differ by no more than 1
For Example:
arr = [0, 1, 2, 1, 2, 3] -> length = 4; [1,2,1,2]
arr = [1, 2, 3, 4, 5] -> length = 2; [1,2]
arr = [1, 1, 1, 3, 3, 2, 2] -> length = ... |
#!/usr/bin/env python3
#
# --- Day 21: Dirac Dice / Part Two ---
#
# Now that you're warmed up, it's time to play the real game.
#
# A second compartment opens, this time labeled Dirac dice. Out of it falls
# a single three-sided die.
#
# As you experiment with the die, you feel a little strange. An informational
# bro... |
a, b = map(int, input().split())
y = []
p = 0
#w = []
for i in range(1, 1000):
p += i
y.append(p)
#w.append(1)
c = b - a
for i in range(1, 999):
if y[i] - y[i - 1] == c:
print(y[i] - b)
break
"""z = []
for i in range(499500):
z.append([])
for i in range(499500):
z[i] = list(map(l... |
# write recursively
# ie
# 10 > 7+3 or 5+5
# 7+3 is done
# 5+5 -> 3 + 2 + 5
# 3+ 2 + 5 -> 3 + 2 + 3 + 2 is done
# if the number youre breaking is even you get 2 initially, if its odd you get 1 more sum
def solve():
raise NotImplementedError
if __name__ == '__main__':
print(solve())
|
# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. 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
#
#... |
guest = input()
host = input()
pile = input()
print("YES" if sorted(pile) == sorted(guest + host) else "NO")
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Bellkor.Utils
"""
|
# -*- coding: utf-8 -*-
def write_out(message):
with open('/tmp/out', 'w') as f:
f.write("We have triggered.")
f.write(message)
|
class Arithmatic:
#This function does adding to integer
def Add(self, x, y):
return x + y
#This fnction does su
def Subtraction(self, x, y):
return x - y
|
lanche = ('Hambúrguer', 'Suco', 'Pizza', 'Pudim')
print(f'A variavel tem {len(lanche)} lanches')
for comida in lanche:
print(f'Esses são os lanches: {comida}')
for cont in range(0, len(lanche)):
print(f'Esses são os lanches: {lanche[cont]}')
for pos, comida in enumerate(lanche):
print(f'Esse lanche {comida}... |
def category(cat):
def set_cat(cmd):
cmd.category = cat.title()
return cmd
return set_cat |
'''
File to calculate the Budget associated with new motorcycle
'''
class Budget(object):
def __init__(self):
self.price = 13000
self.years = 5
self.interet = 7
def pvtx(self):
"""Calcul of the provincial tax on sale price"""
return self.price * 0.0975
def fdtx(sel... |
# Copyright (C) 2018 Garth N. Wells
#
# SPDX-License-Identifier: MIT
"""This module contains utility functions."""
def sorted_by_key(x, i, reverse=False):
"""For a list of lists/tuples, return list sorted by the ith
component of the list/tuple,
Examples:
Sort on first entry of tuple:
... |
class Solution:
def isAdditiveNumber(self, num: str) -> bool:
def isValid(str1, str2, num):
if not num:
return True
res = str(int(str1) + int(str2))
# print(str1, str2, res, num)
str1, str2 = str2, res
l = len(res)
retur... |
if __name__ == '__main__':
if (1!=1) : print("IF")
else : print("InnerElse")
else: print("OuterElse")
|
num = int(input())
lista = [[0] * num for i in range(num)]
for i in range(num):
for j in range(num):
if i < j:
lista[i][j] = 0
elif i > j:
lista[i][j] = 2
else:
lista[i][j] = 1
for r in lista:
print(' '.join([str(elem) for elem in r]))
|
def aumentar(preco=0, taxa=0, formato=False):
res = preco + (preco * taxa/100)
return res if formato is False else moeda(res)
def diminuir(preco=0, taxa=0, formato=False):
res = preco - (preco * taxa/100)
return res if formato is False else moeda(res)
def dobro(preco=0, formato=False):
res = pre... |
# Copyright 2014 Metaswitch Networks
#
# 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 w... |
def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the messag... |
class PartyAnimal:
x = 0
def party(self):
self.x = self.x + 1
print(f'So far {self.x}')
an = PartyAnimal()
an.party()
an.party()
an.party()
print(dir(an))
|
with open("./build-scripts/opcodes.txt", "r") as f:
opcodes = f.readlines()
opcodes_h = open("./src/core/bc_data/opcodes.txt", "w")
opcodes_h.write("enum au_opcode {\n")
callbacks_h = open("./src/core/bc_data/callbacks.txt", "w")
callbacks_h.write("static void *cb[] = {\n")
dbg_h = open("./src/core/bc_data/dbg.t... |
"""
Iterable - __iter__() or __getitem__()
Iterator - __next__()
Iteration -
"""
def gen(n):
for i in range(n):
yield i
#g = gen(89765456432165464988789465456421321564578979874654654613216547897894654) # dont print number upto n number print location
# print(g)
g = gen(4)
print(g.__ne... |
# lets make a Player class
class Player:
def __init__(self, name, starting_room):
self.name = name
self.current_room = starting_room
|
#!/usr/local/bin/python3
# Frequency queries
def freqQuery(queries):
result = []
numbers = {}
occurrences = {}
for operation, value in queries:
if operation == 1:
quantity = numbers.get(value, 0)
if quantity > 0:
occurrences[quantity] = occurrences[quantity] - 1
numbers[value] = numbers.get(value... |
#GuestList:
names = ['tony','steve','thor']
message = ", You are invited!"
print(names[0]+message)
print(names[1]+message)
print(names[2]+message)
|
general = {
'provide-edep-targets' : True,
}
edeps = {
'zmdep-b' : {
'rootdir': '../zmdep-b',
'export-includes' : '../zmdep-b',
'buildtypes-map' : {
'debug' : 'mydebug',
'release' : 'myrelease',
},
},
}
subdirs = [ 'libs/core', 'libs/engine' ]
ta... |
#exercicio 63
termos = int(input('Quantos termos vc quer na sequencia de fibonacci? '))
c = 1
sequencia = 1
sequencia2 = 0
while c != termos:
fi = (sequencia+sequencia2) - ((sequencia+sequencia2)-sequencia2)
print ('{}'.format(fi), end='- ')
sequencia += sequencia2
sequencia2 = sequencia - sequencia2
... |
'''
最大频率栈
实现 FreqStack,模拟类似栈的数据结构的操作的一个类。
FreqStack 有两个函数:
push(int x),将整数 x 推入栈中。
pop(),它移除并返回栈中出现最频繁的元素。
如果最频繁的元素不只一个,则移除并返回最接近栈顶的元素。
示例:
输入:
["FreqStack","push","push","push","push","push","push","pop","pop","pop","pop"],
[[],[5],[7],[5],[7],[4],[5],[],[],[],[]]
输出:[null,null,null,null,null,null,null,5,7,5,4]... |
##Create a target array in the given order
def generate_target_array(nums, index):
length_of_num = len(nums)
target_array = []
for i in range(0, length_of_num):
if index[i] >= length_of_num:
target_array.append(nums[i])
else:
target_array.insert(index[i], nums[i])
... |
class ExtractedItem:
def __init__(self, _id=None, field_name=None, data=None):
self.data = data if data else None
self._id = _id
self.field_name = field_name
def get_dict(self):
"""
returns the data in json format
:return:
"""
if self.field_name:... |
"""
Module: 'uasyncio.core' on pyboard 1.13.0-95
"""
# MCU: (sysname='pyboard', nodename='pyboard', release='1.13.0', version='v1.13-95-g0fff2e03f on 2020-10-03', machine='PYBv1.1 with STM32F405RG')
# Stubber: 1.3.4
class CancelledError:
''
class IOQueue:
''
def _dequeue():
pass
def _enqueue(... |
class Config:
DIR = "arm_now/"
kernel = "kernel"
dtb = "dtb"
rootfs = "rootfs.ext2"
arch = "arch"
KERNEL = DIR + "kernel"
DTB = DIR + "dtb"
ROOTFS = DIR + "rootfs.ext2"
ARCH = DIR + "arch"
DOWNLOAD_CACHE_DIR = "/tmp/arm_now"
qemu_options = {
"aarch64": ["aarch64", "-M virt -cpu... |
def Capital_letter(func): #This function receive another function
def Wrapper(text):
return func(text).upper()
return Wrapper
@Capital_letter
def message(name):
return f'{name}, you have received a message'
print(message('Yery')) |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
class Encumbrance:
speed_multiplier = 1
to_hit_modifier = 0
@classmethod
def get_encumbrance_state(cls, w... |
_base_ = [
'../_base_/models/r50_multihead.py',
'../_base_/datasets/imagenet_color_sz224_4xbs64.py',
'../_base_/default_runtime.py',
]
# model settings
model = dict(
backbone=dict(frozen_stages=4),
head=dict(num_classes=1000))
# optimizer
optimizer = dict(
type='SGD',
lr=0.01,
momentum... |
n = int(input())
if n == 2:
print(2)
else:
if n%2 == 0:
n -= 1
for i in range(n, 1, -2):
flag = True
size = int(pow(i,0.5))
for j in range(3, size+1):
if i % j == 0:
flag = False
break
if flag:
prin... |
# -*- coding: utf-8 -*-
DESC = "autoscaling-2018-04-19"
INFO = {
"CreateAutoScalingGroup": {
"params": [
{
"name": "AutoScalingGroupName",
"desc": "伸缩组名称,在您账号中必须唯一。名称仅支持中文、英文、数字、下划线、分隔符\"-\"、小数点,最大长度不能超55个字节。"
},
{
"name": "LaunchConfigurationId",
"desc": "启动配置ID"... |
# More conditional structures
"""- multi-way
if (...) :
...
elif (...) :
...
else :
..."""
"""- The try/except structures
try:
...
except:
...
(except only runs if try fails)"""
'''astr = 'Saul'
try:
print('123')
istr = int(astr)
print('456')
except:
ist... |
height = int(input())
for i in range(height,0,-1):
for j in range(i,height):
print(end=" ")
for j in range(1,i+1):
if(i%2 != 0):
c = chr(i+64)
print(c,end=" ")
else:
print(i,end=" ")
print()
# Sample Input :- 5
# Output :-
# E E E E E
... |
n = 1
l = []
while n != 0:
l.append(int(input("Digite um número: ")))
n = l[-1]
print("\n\nVocê digitou 0 e encerrou o programa!")
print("\nOs números que você digitou foram:\n")
for elemento in l:
print(elemento)
if len(l) % 2 == 0:
print("\nVocê digitou uma quantidade PAR de números!")
else:
... |
class PysetoError(Exception):
"""
Base class for all exceptions.
"""
pass
class NotSupportedError(PysetoError):
"""
An Exception occurred when the function is not supported for the key object.
"""
pass
class EncryptError(PysetoError):
"""
An Exception occurred when an encry... |
# Crie um programa que leia o nome e o preço de vários produtos. O programa deverá perguntar
# se o usuário vai continuar ou não. No final, mostre:
# A) qual é o total gasto na compra.
# B) quantos produtos custam mais de R$1000.
# C) qual é o nome do produto mais barato.
print('\033[1;32;46m=*'*20, 'XDEVELOPERS STORE... |
"""
Django integration for Salesforce using Heroku Connect.
Model classes inheriting from :class:`HerokuConnectModel<heroku_connect.models.HerokuConnectModel>`
can easily be registered with `Heroku Connect`_, which then keeps their tables
in the Heroku database in sync with Salesforce.
.. _`Heroku Connect`: https://d... |
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: moveoperators.py
#
# Tests: plots - Pseudocolor, Mesh, FilledBoundary
# operators - Erase, Isosurface, Reflect, Slice, Transform
#
# Defect ID: '1837
#
# Programmer: Brad Whitloc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.