content stringlengths 7 1.05M |
|---|
print('>>> DEPARTAMENTO ESTADUAL DE METEOROLOGIA <<<')
print('Informe a temperatura ou digite 0 para finalizar!')
c = 0
temp = 1
tot_temp = 0
while temp != 0:
c += 1
temp = float(input(f'- Temperatura {c}: '))
tot_temp += temp
if c == 1:
maior = temp
else:
if temp > maior... |
# helpers.py
def url_join(*args, end_slash = True):
strip_args = [str(a).rstrip("/") for a in args]
url = "/".join(strip_args)
if end_slash and not url.endswith("/"):
url = url + "/"
return url
|
class Rectangle:
def __init__(self, dx, dy): # 初期化関数
self.dx = dx
self.dy = dy
def cal_area(self): # 面積を計算する関数
self.area = self.dx * self.dy
return self.area |
ALL_DOMAINS = ["餐馆", "酒店", "景点", "出租", "地铁"]
INFORMABLE_SLOTS = {
"餐馆": ["名称", "评分", "人均消费", "推荐菜", "周边酒店", "周边景点", "周边餐馆"],
"酒店": ["名称", "评分", "价格", "酒店类型", "酒店设施", "周边酒店", "周边景点", "周边餐馆"],
"景点": ["名称", "评分", "门票", "游玩时间", "周边酒店", "周边景点", "周边餐馆"],
"出租": ["目的地", "出发地"],
"地铁": ["目的地", "出发地"],
}
BOS... |
#
# Copyright (c) 2010-2016, Fabric Software Inc. All rights reserved.
#
class DirQualTypeInfo:
def __init__(self, dir_qual, type_info):
self.dir_qual = dir_qual
self.type_info = type_info
@property
def dq(self):
return self.dir_qual
@property
def ti(self):
return self.type_info
def g... |
grade = 95
if grade >= 90:
print("A")
elif grade >= 80:
print("B")
elif grade >= 70:
print("C")
elif grade >= 60:
print("D")
else:
print("F") |
def gen_src(count):
for i in range(1, count):
data = "".join(["%d" % x for x in range(1, 10000)])
native.genrule(
name = "generated_class_%d" % i,
out = "Class%d.java" % i,
bash = "echo -e 'package gen;\npublic class Class%d { static String data = \"%s\"; }' > $OU... |
##Exemplo retirado do site http://code.tutsplus.com/tutorials/beginning-test-driven-development-in-python--net-30137
##//lhekheklqhlekhqkehqkehqkhelqw
##//ljkfhjdhfjkdhfkjlsdhlfkhslkjkljdflksgflsgdf
##//lkhdsklfskfgshgfsjhgfs
class Calculator(object):
def add(self, x, y):
number_types = (int, float, compl... |
'''
Prompt:
Write a function bestSum(targetSum, numbers) that takes
in a targetSum and an array of numbers as arguments.
The function should return an array containing the
shortest combination of numbers that add up to exactly the targetSum.
If there is a tie for the shotest combination, you may return any of the sh... |
apps_details = [
{
"app": "Learning xc functional from experimental data",
"repo": "https://github.com/mfkasim1/xcnn", # leave blank if no repo available
# leave blank if no paper available, strongly suggested to link to open-access paper
"paper": "https://arxiv.org/abs/2102.04229",... |
class TempChDir:
"""
Context manager to step into a directory temporarily. Use in a `with` block:
with TempChDir(path):
...do stuff...
This automatically changes cwd if necessary, upon entry of the block, and
changes it back on exit. Note that if `path` is ".", this is
... |
class ChainMap:
def __init__(self, *maps):
if maps:
self.maps = list(maps)
else:
self.maps = [{}]
def __getitem__(self, k):
for m in self.maps:
if k in m:
return m[k]
raise KeyError(k)
def __setitem__(self, k, v):
... |
#
# PySNMP MIB module BDCOM-FLASH (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BDCOM-FLASH
# Produced by pysmi-0.3.4 at Wed May 1 11:36:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... |
# https://www.codewars.com/kata/human-readable-duration-format
def format_duration(seconds):
if not seconds:
return "now"
units = [
("year", 365 * 24 * 60 * 60),
("day", 24 * 60 * 60),
("hour", 60 * 60),
("minute", 60),
("second", 1)
]
parts = []
... |
class RotationMatrix(object):
def __init__(self, M, N, entries):
self.M, self.N = M, N
self.entries = dict(entries)
self.tier_index = self._create_tier_index()
def __str__(self):
string = ""
for i in range(self.M):
for j in range(self.N):
... |
""" GLSL code to render colored glyphs:\
:download:`[source] <../../../litGL/glsl_base_c.py>`
GLSL shader code based on the following public sources:
- Journal paper: Eric Lengyel, GPU-Centered Font Rendering Directly from Glyph
Outlines, Journal of Computer Graphics Techniques (JCGT), vol. 6, no. 2,
31... |
__version__ = "0.0.10"
__description__ = "Python client for interfacing with NTCore"
__license__ = "Apache 2.0"
__maintainer__ = "NTCore"
__maintainer_email__ = "info@nantutech.com"
__title__ = "ntcore"
__url__ = "https://www.nantu.io/" |
def get_the_2nd_lower( stu_list ):
min_grade = min( stu_list, key = lambda x: x[1])[1]
#print( min_grade )
stu_list_without_lowest = [ s for s in stu_list if s[1] != min_grade]
# sort with student's name of ascending order
stu_list_without_lowest.sort( key = lambda x:x[0])
# get second lowe... |
base_number = 10
digit_grouping = 4
negative_word = 'mainasu'
default_separator = ' '
default_ordering = 'hst'
unit_names = [
'rei',
'ichi',
'ni',
'san',
'yon',
'go',
'roku',
'nana',
'hachi',
'kyū',
]
suffixes = [
['jū', 'hyaku', 'sen'],
'man',
... |
'''
Given a non-empty string s and an integer k, rearrange the string such that the same characters are at least distance k from each other.
All input strings are given in lowercase letters. If it is not possible to rearrange the string, return an empty string "".
Example 1:
Input: s = "aabbcc", k = 3
Output: "abcab... |
class HttpListenerPrefixCollection(object,ICollection[str],IEnumerable[str],IEnumerable):
""" Represents the collection used to store Uniform Resource Identifier (URI) prefixes for System.Net.HttpListener objects. """
def Add(self,uriPrefix):
"""
Add(self: HttpListenerPrefixCollection,uriPrefix: str)
Add... |
"""
Events app for the CDH webapp.
Provides event types, locations, and events
"""
default_app_config = "cdhweb.events.apps.EventsConfig"
|
def padovan(n):
res=[1,1,1]
for i in range(n-2):
res.append(res[-2]+res[-3])
return res[n] |
# Time: O(n)
# Space: O(1)
# 45
# Given an array of non-negative integers, you are initially positioned at the first index of the array.
#
# Each element in the array represents your maximum jump length at that position.
#
# Your goal is to reach the last index in the minimum number of jumps.
#
# For example:
# Given ... |
"""406. Queue Reconstruction by Height"""
class Solution(object):
def reconstructQueue(self, people):
"""
:type people: List[List[int]]
:rtype: List[List[int]]
"""
## R2:
people.sort(key = lambda x: (-x[0], x[1]))
res = []
for p in people:
... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# Recursive DFS
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if root == None:
return 0
else:
left_height = se... |
# Copyright (c) 2020, Vercer Ltd. Rights set out in LICENCE.txt
class StatementAlreadyPreparedException(Exception):
pass
class StatementNotPreparedException(Exception):
pass
class PreparedQueryNotSupported(Exception):
pass
class CannotAlterPreparedStatementQuerySet(Exception):
pass
class Prepa... |
# 通用配置
class Config:
SECRET_KEY = 'F5MgeYenAUQh7T6TdV1X/fwulCdtRMurfA9p0Lcg4dA='
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
# SESSION_TYPE = 'redis'
# SESSION_USE_SIGNER = True # 混淆Session
# SESSION_PERMANENT = False # session是否长期有效
# PERMANENT_SESSION_LIFETIME = 3600 # session有效时间
@static... |
__version__ = (
'1.2'
".3"
)
__custom__ = 42
|
TITLE = "Jumpy Boi"
# screen dims
WIDTH = 1280
HEIGHT = 760
# frames per second
FPS = 60
# colors
WHITE = (255, 255, 255)
BLACK = (0,0,0)
REDDISH = (240,55,66)
SKY_BLUE = (143, 185, 252)
BROWN = (153, 140, 113)
GRAY = (110, 160, 149)
DARK_BLUE = (0, 23, 176)
FONT_NAME = 'arial'
SPRITESHEET = "spritesheet_jumper.png"
# ... |
"""
Stride.py
Author: Matthew Yu, Array Lead (2020).
Contact: matthewjkyu@gmail.com
Created: 11/19/20
Last Modified: 02/27/21
Description: Implementation of the Stride class.
"""
# Library Imports.
# Custom Imports.
class Stride:
"""
The Stride class provides the base API for derived classes to
calcula... |
# EXERCICIO 051 - PROGRESSÃO ARITMÉTICA
primeiro = int(input('Primeiro termo: '))
razao = int(input('Razão: '))
decimo = primeiro+(10-1) * razao
for c in range(primeiro,decimo + razao ,razao):
print('{} '.format(c),end = " ")
print('Acabou')
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021-2022 F4PGA Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
# -- General configuration ---------------------... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : alrofrithms.py
@Time : 2021/01/19 21:55:55
@Author : Billy Liu
@Version : 1.0
@Contact : billy@test.mail
@Desc : None
'''
print('algorithms 被引入囉')
def main():
print('algorithms 被調用囉')
def call_foo():
print('call foo')
if __na... |
mail = "To Tax authortiy, Last year earnings of our consultants are given as below (in GBP)\n \
Sirish Dhulipala: 4000 for Jan, 4100 for Feb, 4200 For March, 3900 for April, 4000 May, 4100 June, 4000 July, 4000 August, 4000 September, 4000 October, 4000 November, 4000 December \n \
Anand Reddy: 18000 for first half an... |
'''
2^(15) = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^(1000)?
'''
n = 0
for _ in list(map(int, list(str(2**1000)))):
n += _
print(n)
|
SAMTRYGG_JSON_API_URL = 'https://www.samtrygg.se/RentalObject/SearchResult'
SAMTRYGG_DATASTORE_FILEPATH = '/datastore/samtrygg_data.json'
SAMTRYGG_PROCESSED_DATASTORE_FILEPATH = '/datastore/processed_samtrygg_data.json'
SAMTRYGG_PROCESSED_UNSEEN_DATASTORE_FILEPATH = '/datastore/processed_unseen_samtrygg_data.json'
|
#Implemente um script Python que consista em uma calculadora básica de quatro operações (soma, subtração, multiplicação e divisão)
sn='s'
while sn == 's':
n1=float(input('\nNúmero: '))
op=str(input('+ - * /: '))
while op != '+' and op != '-' and op != '*' and op != '/':
op=str(input('Informe uma da... |
colors = {
"Light": {
"BackgroundColor": [1, 0, 1, .2],
"TabColor": [1, 0, 1, .3],
"ThemeColor": [1, 0, 1, 1],
"BottomStatusColor": [.9, 0.9, 1, .8],
"PrimaryTextColor": [0, 0, 0, 1],
"SecondaryTextColor": [0, 0, 0, .5],
"SelectorHoverColor": [.7, .7, .7, .5],... |
# https://leetcode.com/problems/sort-colors/
# Related Topics: Array, Two Pointers, Sort
# Difficulty: Medium
# Initial thoughts:
# Since we are dealing with a small and predefined set of possiblities (3 colors in this case)
# we can loop once over the array, creating a frequency table for the 3 colors and then fi... |
while True:
line = input().split(' ')
n = int(line[0])
n2 = int(line[1])
if n == n2 and n == 0:
break
num = line[1].replace(line[0], '')
print(int(num) if num != '' else 0)
|
"""initialize paths, checkpoints etc"""
# initialize screenshot path (default: "sh.png", for testing e.g. "assets/test/t1.jpeg")
screenshot_path = "sh.png"
# initialize checkpoint template file, located in "./assets/scene/" (default: "checkpoint")
checkpoint = "checkpoint3"
# initialize battle mode ("default_mode", ... |
num = int(input('digite um numero inteiro: '))
print('''escolha um das bases de converção:
[ 1 ] converter para binario
[ 2 ] converter para octal
[ 3 ] converter para hexadecimal''')
ops = int(input('sua opção: '))
if ops == 1:
print(f'{num} convertido para binario e igual a {bin(num)[2:]}')
elif ops == 2:
pr... |
def sort_twisted37(arr):
return sorted(arr, key=lambda x: convert(x))
def convert(n):
if "3" not in str(n) and "7" not in str(n):
return n
neg_flag=True if n<0 else False
n=abs(n)
total=0
for i in str(n):
if i=="3":
total=total*10+7
elif i=="7":
to... |
##
# DATA_ENCODING:
#
# In order to transmit data in a serialized format, string objects need to be encoded. Otherwise,
# it is unclear how the characters are translated into raw bytes on the wire. This value should be
# consistent with the encoding used on the flight software that is being communicated with.
#
# Tradi... |
# Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
# (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
# Find the minimum element.
# You may assume no duplicate exists in the array.
class Solution(object):
def findMin(self, nums):
"""
O(logn)
... |
"""
@no 35
@name Search Insert Position
"""
class Solution:
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if len(nums) == 0:
return 0
else:
for i in range(len(nums)):
i... |
#bear in mind, this is log(n)
def binary_search(arr, target):
return binary_search_func(arr, 0, len(arr) - 1, target)
def binary_search_func(arr, start_index, end_index, target):
if start_index > end_index:
return -1
mid_index = (start_index + end_index) // 2
if arr[mid_index] == target:
... |
try:
age = int(input("Enter age:"))
if age >= 18:
print("You can vote")
elif age > 0 and age <= 17:
print("Too young to vote")
else:
print("You are a time traveller")
except:
print("Please enter age as integer") |
class Solution:
def equalPartition(self, N, arr):
# Find the sum of the array
summ = sum(arr)
# If the sum is odd, then return false
if summ % 2 != 0 :
return 0
# This is the number we need to obtain during the computation
required = summ // 2
... |
#Aluguel de carros
dia = int(input('Por quantos dias o carro foi usado: '))
km = float(input('Andou quantos KM: '))
total = (dia * 60) + (km * 0.15)
print('O total a pagar será de R${:.2f}'.format(total))
|
class SignatureNoeud:
def __init__(self,attributs, degre, degres_noeuds_adjacents,attributs_arretes):
self.attributs = attributs
self.degre = degre
self.degres_noeuds_adjacents = degres_noeuds_adjacents
self.attributs_arretes = attributs_arretes
|
class QueueException(Exception):
pass
class Empty(QueueException):
pass
class Full(QueueException):
pass |
GITHUB_IPS_ONLY = False
ENFORCE_SECRET = ""
RETURN_SCRIPTS_INFO = True
PORT = 8000
|
def number():
while True:
try:
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
break
except ValueError:
print("One of the values entered is not an integer, try again")
while num1 < 1 or num2 < 1:
print("One of the numbers isnt a positive int... |
class GaApiError(Exception):
"""Base exception for API errors."""
class GaInvalidArgumentError(GaApiError):
"""Exception for errors on the report definition."""
class GaAuthenticationError(GaApiError):
"""Exception for UNAUTHENTICATED && PERMISSION_DENIED errors."""
class GaRateLimitError(GaApiError):
... |
class IDError(Exception):
pass
class Service:
def __init__(self, google_service_object, id = None):
self.service = google_service_object
self.id = id
@property
def id(self):
if self.__id is None:
raise IDError("Service id is uninitialized, use .initialize_env(...)")... |
"""
You can use the reverse(N, A) procedure defined in today's easy problem [20120611A] to completely sort a list. For
instance, if we wanted to sort the list [2,5,4,3,1], you could execute the following series of reversals:
A = [2, 5, 4, 3, 1]
reverse(2, A) (A = [5, 2, 4, 3, 1])
reverse(5, A) (A = [1, 3,... |
while True:
D,N = input().split()
if D == N == '0': break
N = N.replace(D,'')
print(0) if N == '' else print(int(N))
|
def factorial(n):
if n == 0: # base case
return 1
else: # divide and conquer
return n * factorial(n - 1) # call the same function passing in an argument that leads down to the base case
for n in range(0, 12):
print(factorial(n))
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
class Event():
pass
class MarketEvent(Event):
def __init__(self, product, sym, last_bar):
self.type = 'MARKET'
self.product = product
self.sym = sym
self.last_bar = last_bar # dict
class RefreshEvent(Event):
def __init__(self)... |
# 练习1:不改变插入函数与删除函数代码,
# 为其增加验证权限的功能
def verify_permissions(func):
def wrapper(*args, **kwargs):
print("验证权限")
return func(*args, **kwargs)
return wrapper
# insert = verify_permissions(insert)
@verify_permissions
def insert(p1):
print("插入")
return "ok"
@verify_permissions
def delet... |
HELM_BUILD_FILE = """
package(default_visibility = ["//visibility:public"])
exports_files( ["helm"] )
"""
def _helm3_repository_impl(repository_ctx):
os_arch = repository_ctx.attr.os_arch
os_name = repository_ctx.os.name.lower()
if os_name.startswith("mac os"):
os_arch = "darwin-amd64"
else:
... |
class RevStr(str):
def __iter__(self):
return ItRevStr(self)
class ItRevStr:
def __init__(self, chaine_a_parcourir):
self.chaine_a_parcourir=chaine_a_parcourir
self.position=len(self.chaine_a_parcourir)
def __next__(self):
if self.position==0:
raise StopIteration
self.position-=1
return self.chaine... |
'''
Exercício Python 061: Refaça o DESAFIO 051, lendo o primeiro termo
e a razão de uma PA, mostrando os 10 primeiros termos da progressão
usando a estrutura while.
'''
print('Gerador de PA')
print('-=' * 10)
primeiro = int(input('Primeiro termo: '))
razao = int(input('Razão: '))
termo = primeiro
cont = 1
while cont... |
img_properties = 'width="14" height="12" alt=""'
valid_letters = 'YNLUKGFPBDTCIHS8EM'
emoticons = {
"(:-)" : "emoticon-smile.gif",
"(;-)" : "emoticon-wink.gif",
"(:-()" : "emoticon-sad.gif",
"(:-|)" : "emoticon-ambivalent.gif",
"(:-D)" : "emoticon-laugh.gif",
"(:-O)" : "emoticon-surprised.gif",
... |
gamestr = "Icewind Dale EE 2.6.5.0 + BetterHOF + CDTWEAKS"
headers = ["Area", "NPC", "XP", "Gold Carried", "Pickpocket Skill", "Item Price (base)", "Item Type", "Item"]
areas = [
"animtest (Spawned)",
"ar1001 - Easthaven (prologue) - Temple of Tempus",
"ar1008 - Easthaven (prologue) - Snowdrift Inn",
"ar1100 - Eas... |
'''
a = 'iasdsdasda'
b= 0
c = len(a)
while b<c:
print(a[b])
b+=1
import random
a = random.randrange(1,3)
s = eval(raw_input(">>"))
while a-s!=0:
if a>s:
print("you are low")
elif a<s:
print("you are high")
s = eval(raw_input(">>"))
while a-s==0:
print("you are right")
break
'''... |
# I got to use a map dictionary (identical values) in one place as it is
# but in another I should convert keys as values and values as keys!
# Note
'''
+ This is only for dictionary which has identical values and when considered as hashmap.
- If dictionary which has duplicate values may not work well.
- If dictionar... |
#Internal framework imports
#Typing imports
class ResizeMethod:
NONE = 1
CROP = 2
STRETCH = 3
LETTERBOX = 4
@classmethod
def str2enum(cls, resize_method_string, error_if_none = False):
resize_method_string = resize_method_string.lower()
if resize_method_string == "crop":
... |
def add(*args):
return list(list(sum(j) for j in zip(*rows)) for rows in zip(*args))
matrix1 = [[1, -2], [-3, 4]]
matrix2 = [[2, -1], [0, -1]]
result = add(matrix1, matrix2)
print(result) |
class ConfigNotFoundException(Exception):
def __init__(self, message):
super().__init__(message)
class WorkingDirectoryDoesNotExistException(Exception):
def __init__(self, message):
super().__init__(message)
class ImageUploaderException(Exception):
def __init__(self, message):
su... |
text = '''<?xml version="1.0" encoding="utf-8" ?>
<body copyright="All data copyright San Francisco Muni 2015.">
<predictions agencyTitle="San Francisco Muni" routeTitle="38-Geary" routeTag="38" stopTitle="43rd Ave & Point Lobos Ave" stopTag="13568">
<direction title="Inbound to Downtown">
<prediction epochTim... |
soma = 0
cont = 0
for imp in range(3, 500, 2):
if imp % 3 == 0:
soma += imp
cont += 1
print('A soma de todos os {} valores solicitados é {}'.format(cont, soma))
|
colour = {'r': '\033[31m', 'g': '\033[32m', 'w': '\033[33m', 'b': '\033[34m', 'p': '\033[35m',
'c': '\033[36m', 'limit': '\033[m'}
def line(n=37):
print('-' * n)
def title(txt, x=37):
print('-' * x)
print(f'{colour["c"]}{txt.center(x)}{colour["limit"]}')
print('-' * x) |
class widget_type(object):
stage = 0
button = 1
toggle = 2
slider = 3
dropdown = 4
text = 5
input_field = 6
joystick = 7
class widget_date_type(object):
bool = 0
int32 = 1
float = 2
string = 3
class widget_public_function(object):
create = 0
destory = 1
ac... |
f = open('task1-test-input.txt')
o = open('o1.txt', 'w')
t = int(f.readline().strip())
for i in xrange(1, t + 1):
o.write("Case #{}:".format(i))
n = f.readline()
n = int(f.readline().strip())
x = [int(j) for j in f.readline().strip().split()]
mean = 0
for j in xrange(0, n):
mean += x[j]
... |
# Write a program that compares two lists and prints a message depending on if the inputs are identical or not.
# Your program should be able to accept and compare two lists: list_one and list_two. If both lists are identical print "The lists are the same". If they are not identical print "The lists are not the same." ... |
# spec.py
# Problem 1: Implement this function.
def Newtons_method(f, x0, Df, iters=15, tol=.1e-5):
'''
Use Newton's method to approximate a zero of a function.
Inputs:
f (function): A function handle. Should represent a function
from R to R.
x0 (float): Initial guess.
... |
#
# PySNMP MIB module IEEE8021-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IEEE8021-TC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:13:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
# -*- coding: utf-8 -*-
info = {
"name": "bas",
"date_order": "DMY",
"january": [
"kɔndɔŋ",
"kɔn"
],
"february": [
"màcɛ̂l",
"mac"
],
"march": [
"màtùmb",
"mat"
],
"april": [
"màtop",
"mto"
],
"may": [
"m... |
entries = [
{
"env-title": "atari-alien",
"env-variant": "No-op start",
"score": 1536.05,
},
{
"env-title": "atari-amidar",
"env-variant": "No-op start",
"score": 497.62,
},
{
"env-title": "atari-assault",
"env-variant": "No-op start",
... |
TS = "timestep"
H = "hourly"
D = "daily"
M = "monthly"
A = "annual"
RP = "runperiod"
FREQUENCY = "frequency"
VARIABLE = "variable"
KEY = "key"
TYPE = "type"
UNITS = "units"
|
help(print)
def count(i,f,p):
"""
Faz uma contagem na tela
para i: Inicio da contagem
para f: fim da contagem
para p: passo da contagem
return: sem retorno
"""
for c in range(i,f,p):
print(c)
print("Fim")
help(count)
def somar(a=0,b=0,c=0):
s=a+b+b
print(s)
#ou
... |
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def mergeTwoLists(l1, l2):
# edge case
if l1 is None:
return l2
if l2 is None:
return l1
# general case
cur1 = l1
cur2 = l2
ans = ListNode()
cur = ans
while cur... |
class ArgumentError(ValueError):
...
class PathOpError(ValueError):
...
|
"""
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example:
Given num = 16, return true. Given num = 5, return false.
Follow up: Could you solve it without loops/recursion?
"""
__author__ = 'Daniel'
class Solution(object):
def isPowerOfFour(self, num):
"""
... |
# Do not edit. bazel-deps autogenerates this file from.
_JAVA_LIBRARY_TEMPLATE = """
java_library(
name = "{name}",
exports = [
{exports}
],
runtime_deps = [
{runtime_deps}
],
visibility = [
"{visibility}"
]
)\n"""
_SCALA_IMPORT_TEMPLATE = """
scala_import(
name = "{name}",
export... |
# Q20
print("======= a =======")
for x in range(1,200):
if x % 4 == 0:
print('{0:.2f}'.format(x))
print("======= b =======")
#while x < 200:
# if (x % 4 == 0):
# x = x + 1
# print('{0:d}'.format(x))
# x = x + 2
print("======= c =======")
for x in range(1,200):
if x % 2 == 0:
... |
num = ''
for i in range(10):
num = str(i)
for j in range(10):
num += str(j)
for k in range(10):
num += str(k)
print(num)
num = str(i) + str(j)
num = str(i) |
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
item2 = {'a': 0}
item3 = True
item4 = 'test'
item_cfg = {'b': 1}
item5 = {'cfg': item_cfg}
item6 = {'cfg': item_cfg}
|
DB_DATA = {
"users": [],
"protected_data": "Lorem ipsum dolor sit amet..."
}
|
name = 'Webware for Python'
version = (3, 0, 4)
status = 'stable'
requiredPyVersion = (3, 6)
synopsis = (
"Webware for Python is a time-tested"
" modular, object-oriented web framework.")
webwareConfig = {
'examplePages': [
'Welcome',
'ShowTime',
'CountVisits',
'Error',
... |
__all__ = ["VERSION"]
# Do not use pkg_resources to find the version but set it here directly!
VERSION = '0.0.1'
|
#
# PySNMP MIB module A3COM-HUAWEI-SSH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-SSH-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:07:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
class OptionsNotSet(Exception):
""" No Options were set"""
class NoPlayerRegistered(Exception):
""" No Players were registered."""
class ValueDoesNotExist(Exception):
""" The value does not exist on a dart-board """
class FieldDoesNotExist(Exception):
""" The given field does not exist on a dart-boa... |
# coding=utf-8
class BaseOptimizer():
"""Abstract class for Optimizer
"""
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
def get_optimizer(self, weight_params, params):
raise NotImplementedError()
|
"""
Description:
Encontra objetos em lista
Author: @Palin/Renan
Created: 2021-07-01
Copyright: (c) Ampere Consultoria Ltda
"""
def find_obj(lst_to_find, name_field: str, value_to_find):
if len(lst_to_find) == 0:
return None
try:
lst_result = list... |
class ReviewRouter(object):
"""
Sends all review-related operations to a database with the alias of
"reviews". No other apps should use this db alias.
"""
def db_for_read(self, model, **hints):
if model._meta.app_label == "reviews":
return "reviews"
return None
def d... |
SPANISH = "Spanish"
FRENCH = "French"
ENGLISH_HELLO_PREFIX = "Hello"
SPANISH_HELLO_PREFIX = "Hola"
FRENCH_HELLO_PREFIX = "Bonjour"
def hello(name: str = None, language: str = None) -> str:
"""Return a personalized greeting.
Defaulting to `Hello, World` if no name and language are passed.
"""
if not na... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.