content stringlengths 7 1.05M |
|---|
class Solution(object):
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
# Runtime: 20 ms
# Memory: 13.7 MB
if needle in haystack:
return haystack.index(needle)
else:
return -... |
{
"targets": [
{
"target_name": "mtrace",
"sources": [ "mtrace.cc" ],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
]
}
]
}
|
class TCPServer(object):
def process_request(self, request, client_address):
self.do_work(request, client_address)
self.shutdown_request(request)
class ThreadingMixIn:
"""Mix-in class to handle each request in a new thread."""
def process_request(self, request, client_address):
... |
class Node:
def __init__(self, data, parent=None):
self.parent = parent
self.data = data
self.left = None
self.right = None
def leftChild(self, left):
self.left = Node(left, self)
def rightChild... |
class Solution:
def isPalindrome(self, s: str) -> bool:
formattedString = ''.join([c.lower() for c in s if c.isalnum()])
if formattedString == formattedString[::-1]:
return True
return False |
VERSION = (0, 0, 2, 3)
__version__ = '.'.join(map(str, VERSION))
default_app_config = 'django.chatbot.apps.DjangoChatBotConfig'
|
# Use right join to merge the movie_to_genres and pop_movies tables
genres_movies = movie_to_genres.merge(pop_movies, how='right',
left_on='movie_id',
right_on='id')
# Count the number of genres
genre_count = genres_movies.groupby('genre... |
counter = 10
sums = 1
k = 2
currLast = 1
while counter > 0:
k += 1
while sums < (k + 1) ** 2:
currLast += 1
sums += currLast
if sums == (k + 1) ** 2:
counter -= 1
print (k + 1), currLast
|
# IMPORTS
# DATA
data = []
with open("Data - Day11.txt") as file:
for line in file:
for direction in line.strip().split(","):
data.append(direction)
# GOAL 1
"""
The hexagons ("hexes") in this grid are aligned such that adjacent hexes can be found to the north,
northeast, southeast, south, so... |
class Solution(object):
def sortColors(self, nums):
"""
:type nums: List[int]
:rtype: None Do not return anything, modify nums in-place instead.
"""
lo = 0
hi = len(nums) - 1
while (lo < hi):
if nums[lo] == 0:
lo += 1
... |
CONVERT_JSON_TO_YAML = {
"type": "post",
"endpoint": "/convertJSONtoYAML",
"call_message": "{type} {endpoint}",
"error_message": "{type} {endpoint} {response_code}"
}
CONVERT_RANGE_FROM_TO = {
"type": "get",
"endpoint": "/convertRangeFromTo",
"call_message": "{type} {endpoint}",
"error_message": "{type} {endpoi... |
number = 0
total = 0
while number != -1:
total += number
number = float(input("Please enter a positive number (-1 to stop):"))
print(total)
|
"""
This module contains several parsers. This includes utilities for reading and converting molecular
dynamics input files to instructions for the :obj:`schnetpack.md.simulator.Simulator`. In addition, there is
a full package for parsing ORCA output files.
"""
|
def fatorial(n, show=True):
'''
Calcula o fatorial de um número.
:param n: Numero a ser calculado.
:param show: Exibe ou não o calculo. True para exibir, false para não exibir.
:return: O fatorial do número informado.
'''
print(f'O fatorial de {n} é: {n}', end=' ')
for c in range(n - 1, ... |
# Define your handoff handlers here
# for more information, see:
# http://docs.tethysplatform.org/en/dev/tethys_sdk/handoff.html
def csv(request, csv_url):
"""
Test Handoff handler.
"""
return 'test_app:home'
|
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
python装饰器的使用
https://blog.csdn.net/chenhanxuan1999/article/details/103771009
http://c.biancheng.net/view/2270.html
https://www.jb51.net/article/168276.htm
"""
"""
闭包的概念:
1)函数嵌套
2)内部函数使用外部函数的变量
3)外部函数的返回值为内部函数
"""
def closure_func(name):
d... |
# -*— coding: utf-8 -*-
class ServerCC:
DEV = 2
TEST = 3
RASDEV = 4
RASTEST = 5
def __rasdev(self):
url = 'https://rasdev9.zhixueyun.com'
auth_url = 'https://rasdev9.zhixueyun.com/oauth/api/v1/auth'
return (url, auth_url)
def __rastest(self):
url = 'https://ra... |
#
# PySNMP MIB module ZHONE-CARD-DIAGNOSTICS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-CARD-DIAGNOSTICS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:46:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... |
line = input()
party = {}
unlikes = 0
while line != "Stop":
act, guest, meal = line.split("-")
if act == "Like":
if guest in party.keys():
if meal in party[guest]:
line = input()
continue
party[guest].append(meal)
line = input()
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__project__ = 'leetcode'
__file__ = '__init__.py'
__author__ = 'king'
__time__ = '2020/3/6 22:12'
_ooOoo_
o8888888o
88" . "88
(| -_- |)
... |
L=raw_input("Please Enter the length of the layer (in m): ")
A=raw_input("Please Enter the area of the wall (in m2): ")
material=raw_input("Please Enter the material of the layer: ")
if material=="glass":
type_glas=raw_input("which type of glass do you mean:window=1, wool insulation=2 ")
if int(type_glas)==1:
... |
def test_user_create_public_group( # noqa
user, public_group,
):
accessible = public_group.is_accessible_by(user, mode="create")
assert accessible
def test_user_create_public_groupuser(
user, public_groupuser,
):
accessible = public_groupuser.is_accessible_by(user, mode="create")
assert not a... |
#define a value holder function
# => True
def switch(value):
switch.value=value
return True
#define matching case function
# => True or False
def case(*args):
return any((arg == switch.value for arg in args))
# Switch example:
print("Describe a number from range:")
for n in range(0,10):
print(n, end=" "... |
# Recursive solution (TLE)
class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: bool
"""
def util(s, wordDict):
if s == "":
return True
for i in range(1, len(s)+1):
... |
# Copyright 2019 AUI, Inc. Washington DC, USA
#
# 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 ... |
#Tendo NElem como uma Lista de 25 elementos do tipo Inteiro, desenvolva um
#programa que faça a leitura de N elementos para essa Lista sendo pedido ao
#utilizador o valor de N (num máximo de 25). De seguida desenvolva:
#a) Uma função para fazer a apresentação dos elementos dessa lista.
#b) uma função que calcule o ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013, 2014, 2016, 2017 Guenter Bartsch
#
# 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/LIC... |
#!/usr/bin/python3
"""
This is a simple implementation of BST
binary search tree
"""
class Node(object):
def __init__(self, value=None, left=None, right=None, parent=None):
self.value = value
self.left = left
self.right = right
self.parent = parent
def __str__(self):
... |
pessoas = list()
dados = list()
maior = menor = 0
while True:
dados.append(str(input('Digite seu nome: ').strip().capitalize()))
dados.append(int(input('Digite seu peso: ')))
if not pessoas:
maior = menor = dados[1]
pessoas.append(dados[:])
for valor in pessoas:
if valor[1] > maior:
... |
#!/usr/bin/python3
# Guilhem Mizrahi 09/2019
def first():
var1=input("Enter the first number: ")
var2=input("Enter the second number: ")
print(var1/var2)
def second():
var1=int(input("Enter the first number: "))
var2=int(input("Enter the second number: "))
print(var1/var2)
def third():
... |
PROG = 'censor'
fin = open(PROG + '.in', 'r')
fout = open(PROG + '.out', 'w')
def main():
s = fin.readline()
s = s[:len(s) - 1]
t = fin.readline()
t = t[:len(t) - 1]
while True:
i = s.find(t)
if i == -1:
break
s = s[0:i] + s[i + len(t):]
fout.write(s + '\n')
main()
fin.close()
fout.close()
|
# tests.py
# Run `conda install pytest`
# Run `pytest test_main.py` from the speech2phone/ directory.
"""
To use pytest, the file must be named "test***.py". For example, `tests.py` or `test_pca.py`.
Test functions must be prefixed with `test_`. So `multiply()` is not a test function, but `test_numbers_3_4()` is.
We u... |
class IncorrectInputVectorLength(Exception):
pass
class NetIsNotInitialized(Exception):
pass
class IncorrectFactorValue(Exception):
pass
class NetIsNotCalculated(Exception):
pass
class IncorrectExpectedOutputVectorLength(Exception):
pass
class NetConfigIndefined(Exception):
pass
clas... |
# The rand7() API is already defined for you.
# def rand7():
# @return a random integer in the range 1 to 7
class Solution:
def rand10(self):
"""
:rtype: int
"""
v = (rand7()-1)*7 + rand7()-1
while v >= 40: v = (rand7()-1)*7 + rand7()-1
return v%10 + 1 |
class BingoBoard:
def __init__(self, numbers):
self.numbers = [int(n) for n in numbers.replace("\n", " ").split()]
self.marked = set()
def mark(self, n):
if n in self.numbers:
self.marked.add(n)
return self.check_win()
return False
def get_score(sel... |
#from http://rosettacode.org/wiki/Greatest_common_divisor#Python
#pythran export gcd_iter(int, int)
#pythran export gcd(int, int)
#pythran export gcd_bin(int, int)
#runas gcd_iter(40902, 24140)
#runas gcd(40902, 24140)
#runas gcd_bin(40902, 24140)
def gcd_iter(u, v):
while v:
u, v = v, u % v
return abs... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 10 21:24:01 2019
@author: li-ming-fan
"""
#
def segment_sentences(text, delimiters = None):
"""
"""
if delimiters is None:
delimiters = ['?', '!', ';', '?', '!', '。', ';', '…', '\n']
#
text = text.replace('...', '。。。'... |
# Copyright (c) 2022 PaddlePaddle 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 ap... |
def Menunggu(n,des):
#basis
if n == 0:
return 0
#rekuren
print(des)
return Menunggu(n-1,des)
def MySum(n):
#basis
if n == 0:
return 0
#rekuren
return n+MySum(n-1)
def main():
# solusi iteratif/pengulangan dengan teknik for loop
#n = 10
#for i in range(n... |
i = input().split()
N,Q = int(i[0]),int(i[1])
AI = input().split()
ai = []
for n in AI:
ai.append(int(n))
QI = input().split()
qi = []
for n in QI:
qi.append(int(n))
for q in qi:
ai_aux = ai.copy()
count = 0
p = 0
while(p<len(ai_aux)-1):
if q in ai_aux:
... |
class hparams:
train_or_test = 'train'
output_dir = 'logs/your_program_name'
aug = False
latest_checkpoint_file = 'checkpoint_latest.pt'
total_epochs = 100
epochs_per_checkpoint = 10
batch_size = 2
ckpt = None
init_lr = 0.0002
scheduer_step_size = 20
scheduer_gamma = 0.8
... |
'''
--- Day 1: The Tyranny of the Rocket Equation ---
-- Part 1 --
The Elves quickly load you into a spacecraft and prepare to launch.
At the first Go / No Go poll, every Elf is Go until the Fuel Counter-Upper.
They haven't determined the amount of fuel required yet.
Fuel required to launch a given module is based... |
"""
exceptions/__init__.py
Comments:
Author: Dennis Whitney
Email: dennis@runasroot.com
Copyright (c) 2021, iRunAsRoot
"""
class ValueReadOnly(Exception):
pass
class ValueNotAllowed(Exception):
pass
class UnauthorizedAccess(Exception):
pass
class UnknownEndpoint(Exception):
pass
|
def test_create(app):
wd = app.wd
assert app.soap.can_login(username="administrator", password="admin")
app.session.login(user_name="administrator", user_pass="admin")
assert app.session.is_logged_in_as("administrator")
#open create page
app.open_create_page()
# fill form
pn = "name0"
... |
# Redis数据库地址
REDIS_HOST = 'localhost'
# Redis端口
REDIS_PORT = 6379
# Redis密码,如无填None
REDIS_PASSWORD = 'foobared'
# 产生器使用的浏览器
BROWSER_TYPE = 'Chrome'
# 产生器类,如扩展其他站点,请在此配置
GENERATOR_MAP = {
'weibo': 'WeiboCookiesGenerator'
}
# 测试类,如扩展其他站点,请在此配置
TESTER_MAP = {
'weibo': 'WeiboValidTester'
}
TEST_URL_MAP = {
... |
"""
map data could be a 2D grid with data for each cell as N, S, E, W. A special data
set would highlight "here" information, like if there's a pit, item, encounter or
teleportation.
w - wall
d - door
o - open
s - secret door (shows as 'w' on other side)
A box with a door leading east from the NE quadrant would look ... |
#This is a simple inventory program for a small car dealership.
print('Automotive Inventory')
class Automobile:
def __init__(self):
self._make = ''
self._model = ''
self._year = 0
self._color = ''
self._mileage = 0
def addVehicle(self):
try:
... |
class Registry:
def __init__(self):
self.addr = ["134.209.83.144"]
self._config = None
self._executor = None
@property
def executor(self):
if not self._executor:
self._executor = ExecutorSSH(self.addr[0], 22)
return self._executor
@property
def m... |
# Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYING file.
""" qisrc actcions """
|
__author__ = 'ian.collins'
currentcolor = True # true=day, false=night
lightthreshold = 50
lightchecktime = 10.0
gpsrefreshtime = 15.0
netrefreshtime = 30.0
crvincidentmain = None
# The actualt status bar
statusbar = None
# Where the statusbar fields are kept
statusbarbox = None
# An alternate statusbar ... |
#########################################################################################################################################################################
# Author : Remi Monthiller, remi.monthiller@etu.enseeiht.fr
# Adapted from the code of Raphael Maurin, raphael.maurin@imft.fr
# 30/10/2018
#
# Inclin... |
class Solution(object):
def wordsAbbreviation(self, dict):
"""
:type dict: List[str]
:rtype: List[str]
"""
res = []
countMap = {}
prefix = [1] * len(dict)
for word in dict:
abbr = self.abbreviateWord(word, 1)
res.append(abbr)
... |
DRIVERS = {
"default": "cookie",
"cookie": {},
}
|
string = "resource"
if len(string) < 2:
print("--")
else:
print(string[0:2] + string[-2:])
|
def run_tests(tests, function):
"""
Runs provided test cases and reports failure or success
:param tests: list of tests in (dict, expected value) format
:param function: function to run the tests against
:return: None
"""
success = 0
for test, expected in tests:
actual = function... |
def increment_id(tag):
if tag == "error":
filename = "errorarena"
elif tag == "valid":
filename = "validarena"
elif tag == "gif":
filename = "gif"
file = open(f"./results/id/{filename}.txt","r")
id_line = file.readline()
file.close()
curr_id = int(id_line.strip())... |
for char in 'One':
print (char)
'''
O
n
e
''' |
# program to convert degrees f to degrees c
# need to use (degF - 32) * 5/9
user = input('Hello, what is your name? ')
print('Hello', user)
degF = int(input('Enter a temperature in degrees F: '))
degC = (degF -32) * 5/9
print('{} ,degrees F converts to , {} ,degrees C'.format(degF, (degC)))
|
num =10
num2= 20
num3=30
num4=40
|
class A(object):
x:int = 1
class B(A):
def __init__(self: "B"):
pass
class C(B):
z:bool = True
a:A = None
b:B = None
c:C = None
a = A()
b = B()
c = C()
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 21 20:55:21 2017
@author: Lama Hamadeh
"""
'''
Case Study about DNA translation
'''
'''
NCBI is the United States' main public repository of DNA and related information
We will download two files from NCBI: the first is a strand of DNA and the secon... |
class Solution:
def findKthPositive(self, arr: List[int], k: int) -> int:
'''
Number of missing element at index i =
= arr[0] - 1 + arr[idx] - arr[0] - idx =
= arr[idx] - idx - 1
For more description, see: 1060 Missing Element in Sorted Array
T: O(log n) a... |
z = "Tests were ran for service: matchService \n" \
"Passed: \n" \
"Failed: \n" \
"Error: \n" \
"Skipped: \n"
|
ip_addr1="192.168.1.1"
ip_addr2="10.1.1.1"
ip_addr3="172.16.1.1"
print ("\n")
print ("-" * 80)
print ("{my_ip:^20}{ip:^20}{ip_alt:^20}".format(ip_alt=ip_addr1, ip=ip_addr2, my_ip=ip_addr3))
print ("-" * 80)
print ("\n")
octets = ip_addr1.split('.')
|
"""
find the last item in a singly linked list
"""
#keep checking list until there is node has no next
def lastnode(linked_list, k):
if k <= 0:
return None
pointer2 = linkedlist.head
for i in range(k-1):
if pointer2.next != None:
pointer2 = pointer2.next
else:
... |
"""Define module exceptions."""
class SeventeenTrackError(Exception):
"""Define a base error."""
pass
class InvalidTrackingNumberError(SeventeenTrackError):
"""Define an error for an invalid tracking number."""
pass
class RequestError(SeventeenTrackError):
"""Define an error for HTTP request... |
class Registers(object):
def __eq__(self, other) :
return self.__dict__ == other.__dict__
def __init__(self):
self.accumulator = 0
self.x_index = 0
self.y_index = 0
self.sp = 0xFD
self.pc = 0
self.carry_flag = False
self.zero_flag = ... |
def take_input():
"""Helper function to take input for a user"""
name_marks = input().split()
name = name_marks[0]
marks = [float(x) for x in name_marks[1:]]
return name, marks
def rank_user(users_name_list, users_score_lst):
"""Returns a dictionary. Key is user_name and values is rank"""
user_score ... |
class Solution:
def anagrams(self, strs):
key = lambda s: ''.join(sorted(s))
strs = sorted(strs, key=key)
strs = itertools.groupby(strs, key=key)
result = []
for k, g in strs:
l = list(g)
if len(l) == 1:
continue
... |
"""
파일 이름 : 11656.py
제작자 : 정지운
제작 날짜 : 2017년 7월 31일
"""
# 입력
s = input()
# 모든 접미사 리스트에 등록
lst = []
for i in range(len(s)):
lst.append(s[i:len(s)])
# 정렬 후 출력
lst.sort()
for i in range(len(lst)):
print(lst[i]) |
# Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... |
class RebarContainerParameterManager(object,IDisposable):
""" Provides implementation of RebarContainer parameters overrides. """
def AddOverride(self,paramId,value):
"""
AddOverride(self: RebarContainerParameterManager,paramId: ElementId,value: int)
Adds an override for the given parameter as its value... |
# MIT License
#
# Copyright (c) 2019 Michael J Simms. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... |
# Meta classes
class Meta(type):
def __new__(self, class_name, bases, attrs):
print(attrs)
a = {}
for name, val in attrs.items():
if name.startswith("__"):
a[name] = val
else:
a[name.upper()] = val
return type(class_name, bases... |
def listifyer(word):
listify = list(word)
return listify
def rearrPL(word):
seperator = ','
del word[-1]
del word[-1]
last_element = word[(len(word) - 1)]
word.insert(0, last_element)
del word[-1]
new_word = seperator.join(word)
return new_word
def rearrE(word):
first_let... |
# -*- coding: utf-8 -*-
# cython:language_level=3
"""
-------------------------------------------------
File Name: surfExpression
Description :
Author : liaozhaoyan
date: 2021/12/24
-------------------------------------------------
Change Activity:
2021/12/24:
------... |
mortgage = 366323
agent_fee = .06
prorated_property_taxes = 400
prorated_mortgage_interest = 1500
other_fees = 2500
closing_costs = prorated_property_taxes + prorated_mortgage_interest + other_fees
sale_price = input('What is the sale price of your home? ')
agent_cost = agent_fee * float(sale_price)
price_per_sqft = (f... |
"""
ipcai2016
Copyright (c) German Cancer Research Center,
Computer Assisted Interventions.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE for details
"""
|
# -*- coding: utf-8 -*-
"""Top-level package for Django CMS export page."""
__author__ = """Maykin Media"""
__email__ = 'support@maykinmedia.nl'
__version__ = '0.1.0'
|
_base_ = './mask_rcnn_r50_fpn_gn_ws-all_2x_coco.py'
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://jhu/resnet101_gn_ws'))) |
"""Sample package."""
MORSE_MAPPING = {
"A": ".-",
"B": "-...",
"C": "-.-.",
"D": "-..",
"E": ".",
"F": "..-.",
"G": "--.",
"H": "....",
"I": "..",
"J": ".---",
"K": "-.-",
"L": ".-..",
"M": "--",
"N": "-.",
"O": "---",
"P": ".--.",
"Q": "--.-",
"... |
'''
Author : MiKueen
Level : Medium
Problem Statement : Find First and Last Position of Elements in Sorted Array
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target ... |
###########################################
# EXERCICIO 055 #
###########################################
'''FAÇA UM PROGRAMA QUE LEIA O PESO DE 5
PESSOAS. NO FINAL MOSTRE QUAL FOI O MAIOR
E O MENOR PESO'''
maior = 0
menor = 0
for c in range(1,6):
peso = float(input('PESO DA {}ª PESSOA: '... |
totidade = homens = mulheresmenores = 0
while True:
print('-'*20)
print('Cadastre uma pessoa')
print('-'*20)
idade = int(input('Idade: '))
sexo = ' '
while sexo not in 'MF':
sexo = str(input('Sexo: [M/F]')).strip().upper()[0]
cont = ' '
while cont not in 'SN':
cont = str... |
def get_build_tool(name):
tools = {
"cmake": CMakeBuildTool,
"colcon": ColconBuildTool,
"catkin": CatkinBuildTool
}
if name not in tools:
raise Exception("Unknown build tool: {}".format(name))
return tools[name]
class BuildTool():
@staticmethod
def getCommands():... |
number = input('Enter a number: ')
number = int(number)
if number % 2 == 0:
print('The number is even')
else:
print('The number is odd') |
print("input 5 decimals")
values = []
for i in range(5):
values.append(float(input("demical #"+str(i+1)+": ")))
cnt = 0
for i in values:
if i >= 10 and i <= 100:
cnt += 1
print(cnt)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2018-11-11
@author: marcel-odya
'''
base = [
["właśnie teraz", "za chwilę"],
["%s sekund temu", "za %s sekund", "%s sekundy temu", "za %s sekundy"],
["minutę temu", "za minutę"],
["%s minut temu", "za %s minut", "%s minuty temu", "za %s minu... |
# 3. n children have got m pieces of candy. They want to eat as much candy as they can, but each child must eat exactly the same amount of candy as any other child. Determine how many pieces of candy will be eaten by all the children together. Individual pieces of candy cannot be split.
# Example
# For n = 3 and m = ... |
def install_file(name, src, out):
"""
Install a single file, using `install`. Returns out, so that it can be easily
embedded into a filegroup rule.
"""
native.genrule(
name = name,
srcs = [src],
outs = [out],
cmd = "install -c -m 644 $(location {}) $(location {})".fo... |
test = {
'name': 'lab1_p1',
'suites': [
{
'cases': [
{
'code': r"""
>>> # It looks like your variable is not named correctly.
>>> # Please check for a typo. The variable name should be
>>> # my_favorite_things_lst
>>> 'my_favorite_things_lst' in v... |
"""Cascade Mask RCNN with ResNet101-FPN, 3x schedule, MS training."""
_base_ = "./cascade_mask_rcnn_r50_fpn_3x_ins_seg_bdd100k.py"
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type="Pretrained", checkpoint="torchvision://resnet101"),
)
)
load_from = "https://dl.cv.ethz.ch/bdd100k/ins_s... |
'''error pattern'''
class A:
def __init__(self, text):
print('a')
print(text)
class B(A):
def __init__(self, text):
print('b')
super(B, self).__init__(text)
class C:
def __init__(self, **kwargs):
print('c')
super(C, self).__init__()
class D(C, B):
def __init__(self, text):
pr... |
def test_restart_opencart_mysql_service(restart_mysql):
assert "active (running)" in restart_mysql
print(restart_mysql)
def test_restart_opencart_apache_service(restart_apache):
assert "active (running)" in restart_apache
print(restart_apache)
def test_opencart_is_active(request_opencart):
print... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
List Comprehensions 列表推导式
对序列或可迭代对象中的每个元素应用某种操作,用生成的结果创建新的列表;或用满足特定条件的元素创建子序列。
"""
squares = [x * x for x in range(1, 5)]
print(squares)
even_l = [x ** 2 for x in range(1, 11) if x % 2 == 0]
print(even_l)
num_l = [x if x % 2 == 1 else -x for x in range(1, 11)]
print... |
def fatorial(n):
nFatorial=n
for i in range(1,n):
nFatorial=nFatorial*(n-i)
return nFatorial
|
class Solution:
def dayOfTheWeek(self, day: int, month: int, year: int) -> str:
num2day = ['Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday']
mon2num = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
count = 0
for i in range(1971, year):
i... |
def preenchimento_de_vetor_iv():
n = 0
par = list()
impar = list()
while n < 15:
numero = int(input())
if numero % 2 == 0:
par.append(numero)
else:
impar.append(numero)
if len(par) == 5:
for i in range(5):
print(f'par[{i... |
# -*- coding: utf-8 -*-
# @Time : 2018/4/12 20:16
# @Author : ddvv
# @Site : http://ddvv.life
# @File : __init__.py.py
# @Software: PyCharm
def main():
pass
if __name__ == "__main__":
main() |
n= int(input())
alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(n):
letras=input()
pulos=int(input())
novaPalavra=""
for j in range(len(letras)):
posicao=alfabeto.find(letras[j])
numeroPosicao=posicao-pulos
if numeroPosicao<0:
novaPosicao=len(alfabeto)+numer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.