content stringlengths 7 1.05M |
|---|
print('\033[32;1mDESAFIO 59 - Analise de Dados em uma Tuplas\033[m')
print('\033[32;1mALUNO:\033[m \033[36;1mJoaquim Fernandes\033[m')
print('-' * 80)
num = (int(input('Digite um número: ')),
int(input('Digite outro número: ')),
int(input('Digite mais um número: ')),
int(input('Digite último númer... |
"""Configuration information for an AgPipeline Transformer
"""
class Configuration:
"""Contains configuration information on Transformers
"""
# Silence this error until we have public methods
# pylint: disable=too-few-public-methods
# The version number of the transformer
transformer_version =... |
n1 = float(input('Primeira nota: '))
n2 = float(input('Segunda aula: '))
m = (n1 + n2) / 2
print(f'Sua média foi {m}.')
if m < 5:
print('REPROVADO!')
elif m == 5 or m <= 6.9:
print('RECUPERAÇÃO!')
else:
print('APROVADO!')
|
# Copyright (c) 2017, Matt Layman
class AbortError(Exception):
"""Any fatal errors that would prevent handroll from proceeding should
signal with the ``AbortError`` exception."""
|
"""Strip .HTML extension from URIs."""
def process(app, stream):
for item in stream:
# Most modern HTTP servers implicitly serve one of these files when
# requested URL is pointing to a directory on filesystem. Hence in
# order to provide "pretty" URLs we need to transform destination
... |
#
# Font compiler
#
fonts = [ None ] * 64
current = -1
for l in open("font.txt").readlines():
print(l)
if l.strip() != "":
if l[0] == ':':
current = ord(l[1]) & 0x3F
fonts[current] = []
else:
l = l.strip().replace(".","0").replace("X","1")
assert len(l) == 3
fonts[current].append(int(l,2))
for i ... |
"""Classes used in warehouse"""
class ItemSet:
"""A set of identical items.
The dimensions is a tuple (x, y, z) of the dimensions of a single item.
The weight is a weight of a single member"""
def __init__(self, dimensions, weight, ref_id, quantity, colour):
self.dimensions = dimensions
... |
# Read a DNA Sequence
def readSequence():
sequence = open(raw_input('Enter sequence filename: '),'r')
sequence.readline()
sequence = sequence.read().replace('\n', '')
return sequence
def match(a, b):
if a == b:
return 1
else:
return -1
# Align two sequences using Smith-Waterman algorithm
def alignSequences(... |
distance = int(input('Qual vai ser a distância da sua viagem? '))
if distance <= 200:
print(f'O preço da passagem será R${distance*0.5:.2f}')
else:
print(f'O preço da passagem será R${distance*0.45:.2f}') |
def flip(arr, i):
start = 0
while start < i:
temp = arr[start]
arr[start] = arr[i]
arr[i] = temp
start += 1
i -= 1
def findMax(arr, n):
mi = 0
for i in range(0,n):
if arr[i] > arr[mi]:
mi = i
return mi
def pancakeSort(arr, n):
curr_size = n
while curr_size > 1:
mi = findMax(arr, curr_size)
i... |
n = int(input())
s = []
while n != 0:
n -= 1
name = input()
s.append(name)
r = input()
for i in range(len(s)):
if r in s[i]:
while r in s[i]:
s[i] = s[i].replace(r, "")
max_seq = ""
for i in range(len(s[0])):
ans = ""
for j in range(i, len(s[0])):
ans... |
class EnvMap(object):
"""EnvMap object used to load and render map from file"""
def __init__(self, map_path):
super(EnvMap, self).__init__()
self.map_path = map_path
self.load_map()
def get_all_treasure_locations(self):
treasure_locations = []
for row in range(len... |
testArray = [1, 2, 3, 4, 5]
testString = 'this is the test string'
newString = testString + str(testArray)
print(newString) |
class Solution:
def alienOrder(self, words: List[str]) -> str:
"""
Approach:
1. Make a graph according to the letters order, comparing to adjacent words
2. Find Topological order based on the graph
Examples:
["ba", "bc", "ac", "cab"]
... |
"""
https://leetcode.com/problems/find-lucky-integer-in-an-array/
Given an array of integers arr, a lucky integer is an integer which has a frequency in the array equal to its value.
Return a lucky integer in the array. If there are multiple lucky integers return the largest of them. If there is no lucky integer retur... |
def load_sensitivity_study_file_names(design):
"""
Parameters
----------
design: Name of design
Returns experiment files names of a design
-------
"""
file_names = {}
if design == 'NAE-IAW':
path = '../Files_Results/Sensitivity_Study/NAE-IAW/'
file_names['FILE_Mea... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
class DepthInfo:
# The default depth that we travel before forcing a foreign key attribute
DEFAULT_MAX_DEPTH = 2
# The max depth set if the user specif... |
class Solution:
def isMatch(self, text, pattern):
if not pattern:
return not text
first_match = bool(text) and pattern[0] in {text[0], '.'}
if len(pattern) >= 2 and pattern[1] == '*':
return (self.isMatch(text, pattern[2:]) or
first_match and sel... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Associations Management',
'version': '0.1',
'category': 'Marketing',
'description': """
This module is to configure modules related to an association.
=========================================... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class SnapKorf(MakefilePackage):
"""SNAP is a general purpose gene finding program suitable for both
eukaryoti... |
def format_sql(table, obj: dict) -> str:
cols = ','.join(obj.keys())
values = ','.join(obj.values())
sql = "insert into {table} ({cols}) values ({values})".format(table=table, cols=cols, values=values)
return
def format_sqls(table, objs: list) -> str:
obj = objs.__getitem__(0)
cols = ','.join(... |
# 문제: 238. Product of Array Except Self
# 링크: https://leetcode.com/problems/product-of-array-except-self/
# 시간/공간: 248ms / 22.4MB
class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
n = len(nums)
# 앞에서 부터 시작해 누적곱 계산
left = [nums[0]]
for i in range(1, n):
... |
# Head ends here
def next_move(posr, posc, board):
p = 0
q = 0
dmin = 0
dmax = 0
position = 0
for i in range(5) :
count = 0
for j in range(5) :
if board[i][j] == "d" :
count += 1
if count == 1 :
dmax ... |
class Person:
def __init__(self, name):
self.name = name
# create the method greet here
def greet(self):
print(f"Hello, I am {self.name}!")
in_name = input()
p = Person(in_name)
p.greet()
|
load("@wix_oss_infra//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "org_xerial_snappy_snappy_java",
artifact = "org.xerial.snappy:snappy-java:1.1.7.1",
artifact_sha256 = "bb52854753feb1919f13099a53475a2a8eb65db... |
'''from flask import render_template
from flask import Response
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return render_template('streaming2.html')
def generate(camera):
while True:
frame = camera.get_frame()
yield (b'--frame\r\n'
b'Content-Type: image/jpg\r\n\r\n' + frame ... |
#Função verifica se é par ou impar
numero=int(input('Digite um número: '))
def Ehpar(numero):
if(numero%2==0):
return True
else:
return False
print('Portanto, o número digitado é par? ', Ehpar(numero)) |
class AbBuildUnsuccesful(Exception):
""" Build was not successful """
def __init__(self, msg, output):
self.msg = msg
self.output = output
def __str__(self):
return "%s" % self.msg
|
class StreamQueue:
repeat = False
current = None
streams = []
def next(self):
if self.repeat and self.current is not None:
return self.current
self.current = None
if len(self.streams) > 0:
self.current = self.streams.pop(0)
return self.curre... |
# GCD, LCM
"""
T = int(input())
def lcm(x, y):
if x > y:
greater = x
else:
greater = y
while True:
if greater % x == 0 and greater % y == 0:
lcm = greater
break
greater += 1
return lcm
for _ in range(T):
M, N, x, y = map(int(), input().split(... |
transformers = [
{
'id': 1,
'category': 'Feature Extractors',
'transformer': 'Dictionary Vectorizer',
'description': 'The class DictVectorizer can be used to convert feature arrays represented as lists of standard Python dict objects to the NumPy/SciPy representation used by scikit-l... |
def Move():
global ArchiveIndex, gameData
playerShip.landedBefore = playerShip.landedOn
playerShip.landedOn = None
for Thing in PlanetContainer:
XDiff = playerShip.X - Thing.X
YDiff = playerShip.Y + Thing.Y
Distance = (XDiff ** 2 + YDiff ** 2) ** 0.5
if Distance > 40000:
... |
"""
>= 0.9 A
>= 0.8 B
>= 0.7 C
>= 0.6 D
< 0.6 F
"""
score = input("Enter Score: ")
try:
s = float(score)
except:
print("please enter numeric numbers")
quit()
if s>1.0 or s< 0.0:
print("value out of range! please enter number btw 1.0 and 0.0")
elif s >= 0.9:
print("A")
elif s >=0.8:
print("B")... |
def names(l):
# list way
new = []
for i in l:
if not i in new:
new.append(i)
# set way
new = list(set(l))
print(new)
names(["Michele", "Robin", "Sara", "Michele"]) |
"""
https://leetcode.com/problems/find-the-difference/
Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Input:
s = "abcd"
t = "abcde"
Output:
e
Explanation:... |
mylist = [1, 2, 3]
# Imprime 1,2,3
for x in mylist:
print(x)
|
#Faça um programa que calcule a soma entre todos os números impares que são multiplos de três e que se encontram no intervalo de 1 até 500
ac = 0
cont = 0
for i in range(1,501,2):
if i % 3 == 0:
ac += i
cont += 1
print(i, end = ' ')
print('A Soma de todos os {} valores solicitados é {}'.f... |
"""
141. Linked List Cycle
"""
class Solution(object):
def hasCycle(self, head):
"""
:type head: ListNode
:rtype: bool
"""
slow = fast = head
while fast and fast.next:
fast = fast.next.next
slow = slow.next
if slow ... |
#Print without newline or space
print("\n")
for j in range(10):
print("")
for i in range(10):
print(' @ ', end="")
print("\n") |
class Entry:
def __init__(self, obj, line_number = 1):
self.obj = obj
self.line_number = line_number
def __repr__(self):
return "In {}, line {}".format(self.obj.name, self.line_number)
class CallStack:
def __init__(self, initial = None):
self.__stack = [] if not initial e... |
class BaseConfig():
API_PREFIX = '/api'
TESTING = False
DEBUG = False
SECRET_KEY = '@!s3cr3t'
AGENT_SOCK = 'cmdsrv__0'
class DevConfig(BaseConfig):
FLASK_ENV = 'development'
DEBUG = True
CELERY_BROKER = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
REDIS_UR... |
while True:
x,y=map(int,input().split())
if x==0 and y==0:
break
print(x+y)
|
def encode(json, schema):
payload = schema.Main()
payload.github = json['github']
payload.patreon = json['patreon']
payload.open_collective = json['open_collective']
payload.ko_fi = json['ko_fi']
payload.tidelift = json['tidelift']
payload.community_bridge = json['community_bridge']
payl... |
#!/usr/local/bin/python3
"""
This is written by Zhiyang Ong to try out Solutions 1-4
from [Sceenivasan, 2017].
Reference for Solutions 1, 2, 3, and 4 [Sceenivasan, 2017]:
Sreeram Sceenivasan, "How to implement a switch-case statement
in Python: No in-built switch statement here," from JAXenter.com,
Software ... |
# Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking.
#
# Your class will have the method, book(int start, int end). Formally, this represents a booking on the half open interval [start, end), the range of real numbers x such that start <= x <... |
#!/usr/bin/python3
OPENVSWITCH_SERVICES_EXPRS = [r"ovsdb-\S+",
r"ovs-vswitch\S+",
r"ovn\S+"]
OVS_PKGS = [r"libc-bin",
r"openvswitch-switch",
r"ovn",
]
OVS_DAEMONS = {"ovs-vswitchd":
{"logs": "var/log/openvswit... |
#!/usr/bin/env python3
inputs = {}
reduced = {}
with open("input.txt") as f:
for line in f:
inp, to = map(lambda x: x.strip(), line.split("->"))
inputs[to] = inp.split(" ")
inputs["b"] = "956"
def reduce(name):
try:
return int(name)
except:
pass
try:
return int(... |
LCGDIR = '../lib/sunos5'
LIBDIR = '${LCGDIR}'
BF_PYTHON = '/usr/local'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/c... |
""" Connected client statistics """
class Statistics(object):
""" A connected client statistics """
def __init__(self, downspeed, online, upspeed):
self._downspeed = downspeed
self._online = online
self._upspeed = upspeed
def get_downspeed(self):
return self._downspeed
... |
t=input()
while(t>0):
s=raw_input()
str=s.split(' ')
b=int(str[0])
c=int(str[1])
d=int(str[2])
print (c-b)+(c-d)
t=t-1
|
def generate_shared_public_key(my_private_key, their_public_pair, generator):
"""
Two parties each generate a private key and share their public key with the
other party over an insecure channel. The shared public key can be generated by
either side, but not by eavesdroppers. You can then use the entrop... |
__version__ = "0.1"
__requires__ = [
"apptools>=4.2.0",
"numpy>=1.6",
"traits>=4.4",
"enable>4.2",
"chaco>=4.4",
"fiona>=1.0.2",
"scimath>=4.1.2",
"shapely>=1.2.17",
"tables>=2.4.0",
"sdi",
]
|
# A plugin is supposed to define a setup function
# which returns the type that the plugin provides
#
# This plugin fails to do so
def useless():
print("Hello World")
|
""" This module is deprecated and has been moved to `//toolchains/built_tools/...` """
load("//foreign_cc/built_tools:ninja_build.bzl", _ninja_tool = "ninja_tool")
load(":deprecation.bzl", "print_deprecation")
print_deprecation()
ninja_tool = _ninja_tool
|
class Number:
def numSum(num):
count = []
for x in range(1, (num+1)):
count.append(x)
print(sum(count))
if __name__ == "__main__":
num = int(input("Enter A Number: "))
numSum(num)
|
num = int(input('Digite um numero inteiro: '))
print('''Escolha um das bases de conversão:
[ 1 ] converter para BINÁRIO
[ 2 ] converter para OCTAL
[ 3 ] converter para HEXADECIMAL ''')
opção = int(input('Sua opção: '))
if opção == 1:
print('{} convertido para BINÁRIO é igual a {}' .format(num, bin(num) [2:]))
elif ... |
logging.info(" *** Step 3: Build features *** ".format())
# %% ===========================================================================
# Feature - Pure Breed Boolean column
# =============================================================================
def pure_breed(row):
# print(row)
mixed_breed_keywords... |
aws_access_key_id=None
aws_secret_access_key=None
img_bucket_name=None
|
# -*- coding: utf-8 -*-
"""Deep Go Patterns
======
Design Patterns
"""
|
"""
Python 字典测试
"""
dict = {'name':'goujinping','age':'21','sex':'man','school':'NEFU'}
print(dict)
print(dict['age']) #通过键访问相应的值
print(dict['name'])
for key in dict.keys(): #访问字典的键 dict2.keys(),返回一个列表
print(key)
for value in dict.values(): #访问字典的值 dict2.values(), 返回一个列表
print(value)
del dict['sex'] #删除字典元素... |
# -*- coding: utf-8 -*-
# Copyright © 2014 Cask Data, 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... |
def get_tickets(path):
with open(path, 'r') as fh:
yield fh.read().splitlines()
def get_new_range(_min, _max, value):
# print(_min, _max, value)
if value == 'F' or value == 'L':
mid = _min + (_max - _min) // 2
return (_min, mid)
if value == 'B' or value == 'R':
mid = _m... |
"""
About this package
"""
__version__ = '0.1.0'
__description__ = 'Python3 client code for ec_golanggrpc'
__author__ = 'Paul Hewlett'
__author_email__ = 'phewlett76@gmail.com'
__license__ = 'MIT'
|
class CrawlerCodeDTO(object):
"""
Object that contains grouped all data of the code
"""
def __init__(self, id, libs, comments, variable_names, function_names, class_name, lines_number, code):
self.id = id
self.libs = libs if len(libs) > 0 else []
self.comments = comments if ... |
def cls_with_meta(mc, attrs):
class _x_(object):
__metaclass__ = mc
for k, v in attrs.items():
setattr(_x_, k, v)
return _x_
|
num = int(input('Digite um valor para saber seu fatorial: '))
d = num
for c in range(num-1,1,-1):
num += (num * c) - num
print('Calculando {}! = {}.'.format(d, num)) |
class Solution:
def partition(self, head: ListNode, x: int) -> ListNode:
head = ListNode(0, head)
p1, prev, p2 = head, head, head.next
while p2:
if p2.val < x:
if p1 == prev:
prev, p2 = p2, p2.next
else:
... |
# Să se unifice două dicționare în care cheile sunt șiruri de caractere, iar valorile sunt de tip numeric.
# Astfel, în rezultat va apărea fiecare cheie distinctă, iar pentru o cheie care apare în ambele dicționare inițiale
# valoarea corespunzătoare va fi egală cu suma valorilor asociate cheii respective în cele două ... |
#
# PySNMP MIB module BLUECOAT-HOST-RESOURCES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BLUECOAT-HOST-RESOURCES-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:39:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... |
animales = ['Perro','Gato','Hamster','Conejo','Raton']
for animal in animales:
print(animal)
print('Un '+animal.title()+' sería una maravillosa mascota')
print('Cualquiera de estos animales sería una mascota fantastica')
print('//////////////////////////')
print("Los primeros tres elementos de la lista son:... |
t = {}
t["0"] = ["-113", "Marginal"]
t["1"] = ["-111", "Marginal"]
t["2"] = ["-109", "Marginal"]
t["3"] = ["-107", "Marginal"]
t["4"] = ["-105", "Marginal"]
t["5"] = ["-103", "Marginal"]
t["6"] = ["-101", "Marginal"]
t["7"] = ["-99", "Marginal"]
t["8"] = ["-97", "Marginal"]
t["9"] = ["-95", "Marginal"]
t["10"] = ["-93"... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
class Solution:
def longestWPI(self, hours: List[int]) -> int:
acc = 0
seen = {0 : -1}
mx_len = 0
for i, h in enumerate(hours):
if h > 8:
acc += 1
else:
acc -= 1
if acc > 0:
mx_len = i + 1
... |
#log in process
def login():
Username = input("Enter Username : ")
if Username == 'betterllama' or NewUsername:
Password = input("Enter Password : ")
else:
print("Username Incorrect")
if Password == 'omoshi' or NewPassword:
print("Welcome, " + Username)
else:
print("Password is incorrect")
#sign up + log... |
# You are given a set of n rectangles in no particular order. They have varying
# widths and heights, but their bottom edges are collinear, so that they look
# like buildings on a skyline. For each rectangle, you’re given the x position of
# the left edge, the x position of the right edge, and the height. Your task is
... |
# -*- coding: utf8 -*-
def js_test():
pass |
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# This example will open a file and read it line by line, process each line,
# and write the processed line to standard out.
# -----------------------------------------------------------------------------
# Open a fil... |
"""
107. Word Break
https://www.lintcode.com/problem/word-break/description?_from=ladder&&fromId=160
DFS on dictionary
"""
class Solution:
"""
@param: s: A string
@param: dict: A dictionary of words dict
@return: A boolean
"""
def wordBreak(self, s, dict):
return self.dfs(s, dict, 0)... |
# A binary search template
"""
left, right = 0, len(array) - 1
while left <= right:
mid = left + (right - left) // 2
if array[mid] == target:
break or return result
elif array[mid] < target:
left = mid + 1
else:
right = mid - 1
""" |
class Solution:
def reverse(self, x: int) -> int:
if x == 0:
return 0
if x < -(2 ** 31) or x > (2 ** 31) - 1:
return 0
newNumber = 0
tempNumber = abs(x)
while tempNumber > 0:
newNumber = (newNumber * 10) + tempNumber % 10
te... |
good = 0
good_2 = 0
with open("day2.txt") as f:
for line in f.readlines():
parts = line.strip().split()
print(parts)
cmin, cmax = [int(i) for i in parts[0].split('-')]
letter = parts[1][0]
pwd = parts[2]
print(cmin, cmax, letter, pwd)
count = pwd.count(letter... |
description = 'PUMA multianalyzer device'
group = 'lowlevel'
includes = ['aliases']
level = False
devices = dict(
man = device('nicos_mlz.puma.devices.PumaMultiAnalyzer',
description = 'PUMA multi analyzer',
translations = ['ta1', 'ta2', 'ta3', 'ta4', 'ta5', 'ta6', 'ta7', 'ta8',
... |
# https://leetcode-cn.com/problems/bomb-enemy/
# 想象一下炸弹人游戏,在你面前有一个二维的网格来表示地图,网格中的格子分别被以下三种符号占据:
#
# 'W' 表示一堵墙
# 'E' 表示一个敌人
# '0'(数字 0)表示一个空位
#
# 请你计算一个炸弹最多能炸多少敌人。
#
# 由于炸弹的威力不足以穿透墙体,炸弹只能炸到同一行和同一列没被墙体挡住的敌人。
#
# 注意:
# 你只能把炸弹放在一个空的格子里
#
# 示例:
# 输入: [["0","E","0","0"],["E","0","W","E"],["0","E","0","0"]]
# 输出: 3
# 解释: ... |
class Solution:
def longestPalindrome(self, s: str) -> str:
if not s:
return None
result = ''
maxPal = 0
record = [[0] * len(s) for i in range(len(s))]
for j in range(len(s)):
for i in range(j+1):
record[i][j] = ((s[i] == s[j]) and (j-i... |
"""
entrada
nombre-->str-->n
horas_trabajadas-->int-->ht
precio_hora_normal-->int-->phn
horas _extras-->int-->hx
#hijos-->int-->hi
salidas
asignaciones-->str-->asi
deducciones-->str-->dd
sueldo_neto-->str-->sn
"""
n=str(input("escriba el nombre del trabador "))
ht=int(input("digite la cantidad de horas trabajadas "))
p... |
__author__ = 'Liu'
def quadrado_menores(n):
return [i ** 2 for i in range(1, n + 1) if i ** 2 <= n]
assert [1] == quadrado_menores(1)
assert [1, 4] == quadrado_menores(4)
assert [1, 4, 9] == quadrado_menores(9)
assert [1, 4, 9] == quadrado_menores(11)
def soma_quadrados(n):
if n > 0:
menores = quadrad... |
try:
pass
except ImportError:
pass
if False:
pass
class GraphQLSchema(object):
"""Schema Definition
A Schema is created by supplying the root types of each type of operation, query and mutation (optional).
A schema definition is then supplied to the validator and executor.
Example:
MyAppSchema =... |
a = 1
if a == 1:
print("ok")
else:
print("no")
py_builtins = 1
if py_builtins == 1:
print("ok")
else:
print("no")
for py_builtins in range(5):
a += py_builtins
print(a)
|
lista_notas = []
for x in range(4):
lista_notas.append(int(input("Me de um número ae meu chapa\n")))
media = 0
for nota in lista_notas:
media += nota / 4
print("Media: ", media)
|
""" html head """
def get_head(content):
""" xxx """
return_data = '<head>'+ content +'</head>'
return return_data
|
"""Exceptions for ReSpecTh Parser.
.. moduleauthor:: Kyle Niemeyer <kyle.niemeyer@gmail.com>
"""
class ParseError(Exception):
"""Base class for errors."""
pass
class KeywordError(ParseError):
"""Raised for errors in keyword parsing."""
def __init__(self, *keywords):
self.keywords = keywords... |
#Crie um programa onde o usuário possa digitar vários valores numéricos e cadastre-os em uma lista. Caso o #número já exista lá dentro, ele não será adicionado. No final, serão exibidos todos os valores únicos #digitados, em ordem crescente.
valores=[]
while True:
digitado=(int(input("Digite o valor: ")))
... |
# encoding: UTF-8
{
"name":u'CoMPS',
'version': '1.0',
'category': u'Saúde',
'depends':[],
'data':[
'views/qweb/comps_template.xml',
'security/comps_security.xml',
'security/ir.model.access.csv',
'views/cadastro_usuarios_view.xml',
'views/cadastro_e... |
"""
digit factorial chains
"""
factorial = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880]
def next_number(n):
factorial_sum = 0
while n != 0:
factorial_sum += factorial[n % 10]
n //= 10
return factorial_sum
def chain_len(n):
chain = []
while not chain.__contains__(n):
cha... |
flag = [""] * 36
flag[0] = chr(0x46)
flag[1] = chr(0x4c)
flag[2] = chr(0x41)
flag[3] = chr(0x47)
flag[4] = chr(0x7b)
flag[5] = chr(0x35)
flag[6] = chr(0x69)
flag[7] = chr(0x6d)
flag[8] = chr(0x70)
flag[9] = chr(0x31)
flag[10] = chr(0x65)
flag[11] = chr(0x5f)
flag[12] = chr(0x52)
flag[13] = chr(0x65)
flag[14] = chr(0x7... |
def code_function():
#function begin############################################
global code
code="""
class {0}_scoreboard extends uvm_scoreboard;
//---------------------------------------
// declaring pkt_qu to store the pkt's recived from monitor
//---------------------------------------
... |
uno= Board('/dev/cu.wchusbserial1420')
led= Led(13)
led.setColor([0.84, 0.34, 0.67])
ledController= ExdTextInputBox(target= led, value="period", size="sm")
APP.STACK.add_widget(ledController)
|
a, b = map(int, input().split())
if a + b == 15:
print('+')
elif a*b == 15:
print('*')
else:
print('x')
|
class Solution:
def stoneGameV(self, stoneValue: List[int]) -> int:
n = len(stoneValue)
dp = [[0] * n for _ in range(n)]
mx = [[0] * n for _ in range(n)]
for i in range(n):
mx[i][i] = stoneValue[i]
for j in range(1, n):
mid = j
s = stoneVal... |
# %% [404. Sum of Left Leaves](https://leetcode.com/problems/sum-of-left-leaves/)
class Solution:
def sumOfLeftLeaves(self, root: TreeNode) -> int:
if not root:
return 0
r = self.sumOfLeftLeaves(root.right)
if (p := root.left) and not p.left and not p.right:
return ro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.