content stringlengths 7 1.05M |
|---|
class PathNotSetError(Exception):
"""database path not set error"""
def __init__(self,message):
super(PathNotSetError, self).__init__(message)
self.message = message
class SetPasswordError(Exception):
"""session password not set error"""
def __init__(self, message):
super(SetPasswordError, self).__init__... |
RICK_DB_VERSION = ["0", "9", "4"]
def get_version():
return ".".join(RICK_DB_VERSION)
|
### Given two strings, determine whether one is permutations of the other
# Solution: Two strings are permutations of each other if they have the same characters in different order.
# So, you can sort them and compare them
# Clarify if they are case sensitive, or if they contain space.
# Answer 1: Brute force, sort ... |
#Displays Bot Username ***Required***
name = '#Insert Bot Username Here#'
#Bot User ID ***Required***
uid = '#Insert Bot User ID Here#'
#Banner List (This is for On-Account-Creation Banner RNG)
banner_list = ['https://cdn.discordapp.com/attachments/461057214749081600/468314847147196416/image.gif', 'https://cdn.discord... |
class YandexAPIError(Exception):
error_codes = {
401: "ERR_KEY_INVALID",
402: "ERR_KEY_BLOCKED",
403: "ERR_DAILY_REQ_LIMIT_EXCEEDED",
413: "ERR_TEXT_TOO_LONG",
501: "ERR_LANG_NOT_SUPPORTED",
}
def __init__(self, response: dict = None):
status_code = response... |
class InsertConflictError(Exception):
pass
class OptimisticLockError(Exception):
pass
|
# puzzle easy // https://www.codingame.com/ide/puzzle/sudoku-validator
# needed values
row_, column_, grid_3x3, sol = [], [], [], []
valid = [1, 2, 3, 4, 5, 6, 7, 8, 9]
subgrid = False
# needed functions
def check(arr):
for _ in arr:
tmp = valid.copy()
for s in _:
if s in tmp: tmp.re... |
#
# (c) Copyright 2021 Micro Focus or one of its affiliates.
#
class ErrorMessage:
GENERAL_ERROR = "Something went wrong"
OA_SERVICE_CAN_NOT_BE_NONE = "service_endpoint can not be empty"
MAX_ATTEMPTS_CAN_NOT_BE_NONE = "max_attempts can not be empty"
USERNAME_CAN_NOT_BE_NONE = "username can not be empt... |
DEBUG=False
# bool value
# True for debug output
ADC_URL='http://192.168.1.1'
# str value
# URL to FortiADC Management/API interface
ADC_USERNAME='certificate_admin'
# str value
# Administrator account on FortiADC
# Account requires only System Read-Write Access Prof... |
#############################################
# Author: Hongwei Fan #
# E-mail: hwnorm@outlook.com #
# Homepage: https://github.com/hwfan #
#############################################
def format_size(num_size):
try:
num_size = float(num_size)
KB ... |
ACRONYM = "PMC"
def promoter(**identifier_properties):
unique_data_string = [
identifier_properties.get("name", "NoName"),
identifier_properties.get("pos1", "NoPos1"),
identifier_properties.get("transcriptionStartSite", {}).get("leftEndPosition", "NoTSSLEND"),
identifier_properties... |
# Configuration values
# Edit this file to match your server settings and options
config = {
'usenet_server': 'news.easynews.com',
'usenet_port': 119,
'usenet_username': '',
'usenet_password': '',
'database_server': 'localhost',
'database_port': 27017,
'... |
class TarsError(Exception):
pass
class SyncError(TarsError):
pass
class PackageError(TarsError):
pass
|
class Deque:
""" Deque implementation using python list as underlying storage """
def __init__(self):
""" Creates an empty deque """
self._data = []
def __len__(self):
""" Returns the length of the deque """
return len(self._data)
def display(self):
return self.... |
MAGIC = {
"xls": "{D0 CF 11}",
"html": None
}
|
def generate_key(n):
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
key = {}
cnt = 0
for c in letters:
key[c] = letters[(cnt + n) % len(letters)]
cnt += 1
return key
def encrypt(key, message):
cipher = ""
for c in message:
if c in key:
cipher += key[c]
e... |
# Library targets for DashToHls. These minimize external dependencies (such
# as OpenSSL) so other projects can depend on them without bringing in
# unnecessary dependencies.
{
'target_defaults': {
'xcode_settings': {
'CLANG_ENABLE_OBJC_ARC': [ 'YES' ],
},
},
'targets': [
{
'target_name': ... |
class DreamingAboutCarrots:
def carrotsBetweenCarrots(self, x1, y1, x2, y2):
(x1, x2), (y1, y2) = sorted([x1, x2]), sorted([y1, y2])
dx, dy = x2-x1, y2-y1
return sum(
(x-x1)*dy - (y-y1)*dx == 0
for x in xrange(x1, x2+1)
for y in xrange(y1, y2+1)
) ... |
class Solution:
def numFriendRequests(self, ages):
"""
:type ages: List[int]
:rtype: int
"""
cntr, res = collections.Counter(ages), 0
for A in cntr:
for B in cntr:
if B <= 0.5 * A + 7 or B > A: continue
if A == B: res += cnt... |
# TODO: Implement
class StorageMan():
"""
Storage Manager
"""
def __init__(self):
pass
def stroe_info(self):
pass
def store_result(self):
pass
def _get_file_path(self):
pass
|
#spotify
spotify_token = ""
spotify_client_id = ""
user_id=''
#youtube
#scopes = ["https://www.googleapis.com/auth/youtube.force-ssl"]
|
def peak(A):
start = 0
end = len(A) - 1
while(start <= end):
mid = start + (end - start)//2
if(mid > 0 and mid < len(A)-1):
if(A[mid] > A[mid-1] and A[mid] > A[mid+1]):
return A[mid]
elif(A[mid] < A[mid-1]):
end = mid -1
... |
async def dm(user, **kwargs):
"""functions the same as a send function"""
dm = user.dm_channel
if dm is None:
dm = await user.create_dm()
await dm.send(**kwargs)
|
{
SchemaConfigRoot: {
SchemaType: SchemaTypeArray,
SchemaRule: [
CheckForeachAsType(PDBConst.DB)
]
},
PDBConst.DB: {
SchemaType: SchemaTypeDict,
SchemaRule: [
HasKey(PDBConst.Name, PDBConst.Tables)
]
},
PDBConst.Name: {
... |
class Card(object):
"""Cards in the deck."""
pass
|
class OSContainerError(Exception):
"""General container data processing error"""
def __init__(self, *args, **kwargs):
super(OSContainerError, self).__init__(*args, **kwargs)
|
# Time: init:O(len(nums)), update: O(logn), sumRange: O(logn)
# Space: init:O(len(nums)), update: O(1), sumRange: O(1)
class NumArray:
def __init__(self, nums: List[int]):
self.n = len(nums)
self.arr = [None]*(2*self.n-1)
last_row_index = 0
for index in range(self.n-1, 2*self.n-1... |
# Author: Melissa Perez
# Date: --/--/--
# Description:
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode... |
""" Contains a class that implements an unweighted and undirected graph.
This module implements an API that define the fundamental graph operations. It contains only one class, called Graph,
that implements an unweighted and undirected graph.
@Author: Gabriel Nogueira (Talendar)
"""
class Graph:
""" Implementat... |
class Solution(object):
def maxProfit(self, prices):
if not prices or len(prices)<=1: return 0
N = len(prices)
buy = [-prices[0], max(-prices[1], -prices[0])]
sell = [0, max(prices[1]+buy[0], 0)]
for i in xrange(2, N):
buy.append(max(sell[i-2]-prices[i],... |
namespace = "reflex_takktile2"
takktile2_config = {}
all_joint_names = ["%s_f1"%namespace,
"%s_f2"%namespace,
"%s_f3"%namespace,
"%s_preshape"%namespace]
joint_limits = [{'lower': 0.0, 'upper': 3.14},
{'lower': 0.0, 'upper': 3.14},
{'lower': 0.0, 'upper': 3.14},
... |
r"""
tk.PanedWindow based
"""
class Handler:
pass
|
numeros = list()
maiorPosicao = list()
menorPosicao = list()
for i in (range(5)):
numeros.append(int(input('Digite o valor: ')))
maior = max(numeros)
menor = min(numeros)
for c, i in enumerate(numeros):
if i == maior:
maiorPosicao.append(c)
if i == menor:
menorPosicao.append(c)
print... |
class Paths(object):
qradio_path = ''
python_path = ''
def __init__(self):
qradio_path = 'path_to_cli_qradio.py'
python_path = ''
|
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1, # Use higher warning level.
},
'target_defaults': {
'conditions': [
# Linux shared libraries sh... |
'''
basic datatypes
---------------
bool -> boolean
int -> integer
float -> decimals/float
str -> string
dict -> dictionaries (aka. hash map in some languages)
list -> lists (aka. arrays in some langauges)
tuples -> basically lists, but immutable
None ... |
# coding=utf-8
def get_procurement_type_xpath(mode):
procurement_type_xpath = {
"belowThreshold": "//*[@value='belowThreshold']",
"openua": "//*[@name='tender[procedure_type]_2']",
"openeu": "//*[@name='tender[procedure_type]_3']",
"negotiation": "//*[@name='tender[procedure_... |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... |
class Bike:
name = ''
color= ' '
price = 0
def info(self, name, color, price):
self.name, self.color, self.price = name,color,price
print("{}: {} and {}".format(self.name,self.color,self.price))
|
#
# PySNMP MIB module DISMAN-EXPRESSION-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/DISMAN-EXPRESSION-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:07:59 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016,... |
q = int(input())
for i in range(q):
l1,r1,l2,r2 = map(int, input().split())
if l2 < l1 and r2 < r1:
print(l1, l2)
else:
print(l1,r2)
|
API_URL = "https://keel.algida.me/electra/api/promo"
AppKey = "4125C97A-D92E-4F60-82C2-CC6CA5A3E683"
LoginResponse = {
"key": "Message",
"wrong": {
"values": ["Girmiş olduğunuz cep telefonu numarası sistemde kayıtlı değildir, lütfen kontrol edip tekrar deneyiniz"],
"code": 1
},
... |
"proto_scala_library.bzl provides a scala_library for proto files."
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library")
def proto_scala_library(**kwargs):
scala_library(**kwargs)
|
isbn = input().split('-')
offset = 0
weight = 1
for i in range(3):
for j in isbn[i]:
offset = offset + int(j) * weight
weight += 1
offset = offset % 11
if offset == 10 and isbn[3] == 'X':
print('Right')
elif offset < 10 and str(offset) == isbn[3]:
print('Right')
else:
if offset == 10:... |
def find_missing( current_list, target_list ):
return [ x for x in target_list if x not in current_list ]
def compare( current_list, target_list ):
additions_list = find_missing( current_list, target_list )
deletions_list = find_missing( target_list, current_list )
return { 'additions': additions_list,... |
# Escreva um programa que vai ler a velocidade de um carro. Se ele ultrapassar 80Km/h,
# mostre uma mensagem caso ultrapasse os 80Km/h dizendo que ele foi multado.
# A multa vai custar R$ 7,00 por Km acima da média. Calcule o valor da multa e mostre junto da mensagem também.
print('A velocidade máxima é de 80Km/h! Cas... |
def __len__(self):
"""Method to behave like a list and iterate in the object"""
if self.nb_simu != None:
return self.nb_simu
else:
return len(self.output_list)
|
#
# PySNMP MIB module Wellfleet-AT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-AT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:32:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
def findOrder(numCourses, prerequisites):
"""
:type numCourse: int
:type prerequirements: List[List[int]]
:rtype:list
"""
L = []
in_degrees = [0 for _ in range(numCourses)]
graph = [[] for _ in range(numCourses)]
# Construct the graph
for u, v in prerequisites:
graph[v... |
# https://paiza.jp/poh/hatsukoi/challenge/hatsukoi_hair4
def func1(des):
count = 0
for [d, e] in des:
if d == e:
count += 1
if count >= 3:
print('OK')
else:
print('NG')
def func2(des):
count = 0
for d,e in des:
if d == e:
count += 1
return 'OK' if count >= 3 else 'NG'
def ... |
class Solution:
def interpret(self, command: str) -> str:
result = ""
for i in range(len(command)):
if command[i] == 'G':
result += command[i]
elif command[i] == '(':
if command[i+1] == ')':
result ... |
# cook your dish here
for i in range(int(input())):
x=int(input())
cars=x//4
left=x-(cars*4)
bikes=left//2
leftafter=left-(bikes*2)
if bikes>0:
print("YES")
else:
print("NO")
|
nota1 = float(input('Digite a sua nota: '))
nota2 = float(input('Digite outra nota: '))
media = (nota1 + nota2)/2
print(f'A sua primeira nota é {nota1}, a sua segunda nota é {nota2}, \n'
f'A média entre elas é {media :.1f}')
|
"""Constants for JSON keys used primarily in the PR recorder."""
class TOP_LEVEL:
"""The top-level keys."""
REPO_SLUG = "repoSlug"
class PR:
"""Keys for PR metadata."""
SECTION_KEY = "prMetadata"
URL = "url"
CREATED_AT = "createdAt"
CLOSED_AT = "closedAt"
MERGED_AT = "mergedAt"
... |
NUMBERS = (-10, -21, -4, -45, -66, -93, 11)
def count_positives(lst: list[int] | tuple[int]) -> int:
return len([num for num in lst if num >= 1])
# return len(list(filter(lambda x: x >= 0, lst)))
POS_COUNT = count_positives(NUMBERS)
if __name__ == "__main__":
print(f"Positive numbers in the list: {POS_... |
#!/usr/bin/python3
CARDS = """Hesper Starkey
Paracelsus
Archibald Alderton
Elladora Ketteridge
Gaspard Shingleton
Glover Hipworth
Gregory the Smarmy
Laverne DeMontmorency
Ignatia Wildsmith
Sacharissa Tugwood
Glanmore Peakes
Balfour Blane
Felix Summerbee
Greta Catchlove
Honouria Nutcombe
Gifford Ollerton
Jocunda Sykes
... |
class train_config:
datasets = {'glove':{'N':1183514,'d':100},
'Sift-128':{'N':1000000, 'd':128}
}
dataset_name = 'glove'
inp_dim = datasets[dataset_name]['d']
n_classes = datasets[dataset_name]['N']
####
n_cores = 1 # core count for TF REcord data loader
B = ... |
def palindrome(s):
l = len(s)
if l == 0 or l == 1:
return True
return (s[0] == s[l-1]) and palindrome(s[1:l-1])
|
n = int(input())
sum = 0
for i in range(n):
num = int(input())
sum += num
print(sum) |
# noqa: D104
# pylint: disable=missing-module-docstring
__version__ = "0.0.18"
|
#!/usr/bin/env python
# encoding: utf-8
'''
@author: Jason Lee
@license: (C) Copyright @ Jason Lee
@contact: jiansenll@163.com
@file: 11.py
@time: 2019/5/27 13:35
@desc:
'''
class Solution:
def maxArea(self, height: List[int]) -> int:
# f(n) = max{f(n-1), max[min(ai, an)*(n-i)]}
f = [0 for ... |
''' DESENVOLVA UM PROGRAMA QUE LEIA 6 NÚMEROS INTEIROS E MOSTRE A SOMA APENAS
DAQUELES QUE FOREM PARES. SE O VALOR INFORMADO FOR ÍMPAR DESCONSIDERE'''
s = 0
for i in range(1, 7):
n = int(input('Informe um número inteiro: '))
if (n % 2) == 0:
s += n
print('A soma dos números pares dentre os informados é ... |
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __repr__(self):
return "{} => (l: {}, r: {})".format(
self.data, self.left, self.right)
def get_tree(seq):
head = Node(seq[-1])
if len(seq) == 1:
return he... |
#Definicion de variables y otros
print("ajercicio 01: Area de un Trianfulo ")
#Datos de entrada mediante dispositivos de entrada
b=int(input("Ingrese Base:"))
h=int(input("Ingrese altura:"))
#preceso
area=(b*h)/2
#datos de salida
print("El area es:", area)
|
#!/usr/bin/env python
"""
Difficulty: 4
You are stuck on the Moon and need to get back to Earth! To be able to get back to
Earth, we need to solve a linear system of equations. Don't ask how solving a linear
system of equation helps you getting back to the Earth. It just does.
Unfortunately, the Internet connection ... |
class ClassicalModel(object):
"""
The model for a classical erasure channel.
"""
def __init__(self):
self._length = 0
self._transmission_p = 1.0
@property
def length(self):
"""
Length of the channel in Km
Returns:
(float) : Length of the cha... |
def collatz ( n ):
'''
collatz: According to Collatz Conjecture generates a sequence that terminates at 1.
n: positive integer that starts the sequence
'''
# recursion unrolling
while n != 1:
print(n)
if n % 2 ==0: # n is even
n //= 2
else: ... |
#SUBPROGRAMAS
def menordist(pontos, centroide):
menorind = 0
for index, ponto in enumerate(pontos):
dist = ((ponto[0]-centroide[0])**2 + (ponto[1]-centroide[1])**2)**(1/2)
if index == 0:
menordist = dist
else:
if dist < menordist:
menorind = index
menordist = dist
stringme... |
class Solution:
def dfs(self, nums, visit, cur, res):
"""
visit记录元素是否被使用
cur是一个排列
res是最后的结果
"""
if len(cur) == len(nums):
res.append(cur[:])
last = None
for i in range(len(nums)):
if visit[i]:
continue
... |
# hello4.py
def hello():
print("Hello, world!")
def test():
hello()
if __name__ == '__main__': test() |
#! python3
# aoc_07.py
# Advent of code:
# https://adventofcode.com/2021/day/7
# https://adventofcode.com/2021/day/7#part2
#
def part_one(input) -> int:
with open(input, 'r') as f:
data = [[int(x) for x in line.strip()] for line in f.readlines()]
return 0
def part_two(input) -> int:
with open(input... |
#
# Copyright 2021 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
ddo_dict = {
"id": "did:op:e16a777d1f146dba369cf98d212f34c17d9de516fcda5c9546076cf043ba6e37",
"version": "4.1.0",
"chain_id": 8996,
"metadata": {
"created": "2021-12-29T13:34:27",
"updated": "2021-12-29T... |
num_pessoas = maior_idade = homens = menor_idade = 0
print('\033[1;31m CADASTRAMENTO \033[m')
while True:
print('-=' * 20)
idade = int(input('Digite a idade: '))
if idade >= 18:
maior_idade += 1
sexo = str(input('Digite o sexo [M/F]: ')).upper().strip()[0]
while sexo not in 'MmFf':
s... |
def solve(n, ss):
inp_arr_unsorted = [int(k) for k in ss.split(' ')]
inp_arr = sorted(inp_arr_unsorted)[::-1]
flag = False
counter = 0
n_fix = n
candidate_ans = 0
while not flag:
if inp_arr[counter] <= n:
flag = True
candidate_ans = n
else:
... |
# print("Valdis")
#
# # # # we declare variables in Python when we first use them
# my_name = "Valdis" # there are no types no val, no var no const nothing like that in Python
# print(my_name)
# print("my_name") # this is not a variable, this string literal
#
# # # variables do have data types in Python
# print(type(... |
#
# PySNMP MIB module ALVARION-AAA-CLIENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-AAA-CLIENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:21:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
begin_unit
comment|'# All Rights Reserved.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#... |
chosenNumber = int(input("Number? "))
rangeNumber = 100
previousNumber = 0
count = 0
while count != 10:
count += 1
rangeNumber = (100 - previousNumber) // 2
previousNumber = rangeNumber + previousNumber
print("rangeNumber: %i; previousNumber: %i; try: %i" % (rangeNumber, previousNumber, count))
i... |
'''
Copyright (c) 2012-2017, Agora Games, LLC All rights reserved.
https://github.com/agoragames/kairos/blob/master/LICENSE.txt
'''
class KairosException(Exception):
'''Base class for all kairos exceptions'''
class UnknownInterval(KairosException):
'''The requested interval is not configured.'''
|
"""
What you will lean:
- What is a while loop
- How to write a while
- starting conditions for while loops
- Exit conditions for while loops
Okay so now we know if a "thing" is True of False. Now let's use that tool for something more powerful: loops.
We will first do "while loops".
Pretend you are drunk and on a ma... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
def test1():
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
print(letters)
letters[2:5] = ['C', 'D', 'E']
print(letters)
letters[2:5] = []
print(letters)
letters[:] = []
print(letters)
def test2():
print('\ntest2')
a = ['a', 'b'... |
DEFAULT_DOMAIN = "messages"
DEFAULT_LOCALE_DIR_NAME = "locale"
DEFAULT_IGNORE_PATTERNS = [
".*",
"*~",
"CVS",
"__pycache__",
"*.pyc",
]
DEFAULT_KEYWORDS = [
"_", "gettext",
"L_", "gettext_lazy",
"N_:1,2", "ngettext:1,2",
"LN_:1,2", "ngettext_lazy:1,2",
"P_:1c,2", "... |
a = 50
print('\033[32m_\033[m'*a)
print('\033[1;32m{:=^{}}\033[m'.format('SISTEMA DE DETECÇAO DE NUMEROS', a))
print('\033[32m-\033[m'*a)
nove = 0
par = '0'
num1 = int(input('\033[35mDigite um numero inteiro: '))
num2 = int(input('\033[35mDigite um numero inteiro: '))
num3 = int(input('\033[35mDigite um numero inteiro... |
"""Function for building a diatomic molecule."""
def create_diatomic_molecule_geometry(species1, species2, bond_length):
"""Create a molecular geometry for a diatomic molecule.
Args:
species1 (str): Chemical symbol of the first atom, e.g. 'H'.
species2 (str): Chemical symbol of the second ... |
X_threads = 16*2
Y_threads = 1
Invoc_count = 2
start_index = 0
end_index = 0
src_list = ["needle_kernel.cu", "needle.h"]
SHARED_MEM_USE = True
total_shared_mem_size = 2.18*1024
domi_list = [233]
domi_val = [0]
|
# -*- coding: utf-8 -*-
__author__ = 'luckydonald'
CHARS_UNESCAPED = ["\\", "\n", "\r", "\t", "\b", "\a", "'"]
CHARS_ESCAPED = ["\\\\", "\\n", "\\r", "\\t", "\\b", "\\a", "\\'"]
def suppress_context(exc):
exc.__context__ = None
return exc
def escape(string):
for i in range(0, 7):
string = string.replace(CHARS... |
#! /usr/bin/env python3
# coding: utf-8
def main():
file1 = open('input', 'r')
Lines = file1.readlines()
valid_passwords = 0
numbers = []
# Strips the newline character
for line in Lines:
print(line)
firstPosition = int(line.split('-')[0])
secondPosition = int(line.... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 17:21:06 2020
@author: Ravi
"""
def MazeRunner(n,s):
ans = ''
for i in s:
if i=='S':
ans+='E'
else:
ans+='S'
return ans
t = int(input())
for i in range(t):
n = int(input())
s = input()
... |
recipes_tuple = {
"Chicken and chips": [
("chicken", 100),
("potatoes", 3),
("salt", 1),
("malt vinegar", 5),
],
}
recipes_dict = {
"Chicken and chips": {
"chicken": 100,
"potatoes": 3,
"salt": 1,
"malt vinegar": 5,
},
}
# using tuples
fo... |
# =====================================
# generator=datazen
# version=2.1.0
# hash=8d04b157255269c7d7ec7a9f5e0e3e02
# =====================================
"""
Useful defaults and other package metadata.
"""
DESCRIPTION = "A collection of core Python utilities."
PKG_NAME = "vcorelib"
VERSION = "0.10.5"
DEFAULT_INDEN... |
class Scorer:
"""
Base class for an estimator scoring object.
"""
def __call__(self, estimator, X, y, sample_weight=None):
"""
Parameters
----------
estimator: Estimator
The fit estimator to score.
X: array-like, shape (n_samples, n_features)
... |
class RequestsError(Exception):
pass
def report_error(response):
"""
Report an error from a REST request.
response
A response object corresponding to an API request.
The caller will be responsible for checking the
status code for an error.
"""
url = re... |
# always and forever
MAGZP_REF = 30.0
# this is always true for the DES
POSITION_OFFSET = 1
# never change these
MEDSCONF = 'y3v02'
PIFF_RUN = 'y3a1-v29'
|
# Ex: 059 - Crie um programa que leia dois valores e mostre um menu na tela:
# [1]Somar; [2]Multiplicar; [3]Maior; [4]Novos números; [5] Sair do programa.
# Seu programa deverá realizar a operação solicitada em cada caso.
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 059
-=-=-=-=... |
#Ejercicio 1002
'''
radio = input()
radio = float(radio)
pi = float(3.14159)
A = (pi*(radio**2))
print ("A={:.4f}".format(A))
*/
'''
#Ejercicio 1003
'''
A = input()
B = input()
A = int(A)
B = int(B)
SOMA = A+B
print("SOMA = {0}".format(SOMA))
'''
#Ejercicio 1004
'''
A = input()
B =... |
'''
@author: Jakob Prange (jakpra)
@copyright: Copyright 2020, Jakob Prange
@license: Apache 2.0
'''
def open_par(s):
return s == '('
def close_par(s):
return s == ')'
def open_angle(s):
return s == '<'
def close_angle(s):
return s == '>'
def open_bracket(s):
return s == '['
def close_bra... |
m_start = 'Привет!\nТы попал в анонимный чат знакомств!\n' \
'Нажимай кнопку ниже, чтобы начать общение с собеседником. ' \
'Если захочешь узнать человека поближе - жми кнопку like и при взаимной симпатии ' \
'вы сможете узнать никнейм партнера. Если собеседник вам не по нра... |
def fact(n):
f = 1
while(n>=1):
f = f * n
n-= 1
print(f)
def main():
n = int(input("Enter a number: "))
fact(n)
if __name__ == "__main__":
main() |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... |
#VÊ SE UM NÚMERO É POSITIVO OU NÃO
num = int(input("Digite um número:"))
if num >=1:
print("Número positivo")
elif num < 0:
print("Número negativo")
else:
print("Zero não pode, ele é neutro pô")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.