content stringlengths 7 1.05M |
|---|
class Solution:
def nextGreaterElement(self, n: int) -> int:
s = list(str(n))
i = len(s) - 1
while i - 1 >= 0 and s[i - 1] >= s[i]:
i -= 1
if i == 0:
return -1
j = len(s) - 1
while s[j] <= s[i - 1]:
j -= 1
s[i - 1], s[j] =... |
class MyrialCompileException(Exception):
pass
class MyrialUnexpectedEndOfFileException(MyrialCompileException):
def __str__(self):
return "Unexpected end-of-file"
class MyrialParseException(MyrialCompileException):
def __init__(self, token):
self.token = token
def __str__(self):
... |
#punto 1
#entradas
n=int(input("Escriba el primer digito "))
k=int(input("Escriba el primer digito "))
#caja negra y salidas
while True:
n=0
if(k<n):
n=n-1
print(n)
elif(n==k):
print(k)
break |
'''
Created on 2015年12月1日
https://leetcode.com/problems/word-ladder/
@author: Darren
'''
def wordLadder(startWord,endWord,wordDic,path,visited):
for index in range(len(startWord)):
for i in range(26):
newWord=startWord[:index]+chr(ord("a")+i)+startWord[index+1:]
if newWord==startWor... |
class CandeError(Exception):
pass
class CandeSerializationError(CandeError):
pass
class CandeDeserializationError(CandeError):
pass
class CandeReadError(CandeError):
pass
class CandePartError(CandeError):
pass
class CandeFormatError(CandePartError):
pass
|
items = ['T-Shirt','Sweater']
print("*** Note: If you want to quit this program, simply type 'quit' or 'QUIT'.")
print("*" * 20)
while True:
action = (input("Welcome to our shop, what do you want (C, R, U, D)? ")).upper()
if action == "R":
print("Our items: ", end='')
print(*items,sep=', ')
... |
'''
Catalan numbers (Cn) are a sequence of natural numbers that
occur in many places. The most important ones being that Cn
gives the number of Binary Search Trees possible with n values.
Cn is the number of full Binary Trees with n + 1 leaves.
Cn is the number of different ways n + 1 factors can be... |
# operador logico
print("Ingrese el valor de a")
a = float(input())
print("Ingrese el valor de b")
b = float(input())
print("b es mayor que a")
print(b > a)
print(type(b > a))
print("b es menor que a")
print(b < a)
print("b es mayor o igual que a")
print(b >= a)
print("b es menor o igual que a")
print(b <= a)
print("b ... |
def similar_users_query(user):
# Pass user object, return query to get users who starred same things as them
query = """
select subq.user_id
, sum(1/log(subq.stargazers_count+1)) `score`
, count(*) `count`
from
(select others.user_id
, others.starred_re... |
# Copyright (c) 2017 Cisco and/or its affiliates.
# 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 ag... |
class d_linked_node:
def __init__(self, initData, initNext, initPrevious):
# constructs a new node and initializes it to contain
# the given object (initData) and links to the given next
# and previous nodes.
self.__data = initData
self.__next = initNext
... |
class TimeInBedLessSleepError(Exception):
"""Ошибка возникающая, если время проведенное в кровати меньше времени сна"""
pass
class NonUniqueNotationDate(Exception):
"""Ошибка возникающая, если при импортировании файла с записями находится запись с датой,
которая уже существует в дневнике сна/базе данн... |
#python program to subtract two numbers using function
def subtraction(x,y): #function definifion for subtraction
sub=x-y
return sub
num1=int(input("please enter first number: "))#input from user to num1
num2=int(input("please enter second number: "))#input from user to num2
print("Subtraction is: ",subtract... |
'''
Package to read and process material export data.
To use, initiate an endomaterial object and start exploring!
---------
Examples:
## Init
from ukw_intelli_store import EndoMaterial
em = EndoMaterial(path, path)
## To explore all used materials:
em.mat_info
## To explore specific material id
em.get_mat_info_f... |
# Source: https://www.geeksforgeeks.org/sets-in-python/
# Python program to
# demonstrate intersection
# of two sets
set1 = [0,1,2,3,4,5]
set2 = [3,4,5,6,7,8,9]
set3 = set1 + set2
unique_set3 = []
for i in set3:
if i not in unique_set3:
unique_set3.append(i)
print("Intersection using intersecti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" ib.ext.cfg.EWrapperMsgGenerator -> config module for EWrapperMsgGenerator.java.
"""
modulePreamble = [
'from ib.ext.AnyWrapperMsgGenerator import AnyWrapperMsgGenerator',
'from ib.ext.Util import Util',
]
|
class Validator:
PLUS_CHAR = 43
AT_CHAR = 64
def __init__(self):
self.validation_results = None
self.sequence_symbols = list()
for symbol in "ACTGN.":
self.sequence_symbols.append(ord(symbol))
self.quality_score_symbols = list()
for symbol in "!\"#$%&'()*... |
#work in prgress - This creates a skelatal mods file for the givne set of files
templateFile = "C:\\python-scripts\\xml-file-output\\aids_skeletalmods.xml"
def createXmlFiles(idList):
print("create xml file list")
for id in idList:
#print("processing id " + id )
tree = ElementTree()
t... |
j,i=65,-2
for I in range (1,14):
J= j-5
I=i+3
print('I=%d J=%d' %(I,J))
j=J
i=I |
enums = {
'AmpPath': {
'values': [
{
'documentation': {
'description': ' Sets the amplification path to use the high power path. \n'
},
'name': 'HIGH_POWER',
'value': 16000
},
{
... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by Ross on 19-1-18
"""由于垃圾windows把我的代码无缘无故给删了,所以现在直接使用MKYAN的代码,若有侵权,请告知"""
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# 返回合并后列表
def Merge(self, pHead1, pHead2):
# write code here
... |
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def isMirror(self, left: TreeNode, right: TreeNode) -> bool:
if left is None and right is None:
return True
elif left is not ... |
class Solution(object):
def maxRotateFunction(self, A):
"""
:type A: List[int]
:rtype: int
"""
totalSum = sum(A)
Al = len(A)
F = {0:0}
for i in range(Al):
F[0] += i * A[i]
maxNum = F[0]
... |
class Config:
# image size
image_min_dims = 512
image_max_dims = 512
steps_per_epoch = 50
validation_steps = 20
batch_size = 16
epochs = 10
shuffle = True
num_classes = 21
|
'''https://leetcode.com/problems/course-schedule/
207. Course Schedule
Medium
7445
303
Add to List
Share
There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if ... |
# SPDX-FileCopyrightText: Copyright (C) 2019-2021 Ryan Finnie
# SPDX-License-Identifier: MIT
class SMWRand:
"""Super Mario World random number generator
Based on deconstruction by Retro Game Mechanics Explained
https://www.youtube.com/watch?v=q15yNrJHOak
"""
# SPDX-SnippetComment: Originally fro... |
#===================================================================================================================================================================================
# Author: Shlomo Stept
# ccvaliditycheck.py will open up a window and determine if any credit card number; entered by the user, is valid.
#... |
#coding=utf-8
# interval
interval = 60 # 上报的 step 间隔
# vcenter
host = "172.16.10.127" # vcenter 的地址
user = "administrator@vsphere.local" # vcenter 的用户名
pwd = "P@ssw0rd" # vcenter 的密码
port = 443 # vcenter 的端口
|
# Time complexity: O(n)
# Approach: Manacher's Algorithm. Please watch this vide for explanation https://youtu.be/V-sEwsca1ak
class Solution:
def longestPalindrome(self, s: str) -> str:
newS = ""
n = 2 * len(s) + 1
ind = 0
for j in range(n):
if j % 2 == 1:
... |
def is_index_valid(i, length):
return 0 <= i < length
initial_loot = input().split('|')
while True:
line = input()
if line == 'Yohoho!':
break
command = line.split(' ', maxsplit=1)
if command[0] == 'Loot':
items = command[1].split()
for item in items:
... |
초성 = ['ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ']
중성 = ['ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ', 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ']
종성 = ['', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ'... |
# Funksjon som sjekker om året er et skuddår
def is_leap_year(year):
if year % 400 == 0:
return True
elif year % 100 == 0:
return False
elif year % 4 == 0:
return True
return False
# Funksjon som returnerer hvilken ukedag året starter på.
# (fungerer bare fra og m... |
def idade_pessoa(id):
idp = int(id)
if idp <0:
return 'idade inválida'
elif idp <12:
return 'você ainda é uma criança'
elif idp <18:
return 'você é adolecente'
elif idp <65:
return 'Você já é adulto'
elif idp <100:
return 'você está na melhor idade'
... |
__author__ = 'Administrator'
# class Foo(object):
# instance = None
#
# def __init__(self):
# self.name = 'alex'
# @classmethod
# def get_instance(cls):
# if Foo.instance:
# return Foo.instance
# else:
# Foo.instance = Foo()
# return Foo.insta... |
ano = int(input('Ano que você nasceu: '))
if ano%4==0 and ano%100!=0 or ano%400==0:
print('Ano Bissexto')
else:
print('Não foi Bissexto')
|
# Requer atributo e atributo_comp = {"atributo": int (id_atributo), "atributo_comp" : int (id_atributo)}
select_efetividades = lambda : """
Select fator
FROM efetividades
WHERE atributo = :atributo
AND atributo_comp = :atributo_comp
""" |
'''
디지털 세계 토지조사
디지몬들이 살고 있는 추억의 세계 디지털 월드는 다양한 크기의 섬들로 이루어져있습니다.
당신은 디지털국토정보공사를 도와 디지털월드를 개발하기 위한 토지조사를 진행하기로 하였습니다.
디지털 월드는 정사각형모양으로 생겼고, 토지는 1, 해양은 0으로 구성되어있습니다.
1이 상,하,좌,우로 연결되어있는 경우를 섬이라고 합니다.
디지털 월드에 있는 모든 섬들의 갯수와 섬의 크기를 조사하여 디지털 국토정보공사의 지적측량을 도와주세요.
디지털월드의 국토는 다음과 같이 생겼습니다.
그림 1
디지털월드를 탐색해서 다음과 같이 섬의 구역을 나... |
inputfile = open('primes.txt')
lista = inputfile.read().split(',')
inputfile.close()
lista = sorted([int(i) for i in lista])
outputfile = open('primes_sorted.txt', 'w')
for i in lista:
outputfile.write(str(i)+',')
|
inp = input("Input roman numerals: ").upper() + " "
tot = 0
numeralDict = {
"I":1,
"V":5,
"X":10,
"L":50,
"C":100,
"D":500,
"M":1000
}
inp = list(inp)
for charNum in range(len(inp)):
char = inp[charNum]
if(char == "I"):
if(inp[charNum + 1] != "I" and inp[charNum + 1] != " "... |
# Crie um programa que leia o nome de uma pessoa e diga se ela tem 'Silva' no nome
nome = str(input('Digite seu nome completo: ')).strip()
print('Seu nome tem Silva? {}'.format('SILVA' in nome.upper()))
# Resolução da aula
# nome = str(input('Qual é seu nome completo? ')).strip()
# print('Seu nome tem Silva? {}'.for... |
def saudacao(saudar, nome):
print(saudar, nome)
saudacao('Olá', 'Leandro')
|
f=open('countlines.txt','rt')
n=0
for i in f:
n+=1
print(n)
f.close()
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Created by techno at 25/04/19
#Feature: #Enter feature name here
# Enter feature description here
#Scenario: # Enter scenario name here
# Enter steps here
""" tokenizing a string and counting unique words"""
text = ('this is sample text with several words different... |
our_method_top50_dict = {
2: {
'is_hired_1mo': 0.98,
'is_unemployed': 0.98,
'lost_job_1mo': 0.74,
'job_search': 0.12,
'job_offer': 1.0},
0: {
'is_hired_1mo': 0.92,
'is_unemployed': 0.06,
'lost_job_1mo': 0.3,
'job_search': 1.0,
'job_... |
def solve() -> int:
n, a, b, x, y, z = map(int, input().split())
y = min(y, a * x)
z = min(z, b * x)
if y * b > z * a:
a, b = b, a
y, z = z, y
mn_cost = 1 << 60
if n // a <= a - 1:
for i in range(n // a + 1):
j, k = divmod(n - i * a, b)
... |
pessoas_jantar = input("Boa noite,quantas pessoas estão para jantar?:")
pessoas_jantar = int(pessoas_jantar)
if pessoas_jantar >= 8:
print("Desculpe como vocês estão em " + str(pessoas_jantar)
+ " pessoas,precisarão aguardar termos mesas disponiveis.")
else:
print("Ok! Por favor me acompanhe até sua mesa!"... |
def total(n):
return n <= 9 and n >= 0
def main():
n = int(input("Digite um numero entre 0 e 9, caso contrario será falso: "))
resultado = total(n)
print(f' o numero é {resultado}')
if __name__ == '__main__':
main() |
# Problem Statement: https://leetcode.com/problems/climbing-stairs/
class Solution:
def climbStairs(self, n: int) -> int:
# Base Cases
if n==1:
return 1
if n==2:
return 2
# Memoization
memo_table = [1]*(n+1)
# Initializati... |
#concatenation
# youtuber = " varun verma" #some string concatenation
# print("subscribe to "+ youtuber)
# print("subscribe to {}" .format(youtuber))
# print(f"subscriber to {youtuber}")
adj= input("Adjective: ")
verb1 = input("Verb: ")
verb2 = input("Verb: ")
famous_person = input("Famous Person: ")
madlib = f"Comput... |
class Solution:
def XXX(self, nums: List[int]) -> bool:
l = len(nums)
start = l-1
end = 1
for index in range(1,l):
val = nums[start - index]
if val >= end:
end = 1
else:
end += 1
return end == 1
|
# Sage version information for Python scripts
# This file is auto-generated by the sage-update-version script, do not edit!
version = '9.5.beta2'
date = '2021-09-26'
banner = 'SageMath version 9.5.beta2, Release Date: 2021-09-26'
|
countries = {
"kabul": "afghanistan",
"tirana": "albania",
"alger": "algeria",
"fagatogo": "american samoa",
"andorra la vella": "andorra",
"luanda": "angola",
"the valley": "anguilla",
"null": "united states minor outlying islands",
"saint john's": "antigua and barbuda",
"buenos... |
def createTree(self, root, *elements):
root = None
for element in elements:
root = self.insert(root, element)
return root |
class ClassList(list):
def __init__(self):
self.OnClassListChange = lambda *args,**kwargs:0
def AddClass(self,Cls, notify = True):
if Cls not in self:
self.append(Cls)
if notify:self.OnClassListChange(added = self[-1])
def RemoveClass(self, Cls, notify = True):
... |
'''
Defines `Error`, the base class for all exceptions generated in this package.
'''
class Error(Exception):
pass
|
def can_build(env, platform):
return True
def configure(env):
pass
def get_doc_classes():
return [
"WorldArea",
"VoxelLight",
"VoxelmanLight",
"VoxelmanLevelGenerator",
"VoxelmanLevelGeneratorFlat",
"VoxelSurfaceMerger",
"VoxelSurfaceSimple",
... |
#
# PySNMP MIB module Fore-J2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-J2-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:17:14 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... |
n = int(input())
lado = 2
for i in range(n):
lado = 2*lado-1
print(lado*lado)
|
class SequentialSearchST():
first = None
class Node():
def __init__(self, key, val, next):
self.key = key
self.val = val
self.next = next
def get(self, key):
x = self.first
while x is not None:
if key == x.key:
return x.val
x = x.next
return None
def ... |
class Solution:
def findNumberIn2DArray(self, matrix, target: int) -> bool:
if not matrix:
return False
n,m=len(matrix),len(matrix[0])
if m==0:
return False
row,col=0,m-1
while 1:
print(row,col)
cur=matrix[row][col]
... |
class StackCollection:
def __init__(self, client=None, data=None):
super(StackCollection, self).__init__()
if data is None:
paginator = client.get_paginator('describe_stacks')
results = paginator.paginate()
self.list = list()
for result in results:
... |
"""
import a
import a.b
import a.B (and is the cross thing)
import a.*
import a.b as c
from a import b, c
import a, b
from _ import *
"""
# objects see their own vars
# function args are seen ((x)->x)(2)
# import bogus
# errors
# bogus -> NameError
"""
del list[index]
del x
del dict[key]
delete o... |
# author: Allyson Vasquez
# version: May.14.2020
# Practice using functions & lists
# https://www.w3resource.com/python-exercises/python-functions-exercises.php
# Find the max of three numbers
def max(x,y,z):
if x > y or x == y:
num1 = x
else:
num1 = y
if num1 > z or num1 == z:
ma... |
def ajuda(com, cor=0):
print(c[cor], end='')
help(com)
print(c[0], end='')
def titulo(msg, cor=0):
tam = len(msg)+4
print(c[cor], end='')
print('~' * tam)
print(f' {msg}')
print('~' * tam)
print(c[0], end='')
#pricipal
c = ('\033[m', #sem cores
'\033[0;30;41m', ... |
# pylint: disable=missing-docstring
__title__ = "estraven"
__summary__ = "An opinionated YAML formatter for Ansible playbooks"
__version__ = "0.0.0"
__url__ = "https://github.com/enpaul/estraven/"
__license__ = "MIT"
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
"""
0034. Find First and Last Position of Element in Sorted Array
Medium
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.
If target is not found in the array, return [-1, -1].
Follow up: Could you write an algorithm with O(log n) runtime comple... |
def parallel_generator(generators, functors):
"""
:param generators: A list of k generators (initialized) repersenting files,
file are sorted with respect to the functors.
:param functors: A list of k functors (must be the same size as the generators),
... |
def reg(n):
j = 0
i = 2
while i**2<=n and j!=1:
if n % i == 0:
j = 1
else:
i = i + 1
else:
if j == 1:
j = "Составное число"
elif j == 0:
j = "Простое число"
return j
n = int(input())
print(reg(n))
|
concept_detector_cfg = dict(
quantile_threshold=0.99,
with_bboxes=True,
count_disjoint=True,
)
target_layer = 'layer3.5'
|
method1 = []
method2 = []
with open("out.raw", "rb") as file:
byteValue = file.read(2)
while byteValue != b"":
intValueOne = int.from_bytes(byteValue, "big", signed=True)
intValueTwo = int.from_bytes(byteValue, "little", signed=True)
method1.append(intValueOne)
method2.append... |
#
# PySNMP MIB module CISCO-TELEPRESENCE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-TELEPRESENCE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:14:18 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
#!usr/bin/python
# -*- coding:utf8 -*-
"""
__del__:析构方法, 当对象在内存中被释放时,自动触发此方法
"""
class Foo:
def __del__(self):
print("__del__")
obj = Foo() # 程序结束自动会被回收
|
class SearchModule:
def __init__(self):
pass
def search_for_competition_by_name(self, competitions, query):
m, answer = self.search(competitions, attribute_name="caption", query=query)
if m == 0:
return False
return answer
def search_for_competition_by_code(self... |
""" Write a program to display values of variables in Python. """
message = "Keep Smiling!"
print(message)
userNo = 101
print("User No is ", userNo)
gender = 'M'
print("Gender: ",gender)
|
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "core_library", "core_resource")
filegroup(
name = "core_common",
srcs = [
":src/common/ExceptionExtensions.cs",
":src/common/Guard.cs",
":src/common/TestMethodDisplay.cs",
":src/common/TestMethodDisplayOptions.cs",
] + ["@xuni... |
res = []
with open('test.txt', mode='r', encoding="utf-8") as f:
for line in f:
arr = line.split()
print(arr)
res.append(arr[1])
r = '\t'.join(res)
with open('res.txt', mode='w', encoding="utf-8") as f:
# print(r)
f.write(r) |
class GuildConfig:
def __init__(self, data):
self._data = data
self.prefix = self.settings['prefix']
self.offset = self.settings['offset']
self.regional_pkmn = self.settings['regional']
self.has_configured = self.settings['done']
@property
def settings(self):
... |
# -*- coding: utf-8 -*-
"""Top-level package for Elejandria Libros chef."""
__author__ = """Learning Equality"""
__email__ = 'benjamin@learningequality.org'
__version__ = '0.1.0'
|
"""
# Definition for a Node.
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
"""
class Solution:
def treeToDoublyList(self, root: 'Node') -> 'Node':
if not root: return None
nodes = []
def inorder(roo... |
def solution(salaries: list[int]) -> int:
return sorted(salaries)[1]
if __name__ == '__main__':
user_input = input()
param = [int(x) for x in user_input.split()]
print(solution(salaries=param))
|
#adding two numbers
num1 = 2
num2 = 3
sum = num1 + num2
print("The sum is:", sum) |
""" Cube class contains the logic for maintaining the current
state of the container, or Bedlam Cube, and methods for
checking, inserting, and removing individual Shape objects
from the cube space. """
""" Each Cube is made up of X * Y * Z Cuboids, Each of which
for simplicities sakes contain all the... |
def validate_positive_integer(param):
if isinstance(param,int) and (param > 0):
return(None)
else:
raise ValueError("Invalid value, expected positive integer, got {0}".format(param))
|
n = float(input('Distância viagem: '))
'''if n > 200:
n1 = n*0.45
else:
n1 = n*0.5'''
# modo 2
n1 = n*0.5 if n<=200 else n*0.45
print('Sua viagem de {}km custará {} reais'.format(n, n1))
|
class Node:
"""
This Node class has been created for you.
It contains the necessary properties for the solution, which are:
- text
- next
"""
def __init__(self, data, value):
self.data = data
self.value = value
self.__left = None
self.__right = None
def ... |
class Solution:
def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:
n = len(gas)
total_tank, curr_tank = 0, 0
start = 0
for i in range(n):
total_tank += gas[i] - cost[i]
curr_tank += gas[i] - cost[i]
# If one cou... |
def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the messag... |
# New tokens can be found at https://archive.org/account/s3.php
IA_ACCESS_KEY = 'change to valid token'
IA_SECRET_KEY = 'change to valid token'
DOI_FORMAT = '10.70102/fk2osf.io/{guid}'
OSF_BEARER_TOKEN = ''
DATACITE_USERNAME = None
DATACITE_PASSWORD = None
DATACITE_URL = None
DATACITE_PREFIX = '10.70102' # Datacite... |
test = { 'name': 'q5',
'points': 3,
'suites': [ { 'cases': [ {'code': ">>> big_tippers(['suraj', 15, 'isaac', 9, 'angela', 19]) == ['suraj', 'angela']\nTrue", 'hidden': False, 'locked': False},
{ 'code': ">>> big_tippers(['suraj', 15, 'isaac', 25, 'angela', 19, 'anna... |
#statsFunctions2.py
def total(list_obj):
total = 0
n = len(list_obj)
for i in range(n):
total += list_obj[i]
return total
def mean(list_obj):
n = len(list_obj)
mean = total(list_obj) / n
return mean
list1 = [3, 6, 9, 12, 15]
total_list1 = total(list1)
print(total_list1)
mean_list1... |
hora = input('Digite a hora atual: ')
try:
hora = int(hora)
if 0 <= hora <= 11:
print('Bom Dia')
elif 12 <= hora <= 17:
print('Boa Tarde')
elif 18 <= hora <= 23:
print('Boa Noite')
else:
print('Valor Inválido')
except:
print('Valor Inválido')
|
ble_address_type = {
'gap_address_type_public': 0,
'gap_address_type_random': 1
}
gap_discoverable_mode = {
'non_discoverable': 0x00,
'limited_discoverable': 0x01,
'general_discoverable': 0x02,
'broadcast': 0x03,
'user_data': 0x04,
'enhanced_broadcasting': 0x80
}
gap_connectable_mode = {... |
#-------------------------------------------------------------------------------
# mrna
#-------------------------------------------------------------------------------
def runFib(inputFile):
fi = open(inputFile, 'r') #reads in the file that list the before/after file names
inputData = fi.readline().split() #r... |
#!/usr/bin/python
CONFIG = {
"BUCKET": "sd_s3_testbucket",
"EXEC_FMT": "/usr/bin/python -m syndicate.rg.gateway",
"DRIVER": "syndicate.rg.drivers.s3"
}
|
expected_output = {
'lsps': {
'mlx8.1_to_ces.2': {
'destination': '1.1.1.1',
'admin': 'UP',
'operational': 'UP',
'flap_count': 1,
'retry_count': 0,
'tunnel_interface': 'tunnel0'
},
'mlx8.1_to_ces.1': {
'desti... |
"""
Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
The same repeated number may be chosen from C unlimited number of times.
Note:
All numbers (including target) will be positive integers.
The solution set must... |
{
'targets': [
{
'target_name': 'modemmanager-dbus-proxies',
'type': 'none',
'variables': {
'xml2cpp_type': 'proxy',
'xml2cpp_in_dir': '<(sysroot)/usr/share/dbus-1/interfaces/',
'xml2cpp_out_dir': 'include/dbus_proxies',
},
'sources': [
'<(xml2cpp_in_d... |
n1 = int(input("Digite um número: "))
if __name__ == '__main__':
if n1 % 2 == 0:
print("Número Par")
elif n1 % 2 == 1:
print("Número Ímpar")
else:
print("Valor Inválido") |
class Queue:
def __init__(self):
self.in_stack = []
self.out_stack = []
# Transfer values in stack1 to stack2
def stack_transfer(self, stack1, stack2):
while stack1:
stack2.append(stack1.pop())
def enqueue(self, value):
self.in_stack.append(value)
def d... |
l = iface.activeLayer()
iter = l.getFeatures()
geoms = []
for feature in iter:
geom = feature.geometry()
if not(geom.isMultipart()):
l.boundingBox(feature.id())
geoms.append(geom)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.