content stringlengths 7 1.05M |
|---|
class MarkdownParser:
def __init__(self, whitelist_filters=None):
self._delimiter = '\n'
self._single_delimiters = \
('#', '*', '+', '~', '-', '|', '`', '\n')
self._whitelist_filters = whitelist_filters or [str.isdigit]
def encode(self, text):
content_parts, conten... |
#!/usr/bin/env python3
# pyre-strict
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
ldops.exceptions
~~~~~~~~~~~
Contains LDOps-wide exceptions.
"""
cl... |
# 用来存储从惠州学院新闻网获取的一个新闻对象
class HzuNews:
"""一个简单的新闻信息数据结构"""
def __init__(self, title, link, time):
self.title = title
self.link = link
self.time = time
def get_title(self):
return self.title
|
# This program has been developed by students from the bachelor Computer Science at Utrecht University within the
# Software and Game project course
# ©Copyright Utrecht University Department of Information and Computing Sciences.
settingStrings = {
"updateMessage": "Settings updates succesfully",
"updateError... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
INPUT_STREAMS = [
'test.count_words_stream.CountWordsStream'
]
REDUCERS = [
'test.count_words_reducer.CountWordsReducer'
]
|
'''
This problem was asked by Facebook.
There is an N by M matrix of zeroes. Given N and M, write a function to count the number of ways of starting at the top-left corner and getting to the bottom-right corner. You can only move right or down.
For example, given a 2 by 2 matrix, you should return 2, since there are ... |
"""converted from vga_8x8.bin """
WIDTH = 8
HEIGHT = 8
FIRST = 0x20
LAST = 0x7f
_FONT =\
b'\x00\x00\x00\x00\x00\x00\x00\x00'\
b'\x18\x3c\x3c\x18\x18\x00\x18\x00'\
b'\x66\x66\x24\x00\x00\x00\x00\x00'\
b'\x6c\x6c\xfe\x6c\xfe\x6c\x6c\x00'\
b'\x18\x3e\x60\x3c\x06\x7c\x18\x00'\
b'\x00\xc6\xcc\x18\x30\x66\xc6\x00'\
b'\x38\x6... |
"""
configurable.py
Copyright 2006 Andres Riancho
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope tha... |
print('=--=' * 20)
print('ANALIZADOR DE TRIÂNGULOS')
print('=--=' * 20)
reta1 = int(input('Digite a primeira reta:'))
reta2 = int(input('Digite a segunda reta:'))
reta3 = int(input('Digite a terceira reta:'))
if reta1 < reta2 + reta3 and reta2 < reta1 + reta3 and reta3 < reta1 + reta2:
print('Os segmentos acima p... |
# Testing Assertions
# Given a sequence of a number of cars,
# the function get_total_cars returns the total number of cars.
# get_total_cars([1, 2, 3, 4])
# outputs: 10
# get_total_cars(['a', 'b', 'c'])
# outputs: ValueError: invalid literal for int() with base 10: 'a'
# Explain in words what the assertions in t... |
class Codec:
ENCODING: str
SEPARATOR: bytes
WIDTH: int
@staticmethod
def default():
"""Default codec specified for id3v2.3 (Latin1 / ISO 8859-1)"""
return _CODECS.get(0)
@staticmethod
def get(key):
"""Get codec by magic number specified in id3v2.3
0: Latin1... |
class FlaskRequest(object):
"""
A Request class to connect the Piwik API to Flask
"""
def __init__(self, request):
"""
:param request: Flask request object.
:type request: flask.Request
:rtype: None
"""
self.request = request
@property
def META(s... |
# Fala um programa que leia a largura e altura
# de uma parede, em metros, e calcule a sua área,
# bem como a quantidade de tinta necessária para
# pintar, supondo que 1L rende 2m^2 de parede.
altura = float(input('Altura da parede: '))
largura = float(input('Largura da parede: '))
area = altura * largura
tinta = are... |
# Sal's Shipping
# Eleni A.
weight = 41.5
GS_FLAT = 20
GSP_FLAT = 125
# Basic Scale Shipping
def basic_shipping(weight):
if weight <= 2:
cost = weight * 1.50
elif weight <= 6:
cost = weight * 3
elif weight <=10:
cost = weight * 4
else:
cost = weight * 4.75
return cost
# Ground Shipping
def ... |
"""
Product of Array Except Self
Given an integer array nums, return an array answer such that answer[i] is equal to the product of
all the elements of nums except nums[i].
The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.
You must write an algorithm that runs in O(n) time and w... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Вариант2
# В списке, состоящем из вещественных элементов, вычислить:
# 1) сумму положительных элементов списка;
# 2) произведение элементов списка, расположенных между максимальным по модулю и
# минимальным по модулю элементами.
# Упорядочить элементы списка по убыванию... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: 2017, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by... |
def open_dev( ):
''' Opens the red light LEDR device
:return: 1 on success, else 0
'''
def set(data):
''' Sets the red light LEDR device
:param data: the integer data to write to LEDR. If data = 0 all lights will be
turned off. If data = 0b1111111111 all lights will be turned on
:retu... |
del_items(0x801234F4)
SetType(0x801234F4, "void GameOnlyTestRoutine__Fv()")
del_items(0x801234FC)
SetType(0x801234FC, "int vecleny__Fii(int a, int b)")
del_items(0x80123520)
SetType(0x80123520, "int veclenx__Fii(int a, int b)")
del_items(0x8012354C)
SetType(0x8012354C, "void GetDamageAmt__FiPiT1(int i, int *mind, int *... |
def simple(arry, target):
# simple search
arry = [i for i in range(20)]
for i in arry:
print("%d steps" % i)
if i == target:
print("Found %d" % i)
break
def binary_search(arry, target):
# binary search
l = 0 # left pointer
r = len(arry) - 1 # right poi... |
"""
11866 : 조세퍼스 문제 0
URL : https://www.acmicpc.net/problem/11866
Input :
7 3
Output :
<3, 6, 2, 7, 5, 1, 4>
"""
N, M = map(int, input().split(' '))
i = 0
josephus = []
sequence = [i for i in range(1, N + 1)]
while sequence:
i = (i + M - 1) % len(sequence)
josephus.append(seque... |
FreeMono9pt7bBitmaps = [
0xAA, 0xA8, 0x0C, 0xED, 0x24, 0x92, 0x48, 0x24, 0x48, 0x91, 0x2F, 0xE4,
0x89, 0x7F, 0x28, 0x51, 0x22, 0x40, 0x08, 0x3E, 0x62, 0x40, 0x30, 0x0E,
0x01, 0x81, 0xC3, 0xBE, 0x08, 0x08, 0x71, 0x12, 0x23, 0x80, 0x23, 0xB8,
0x0E, 0x22, 0x44, 0x70, 0x38, 0x81, 0x02, 0x06, 0x1A, 0x65, 0x4... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# Current source: https://github.com/open-security/vulnpwn/
##
class FrameworkException(Exception):
pass
class OptionValidationError(FrameworkException):
pass
|
num = [[], []]
valor = 0
for C in range (1, 8):
valor = int(input(f'Digite o {C}º. valor: '))
if valor % 2 == 0:
num[0].append(valor)
else:
num[1].append(valor)
print('=' * 48)
num[0].sort()
num[1].sort()
print(f'Os Valores pares digitados foram: {num[0]}')
print(f'Os Valores impares digitad... |
def load(h):
return ({'abbr': 'none', 'code': 0, 'title': 'not set'},
{'abbr': 96,
'code': 96,
'title': 'HIRLAM data',
'units': 'non-standard, deprecated'},
{'abbr': 98,
'code': 98,
'title': 'previously used to tag SMHI data th... |
# Daniel Mc Callion
# Computing the primes
# My list of primes
p = []
# Loop through all of the numbers we're
# checking for primality
for i in range (2,10000):
# Assume that i is a prime
is_prime = True
# Look through all values j from 2 up
# to but not including i
# for j in range(2,i):
for... |
#challenge 19
#Write an algorithm that:
# •Asks the user to input a number and repeat this until they guess the number 7.
# •Congratulate the user with a ‘Well Done’ message when they guess correctly.
num = "num"
while num != 7:
num = int(input("Please enter a number: "))
print("Well Done")
|
# Section 1: Comments and Print
# A single line comment in python is indicated by a # at the beginning
''' This
is
a
multiline
comment '''
# A print function prints the code to the console, useful to learn and to debug
print('This is a print') # a comment can also be added after a funcion declaration or variable dec... |
# -*- coding: utf-8 -*-
"""Top-level package for Music Downloader Telegram Bot."""
__author__ = """@Bots_Ki_Duniya"""
__reportbugs__ = "@Mr_Ninjas_Bot"
__version__ = "0.13.7"
|
inputstr="SecondMostFrequentCharacterInTheString"
safe=inputstr
countar=[]
count=0
for i in inputstr:
if(i!='#'):
countar.append(inputstr.count(i))
print(i,inputstr.count(i),end=", ")
inputstr=inputstr.replace(i,'#')
else:
continue
firstmax=max(countar)
countar.remove... |
class Solution:
def reverseBetween(self, head: ListNode,
left: int, right: int) -> ListNode:
# Base case scenario
if left == right:
return head
node = ptr = ListNode() # Dummy node before actual linked list
node.next = head
# First traver... |
codigo_set = set()
codido_set_saiu = set()
s = input()
codigos = input().split(' ')
for codigo in codigos:
codigo_set.add(codigo)
i = input()
saidas = input().split(' ')
A = 0
I = 0
R = 0
for saida in saidas:
if saida in codigo_set:
if saida in codido_set_saiu:
R += 1
else:
A += 1... |
num = 0
num = (int)(input ())
for i in range(num):
check = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
checkingP = check[1]
popNum = 0
while(True):
existPop = False
#맨 처음 값의 중요도와 뒤의 중요도 비교 for문
for j in range(len(arr)-1):
if(arr[0] >=... |
"""
This is a Utility to parse a file.
"""
def parse_file(input_file = ""):
try:
with open(input_file , 'r') as file:
lines = [line.rstrip() for line in file]
return lines
except :
return None
|
# Configuration file for the Sphinx documentation builder.
project = 'pathlib2'
copyright = '2012-2014 Antoine Pitrou and contributors; 2014-2021, Matthias C. M. Troffaes and contributors'
author = 'Matthias C. M. Troffaes'
# The full version, including alpha/beta/rc tags
with open("../VERSION", "r") as version_file:... |
#
# PySNMP MIB module Dell-vlan-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Dell-vlan-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:43:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
_base_ = [
'../_base_/models/mask_rcnn_r50_fpn.py',
'../_base_/datasets/coco_instance.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
rpn_head=dict(
anchor_generator=dict(type='LegacyAnchorGenerator', center_offset=0.5),
bbox_coder=dict... |
# TODO: Finish exception implementation, with single exception used to manage hiding error details from user in UI
class GigantumException(Exception):
"""Any Exception arising from inside the Labbook class will be cast as a LabbookException.
This is to avoid having "except Exception" clauses in the client cod... |
"""
cmd.do('set ellipsoid_color, ${1:color};')
cmd.do('${0}')
"""
cmd.do('set ellipsoid_color, color;')
# Description: Set ellipsoid color.
# Source: placeHolder
|
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# mysql connect info 待压测数据库信息
mydb_info = 'testdb'
mydb_ip = '1.1.3.111'
mydb_usr = 'compare'
mydb_pass = 'ZAQ_xsw2'
mydb_port = 3306
mydb_db = 'otpstest'
#待压测mysql主机信息
os_data_ip = '1.1.3.200'
os_user = 'oracle'
os_pass = 'oracle22222'
# mysql资料库信息
my_ip = '1.1.3.111'
my_us... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: illuz <iilluzen[at]gmail.com>
# File: AC_stack_dict_n.py
# Create Date: 2015-03-04 19:47:43
# Usage: AC_stack_dict_n.py
# Descripton:
class Solution:
# @return a boolean
def isValid(self, s):
mp = {')': '(', ']': '[', '}': '{'}
... |
class Button(object):
"""Button object, used for creating button messages"""
def __init__(self, type=None, title="", payload=""):
# Type: request param key
valid_types = {
'web_url': 'url',
'postback': 'payload'
}
assert type in valid_types, "Type %s i... |
"""
Equation:
x^3 - 2400x^2 - 3x + 2 = 0
x = [0, ]
"""
def bisection(lb, ub, e, iter):
lv = lb**3-2400*(lb**2)-3*lb+2
uv = ub**3-2400*(ub**2)-3*ub+2
if lv*uv > 0:
print("No root found")
return
prev_mid = (lb+ub)/2
f_lb = lb**3-2400*(lb**2)-3*lb+2
f_mid = prev_mid**... |
f = open('sample-input.txt')
o = open('sample-output.txt', 'w')
t = int(f.readline().strip())
for i in xrange(1, t + 1):
o.write("Case #{}: ".format(i))
n = int(f.readline().strip())
x = [int(j) for j in f.readline().strip().split()]
y = [int(j) for j in f.readline().strip().split()]
o.write("\n")
|
"""Undocumented Module"""
__all__ = []
## from DirectObject import *
## from pandac.PandaModules import *
##
## class PandaObject(DirectObject):
## """
## This is the class that all Panda/Show classes should inherit from
## """
## pass
|
class Users:
def __init__(self, id, name, surname, password, email, changepass, read_comment, read_like):
self.id = id
self.name = name
self.surname = surname
self.password = password
self.email = email
self.changepass = changepass
self.read_comment = read_co... |
M = int(input())
m1 = set(map(int, input().split()))
N = int(input())
n1 = set(map(int, input().split()))
output = list(m1.union(n1).difference(m1.intersection(n1)))
output.sort()
for i in output:
print(i)
|
"""
Version of drf_editable
"""
__version__ = '0.0.1'
|
"""A series of modules containing dictionaries that can be used in run.py"""
def test_person_set_1():
person1 = {
"name": "Steven",
"age": 12,
"likes": "action",
"availability": 3
}
person2 = {
"name": "Jane",
"age": 23,
"likes": "roma... |
class ALonelyClass:
'''
A multiline class docstring.
'''
def AnEquallyLonelyMethod(self):
'''
A multiline method docstring'''
pass
def one_function():
'''This is a docstring with a single line of text.'''
pass
def shockingly_the_quotes_are_normalized():
'''This is... |
## UVSError handling guidelines:
# 1- don't use OOP exceptions, NEVER NEVER NEVER use inheritance in exceptions
# i dont like exception X that inherits from Y and 2mrw is a G then suddenly catches an F blah blah
# doing the above makes it harder not easier to figure out what the hell happened.
# ju... |
"""
Module: 'cmath' on micropython-maixpy-0.6.2-66
"""
# MCU: {'ver': '0.6.2-66', 'build': '66', 'sysname': 'MaixPy', 'platform': 'MaixPy', 'version': '0.6.2', 'release': '0.6.2', 'port': 'MaixPy', 'family': 'micropython', 'name': 'micropython', 'machine': 'Sipeed_M1 with kendryte-k210', 'nodename': 'MaixPy'}
# Stubber... |
def SumOfTwoNums(array , target):
"""
Get THe Sum of Two Numbers from an array to match the required target
"""
#sort the array
array.sort()
NumSums = []
left = 0
right = len(array)-1
while left < right:
currSum = array[left] + array[right]
# print(left , right , c... |
# This is an input class. Do not edit.
class LinkedList:
def __init__(self, value):
self.value = value
self.next = None
def reverseLinkedList(head):
# The trick of the problem is that we need to use three pointers, not two (which is the common pattern).
# the first and third pointer act as a ... |
# cycle.py
def cycle(iterable):
index = 0
length = len(iterable)
while True:
for index in range(length):
yield index
endless = cycle(range(0, 10))
for item in endless:
print(item)
|
# Copyright 2021 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 oddTuples(aTup):
'''
aTup: a tuple
returns: tuple, every other element of aTup.
'''
# using tuple slicing method
return aTup[0: :2]
|
mylang='fr'
family = 'wikipedia'
usernames['wikipedia']['fr']=u'Arktest'
console_encoding = 'utf-8'
|
#!/usr/bin/python3
"""Square class creation
"""
class Square:
"""Bypass attributes or methods declaration
"""
pass
|
'''
@author: Pranshu Aggarwal
@problem: https://hack.codingblocks.com/app/practice/1/285/problem
Algorithm to Generate(arr, n):
for row:=0 to n step by 1,
for col:=0 to row + 1 step by 1,
Set arr[row][col] = 1 if column is 0 or equals row
Set arr[row][col] = (Sum of Diagonally Pre... |
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/1332/A
def f(l):
a,c = l
p = 1
r = 0
while a>0 or c>0:
r += p*((c%3-a%3)%3)
p *= 3
c = c//3
a = a//3
return r
l = list(map(int,input().split()))
print(f(l))
|
a = 0
b = 1
n = int(input())
for i in range(n):
print(a,end=",")
print(b,end=",")
a = a+b
b = b+a
print("\b")
|
DATASET_REGISTRY = {}
def register_dataset(name: str):
def register_dataset_func(func):
DATASET_REGISTRY[name] = func()
return register_dataset_func
|
token = "bot_token"
admins = [admin_id]
api_id = 2040
api_hash = "b18441a1ff607e10a989891a5462e627"
|
a = [3, 4, 5, 6]
b = ['a', 'b', 'c', 'd']
def zipper(a,b):
newZip = []
if len (a) == len(b):
for i in range(len(a)):
newZip.append([a[i], b[i]])
print (newZip)
if len(a)!= len(b):
print("lists do not match")
zipper(a,b)
|
c = get_config()
c.TerminalInteractiveShell.confirm_exit = False
c.TerminalInteractiveShell.editing_mode = 'vi'
|
class Player:
def __init__(self, socket, name, color, board):
self.name = name
self.board = board
self.socket = socket
self.lastMove = []
self.isTurn = False
#self.color = color
self.color = 'w'
async def init(self):
await self.board.addPlayer(se... |
# visit: https://imgur.com/a/oemBqyv
count = 0
total = 0
# Handle any exceptions using try/except
try:
def main():
# Initialize variables
count = 0
total = 0
# Opens the Section1.txt file.
infile = open("Section1.txt", "r")
# Reads the numbers in the file into a li... |
# V0
# V1
# https://www.jiuzhang.com/solution/fair-candy-swap/#tag-highlight-lang-python
class Solution:
"""
@param A: an array
@param B: an array
@return: an integer array
"""
def fairCandySwap(self, A, B):
# Write your code here.
ans = []
sumA = sum(A)
sumB =... |
# PROBLEM LINK:- https://leetcode.com/problems/height-checker/
class Solution:
def heightChecker(self, heights: List[int]) -> int:
n = len(heights)
expected = heights.copy()
expected.sort()
c = 0
for i in range(0,n):
if heights[i] != expected[i]:
... |
m = float(input('Informe os metros: '))
print(f'{m} metros equivale a: \n{m*0.001}km\n{m*0.01}hm\n{m*0.1:.1f}dam\n{m*10:.0f}dm\n{m*100:.0f}cm\n{m*1000:.0f}mm')
#km, hm, dam, m, dm, cm, mm |
__title__ = "feedler"
__description__ = "A dead simple parser"
__version__ = "0.0.2"
__author__ = "Victor Natschke"
__author_email__ = "vnatschke@gmail.com"
__license__ = "MIT"
__copyright__ = "Copyright 2020 Victor Natschke"
|
class Solution:
def InsertInterval(self, Interval, newInterval):
nums,mid = list(), 0
int_len = len(Interval)
for s,e in Interval:
if s < newInterval[0]:
nums.append([s,e])
mid += 1
else:
break
if not nums or n... |
"""
问题描述:请从字符串中找出一个最长的不包含重复字符的子字符串,计算
该最长子字符串的长度。假设字符串中只含有'a~z'的字符。例如,在字符
串'arabcacfr'中,最长不含重复字符的子字符串是'acfr',长度为4
思路:
分别求必须以i(0<=i<=len-1)结尾的最长不含重复字符的子串长度
"""
class LongestSubStr:
def get_longest_substr(self, input_str):
length = len(input_str)
if length <= 1:
return length
d... |
deployment = """
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {cfg[name_version]}-{cfg[name]}
namespace: {cfg[metadata][namespace]}
spec:
replicas: {cfg[replicas]}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
selector:
matchLabels:
app: {... |
# Peter Thornton, 04 Mar 18
# Exercise 5
# Please complete the following exercise this week.
# Write a Python script that reads the Iris data set in and prints the four numerical values on each row in a nice format.
# That is, on the screen should be printed the petal length, petal width, sepal length and sepal widt... |
#! python3
"""[12] El General Manager rata - 23 Puntos:
Se recibirán el nombre del equipo, el número de integrantes y las
habilidades de cada uno de los jugadores.
Se deben devolver la alineación y la calificación total del equipo."""
coeficientes = ((0, 0.2, 0.45, 0.15, 0.2, 0),
(0, 0.45, 0.15, 0.35,... |
EPSILON = "epsilon"
K = "k"
MAX_VALUE = "max_value"
MIN_VALUE = "min_value"
ATTRIBUTE = "attribute"
NAME = "name"
SENSITIVITY_TYPE = "sensitivity_type"
ATTRIBUTE_TYPE = "attribute_type"
# window size is used in the disclosure risk calculation
# it indicates the % of the num of records in the dataset
WINDOW_SIZE = 1
# b... |
pdrop = 0.1
tau = 0.1
lengthscale = 0.01
N = 364
print(lengthscale ** 2 * (1 - pdrop) / (2. * N * tau)) |
class Delegator():
""" Class implementing Delegator pattern in childrens, who enable to
automaticaly use functions and methods from _delegate_subsystems, so
reduces boilerplate code
!!! be aware that Delegator can't delegate methods from childrens
which implements Delegator
"""
def __init__... |
a = 1
b = 1
a = 1
b = 1
|
"""
Crafting.py
Inspired by: Craft3.pdf by John Arras
http://web.archive.org/web/20080211222642/http://www.cs.umd.edu/~jra/craft3.pdf
Intention: Implement a crafting system which can act as a suitable base for a procedurally-generated
society.
"""
# Crafting is the act of producing an object from resources by use o... |
class FrankiException(Exception):
pass
class FrankiInvalidFormatException(Exception):
pass
class FrankiFileNotFound(Exception):
pass
class FrankiInvalidFileFormat(Exception):
pass
__all__ = ("FrankiInvalidFormatException", "FrankiFileNotFound",
"FrankiInvalidFileFormat", "FrankiExcept... |
T = int(input())
for i in range(T):
m, n, a, b = map(int, input().split())
count = 0
for num in range(m, n + 1):
if num % a == 0 or num % b == 0:
count += 1
print(count)
|
"""
Author: Darian T. Yang
Date of Creation: September 13th, 2021
Description:
"""
# Welcome to the WE-dap module!
|
# This problem was asked by Airbnb.
#
# Given a list of integers, write a function that returns the largest sum of non-adjacent numbers.
# Numbers can be 0 or negative.
# For example, [2, 4, 6, 2, 5] should return 13, since we pick 2, 6, and 5. [5, 1, 1, 5] should return 10,
# since we pick 5 and 5.
# Follow-up: Can yo... |
def status(bot, update, webcontrol):
chat_id = update.message.chat_id
code, text = webcontrol.execute('detection', 'status')
if code == 200:
bot.sendMessage(chat_id=chat_id, text=text)
else:
bot.sendMessage(chat_id=chat_id, text="Try it later")
|
blankpsl = """
A P P : C o u r i e r
T Y P E : S c h e m e L o g i c E d i t o r
F O R M A T : 1 . 0
V E R S I O N : 4 . 0 0
D O M A I N : 0 0 S e t t i n g s
S U B D O M A I N : 0 P S L S e t t i n g G r p 1
M O D E L : P 1 4 2 1 1 7 B 4 M 0 4 3 0 J
R E F E ... |
maiores = homens = mulheres = 0
while True:
print('-'*30)
print('CADASTRO DE PESSOA')
print('-' * 30)
idade = int(input('Qual sua idade: '))
sexo = ' '
while sexo not in 'M' and sexo not in 'F' :
sexo = str(input('Qual seu sexo [F|M]: ')).upper().strip()
print('-' * 30)
if sexo =... |
eg = [
'forward 5',
'down 5',
'forward 8',
'up 3',
'down 8',
'forward 2',
]
def load(file):
with open(file) as f:
data = f.readlines()
return data
def steps(lines, pos_char, neg_char):
directions = [ln.split(' ') for ln in lines if ln[0] in [pos_char, neg_char]]
st... |
def test():
print("test successful...")
def update():
print("Updating DSA")
if __name__=='__main__':
pass |
"""Sort an array by anagram."""
def sort_by_anagram(array):
n = len(array)
if n <= 2:
return array
i = 0
while i < n-2:
for j in range(i+1, n):
if is_anagram(array[i], array[j]):
i += 1
array[i], array[j] = array[j], array[i]
i +=... |
class Component:
def __init__(self, fail_ratio, repair_ratio, state):
self.fail_ratio = fail_ratio
self.repair_ratio = repair_ratio
self.state = state |
def parse():
with open("input16") as f:
n = [int(x) for x in f.read()]
return n
n = parse()
for _ in range(100):
result = []
for i in range(1, len(n) + 1):
digit = 0
start = i - 1
add = 1
while start < len(n):
end = min(start + i, len(n))
... |
s = float(input('Salário: '))
if s <= 1250:
s = s * 1.15
if s > 1250:
s = s * 1.1
print('Novo salário: R${}'.format(s))
|
def exec_procedure(session, proc_name, params):
sql_params = ",".join(["@{0}={1}".format(name, value) for name, value in params.items()])
sql_string = """
DECLARE @return_value int;
EXEC @return_value = [dbo].[{proc_name}] {params};
SELECT 'Return Value' = @return_value;
"""... |
MOD = 10 ** 9 + 7
n, m = map(int, input().split())
def comb(n, r, p):
if r < 0 or n < r:
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
def perm(n, r, p):
if r < 0 or n < r:
return 0
return fact[n] * factinv[n-r] % p
p = MOD
N = m
fact = [1, 1] # fact[n... |
"""
Computer vision Utils
=====================
Standard utils module storing common to the package classes, functions, constants, and other objects.
"""
|
'''字典 key - value'''
alien_0={'color':'green','points':5}
print(alien_0['color'])
print(alien_0['points'])
#添加
alien_0['x_position']=0
alien_0['y_position']=25
print(alien_0)
#修改
alien_0['color']='yellow'
print(alien_0)
#删除 删除的键—值对永远消失了。
del alien_0['points']
print(alien_0)
#由类似对象组成 的字典
student={
'name':'Michael... |
expected_output = {
'slot':{
2:{
'port_group':{
1:{
'port':{
'Hu2/0/25':{
'mode':'inactive'
},
'Hu2/0/26':{
'mode':'inactive'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.