content stringlengths 7 1.05M |
|---|
class ViewModel:
def __init__(self):
self._is_valid = None
"""
should contain entries of form {'control_id': 'error message'}.
entries may contain the same value for 'control_id' if there are
muliple errors pertaining to that particular 'control_id'
"""
s... |
class Core(object):
def foo(self):
pass
c = Core()
|
"""This is the player."""
class Player:
"""This is a player class."""
def __init__(self, name):
"""Initiate the player."""
self._name = name
self._score = 0
@property
def name(self):
"""Get player's name."""
return self._name
@property
def score(self)... |
microcode = '''
def macroop VPADDD_XMM_XMM {
vaddi dest=xmm0, src1=xmm0v, src2=xmm0m, size=4, VL=16
};
def macroop VPADDD_XMM_M {
ldfp128 ufp1, seg, sib, "DISPLACEMENT + 0", dataSize=16
vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=16
};
def macroop VPADDD_XMM_P {
rdip t7
ldfp128 ufp1, seg, r... |
# -*- coding: utf-8 -*-
'''
@author: Andreas Peldszus
'''
folds = [
['micro_k009', 'micro_b050', 'micro_b055', 'micro_b041', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_d08', 'micro_b033', 'micro_b060', 'micro_b034', 'micro_k003', 'micro_d15', 'micro_d20', 'micro_k012', 'micro_d13', 'micro_b010', 'micro_k029... |
frase = str(input("digite uma fraze: ")).strip()
print("a letra a aparece um total de: {}".format(frase.lower().count("a")))
print("Qual a primira posição da letra a na string? {}".format(frase.upper().find("A")+1))
print("qual a ultima letra a apareceu na posição {}:".format(frase.upper().rfind("A")+1)) |
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
def rules_web_dependencies():
sass_repositories()
|
count = 0
inputNum = 1
prevInput = -1
while (inputNum > 0):
inputNum = int(input())
if inputNum == prevInput:
count += 1
prevInput = inputNum
print (f'{count}')
|
def snail(h, a, b):
now_high = 0
d = 0
while now_high < h:
now_high += a
if now_high < h:
now_high -= b
d += 1
print(d)
snail(int(input()), int(input()), int(input()))
|
"""
http://community.topcoder.com/stat?c=problem_statement&pm=1708
Single Round Match 144 Round 1 - Division II, Level One
"""
class Time:
def whatTime(self, seconds):
return ':'.join(map(str, [int(seconds / 3600), int(seconds % 3600 / 60), seconds % 60]))
|
"""
Just a placeholder
"""
class TestDummy:
"""
Dummy test
"""
@staticmethod
def test_do_nothing() -> None:
"""Do nothing"""
assert True
@staticmethod
def test_do_nothing2() -> None:
"""Do nothing"""
assert True
|
apiAttachAvailable = u'API tillg\xe4ngligt'
apiAttachNotAvailable = u'Inte tillg\xe4ngligt'
apiAttachPendingAuthorization = u'Godk\xe4nnande avvaktas'
apiAttachRefused = u'Nekades'
apiAttachSuccess = u'Det lyckades'
apiAttachUnknown = u'Ok\xe4nd'
budDeletedFriend = u'Borttagen fr\xe5n kontaktlistan'
budFriend = u'V\xe4... |
ex = (str(input('Digite uma expessão: ')))
pil = list()
for s in ex:
if s == '(':
pil.append('(')
elif s == ')':
if len(pil) > 0:
pil.pop()
else:
pil.append(')')
break
if len(pil) == 0:
print('Expressão valida')
else:
print('Expressão invalida'... |
class Student:
def __init__(self, name, school):
self.name = name
self.school = school
self.marks = []
def average(self):
return sum(self.marks) / len(self.marks)
@classmethod
def friend(cls, origin, friend_name, *args, **kwargs):
return cls(friend_name, origin... |
def round_counter():
RCi = 0
RCi_list = []
# print(type(RCi))
l = 0
for l in range (48):
# print(type(RCi))
RCi = bin(RCi)[2:].zfill(6)
RCi_one_list = [int(d) for d in str((RCi))]
# print(RCi_one_list)
t = 1 + RCi_one_list[0] + RCi_one_list[1]
t = t % ... |
# enter your file path
DATA_PATH = "./lab1/data"
# file names
IN_FILE = "input.txt"
OUT_FILE = "output.txt"
def main():
lines = []
# open input file
with open("{}/{}".format(DATA_PATH, IN_FILE), "r") as file:
# reach each line
for line in file:
# print removing newline
... |
#!/usr/bin/python
# Copyright 2017 Hewlett-Packard Enterprise Development Company, L.P.
# 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.... |
# Simple account class with balance
class Account:
def __init__(self, name, balance):
self.name = name
self.balance = balance
print("Account is created for {}".format(self.name))
def deposit(self, amount):
if amount > 0:
self.balance += amount
def withdr... |
def isPrime(number):
prime = True
global code
for c in range(2, number):
if number % c == 0:
prime = False
if prime is True and len(str(number)) == 3:
code = number
code = counter = 0
while True:
isPrime(counter)
if counter == 1000:
break
counter += 1
pr... |
"""
Trapping Rain Water
Given n non-negative integers representing an elevation map where the
width of each bar is 1, compute how much water it can trap after raining.
Example 1:
Input: height = [0,1,0,2,1,0,1,3,2,1,2,1]
Output: 6
Explanation: The above elevation map (black section) is represented by array [0,1,0,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'ole'
class Message:
irc = None
propagate = True
# IRC-protocol attributes
prefix = ""
command = []
content = ""
# IRC-command dependent attributes
cmd = [] # bot-command within message
nick = ""
channel = None
de... |
# Done by Carlos Amaral (2020/09/22)
# SCU 4.7 - Range Function with a For Loop
for i in range(1,10):
print(i, " squared is ", i**2)
|
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
INSTALLED_APPS = [
'tests.testapp',
]
ROOT_URLCONF = 'tests.urls'
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "nebula"
class BeFilteredException(Exception):
def __init__(self, t):
self._t = t
@property
def type(self):
return self._t
|
"""
* Load and Display
*
* Images can be loaded and displayed to the screen at their actual size
* or any other size.
"""
def setup():
size(640, 360)
# The image file must be in the data folder of the current sketch
# to load successfully
global img
img = loadImage("moonwalk.jpg") # Loa... |
def gcd_iter(u, v):
while v:
u, v = v, u % v
return abs(u)
|
# Silvio Dunst
# Variables can be of type function, and we can call those variables.
# This means that lists, tuples and dicts can have variables of type function in them,
# so we could have a dict that stores the letter of the menu and the function associated with that letter.
# We could access that function by that... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 5 16:02:48 2018
@author: matteo
"""
|
def isInterleave(s1: str, s2: str, s3: str) -> bool:
def dfs(i, j, k): # dfs with memo
if i == len(s1):
return s2[j:] == s3[k:]
if j == len(s2):
return s1[i:] == s3[k:]
if (i, j) in memo:
return memo[(i, j)]
res = F... |
# S and T are strings composed of lowercase letters. In S, no letter occurs more
# than once.
# S was sorted in some custom order previously. We want to permute the characters
# of T so that they match the order that S was sorted. More specifically, if x
# occurs before y in S, then x should occur before y in the retu... |
l = float(input('Largura da parede(em metros): '))
al = float(input('Altura da parede(em metros): '))
ar = l*al
q = ar/2
print('\033[1;30;44m Área da parede:\033[m \033[1;4;31m{}m²\033[m \n\033[1;30;44m Quantidade de tinta(em litros) necessária para pintar:\033[m \033[1;4;31m{}L\033[m'.format(ar, q)) |
with open("inputs/6.txt") as f:
input = f.read()
groups = [group.split() for group in input.split('\n\n')]
total_answers = 0
for group in groups:
total_answers += len(set(''.join(group)))
print("Part 1 answer:", total_answers)
total_answers = 0
for group in groups:
sets = list(map(set, group))
total... |
#disorder
def distinct_list(a):
return list(set(a))
|
class CreditCard:
""" A consumer credit card."""
def __init__(self, customer, bank, acnt, limit):
"""Create a new credit card instance.
The initial balance is zero.
customer the name of the customer (e.g., 'John Bowman')
bank the name of the bank (e.g., 'Californi... |
class SingleLinkedList(object):
"""
simple implimentation of a linked singly linked list
"""
def __init__(self):
"""
initializes a new node with none values
"""
self.next = None
self.data = None
def set_value(self,
value):
"""
... |
f = open('in_domain_dev.tsv', 'r').readlines()
g1 = open('val.src', 'w')
g2 = open('val.tgt', 'w')
for line in f:
line = line.split('\t')
_, label, _, text = line
g1.write('{}'.format(text))
g2.write('{}\n'.format(label))
|
nome = str(input("Digite o nome completo : ")).strip()
print ("Em maiusculo : ",nome.upper())
print("Em minuscula : ",nome.lower())
print("O seu nome contém : ",len(nome)-nome.count(' '))
separar = nome.split()
print('O seu primeiro nome contem {} letras '.format(len(separar[0])) ) |
matriz = [[0,0,0],[0,0,0],[0,0,0]]
for l in range(0,3):
for c in range(0,3):
matriz[l][c] = int(input(f'Digite os valores para [{l}, {c}]: '))
print('=-='*30)
for l in range(0,3):
for c in range(0,3):
print(f'[{matriz[l][c]: ^5}', end = '')
print() |
def node_to_string(node, layer = 0):
message = '|' * layer + repr(node) + '\n'
for child in node.children:
message += node_to_string(child, layer + 1)
return message
|
config = {
"host_server": "<host_address>",
'token_request':{
'client_id': '<client_id>',
'client_secret': '<client_secret>',
'Ocp-Apim-Subscription-Key': '<Ocp-Apim-Subscription-Key> For Access Token',
},
'ecom':{
'Content-Type': 'application/json',
'Ocp... |
def calc(n):
if n<12:
return n
if dp[n]:
return dp[n]
x=calc(n//2)+calc(n//3)+calc(n//4)
dp[n]=max(n,x)
return dp[n]
dp=[0 for i in range(1000000)]
n=int(input())
print(calc(n))
#==============================
def decode(s):
for i in range(2,len(s)+1):
prev=... |
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
y = int(x)
r = 0
while x > 0:
r *= 10
r += x % 10
x //= 10
print(r)
if r == y:
return True
else:
... |
'''For a range of numbers starting at 2, determine whether the number is 'perfect', 'abundant' or 'deficient',
'''
topNum = input("What is the upper number for the range:")
topNum = int(topNum)
theNum=2
while theNum <= topNum:
# sum up the divisors
divisor = 1
sumOfDivisors = 0
while divisor < theNum:... |
def div(n1,n2):
d = n1 // n2
r = n1 - n2 * d
print(r)
while True:
try:
num1 = float(input("Please enter the first number:"))
num2 = float(input("Please enter the second number:"))
except ValueError:
print("Please enter the number correctly.")
else:
div(num1,num2)
... |
#!/usr/bin/env python
# coding=utf-8
def concat(*args, sep = "/"):
return sep.join(args)
concat("earth","mars","venus")
concat("earth","mars","venus", sep=".")
|
class Television:
def __init__(self):
self.ligada = False
self.canal = 4
def power(self):
if self.ligada:
self.ligada = False
else:
self.ligada = True
def canal_up(self):
if self.ligada:
self.canal += 1
def canal_down(self):
... |
"""
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.
Note: You may... |
input = """
% Input: specify parts of the rules ...
rule(r1). head(bird,r1).
rule(r2). head(swims,r1).
rule(r3). head(neg_flies,r3). pbl(peng,r3). nbl(flies,r3).
rule(r4). head(flies,r4). pbl(bird,r4). nbl(neg_flies,r4).
rule(r5). head(peng,r5). pbl(bird,r5). pbl(swims,r5). nbl(neg_peng,r5).
... |
# Use words.txt as the file name
fname = input("Enter file name: ")
fh = open(fname)
for inp in fname:
print(inp.isUpper())
print('hello im the impostor, changes made by satyam raj')
print('ima a hacker, coz im doing this bullshit for hacktoberfest')
|
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def dfs(self, node: TreeNode, sum: int) -> int:
res = 1 if node.val == sum else 0
if node.le... |
def sssi(M, s):
L = []
for i in M[::-1]:
if s >= i:
s -= i
L.append(1)
else:
L.append(0)
if s == 0:
return L[::-1]
print("!!!!!")
|
"""Test Basic Addition"""
def test_basic_addition():
assert 1 + 1 == 2
def test_basic_addition_inverse():
assert 1 + 1 != 3
|
class GrowingBlob:
"""
python is slow in accumulation of large data (str += segment).
Growing blob is an optimization for that
"""
def __init__(self):
self._blobs = []
self._length = 0
def append(self, blob):
self._blobs.append(blob)
self._length += len(blob)
... |
"""Dosya İşlemleri Giriş"""
"""
Mod Açıklama
“r” – Read => (Okuma) Bir dosyayı bu mod ile okuyabiliriz.
Eğer dosya mevcut değilse ekrana bir hata mesajı gelir.
“a” - Append => (Ekleme) Bir dosyaya veri eklemek için kullanılır.
Eğer dosya mevcut değilse otomatik olarak yeni dosya oluşturur
“w” – Write => ... |
"""
For more details regarding inputs and output in form of complex dictionaries see the original source docs at:
%host%/docs/source/Core.html
for example:
`https://editor.webgme.org/docs/source/Core.html <https://editor.webgme.org/docs/source/Core.html>`_
"""
class Core(object):
"""
Class for... |
__title__ = 'consign'
__description__ = 'Python storage for humans.'
__url__ = 'https://requests.readthedocs.io'
__version__ = '0.2.2'
__author__ = 'Daniel Jadraque'
__author_email__ = 'jadraque@hey.com'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2021 Daniel Jadraque' |
nome = input("Digite seu nome: ")
nome = nome.strip().title()
print("No seu nome tem silva? {}".format("Silva" in nome))
print("O seu nome: {}".format(nome))
|
class Employee:
numEmployee = 0
def __init__(self, name, rate):
self.owed = 0
self.name = name
self.rate = rate
Employee.numEmployee += 1
def __repr__(self):
return "a custom object (%r)" % self.name
def __del__(self):
Employee.numEmployee -= 1
def... |
def get_unique_iterable_objects_in_order(iterable):
unique_objects_in_order = []
for object_ in iterable:
if object_ not in unique_objects_in_order:
unique_objects_in_order.append(object_)
return unique_objects_in_order
|
#faça um programa que leia tres numeros e mostre qual e o maior e o menor.
a = int(input('primeiro valor: '))
b = int(input('segundo valor: '))
c = int(input('terceiro valor: '))
#verificando quem e o menor
menor = a
if b < a and b < c:
menor = b
if c < a and c < b:
menor = c
#verificando que em o maior
maior ... |
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['D:\\temp\\main.py'],
pathex=['D:\\temp'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
... |
test = {
'name': 'q1_1',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> # Did you add Career Length column?;
>>> nfl.num_columns == 6
True
""",
'hidden': False,
'locked': False
},
{
'code': ... |
"""
Typcasting w. Strings
"""
# Convert these variables into strings and then back to their original data types. Print out each result as well as its data type. What do you notice about the last one?
five = 5
zero = 0
neg_8 = -8
T = True
F = False |
lista=()
for c in range(0, 4):
lista = int(input('Digite um número: '))
print(lista) |
RAWDATA_DIR = '/staging/as/skchoudh/rna-seq-datasets/single/ornithorhynchus_anatinus/SRP007412'
OUT_DIR = '/staging/as/skchoudh/rna-seq-output/ornithorhynchus_anatinus/SRP007412'
CDNA_FA_GZ = '/home/cmb-panasas2/skchoudh/genomes/ornithorhynchus_anatinus/cdna/Ornithorhynchus_anatinus.OANA5.cdna.all.fa.gz'
CDNA_IDX ... |
'''
Author : MiKueen
Level : Medium
Problem Statement : Find Minimum in Rotated Sorted Array
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.
... |
def say_hello(name):
print("Hello,", name)
user_name = input("What is your name? ")
say_hello(user_name)
|
def square(number):
return number * number
result = square(3)
print(result)
print(square(4))
def square_no_return(number):
print (number * number)
print(square_no_return(4)) # Prints the result and also None
# Reusable Function
def emoji_converter(message):
emojis = {
":)": "😀",
":... |
# GANABARA SOLUTIONS - nõa funciona com erros após sinal de igual
mat = str(input('expressão com parêntesis: '))
pilha = list()
for simbolo in mat:
if simbolo == '(':
pilha.append('(')
elif simbolo == ')':
if len(pilha) > 0:
pilha.pop()
else:
pilha.append(')')
... |
class Solution:
def validPalindrome1(self, s: str) -> bool:
"""时间超限"""
for i in range(len(s)):
sub = s[:i] + s[i + 1:]
if sub == sub[::-1]:
return True
return False
def validPalindrome(self, s: str) -> bool:
left, right = 0, len(s) - 1
... |
CHARS_UNICODE = ["‘", "’", "“", "”", "(", ")", "{", "}", "=", "।", "?", "-", "µ", "॰", ",", ".", "् ",
"०", "१", "२", "३", "४", "५", "६", "७", "८", "९", "x",
"फ़्", "क़", "ख़", "ग़", "ज़्", "ज़", "ड़", "ढ़", "फ़", "य़", "ऱ", "ऩ", #/... |
"""
Program to print a String that says Hello World in Telugu :)
"""
s = "నమస్కారం. హలో వరల్డ్."
print (s)
|
#xsv Libraries / dictionaries / variables or
# WHATEVER YOU FUCKING CALL THEM!
exampleVars = [
{
'Name': 'xH',
'Info': {
'Staff': ['Council'],
'Dev': ['Im Dynamic'],
'Office': ['Couch'],
'Role... |
def is_opcode(line):
return line.startswith('#define') and 'OPCODE' not in line
def get_filename_for_op(op):
return op.split("_")[0]
def get_function_name_for_op(op):
return "op_{}".format(op)
outfiles = {}
opfilenames = []
opmap = {}
ops = []
f = open("opcodes.h")
for line in f:
if is_opcode(line):
toke... |
BATCH_SIZE = 128
EPOCHS = 120
LR = 0.001
NGRAM = 10
NUM_CLASS = 20
EMBEDDING_DIM = 100
CUDA = True
DEVICE = 3
DEBUG = False
# FILENAME = '../bsnn/data/tor_erase_tls2.traffic'
FILENAME = '../bsnn/data/20_header_payload_all.traffic'
# LABELS ={'facebook': 0, 'yahoomail': 1, 'Youtube': 2, 'itunes': 3, 'mysql': 4, 'fi... |
def inputGrades(nm):
grades = []
for i in range(0,nm,1):
grade = float(input('Enter your Grade: '))
grades.append(grade)
return grades
def printGrades(nm,x):
for i in range(0,nm,1):
print(x[i])
def avgGrades(nm,x):
Sum = 0
for i in range(0,nm,1):
Sum = Sum + x[i... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by Ross on 2019/8/21
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
dp = [0] * len(nums)
if len(nums) == 0:
return 0
dp[0] = 1
for i in range(1, len(nums)):
maxval = 0
for j in ... |
class TransformationTypeEnum():
__DOUBLE_SIGMOID = "double_sigmoid"
__SIGMOID = "sigmoid"
__REVERSE_SIGMOID = "reverse_sigmoid"
__RIGHT_STEP = "right_step"
__LEFT_STEP = "left_step"
__STEP = "step"
__CUSTOM_INTERPOLATION = "custom_interpolation"
__NO_TRANSFORMATION = "no_transformation"... |
__author__ = 'yinjun'
"""
@see http://blog.csdn.net/u011095253/article/details/9248073
@see http://www.jiuzhang.com/solutions/interleaving-string/
"""
class Solution:
"""
@params s1, s2, s3: Three strings as description.
@return: return True if s3 is formed by the interleaving of
s1 and s2 or ... |
"""
Enunciado
Informe, de forma decrescente todos os pares entre N (número fornecido pelo usuário) e -N.
"""
N = int(input("Digite um valor inteiro: "))
for numero in range(0, N, 2):
print(f"{numero}, ", end="")
print()
print(f"{-1*N}")
|
a = True # Creates a variable set to true
while a: # While this variable is true, loop. Used to handle for 2+ word inputs
inp = input('Enter ONE word: ') # Takes the users input
test = inp.split() # Makes the users input a list of each word, to check how many words are there
if len(test) == 1: # If thi... |
def main(request, response):
type = request.GET.first("type", None)
is_revalidation = request.headers.get("If-Modified-Since", None)
content = "/* nothing to see here */"
response.add_required_headers = False
if is_revalidation is not None:
response.writer.write_status(304)
response.wr... |
def calcula_soma(A: int, B: int):
if (not isinstance(A, int) or not isinstance(B, int)):
raise TypeError
return f'SOMA = {A + B}'
|
# Flask config reference: http://flask.pocoo.org/docs/1.0/config/
# Flask-Sqlalchemy config reference: http://flask-sqlalchemy.pocoo.org/2.3/config/
POSTGRES_ENV_VARS_DEV = {
'user': 'postgres',
'pwd': '1qaz2wsx',
'host': 'jblin',
'port': '5432',
'db': 'postgres',
}
POSTGRES_ENV_VARS_PRD = {
#... |
print('\033[31;40mExercício Python #007 - Média Aritmética\033[m')
a2 = float(input('\033[31mNota 1 = \033[m'))
b2 = float(input('\033[32mNota 2 = \033[m'))
c2 = (a2 + b2) / 2
print('\033[4;36mA média é {:.1f}'.format(c2)) |
def sort_address_results(addresses, postcode):
'''
# Not to be used. Address Index API should sort for us.
If required address object should include the following fields:
paoStartNumber = address['nag']['pao']['paoStartNumber']
saoStartNumber = address['nag']['sao']['saoStartNumber']
street_num... |
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/851/A
n,k,t = list(map(int,input().split()))
print(min(t,n+k-t,k))
|
# Ch02-FlowControl-while_break_continue_statements.py
# This is an example for while, break, continue statements.
#
# https://automatetheboringstuff.com/chapter2/
# Flow Control Statements: Lesson 6 - while Loops, break, and continue
#
# I changed the original code slightly.
count = 0
while True:
print('What is y... |
#!/bin/python3
# Complete the solve function below.
def solve(s):
words = s.split(' ')
for i in range(len(words)):
words[i] = words[i].capitalize()
return ' '.join(words)
if __name__ == '__main__':
s = input()
result = solve(s)
print(result)
|
# Assignment 6
# Author: Jignesh Chaudhary, Student Id: 197320
# a) Heapsort: Implement the heapsort algorithm from your textbook (Algorithm 7.5) but modify it so it ends after finding z largest keys
# in non-increasing order. You can hardcode the keys to be integer type. Implement test program to provide unsorted i... |
def main(str1, str2):
m = len(str1)
n = len(str2)
j = 0
i = 0
while j < m and i < n:
if str1[j] == str2[i]:
j = j+1
i = i + 1
return j == m
str2 = str(input())
N = int(input())
for i in range(N):
str1 = str(input())
if main(str1, str2):
print("... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 27 04:40:43 2020
@author: Abhishek Mukherjee
"""
class Solution:
def decodeString(self, s: str) -> str:
tempNum=[]
tempAlpha=[]
tempPrime=[]
temp3=[]
flagPrime=1
tempNum1=""
for i in s:
... |
#média aritimética
n1 = float(input('n1 ?'))
n2 = float(input('n2 ?'))
soma = (n1+n2)/2
print('a soma entre {} e {} possui uma media de {:.1f}'.format(n1, n2, soma))
#{:.1f}- implica dizer q so quer uma casa depois da vírgula. |
def process_blok(x0_x1_y0_y1_z0_z1_):
x0_, x1_, y0_, y1_, z0_, z1_ = x0_x1_y0_y1_z0_z1_
print('Setting number of threads in process_blok to %d.\n' %nthread)
os.environ['MKL_NUM_THREADS'] = str(nthread)
# load and dilate initial voxel peak positions
voxl_peaklidx_blok = np.zeros_like(bimag... |
# Жилищная лотерея + Результаты последнего тиража
def test_housinglottery_results_last_draw(app):
app.ResultAndPrizes.open_page_results_and_prizes()
app.ResultAndPrizes.click_game_housinglottery()
app.ResultAndPrizes.click_results_of_the_last_draw()
app.ResultAndPrizes.button_get_report_winners()
... |
def defaultify(value,default):
"""Return `default` if `value` is `None`. Otherwise, return `value`"""
if None == value:
return default
else:
return value
def defaultifyDict(dictionary,key,default):
"""Return `default` if either `key` is not in `dictionary`, or `dictionary[key]` is `None... |
add_library('video')
c=None
w=640.0
h=480.0
darkmode=False
def setup():
global c,cx,cy
size(640,480)
background(0 if darkmode else 255)
stroke(23,202,230)
imageMode(CENTER)
c=Capture(this,640,480)
c.start();
def genart():
line(dx,cy-h/2,dx,cy+h/2)
def draw():
cx=width/2
cy=he... |
#
# PySNMP MIB module CLNS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CLNS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:25:07 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, 09:23:1... |
def fatorial(num, show=False):
# help da função
"""
--> Cálcula o fatorial de um número
:param num: o número a ser calculado
:param show: (opcional) mostra ou não a conta
:return: o valor do fatorial de um número
"""
f = 1
for c in range(num, 0, -1):
if show:
prin... |
VERSION = (0, 2, 2, '', 1)
if VERSION[3] and VERSION[4]:
VERSION_TEXT = '{0}.{1}.{2}{3}{4}'.format(*VERSION)
else:
VERSION_TEXT = '{0}.{1}.{2}'.format(*VERSION[0:3])
VERSION_EXTRA = ''
LICENSE = 'MIT License'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.