content stringlengths 7 1.05M |
|---|
class Const:
GITHUB = "https://github.com/ayvytr/PythonBox"
ISSUE = "https://github.com/Ayvytr/PythonBox/issues"
MAIL = "mailto:ayvytr@163.com?subject=Bug-Report&body={}"
|
def prediction(image_path):
img = tf.keras.utils.load_img(
image_path, target_size=(img_height, img_width))
img = tf.keras.utils.img_to_array(img)
plt.title('Image')
plt.axis('off')
plt.imshow((img/255.0).squeeze())
predict = model.predict(img[np.newaxis , ... |
target_str = "hello python world"
# reverse encrypt
print(target_str[-1::-1])
|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) The Lab of Professor Weiwei Lin (linww@scut.edu.cn),
# School of Computer Science and Engineering, South China University of Technology.
# A-Tune is licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan ... |
def solve():
n=int(input())
row,col=(n,n)
res=""
for i in range(row):
for j in range(col):
if i==j:
res+='1 '
elif i==j-1:
res+='1 '
elif i==j+1:
res+='1 '
else:
res+='0 '
if i... |
tuple_a = 1, 2
tuple_b = (1, 2)
print(tuple_a == tuple_b)
print(tuple_a[1])
AngkorWat = (13.4125, 103.866667)
print(type(AngkorWat))
# <class 'tuple'="">
print("AngkorWat is at latitude: {}".format(AngkorWat[0]))
# AngkorWat is at latitude: 13.4125
print("AngkorWat is at longitude: {}".format(AngkorWat[1])... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
''' Battery runner classes and Report classes '''
class BatteryRunner(object):
def __init__(self, checks):
self._checks = checks
def check_only(self, obj):
reports = []
fo... |
class Solution:
def spiralOrder(self, matrix) -> list:
result = []
m = len(matrix)
n = len(matrix[0])
flag = [[False] * n for _ in range(m)]
i = 0
j = 0
orient = (0, 1) # (0, 1)=left, (1, 0)=down, (0, -1)=right, (-1, 0)=up
while len(result) < m * n:
... |
class RequireTwoFactorException(Exception):
pass
class LoginFailedException(Exception):
pass
|
"""
python-social-auth application, allows OpenId or OAuth user
registration/authentication just adding a few configurations.
"""
version = (0, 1, 16)
extra = ''
__version__ = '.'.join(map(str, version)) + extra
|
### Default Pins M5Stack bzw. Mapping auf IoTKitV3.1 small
DEFAULT_IOTKIT_LED1 = 27 # ohne Funktion - internes Neopixel verwenden
DEFAULT_IOTKIT_BUZZER = 27 # ohne Funktion - internen Vibrationsmotor verwenden
DEFAULT_IOTKIT_BUTTON1 = 39 # Pushbotton A unter Touchscreen M5Stack
# Port A
DE... |
categories = [
(82, False, "player", "defense_ast", "Assist to a tackle."),
(91, False, "player", "defense_ffum", "Defensive player forced a fumble."),
(88, False, "player", "defense_fgblk", "Defensive player blocked a field goal."),
(60, False, "player", "defense_frec", "Defensive player recovered a fu... |
"""
https://leetcode.com/problems/container-with-most-water/
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such... |
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
"""
Stubs for testing cloudformation.py
"""
describe_stack = {
'Stacks': [{
'Outputs': [{
'OutputKey': "DeploymentFrameworkRegionalKMSKey",
'OutputValue': "some_key_arn"
... |
JAVA_EXEC_LABEL="//third_party/openjdk:java"
PHASICJ_AGENT_LABEL="//phasicj/agent:libpjagent"
RENAISSANCE_JAR_LABEL="//third_party/renaissance:jar"
RENAISSANCE_MAIN_CLASS="org.renaissance.core.Launcher"
PHASICJ_EXEC="//phasicj/cli"
EXTRA_PHASICJ_AGENT_OPTIONS="verbose"
def smoke_test_benchmark(name):
native.sh_tes... |
__author__ = """Christopher Bevan Barnett"""
__email__ = 'chrisbarnettster@gmail.com'
__version__ = '0.3.7'
|
def trace(func):
def wrapper():
func_name = func.__name__
print(f'Entering "{func_name}" function')
func()
print(f'Exiting from "{func_name}" function')
return wrapper
def say_hello():
print('Hello!')
say_hello = trace(say_hello)
say_hello()
|
# Copyright 2019 Erik Maciejewski
#
# 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 writi... |
bitcoin = int(input())
yuans = float(input())
commission = float(input()) / 100
bitcoin_lv = bitcoin * 1168
yuans_dollars = yuans * (0.15 * 1.76)
sum_lv = bitcoin_lv + yuans_dollars
sum_eur = sum_lv / 1.95
sum_eur = round(sum_eur - (commission * sum_eur), 2)
print(sum_eur)
|
"""The simplest data reader."""
for line in open('ice-cream.csv'):
row = line.split(',')
print(row)
|
description = 'Neutron Grating Interferometer'
group = 'optional'
tango_base = 'tango://antareshw.antares.frm2.tum.de:10000/antares/'
devices = dict(
G0rz = device('nicos.devices.entangle.Motor',
speed = 1,
unit = 'deg',
description = 'Rotation of G0 grating around beam direction',
... |
e = 2.718281828459045
"""
IEEE 754 floating-point representation of Euler's constant.
``e = 2.71828182845904523536028747135266249775724709369995...``
"""
inf = float('inf')
"""
IEEE 754 floating-point representation of (positive) infinity.
"""
nan = float('nan')
"""
IEEE 754 floating-point representation of Not a Nu... |
# -*- coding: utf-8 -*-
# coding: utf8
@auth.requires_membership('admin')
def index():
return locals()
@auth.requires_membership('admin')
def products():
products_grid = SQLFORM.grid(db.product, csv=False)
return locals()
@auth.requires_membership('admin')
def product_categories():
categories_grid... |
num = int(input("Insert some numbers: "))
even = 0
odd = 0
while num > 0:
if num%2 == 0:
even += 1
else:
odd += 1
num = num//10
print("Even numbers = %d, Odd numbers = %d" % (even,odd))
|
"""A board is a list of list of str. For example, the board
ANTT
XSOB
is represented as the list
[['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']]
A word list is a list of str. For example, the list of words
ANT
BOX
SOB
TO
is represented as the list
['ANT', 'BOX', 'SOB', 'TO']
"""
def is_v... |
# e é uma tupla (A,B) representando os coeficientes da RETA A*x + B
def solve1(A, B, x):
return A*x + B
# e é uma tupla (A,B,C) representando os coeficientes da PARABOLA A*x**2 + B*x + C
def solve2(A, B, C, x):
return A*x**2 + B*x + C |
def foo(x = []):
return x.append("x")
def bar(x = []):
return len(x)
foo()
bar()
class Owner(object):
@classmethod
def cm(cls, arg):
return cls
@classmethod
def cm2(cls, arg):
return arg
#Normal method
def m(self):
a = self.cm(0)
return a.cm2(1)
|
#sequence cleaner removes sequences that are ambiguous (6-mer appending the poly sequence is indefinite ("N") and shifts all "N" characters
#in poly sequence right so that they can be combined
def sequenceCleaner(string):
if len(string) < 13:
return "", 0
if string[5] == "*":
return "", 0
if string[len(string)-... |
# Copyright 2015 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 law ... |
def fibonaci(n):
if n <= 1:
return n
else:
return fibonaci(n-1)+fibonaci(n-2)
fibonaci(0) |
class Position:
def __init__(self, idx, ln, col, fn, ftxt) -> None:
self.idx = idx
self.ln = ln
self.col = col
self.fn = fn
self.ftxt = ftxt
def advance(self, current_char=None):
self.idx += 1
self.col += 1
if current_char == "\n":
se... |
def on_config():
# Here you can do all you want.
print("Called.")
def on_config_with_config(config):
print("Called with config.")
print(config["docs_dir"])
# You can change config, for example:
# config['docs_dir'] = 'other_directory'
# Optionally, you can return altered config to custom... |
lista = [12, 10, 7, 5]
lista_animal = ['cachorro', 'gato', 'elefante', 'lobo', 'arara']
lista_animal[0] = 'macaco' # a lista pode variar de valor, porém, a tupla não!!!!
print(lista_animal)
tupla = (1, 10, 12, 14)
print(len(tupla))
print(len(lista_animal))
tupla_animal = tuple(lista_animal)
print(type(tupla_animal))
... |
##########################################################################
# Copyright (c) 2018-2019 NVIDIA Corporation. 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
#... |
class Car(object):
condition = "new"
def __init__(self, model, color, mpg):
self.model = model
self.color = color
self.mpg = mpg
my_car = Car("Chevv", "GOLDEN", 1933)
print(my_car.model)
print(my_car.color)
print(my_car.mpg)
|
"""
Entradas
capital prestado-->float-->a
tiempo de interes-->int-->b
interes-->float-->c
Salidas
porcentaje de interes anual-->float-->d
"""
a=float(input("cual es la cantidad dde dinero prestado "))
b=int(input("cuantos años de interes tiene el prestamo "))
c=float(input("cual es la cantidad total del capital abonado... |
def validate(name, bracket, bracket_side, bfr):
"""
Check if bracket is lowercase
"""
return bfr[bracket.begin:bracket.end].islower()
|
"""
画出下列代码内存图
找出打印结果
"""
g01 = 100
g02 = 100
g03 = [100]
def func01():
g01 = 200# 创建一个局部变量
def func02():
global g02
g02 = 200
def func03():
g03[0] = 200 # 读取全局变量,修改列表元素
func01()
print(g01) # 100
func02()
print(g02) # 200
func03()
print(g03) # [200]
class MyClass:
cls01 = 300 # 饮水机
... |
def add(a, b) :
s = a + b
return s
#main app begins here
x = 2
y = 3
z = add(x, y)
print('Sum : ', z) |
print("--- TRIANGULO ---")
a = int(input("Digite o 1o. valor: "))
b = int(input("Digite o 2o. valor: "))
c = int(input("Digite o 3o. valor: "))
if a < b + c and b < a + c and c < a + b:
print("Esses valores podem formar um triângulo", end="")
if a == b == c :
print (" e esse triangulo é equilátero.")
... |
#service.process.factory.proc_provider_factories
class ProcProviderFactories(object):
def __init__(self, log):
self._log = log
self._factory = None
def get_factory(self, process):
#should instantiate the teradata factory
if self._factory is None:
tmp = __import__('s... |
# Time: ls: O(l + klogk), l is the path length, k is the number of entries in the last level directory
# mkdir: O(l)
# addContentToFile: O(l + c), c is the content size
# readContentFromFile: O(l + c)
# Space: O(n + s), n is the number of dir/file nodes, s is the total content size.
# Design an i... |
def get_input():
file = open('inputs/bubble_sort.txt')
input = file.read()
file.close()
return input
def bubble_sort(a, n):
swap_count = 0
is_sorted = False
while not is_sorted:
is_sorted = True
for i in range(n-1):
if a[i] > a[i + 1]:
temp = a[i... |
PROJECT_ID_LIST_URL = "https://cloudresourcemanager.googleapis.com/v1/projects"
HTTP_GET_METHOD = "GET"
class UtilBase(object):
def __init__(self, config):
self.config = config
self.__projectList = None
def getProjectList(self):
if self.__projectList != None:
return self._... |
NAME='logzmq'
CFLAGS = []
LDFLAGS = []
LIBS = ['-lzmq']
GCC_LIST = ['plugin']
|
test = {
'name': 'Problem EC',
'points': 2,
'suites': [
{
'cases': [
{
'code': r"""
>>> # Testing status parameters
>>> slow = SlowThrower()
>>> scary = ScaryThrower()
>>> SlowThrower.food_cost
4
>>> ScaryThrower.food_cost
... |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'chromium',
'chromium_android',
'depot_tools/bot_update',
'depot_tools/gclient',
]
def RunSteps(api):
api.gclient.set_config('chromium')... |
# class Tree:
# def __init__(self, val, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def solve(self, root):
if root:
root.left, root.right = self.solve(root.right), self.solve(root.left)
return root
|
products = ['bread','meat','egg','cheese']
file1 = open('products.txt','w')
for product in products:
file1.write(product+'\n')
file1.close()
file2= open('products.txt')
var = file2.readlines()
print(var)
|
def getMessage(status):
if status == 1:
print('status 1')
elif status == 2:
print('status 2')
elif status > 10:
print('status is more than 10')
else:
print('default message')
def isTrue(value):
if value:
print(str(value) + ' is true')
else:
print... |
class Layer(object):
def __init__(self):
self.prevlayer = None
self.nextlayer = None
def forepropagation(self):
pass
def backpropagation(self):
pass
def initialization(self):
pass
|
def collapse_sequences(message, collapse_char, collapsing = False):
if message == '':
return ''
# Approach 1:
prepend = message[0]
if prepend == collapse_char:
if collapsing:
prepend = ''
collapsing = True
else:
collapsing = False
return prepend ... |
class Solution:
def threeSumClosest(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
minval=100000
nums.sort()
for i in range(len(nums)):
#if i>0 and num[i]==num[i-1]:
# continue
le... |
# Zombie Damage Skin
success = sm.addDamageSkin(2434661)
if success:
sm.chat("The Zombie Damage Skin has been added to your account's damage skin collection.")
|
#
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... |
"""
Provides data for the ISO 3166-1 Country codes.
Reference:
https://en.wikipedia.org/wiki/ISO_3166
"""
countries = [
("afghanistan", "af", "afg", "004"),
("aland islands", "ax", "ala", "248"),
("albania", "al", "alb", "008"),
("algeria", "dz", "dza", "012"),
("american samoa", "as", "asm", "... |
def poscode2word(pos):
tag_des = {
'CC': 'Coordinating conjunction',
'CD': 'Cardinal number',
'DT': 'Determiner',
'EX': 'Existential',
'FW': 'Foreign word',
'IN': 'Preposition',
'JJ': 'Adjective',
'JJR': 'Adjective, comparative',
'JJS': 'Adject... |
"""
Faster R-CNN with DIOU Assigner
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.054
Average Precision (AP) @[ IoU=0.25 | area= all | maxDets=1500 ] = -1.000
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.113
Average Precision (AP) @[ IoU=0.75 |... |
def part1(arr):
s = 0
for v in arr:
s += v // 3 - 2
return s
def part2(arr):
s = 0
for v in arr:
fuel = v // 3 - 2
s += fuel
while fuel > 0:
fuel = fuel // 3 - 2
if fuel > 0:
s += fuel
return s
def day1():
arr = [
... |
BASE_JSON_PATH = '/home/mdd36/tools350/tools350/assembler/base_jsn'
BASE_JSON_LOCAL = '/Users/matthew/Documents/SchoolWork/TA/ECE350/2019s/350_tools_mk2/tools350/assembler/base_jsn'
class InstructionType:
def __init__(self, types: dict):
self._instruction_types: dict = types
def get_by_type(self, ty... |
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def inorder(root):
if root is None:
return ""
res = ""
res += inorder(root.left)
res += "{} ".format(root.data)
res += inorder(root.right)
return res
def all_subtree... |
test = {
'name': 'Problem 6',
'points': 1,
'suites': [
{
'cases': [
{
'answer': 'fd4dd892ccea3adcf9446dc4a9738d47',
'choices': [
r"""
Pair('quote', Pair(A, nil)), where:
A is the quoted expression
""",
r"""
... |
for i in range(int(input())):
sum = 0
y, x = map(int, input().split())
n = max(x,y)
sum += (n-1) * (n-1)
if n%2!=0:
sum += x + (n-y)
else:
sum += y + (n-x)
print(sum)
|
entries = [1, 2, 3, 4, 5]
print("all: {}".format(all(entries)))
print("any: {}".format(any(entries)))
print("Iterable with a 'False' value")
entries_with_zero = [1, 2, 0, 4, 5]
print("all: {}".format(all(entries_with_zero)))
print("any: {}".format(any(entries_with_zero)))
print()
print("Values interpreted as False i... |
n1 = float (input('Entre com a 1º nota: '))
n2 = float (input('Entre com a 2º nota: '))
r = (n1 + n2) /2
print ('A média do Aluno é: {:.1f}'.format(r))
|
# -*- coding: utf-8 -*-
#
# PySceneDetect: Python-Based Video Scene Detector
# ---------------------------------------------------------------
# [ Site: http://www.bcastell.com/projects/PySceneDetect/ ]
# [ Github: https://github.com/Breakthrough/PySceneDetect/ ]
# [ Documentation: http://py... |
class Solution(object):
def buddyStrings(self, A, B):
"""
:type A: str
:type B: str
:rtype: bool
"""
if len(A) != len(B):
return False
a, b, sa = [], [], set()
for i in range(0, len(A)):
if A[i] != B[i]:
a.append... |
class Solution(object):
def numJewelsInStones(self, J, S):
"""
:type J: str
:type S: str
:rtype: int
"""
if len(J)==0 or len(S)==0:
return 0
answer=0
J_set = set(J)
for char in S:
if char in J_set:
answer... |
class GetCashgramStatus:
end_point = "/payout/v1/getCashgramStatus"
req_type = "GET"
def __init__(self, *args, **kwargs):
self.cashgramId = kwargs["cashgramId"] |
def reduceNum(n):
print('{} = '.format(n), end='')
if not isinstance(n, int) or n <= 0:
print('请输入一个正确的数字 !')
exit(0)
elif n in [1]:
print('{}'.format(n))
while n not in [1]: # 循环保证递归
for index in range(2, n + 1):
if n % index == 0:
... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
将待加的数存储为单链表, 考察对单链表的使用
"""
... |
# ------------------------------
# 25. Reverse Nodes in k-Group
#
# Description:
# Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
# k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then l... |
description = 'Small Beam Limiter in Experimental Chamber 1'
group = 'optional'
devices = dict(
nbl_l = device('nicos.devices.generic.VirtualReferenceMotor',
description = 'Beam Limiter Left Blade',
lowlevel = True,
abslimits = (-250, 260),
unit = 'mm',
speed = 10,
... |
async def test_admin_auth(client, admin, user):
res = await client.get('/admin', follow_redirect=False)
assert res.status_code == 307
# Login as an simple user
res = await client.post('/login', data={'email': user.email, 'password': 'pass'})
assert res.status_code == 200
res = await client.get... |
# https://edabit.com/challenge/Yj2Rew5XQYpu7Nosq
# Create a function that returns the number of frames shown in a given number of minutes for a certain FPS.
def frames(minutes: int, fps: int) -> int:
try:
total_frames = (minutes * 60) * fps
return total_frames
except TypeError as err:
... |
"""
HTTP/1.0 301 Moved Permanently
Location: http://www.google.ca/
Content-Type: text/html; charset=UTF-8
Date: Wed, 03 Oct 2018 19:51:01 GMT
Expires: Fri, 02 Nov 2018 19:51:01 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 218
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
<HTML><... |
class Node():
def __init__(self, value):
self.value = value
self.next = None
class LinkedList():
def __init__(self):
self.head = None
def __str__(self):
current = self.head
output = ''
while current:
output += f"{ {str(current.value)} } ->"
... |
list_one = [1, 2, 3]
list_two = [4, 5, 6,7]
lst = [0, *list_one, *list_two]
print(lst)
country_lst_one = ['Finland', 'Sweden', 'Norway']
country_lst_two = ['Denmark', 'Iceland']
nordic_countries = [*country_lst_one, *country_lst_two]
print(nordic_countries)
|
input = """
a(1) | a(3).
a(2).
c(1,1).
c(1,3).
d(1,5).
b(X) :- a(X), c(Y,X).
ok :- #max{V :b(V)} < X, d(Y,X).
"""
output = """
a(1) | a(3).
a(2).
c(1,1).
c(1,3).
d(1,5).
b(X) :- a(X), c(Y,X).
ok :- #max{V :b(V)} < X, d(Y,X).
"""
|
offices=[]
expected_offices = ("Federal", "Legislative", "State", "Local Government")
class PoliticalOffice():
@staticmethod
def exists(name):
"""
Checks if an office with the same name exists
Returns a boolean
"""
for office in offices:
if office["name"] ==... |
"""
Queue.py
Description: This file contains the implementation of the queue data structure
"""
# The queue class is used to implement functionality of a queue using a list
class Queue:
# Default constructor
def __init__(self):
self.items = []
# Function used to tell us if the queue i... |
# https://www.codechef.com/problems/DEVARRAY
n,Q=map(int,input().split())
max1,min1,a=-99999999999,99999999999,list(map(int,input().split()))
for z in range(n): min1,max1 = min(min1,a[z]),max(max1,a[z])
for z in range(Q): print("Yes") if(int(input()) in range(min1,max1+1)) else print("No") |
"""Task:"""
# Imports --------------------------------------------------------------
# Classes --------------------------------------------------------------
# Functions ------------------------------------------------------------
# Methods --------------------------------------------------------------
# Defin... |
# Hash Table
# A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leetcode.com". When we visit a domain like "discuss.leetcode.com", we will also visit the parent domains "leetcode.co... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Real estate.
"""
__version__ = '4.0'
content = {
'real-estate_headline': ['<#realestate_shortheadline#>'],
'realestate_headline': ['<#realestate_shortheadline#>'],
'realestate_section': ['<#realestate_type#>'],
'realestate_shorthead... |
class Solution(object):
def singleNonDuplicate(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 1:
return nums[0]
st = 0
ed = len(nums) - 1
if nums[st] != nums[st + 1]:
return nums[st]
if nums[ed] !... |
_base_ = [
'../_base_/default_runtime.py', '../_base_/datasets/coco_detection.py'
]
# model settings
model = dict(
type='CenterNet',
pretrained='torchvision://resnet18',
backbone=dict(
type='ResNet',
depth=18,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages... |
class CTX:
"""
Global Class holding the configuration of the backward pass
"""
active_exts = tuple()
debug = False
@staticmethod
def set_active_exts(active_exts):
CTX.active_exts = tuple()
for act_ext in active_exts:
CTX.active_exts += (act_ext,)
@staticmet... |
"""
Exercício Python 25: Crie um programa que leia o nome de uma pessoa e diga se ela tem “SILVA” no nome.
"""
print('-' * 40)
print(f'{"Tem SILVA no nome":^40}')
print('-' * 40)
nome = str(input("Digite seu nome completo: "))
nome = nome.split()
if nome == "silva" or nome == "Silva":
print(f"Este nome tem SILVA... |
# Copyright (c) 2012 OpenStack, LLC.
#
# 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 wr... |
# tuplas
# O conjunto de dados não podem ser alterados
tupla = (10,12,13,15,18,20)
print(tupla)
print(tupla[1])
print(tupla[1:3])
# Código abaixo gera exceção pois a tupla não permite alteração
# tupla[1] = 88
# Crinando tuplas com tipos de dados diferentes, incluindo listas
tupla_aluno = ('Maykon','Diego',15,[10,8,... |
class HostVisual(ContainerVisual,IResource):
"""
Represents a System.Windows.Media.Visual object that can be connected anywhere to a parent visual tree.
HostVisual()
"""
def AddVisualChild(self,*args):
"""
AddVisualChild(self: Visual,child: Visual)
Defines the parent-child relationship between... |
# Python Program to subtract two numbers
# Store input numbers
num1 = input("Enter first number: ")
num2 = input("Enter second number: ")
# Sub two numbers
sub = float(num1) - float(num2)
# Display the sub
print("The sub of {0} and {1} is {2}".format(num1, num2, sub))
|
BACKTEST_FLOW_OK = {
"nodeList": {
"1": {
"blockType": "DATA_BLOCK",
"blockId": 1,
"equity_name": {"options": ["AAPL"], "value": ""},
"data_type": {"options": ["intraday", "daily_adjusted"], "value": ""},
"interval": {"options": ["1min"], "value": ... |
numbers = [14, 2,3,4,5,6,7,6,5,7,8,8,9,10,11,12,13,14,14]
numbers2 =[]
for number in numbers:
if number not in numbers2:
numbers2.append(number)
print(numbers2) |
def solution(n: int) -> int:
b = to_bin(n)
if len(b) < 3:
return 0
gaps = []
gap_count = 0
for i in range(len(b)):
if b[i] == "1":
# gap stop. save gap and start counting again
gaps.append(gap_count)
# reset gap count
gap_count = 0
... |
class MyClass:
print('MyClass created')
# instansiate a class
my_var = MyClass()
print(type(my_var))
print(dir(my_var)) |
"""Provides a redirection point for platform specific implementations of starlark utilities."""
load(
"//tensorflow/core/platform:default/build_config.bzl",
_pyx_library = "pyx_library",
_tf_additional_all_protos = "tf_additional_all_protos",
_tf_additional_binary_deps = "tf_additional_binary_deps",
... |
"""Should raise SyntaxError: name 'cc' is assigned to prior to global declaration
"""
aa, bb, cc, dd = 1, 2, 3, 4
def fn():
cc = 1
global aa, bb, cc, dd
|
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. #
# All rights reserved. #
# This file is part of the Masci-tools package. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.