content stringlengths 7 1.05M |
|---|
"""
---> Minimum Insertions to Balance a Parentheses String
---> Medium
"""
class Solution:
def minInsertions(self, s: str) -> int:
open_brackets = 0
insertions_needed = 0
i = 0
while i < len(s):
if s[i] == '(':
open_brackets += 1
else:
... |
string1 = "Scout Finch"
string2 = "Harry Potter"
# Concatenation can be used to join multiple strings into one larger string
print(string1 + string2)
# We cannot subtract strings as it will give error and not work
# We can mutiply strings, but cannot divide strings
print(string1 * 3)
# Important String Commands
#... |
########
# Copyright (c) 2020 Cloudify Platform Ltd. 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 requi... |
class IRCUser(object):
def __init__(self, nick, ident, host, voice=False, op=False):
self.nick = nick
self.ident = ident
self.host = host
self.set_hostmask()
self.is_voice = voice
self.is_op = op
def set_hostmask(self):
self.hostmask = "%s@%s" % (sel... |
## https://beginnersbook.com/2018/01/python-program-check-leap-year-or-not/
def is_leap_year(year):
year = int(year);
# Leap Year Check
if year % 4 == 0 and year % 100 != 0:
return True;
elif year % 100 == 0:
print(year, "is not a Leap Year")
return False;
elif year % 400 ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###########################################
# (c) 2016-2020 Polyvios Pratikakis
# polyvios@ics.forth.gr
###########################################
#__all__ = ['utils']
''' empty '''
|
class Solution:
def prisonAfterNDays(self, cells: List[int], N: int) -> List[int]:
def nextDay(cells):
mask = cells.copy()
for i in range(1, len(cells) - 1):
if mask[i-1] ^ mask[i+1] == 0:
cells[i] = 1
else:
... |
class Subject(object):
def regist(self, observer):
pass
def unregist(self, observer):
pass
def notify(self):
pass
class Observer(object):
def update(self):
pass
class MoniterObserver(Observer):
def __init__(self, name):
self.name = name
def updat... |
"""
Dirty script to help generate go_ast code from an actual Go AST.
Paste go code into https://lu4p.github.io/astextract/ and then the AST here.
"""
AST = r"""
&ast.CallExpr {
Fun: &ast.FuncLit {
Type: &ast.FuncType {
Params: &ast.FieldList {
List: []*ast.Field {
&ast.Field {
... |
class Token:
SP_S = '(' # 文字列集合_開始
SP_E = ')' # 文字列集合_終了
AND = '&' # 文字列集合_論理積
OR = '|' # 文字列集合_論理和
INVT = '!' # 文字列集合_否定
REPT = '+' # 文字列集合_1文字以上の繰返し
CH_S = '[' # 文字集合_開始
CH_E = ']' # 文字集合_終了
WHOL = '.' # 文字集合_全集合
DENY = '^' # 文字集合_補集合
ESC = '\\' # エスケープ
|
"""
AERoot module
"""
__version__ = "0.3.2"
|
class CQueue:
''' Custom-made circular queue, which is fixed sized.
The motivation here is to have
* O(1) complexity for peeking the center part of the data
In contrast, deque has O(n) complexity
* O(1) complexity to sample from the queue (e.g., sampling replays)
'''
def __... |
load("@bazel_skylib//lib:collections.bzl", "collections")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:shell.bzl", "shell")
load("//fs_image/bzl/image_actions:feature.bzl", "image_feature")
load("//fs_image/bzl/image_actions:install.bzl", "image_install")
load("//fs_image/bzl/image_actions:mkd... |
# This file is created by generate_build_files.py. Do not edit manually.
test_support_sources = [
"src/crypto/test/file_test.cc",
"src/crypto/test/test_util.cc",
]
def create_tests(copts):
test_support_sources_complete = test_support_sources + \
native.glob(["src/crypto/test/*.h"])
native.cc_test(
... |
# -*- coding: utf-8 -*-
# try something like
def index():
sync.go()
return dict(message="hello from sync.py")
|
{
"metadata": {
"kernelspec": {
"name": "python"
},
"language_info": {
"name": "python",
"version": "3.5.1"
}
},
"nbformat": 4,
"nbformat_minor": 0,
"cells": [
{
"cell_type": "markdown",
"source": "**I'll explain the steps involved in PCA with codes without im... |
print(f'{" LOJAS NASCIMENTO ":=^40}')
preco = float(input('Preço das compras: R$ '))
print('''FORMAS DE PAGAMENTO
[ 1 ] à vista dinheiro/cheque;
[ 2 ] à vista cartão;
[ 3 ] 2x no cartão;
[ 4 ] 3x ou mais no cartão.''')
opcao = int(input('Qual é a opção? '))
if opcao == 1:
total = preco - (preco * 10 / 100)
elif opc... |
# -*- coding: utf-8 -*-
# @Author: 何睿
# @Create Date: 2018-11-15 15:41:11
# @Last Modified by: 何睿
# @Last Modified time: 2018-11-15 15:57:21
# You're now a baseball game point recorder.
# Given a list of strings, each string can be one of the 4 following types:
# Integer (one round's score): Dir... |
def test():
assert Span.has_extension(
"wikipedia_url"
), "你有在span上注册这个扩展吗?"
ext = Span.get_extension("wikipedia_url")
assert ext[2] is not None, "你有正确设置getter吗?"
assert (
"getter=get_wikipedia_url" in __solution__
), "你有设置getter为get_wikipedia_url了吗?"
assert (
"(ent.t... |
class Solution(object):
def findDisappearedNumbers(self, nums):
Out = []
N = set(nums)
n = len(nums)
for i in range(1, n+1):
if i not in N:
Out.append(i)
return Out
nums = [4,3,2,7,8,2,3,1]
Object = Solution()
print(Object.findDisappearedNumbers(nums))
|
# Copyright 2019 The Bazel 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 applicable la... |
def matmul(a, b):
c = []
for i in range(0, len(a)):
c.append([])
for k in range(0, len(b[0])):
num = 0
for j in range(0, len(a[0])):
num += a[i][j]*b[j][k]
c[i].append(num)
return c
def main():
a = [[1,2],[3,4],[5,6]]
b = [[3,2,1]... |
class Path:
def __init__(self, move_sequence):
self.move_sequence = move_sequence
def swap_cities(self, city1, city2):
tmp = list(self.move_sequence)
tmp[city1], tmp[city2] = tmp[city2], tmp[city1]
return Path(tuple(tmp))
def __eq__(self, other):
return self.move_se... |
"""
binary_tree.py
Reference:
https://www.geeksforgeeks.org/binary-search-tree-data-structure/#basic
"""
## define a node class
class Node(object):
def __init__(self, value = None):
self.value = value
self.left = None
self.right = None
def set_value(self, value):
self.value =... |
split_data = lambda x: [[set(j) for j in i.split("\n")] for i in x]
counter = lambda data, set_fn: sum(len(set_fn(*s)) for s in data)
if __name__ == "__main__":
with open("data.txt", "r") as file:
data = split_data(file.read().strip().split("\n\n"))
print("Part 1:", counter(data, set.union))
print... |
class PathFinder(object):
"""
Abstract class for a path finder
"""
def __init__(self, config):
# type: (Namespace, Stepper) -> None
self.config = config
def path(self, from_lat, form_lng, to_lat, to_lng): # pragma: no cover
# type: (float, float, float, float) -> List[... |
class StickyNoteType(Enum, IComparable, IFormattable, IConvertible):
"""
Specifies whether a System.Windows.Controls.StickyNoteControl accepts text or ink.
enum StickyNoteType,values: Ink (1),Text (0)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y... |
class Solution:
def moveZeroes(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
length = len(nums)
for i in range(0, length - 1):
if nums[i] != 0:
continue
k = i
... |
f = open('file.txt','w')
# 2.写入内容
f.write("test")
# 3.保存文件
f.close() # 关闭文件
f = open('file.txt','r')
# 2.写入内容
content = f.read()
f.seek(0)
content += f.read()
print(content)
# 3.保存文件
f.close() # 关闭文件 |
'''
Stepik001146PyBeginch02p02st05TASK02_20200605.py
В популярном сериале «Остаться в живых» использовалась последовательность чисел 4 8 15 16 23 42,
которая принесла героям удачу и помогла сорвать джекпот в лотерее. Напишите программу, которая
выводит данную последовательность чисел с одним пробелом между ними.
'''
p... |
def pig_latin(word):
a={'a','e','i','o','u'}
#make vowels case insensitive
vowels=a|set(b.upper() for b in a)
if word[0].isalpha():
if any(i in vowels for i in word):
if word.isalnum():
if word[0] in vowels:
pig_version=word+'way'
... |
# File: S (Python 2.4)
NORMAL = 0
CUSTOM = 1
EMOTE = 2
PIRATES_QUEST = 3
TOONTOWN_QUEST = 4
|
public_key = b"\x30\x81\x9f\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x03\x81\x8d\x00\x30\x81\x89\x02\x81\x81\x00\xd9\x7a\xcd" + \
b"\x72\x88\xaa\x98\x10\xee\x43\x50\x98\x95\x42\x98\x2d\x4d\xd7\x2c\xd6\x49\x9d\x4e\x37\x97\x53\x7a\xd3\x94\x8c\x93\x70\x22\xf1\x00" + \
b"\x4b\x4... |
####################################################
# Quiz: len, max, min, and Lists
####################################################
a = [1, 5, 8]
b = [2, 6, 9, 10]
c = [100, 200]
print(max([len(a), len(b), len(c)])) # 4
print(min([len(a), len(b), len(c)])) # 2
################################################... |
OPCODE = {
"add": 0, "comp": 0,
"and": 0, "xor": 0,
"shll": 0, "shrl": 0,
"shllv": 0, "shrlv": 0,
"shra": 0, "shrav": 0,
"addi": 8, "compi": 9,
"lw": 16, "sw": 24,
"b": 40, "br": 32,
"bltz": 48, "bz": 49,
"bnz": 50, "bl": 43,
"bcy": 41, "bncy": 42,
}
RFORMATS = {
"add",... |
moves = open('input/day3-input.txt', 'r').read()
visited = set()
location = (0,0)
visited.add(location)
for move in moves:
if move == '^':
location = (location[0], location[1] + 1)
elif move == 'v':
location = (location[0], location[1] - 1)
elif move == '>':
location = (location[0] + 1, location[1])... |
def z3():
global bimage_mean, bimage_peak_fine, cell_dir, frame_i, nthread
nthread = 1
# load plane filename
for frame_i in range(imageframe_nmbr):
with h5py.File(output_dir + 'brain_mask' + str(frame_i) + '.hdf5', 'r') as file_handle:
image_mean = file_handle['image_mean'][()].... |
__all__ = ['AverageMeter', 'get_error', 'print_numbers_acc']
class AverageMeter(object):
"""Computes and stores the average and current value
Imported from https://github.com/pytorch/examples/blob/master/imagenet/main.py#L247-L262
"""
def __init__(self):
self.reset()
def rese... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 25 17:52:09 2019
@author: Falble
"""
def has_duplicates(t):
"""Checks whether any element appears more than once in a sequence.
Simple version using a for loop.
t: sequence
"""
d = {}
for x in t:
if x in d:
retur... |
def get_virus_areas(grid):
areas = []
dangers = []
walls = []
color = [[0] * n for i in range(m)]
for i in range(m):
for j in range(n):
if grid[i][j] == 1 and color[i][j] == 0:
area = [(i, j)]
danger = set()
wall = 0
... |
target = df_data_card.columns[0]
class_inputs = list(df_data_card.select_dtypes(include=['object']).columns)
# impute data
df_data_card = df_data_card.fillna(df_data_card.median())
df_data_card['JOB'] = df_data_card.JOB.fillna('Other')
# dummy the categorical variables
df_data_card_ABT = pd.concat([df_data_card, pd.g... |
#!/usr/bin/env python3
CENT_PER_INCH = 2.54
height_feet = int(input('Enter the "feet" part of your height: '))
height_inches = int(input('Enter the "inches" part of your height: '))
total_height_inches = height_feet * 12 + height_inches
total_cent = total_height_inches * CENT_PER_INCH
print(f"Your height of {heigh... |
print('Digite seis valores inteiros:')
s = 0
cont = 0
for c in range(1, 7):
n = int(input(f'{c}° valor: '))
if n % 2 == 0:
s += n
cont += 1
print(f'A soma do(s) {cont} valor(es) par(es) vale {s}.')
|
# Copyright 2013 Google, Inc. All Rights Reserved.
#
# Google Author(s): Behdad Esfahbod, Roozbeh Pournader
class Options(object):
class UnknownOptionError(Exception):
pass
def __init__(self, **kwargs):
self.verbose = False
self.timing = False
self.drop_tables = []
self.set(**kwargs)
def set(self, *... |
def remove_void(lst:list):
return list(filter(None, lst))
def remove_double_back(string:str):
string.replace("\n\n","@@@@@").replace("\n","").replace("@@@@@","")
def pretty_print(dct:dict):
for val,key in dct.items():
print(val)
for el in key:
print("\t",el)
print("\n") |
n=int(input())
for i in range(1,n+1):
for j in range(1,i+1):
print(j,end="")
print()
for i in range(1,n):
for j in range(n-i):
print(j+1,end="")
print() |
#
# PySNMP MIB module HUAWEI-UNIMNG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-UNIMNG-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:37:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
def kill_timer(timer):
timer.cancel()
def init():
global timeout_add
global timeout_end
timeout_add = pyjd.gobject.timeout_add
timeout_end = kill_timer
|
#!/usr/bin/python3
class _LockCtx(object):
__slots__ = ( "__evt", "__bPreventFiringOnUnlock" )
def __init__(self, evt, bPreventFiringOnUnlock:bool = False):
self.__evt = evt
self.__bPreventFiringOnUnlock = bPreventFiringOnUnlock
#
def dump(self):
print("_LockCtx(")
print("\t__evt = " + str(self.__evt... |
includes=["<def.h>", #for uint64_t
"<io/Output.h>", #for kout
"<io/IntegerFormatter.h>",#for Hex,Bin
]
reg_defs=[
["","uint32_t",[["RES0",2, "EL",2, "RES0",28]],"sys_reg_name","CurrentEL"],
["","uint32_t",[["RES0",6, "F",1, "I",1, "A",1 ,"D",1, "RES0",22]],... |
class FaultyClient(object):
"""A faulty scheduler that will always fail"""
def __init__(self, cluster_name, hosts, auth, domain, options):
pass
def setUp(self):
pass
def tearDown(self):
pass
def create(self, name, image, command='', template=None, port=5000):
rais... |
datasetPath = "/storage/mstrobl/dataset"
waveformPath = "/storage/mstrobl/waveforms"
featurePath = "/storage/mstrobl/features/"
quantumPath = "/storage/mstrobl/quantum/"
modelsPath = "/storage/mstrobl/models"
testDatasetPath = "/storage/mstrobl/testDataset"
testWaveformPath = "/storage/mstrobl/testWaveforms"
testFeatu... |
def one_line():
output = []
with open("toChris.txt", "r") as f:
line = f.readline()
counter = 0
temp = []
while line:
if "{" in line:
counter += 1
elif "}" in line:
counter -= 1
temp.append(line)
if... |
# M이상 N이하의 소수를 모두 출력하는 프로그램을 작성하시오.
# input
# 3 16
#
# output
# 3
# 5
# 7
# 11
# 13
n, m = map(int, input().split())
check = [False] * (m+1)
# check[i] == True: i는 지워짐
# check[i] == False: i는 지워지지 않음
primes = []
for i in range(2, m+1):
# 지워 졌으면 스킵
if check[i]:
continue
# 지워지지 않으면서 가장... |
class Solution(object):
def fib(self, N):
"""
:type N: int
:rtype: int
"""
return self.dynamicProgramming(N)
def recursive(self, N):
if N <= 1:
return N
else:
return self.recursive(N - 1) + self.recursive(N - 2)
def dynami... |
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# Write your code here
t = int(input())
for _ in range(t):
n =... |
def fib(a, b, end):
c = 0
fib_list = [a, b]
if end == 0:
return fib_list
while c < end:
nxt = fib_list[c] + fib_list[c + 1]
fib_list.append(nxt)
c += 1
if nxt >= end:
break
return fib_list
def fib_memo(n):
"""
uses memoization to reduce c... |
"""Wide_Eastasian table. Created by setup.py."""
# Generated: 2016-07-02T04:20:28.048222
# Source: EastAsianWidth-9.0.0.txt
# Date: 2016-05-27, 17:00:00 GMT [KW, LI]
WIDE_EASTASIAN = (
(0x1100, 0x115f,), # Hangul Choseong Kiyeok ..Hangul Choseong Filler
(0x231a, 0x231b,), # Watch ..H... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
module: win_dfs_namespace_root
short_description: Set up a DFS namespace.
description:
- This module creates/man... |
#
# PySNMP MIB module CISCO-RTTMON-IP-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-RTTMON-IP-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:11:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright 2020, Yutong Xie, UIUC.
Using random index to shuffle an array
'''
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
l, r = 0, len(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This software is under a BSD license. See LICENSE.txt for details.
def dt_writer(obj):
"""Check to ensure conformance to dt_writer protocol.
:returns: ``True`` if the object implements the required methods
"""
return hasattr(obj, "__dt_type__"... |
#
# PySNMP MIB module Argus-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Argus-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:33:18 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... |
l = [[], [], []]
while True:
l[0].append(input('Qual o nome do aluno? ').strip().capitalize())
n1 = float(input(f'Qual a primeira nota do aluno? '))
n2 = float(input(f'Qual o segunda nota do aluno? '))
l[1].append((n1 + n2) / 2)
l[2].append(n1)
l[2].append(n2)
while True:
c = input('... |
"""
Transparent class proxy module.
A wrapper class can be created using the function `wrap_with` or
the decorators `proxy_of` (if the wrapped object type is specified
explicitly) or `proxy` (if the wrapped object isn't specified).
"""
__all__ = ["wrap_with", "proxy_of", "proxy", "instance", "reset_proxy_cache"]
IGNO... |
def sum(str1: str, str2: str) -> str:
"""
Find the sum of two numbers represented as strings.
Args:
str1 - string: number
str2 - string: number
Returns - string: The result sum
"""
print("str1=" + str(str1) + ", str2=" + str(str2))
if not str1.isdigit() or not str2.isdigit... |
""" Auth app testing package. """
__author__ = "William Tucker"
__date__ = "2020-03-25"
__copyright__ = "Copyright 2020 United Kingdom Research and Innovation"
__license__ = "BSD - see LICENSE file in top-level package directory"
|
parrot = "Norwegian Blue"
print(parrot)
print(parrot[3])
print(parrot[4])
print(parrot[9])
print(parrot[3])
print(parrot[6])
print(parrot[8])
|
def bool_prompt(msg: str) -> bool:
while True:
response = input(f"{msg} [y/n]: ").lower()
if response == "y":
return True
elif response == "n":
return False
else:
print(f"'{response}' is an invalid option.")
|
class node_values:
def __init__(self, iden, value):
self.iden = iden
self.value = value
def get_iden(self):
return self.iden
def set_iden(self, iden):
self.iden = iden
def get_value(self):
return self.value
def set_value(self, value):
self.value = ... |
class Person:
def __init__(self, first_name, last_name):
self.first = first_name
self.last = last_name
def speak(self):
print("My name is "+ self.first+" "+self.last)
me = Person("Brandon", "Walsh")
you = Person("Ethan", "Reed")
me.speak()
you.speak() |
"""Top-level package for Threaded File Downloader."""
__author__ = """Andy Jackson"""
__email__ = 'amjack100@gmail.com'
__version__ = '0.1.0'
|
def minRemove(arr, n):
LIS = [0 for i in range(n)]
len = 0
for i in range(n):
LIS[i] = 1
for i in range(1, n):
for j in range(i):
if (arr[i] > arr[j] and (i - j) <= (arr[i] - arr[j])):
LIS[i] = max(LIS[i], LIS[j] + 1)
len = max(len, LIS[i])
return ... |
# Programa 4.3 - Cálculo do Imposto de Renda
salário = float(input("Digite o salário para cálculo do imposto: R$"))
base = salário
imposto = 0
if base > 3000:
imposto = imposto + ((base - 3000) * 0.35)
base = 3000
if base > 1000:
imposto = imposto + ((base - 1000) * 0.20)
print(f"Salário: R${salário:6.2f... |
# -*- coding:utf-8 -*-
'''
For example, the number 7 is a "happy" number:
72 = 49 --> 42 + 92 = 97 --> 92 + 72 = 130 --> 12 + 32 + 02 = 10 --> 12 + 02 = 1
Once the sequence reaches the number 1, it will stay there forever since 12 = 1
On the other hand, the number 6 is not a happy number as the sequence th... |
k, a, b = map(int, input().split())
if a + 1 >= b:
print(k + 1)
else:
if k != 1:
t = (k - 2) % a
w = (k - 2) // a
i = b % a
j = b // a
"""if t == a - 1:
print(b * (w + 1))
else:
print(b * w + t)"""
#p = ((k + 1) // (a + 2)) * (a +... |
"""
Validate a Requirements Trace Matrix
"""
__version__ = "0.1.13"
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Carson Anderson <rcanderson23@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'me... |
def arraycopy(ar):
ret=[]
for item in ar:
ret.append(item)
return ret
def subtAr(a1,a2):
ret=[]
for i in range(0,len(a1)):
ret.append(a1[i]-a2[i])
return ret
def sumAr(a1,a2):
ret=[]
for i in range(0,len(a1)):
ret.append(a1[i]+a2[i])
return ret
def abs2Ar(a... |
# Copyright © 2021 BaraniARR
# Encoding = 'utf-8'
# Licensed under MIT License
# Special Thanks for gogoanime
"""ANIME DL TELEGRAM BOT CREDENTIALS"""
api_id = "8560623"
api_hash = "d1f72390990c765e4816e77a1e5a5cfd"
bot_token = "1697116493:AAHB_0tlyg9pQYaToiuOFatPzhx-IzsXBa8"
|
a = input ()
b = input ()
c=a
a=b
b=c
print (a, b)
|
class Bird:
def about(self):
print("Species: Bird")
def Dance(self):
print("Not all but some birds can dance")
class Peacock(Bird):
def Dance(self):
print("Peacock can dance")
class Sparrow(Bird):
def Dance(self):
print("Sparrow can't dance")
|
'''
90-Faça um programa que leia nome e a media de aluno,guardando também a situação em um dicionário.No final mostre a estrutura na tela.
'''
pessoa = {}
pessoa['nome'] = str(input('Nome : ')).upper()
pessoa['media'] = float(input(f"Média do aluno {pessoa['nome']}: "))
if pessoa['media'] >= 7:
pessoa['situacao']... |
def quickSort(alist, first, last):
if (first < last):
splitpoint = partition(alist, first, last)
quickSort(alist, first, splitpoint - 1)
quickSort(alist, splitpoint + 1, last)
def partition(alist, first, last):
pivotvalue = alist[first]
leftmark = first +1
rightmark = ... |
# -*- coding:utf-8 -*-
data = """
# Step 1: 預浸
Test
## 繞圓注水
繞半徑 1 cm 的圓注水 40 ml
在注水過程中,會從 80 mm 升高到 70 mm
每 1 mm 吐出 0.1 ml 的水
每個吐水的點間距 0.01 mm
``` operations
Command: Refill
```
``` circle
Radius: 2 cm
Total Water: 60 ml
High: 170 mm to 150 mm
Feedrate: 80 mm/min
Extrudate: 0.2 ml/mm
Point interval: 0.1 mm
```... |
# Autor: Daniel Martínez(TrebolDan)
#Reading input lines
a=input().split()
b=input().split()
# score[0] to A & score[1] to B
score = [0,0]
# Comparing triplets
for i in range (3):
if(a[i]!=b[i]): # If equals, neither one gets a point
if(a[i]>b[i]):
score[0]=score[0]+1 # A bigger than B
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Colony Framework
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Colony Framework.
#
# Hive Colony Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... |
def lcsv(str_or_list):
''' List of Comma-Separated Values.
Convert a str of comma-separated values to a list over the items, or
convert such a list back to a comma-separated string.
This function does not understand quotes.
See the unit tests for examples of how ``lcsv`` works.
'''
if isi... |
#
# PySNMP MIB module PDN-XDSL-INTERFACE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-XDSL-INTERFACE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:31:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
def _FindNonRepeat(_InputString, chars):
count = 0
_NonRepeat = {}
for i in chars:
count = _InputString.count(i)
if count > 1:
print(count,i)
if count == 1:
_NonRepeat[count] = i
#print(_NonRepeat)
return(_NonRepeat)
def _FindNonRepeat2(... |
a=[1,2,3,4,5]
a=a[::-1]
print (a)
a=[1,1,2,2,2,2,3,3,3]
b=2
print(a.count(b))
a='ana are mere si nu are pere'
b=a.split()
c=len(b)
print(c) |
"""
LeetCode Problem: 107. Binary Tree Level Order Traversal II
Link: https://leetcode.com/problems/binary-tree-level-order-traversal-ii/
Language: Python
Written by: Mostofa Adib Shakib
Time Complexity: O(N)
Space Complexity: O(N)
"""
class Solution:
def levelOrderBottom(self, root: TreeNode) -> List[List[int]]:... |
class ContactHelper:
def __init__(self, app):
self.app = app
def create(self, contact):
wd = self.app.wd
wd.find_element_by_link_text("add new").click()
wd.find_element_by_name("firstname").click()
wd.find_element_by_name("firstname").clear()
wd.find_element_by... |
"""
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 21000?
"""
number = 2**1000
string = str(number)
sum = 0
for c in string:
sum = sum + int(c)
print("the sum of the digits of the number 2e1000: %s" % sum)
|
FAST_NULL = 0x000
FAST_NOON = 0x201
FAST_SUNSET = 0x202
FAST_MOONRISE = 0x203
FAST_DUSK = 0x204
FAST_MIDNIGHT = 0x205
FAST_EKADASI = 0x206
FAST_DAY = 0x207
|
memo = {1: 1, 2: 2, 3: 4}
def climb(n):
if n == 1:
return 1
elif n == 2:
return 2
elif n == 3:
return 4
else:
c = 0
for i in [1, 2, 3]:
t = memo.get(n - i)
if not t:
memo[n - 1] = climb(n - 1)
c += memo.get(n... |
# pylint: skip-file
computing.ubm_training_workers = 8
computing.ivector_dataloader_workers = 22
computing.feature_extraction_workers = 22
computing.use_gpu = True
computing.gpu_ids = (0,)
paths.output_folder = '/media/ssd2/vvestman/sitw_ivector_outputs'
paths.feature_and_list_folder = 'datasets' # No need to update... |
numbers = [111, 7, 2, 1]
print(len(numbers))
print(numbers)
###
numbers.append(4)
print(len(numbers))
print(numbers)
###
numbers.insert(0, 222)
print(len(numbers))
print(numbers)
#
my_list = [] # Creating an empty list.
for i in range(5):
my_list.append(i + 1)
print(my_list)
my_list = [] # Creating an ... |
# -*- coding: utf-8 -*-
ICX_TO_LOOP = 10 ** 18
LOOP_TO_ISCORE = 1000
def icx(value: int) -> int:
return value * ICX_TO_LOOP
def loop_to_str(value: int) -> str:
if value == 0:
return "0"
sign: str = "-" if value < 0 else ""
integer, exponent = divmod(abs(value), ICX_TO_LOOP)
if exponent... |
# http://codeforces.com/problemset/problem/34/A
n = int(input())
heights = [int(x) for x in input().split()]
soldiers = [x for x in range(1, n + 1)]
heights.append(heights[0])
soldiers.append(soldiers[0])
first_min = 0
second_min = 0
difference_min = 999999999999999999999999
for i in range(len(height... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.