content stringlengths 7 1.05M |
|---|
#App
HOST = '0.0.0.0'
PORT = 6000
DEBUG = False
#AWS
BUCKET = 'fastermlpipeline'
ACCESS_KEY = 'sorry_itsasecret'
SECRET_KEY = 'sure_itsasecret'
#Extract Data
URL_DATA = 'http://api:5000/credits'
#Preprocessors
NUMERICAL_FEATURES = ['age', 'job', 'credit_amount' ,'duration']
CATEGORICAL_FEATURES = ['sex', 'housing... |
""" Return nth element from last node
input: A -> B -> C -> D
output: B
"""
class Node:
""" Node class contains everything related to Linked List node """
def __init__(self, data):
""" initializing single node with data """
self.data = data
self.next = None
class LinkedList:
... |
lookup_table = {
"TRI_FACILITY_NPDES": {
"ASGN_NPDES_IND": "Indicates that the associated NPDES_NUM represents the principal NPDES permit number as assigned to the facility by TRI from Form R or Form A submissions. Values: 1 = 'Yes', 0 = 'No'.",
"TRI_FACILITY_ID": "The unique number assigned to each facilit... |
#Write a function that takes a two-dimensional list (list of lists) of numbers as argument and returns a list
#which includes the sum of each row. You can assume that the number of columns in each row is the same.
def sum_of_two_lists_row(list2d):
final_list = []
for list_numbers in list2d:
sum_list = 0
for nu... |
"""
Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A.
We want to find an index mapping P, from A to B. A mapping P[i] = j means the ith element in A appears in B at index j.
These lists A and B may contain duplicates. If there are multi... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... |
def count_words(input_str):
return len(input_str.split())
print(count_words('this is a string'))
demo_str = 'hellow world'
print(count_words(demo_str))
def find_min(num_list):
min_item = num_list[0]
for num in num_list:
if type(num) is not str:
if min_item>... |
class Solution(object):
def pourWater(self, heights, V, K):
"""
:type heights: List[int]
:type V: int
:type K: int
:rtype: List[int]
"""
for i in range(V):
t = K
#left peak [0: k]
for left ... |
class InvalidInputError(Exception):
"""
This will be raised when one tries to input a type thats not in its
list of types that can be used.
"""
def __init__(self, message):
self.message = message
def __str__(self):
return self.message |
"""
nydus.db.backends.base
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
__all__ = ('BaseConnection',)
class BasePipeline(object):
"""
Base Pipeline class.
This basically is absolutely useless, and just provides a sample
API for ... |
def find_minimum_number_of_moves(rows, cols, start_row, start_col, end_row, end_col):
# row_low = start_row if start_row < end_row else end_row
# row_high = start_row if start_row > end_row else end_row
# col_low = start_col if start_col < end_col else end_col
# col_high = start_col if start_col > end_c... |
#
# subtag.py
# =========
#
# Python-3 module for loading and parsing the Language Subtag Registry
# from IANA.
#
# A current copy of the registry can be downloaded from IANA at the
# following address:
#
# https://www.iana.org/assignments/
# language-subtag-registry/language-subtag-registry
#
# The format of this ... |
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
Cree una clase Alumno e inicialícela con el nombre y el número de
registro. Haga los métodos para:
1. Display - Debe mostrar toda la información del estudiante (nombre y
número de registro).
2. setAge - Debe asignar la edad del estudiante
3. setNota - ... |
for _ in range(int(input())):
p,n=input(),int(input())
x=input()[1:-1].split(',')
pos,rpos,mode=0,n-1,0
error=False
for i in p:
if i=='R': mode=(mode+1)%2
else:
if pos>rpos:
print('error')
error=True
break
if mode==0: pos+=1
else: rpos-=1
if error: continue
print(end='[')
if mode==0:
... |
# -*- coding: utf-8 -*-
# @Author: davidhansonc
# @Date: 2021-01-19 10:22:34
# @Last Modified by: davidhansonc
# @Last Modified time: 2021-01-19 10:56:52
my_string = 'abcde fgh'
def reverse_string(string):
rev_str = ''
for i in range(len(string)-1, -1, -1):
rev_str += string[i]
return rev_str
... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def middleNode(self, head: ListNode) -> ListNode:
d = 1
current = head.next
middle = head
while current:
d +=... |
name = 'Sina'
last = 'Bakhshandeh'
age = 29
nationality = 'Iran'
a = 'I am Sina Bakhshandeh 29 years old, from iran.'
# print(a)
# print('I am', name, last, age ,'years old, from ', nationality)
b = 'I am {} {} {} years old, from {}.'
print( b.format(name, last, age, nationality) ) |
#!usr/bin/python3
with open('01/input.txt', 'r') as file:
increases = 0
previous = file.readline()
for line in file.readlines():
delta = int(line) - int(previous)
if delta > 0:
increases += 1
previous = line
print(increases) |
"""
RHGamestation manager API
Well in fact it's not really an API, this is mostly JSON views for some
special jobs like executing some command scripts.
""" |
# Basics
5 == 5 # True
5 == 4 # False
5 != 4 # True
5 > 3 # True
3 < 5 # True
5 >= 3 # True
5 >= 5 # True
[1, 2, 4] > [1, 2, 3] # True
1 < 2 and 5 > 4 # True
(1 < 2) and (5 > 4) # True
1 > 2 or 5 > 4 # True
#Chainging
x = 4
x > 3 and x < 5 # True
3 < x < 5 # True
# isinstance
isinstance("Will", str) # True
isinstance... |
#!/usr/bin/python
# -*- coding: utf8
"""
Keywords reserved in any SQL standard
From http://www.postgresql.org/docs/9.4/static/sql-keywords-appendix.html
"""
sql_reserved_words = [
'ABS',
'ABSOLUTE',
'ACTION',
'ADD',
'ALL',
'ALLOCATE',
'ALTER',
'ANALYSE',
'ANALYZE',
'AND',
'ANY',
'ARE',
'ARRAY',
'ARRAY_AG... |
# Region
# VPC
# Private Subnet
# Public Subnet
# Security Group
# Availability Zone
# AWS Step Functions Workflow
# Elastic Beanstalk container
# Auto Scaling Group
# Server contents
# EC2 instance contents
# Spot Fleet
groups = {
'AWS::AccountId': {'level': 0},
'AWS::Region': {'level': 1},
'AWS::IAM:... |
f = open('latin_text', 'w')
for i in xrange(5000):
text = "Lorem ipsum dolor sit amet, est malis molestiae no,\nrebum" \
"mediocrem vituperatoribus qui et. Quando intellegam ne mea," \
" utroque\n voluptua sensibus nam te. In duo accusam accusamus," \
" mea ad iriure detracto\nsigni... |
'''
Created on Dec 5, 2012
@author: arnaud
'''
"""
from UniShared_python.website.models import UserProfile
from django.contrib.auth.models import User
from django.test.testcases import LiveServerTestCase
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from social_auth.db.django... |
def multi_inverse(b, n):
r1 = n
r2 = b
t1 = 0
t2 = 1
while(r1 > 0):
q = int(r1/r2)
r = r1 - q * r2
r1 = r2
r2 = r
t = t1 - q * t2
t1 = t2
t2 = t
if(r1 == 1):
inv_t = t1
break
return inv_t
|
#Data : 2018-10-15
#Author : Fengyuan Zhang (Franklin)
#Email : franklinzhang@foxmail.com
class ModelDataHandler:
def __init__(self, context):
self.mContext = context
self.mExecutionPath = ''
self.mZipExecutionPath = ''
self.mExecutionName = ''
self.mSavePath = ''
... |
"""Path counting solutions."""
def count_path_recursive(m, n):
"""Count number of paths with the recursive method."""
def traverse(m, n, location=[1, 1]):
# return 0 if past edge
if location[0] > m or location[1] > n:
return 0
# return 1 if at end position
if locati... |
def notas(*num):
'''
Função notas utiliza de uma lista de notas para processamento de dados
:param num: Lista de notas dos alunos de uma sala
:return: Total, maior nota, menor nota, média geral da sala e situacao de aproveitamento
'''
sala = dict()
sala['total'] = len(num)
sala['... |
# faça um programa que leia o nome e o preço de vários produtos. O programa deverá perguntar se o usuario vai continuar
# No final, mostre:
# Qual é o total de gastos da compra
# quantos produtos custam mais de R$1000
# Qual é o nome do produto mais barato
gastos = produts = cont = pbarat = 0
nbarat = ''
while True:
... |
class Solution:
def trap(self, height: List[int]) -> int:
if len(height) < 3:
return 0
max_left = [0] * len(height)
max_right = [0] * len(height)
for i in range(1, len(height)):
max_left[i] = max(height[i - 1], max_left[i - 1])
for i in ra... |
__version__ = "0.2.2"
__license__ = "MIT License"
__website__ = "https://code.exrny.com/opensource/vulcan-builder/"
__download_url__ = ('https://github.com/exrny/vulcan-builder/archive/'
'{}.tar.gz'.format(__version__))
|
"""
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
class Tag:
"""Represents a single Gherkin Tag"""
def __init__(self, name: str, path: str, line: int) -> None:
self.name = na... |
'''
Created on Mar 27, 2015
@author: maxz
'''
def lim(x, perc=.1):
r = x.max() - x.min()
return x.min()-perc*r, x.max()+perc*r
|
def most_frequent(data: list) -> str:
"""
determines the most frequently occurring string in the sequence.
"""
# your code here
return max(data, key=lambda x: data.count(x))
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testin... |
def filter_positive_even_numbers(numbers):
"""Receives a list of numbers, and returns a filtered list of only the
numbers that are both positive and even (divisible by 2), try to use a
list comprehension."""
positive_even_numbers = [x for x in numbers if x > 0 and not x % 2]
return positive_... |
# Copyright 2019 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Benchmark adapted from https://github.com/d5/tengobench/
doc="fib tail call recursion test"
def fib(n, a, b):
if n == 0:
return a
elif n ... |
# Given a collection of distinct integers, return all possible permutations.
# Example:
# Input: [1,2,3]
# Output:
# [
# [1,2,3],
# [1,3,2],
# [2,1,3],
# [2,3,1],
# [3,1,2],
# [3,2,1]
# ]
class Solution:
def permute(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]... |
class ParsingError(Exception):
pass
|
num1 = int(input("Primeiro Valor: "))
num2 = int(input("Segundo Valor: "))
num3 = int(input("Terceiro Valor: "))
menor = num1
#Descobrindo o valor do menor número
if num2 < num1 and num2 < num3:
menor = num2
if num3 < num1 and num3 < num2:
menor = num3
print("O menor valor é {}".format(menor))
maior = num1
#De... |
__all__ = [
"ConsulError",
"ConflictError",
"NotFound",
"SupportDisabled",
"TransactionError",
"UnauthorizedError"
]
class ConsulError(Exception):
"""Consul base error
Attributes:
value (Object): object of the error
meta (Meta): meta of the error
"""
def __init... |
load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_test")
# `dir` is path from WORKSPACE root.
def steep_check(name, bin, srcs, deps, dir = ".", rubyopt = []):
ruby_test(
name = name,
srcs = srcs,
deps = deps,
main = bin,
args = [
"check",
"--steepfile={}/Steepfile".format(dir),
... |
######################################################################
#
# File: b2sdk/transfer/inbound/file_metadata.py
#
# Copyright 2020 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
class FileMe... |
class Location:
pass
class DecimalLocation:
pass
class GridLocation:
pass
|
# -*- coding: utf-8 -*-
"""Exceptions.
"""
class TinderException(Exception):
"""
"""
pass
class TinderAuthenticationException(TinderException):
"""
"""
pass
class TinderConnectionException(TinderException):
"""
"""
pass
|
# 1.
# Find position of Most Significant Bit (MSB) in both numbers.
# If positions of MSB are different, then result is 0.
# If positions are same. Let positions be msb_position.
# ……a) We add 2msb_position to result.
# ……b) We subtract 2msb_position from lower limit and upper limit,
# ……c) Repeat steps 1, 2 and 3 for ... |
def make_complex1(*args):
x, y = args
return dict(**locals())
def make_complex2(x, y):
return {'x': x, 'y': y}
print(make_complex1(5, 6))
print(make_complex2(5, 6))
|
# -*- coding: utf-8 -*-
"""
fbone.modules.frontend
~~~~~~~~~~~~~~~~~~~~~~~~
frontend management commands
"""
|
"""
* @author: Shashank Jain
* @date: 25/12/2018
"""
a=input("Enter the string to count no. of vowels?")
b=list(a.replace(" ","").lower())
c=['a','e','i','o','u']
count=0
for i in b:
for j in c:
if (j==i):
count=count+1
print(count)
|
# -*- coding: utf-8 -*-
"""
Student Do: Trading Log.
This script demonstrates how to perform basic analysis of trading profits/losses
over the course of a month (20 business days).
"""
# @TODO: Initialize the metric variables
# @TODO: Initialize lists to hold profitable and unprofitable day profits/losses
# L... |
# coding:utf-8
# @File : spider.py
# @Author : Leoren
# @Date : 2019/3/25 12:15
# @Desc : 爬取国内酒店信息 途牛网
base_url = "http://www.tuniu.com/"
|
"""
This file defines the structure of the JSON
responses expected by the Searcher module.
They are generated using the JSON Schema Tool,
available here https://jsonschema.net/
"""
# pylint: skip-file
SEARCH_RESULT_SCHEMA = {
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": ... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def addOneRow(self, root, v, d):
"""
:type root: TreeNode
:type v: int
:type d: int
... |
if __name__ == '__main__':
def uninit_switch(*args):
raise TypeError("executed a case stmt outside switch's context")
class switch:
@property
def default(self):
if self.finished:
raise SyntaxError("multiple 'default' cases were provided")
self.fi... |
stamina = 6
alive=False
def report(stamina):
if stamina > 8:
print ("The alien is strong! It resists your pathetic attack!")
elif stamina > 5:
print ("With a loud grunt, the alien stands firm.")
elif stamina > 3:
print ("Your attack seems to be having an effect! The alien stu... |
class EpisodeQuality:
def __init__(self, title: str, url: str):
self.title = title
self.url = url
|
# -*- coding: utf-8 -*-
# @Author : LG
"""
执行用时:56 ms, 在所有 Python3 提交中击败了80.87% 的用户
内存消耗:13.9 MB, 在所有 Python3 提交中击败了8.27% 的用户
解题思路:
回溯
同N皇后解题思路,但由于只需要计算题解数量
"""
class Solution:
def totalNQueens(self, n: int) -> int:
col = []
obl1 = []
obl2 = []
result = [0]
def ba... |
#
# PySNMP MIB module APSLB-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APSLB-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:24:22 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... |
num="""\
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40... |
#i'm an idiot, this algoritm is fucking useless, the FB and LR notation is literally binary notation.
def ticketCheck(line):
rowMin = 0
rowMax = 127
colMin = 0
colMax = 7
for i in range (7):
if line[i] == 'F':
rowMax = rowMin + abs(int((rowMax - rowMin)/2))
else: rowMin ... |
real = float ( input(' Digite o valor em reais: R$'))
#dola = 5.34
dola = real / 5.34
euro = real / 6.25
print (' Convertendo o valor de R${:.2f}, você consegue US${:.2f} ou €{:.2f}.' .format( real,dola, euro))
#print (' Convertendo o valor de R${:.2f}, você consegue US${:.2f} ou € {:.2f}.'.format(real,(real/dola)))
... |
list = [50,100,150,200,250,300]
mininumber = list[0]
for x in list:
if mininumber > x:
mininumber = x
print("mininumber is ",mininumber)
|
# File: config.py
# Author: Qian Ge <geqian1001@gmail.com>
# directory of pre-trained vgg parameters
vgg_dir = '../../data/pretrain/vgg/vgg19.npy'
# directory of training data
data_dir = '../../data/dataset/256_ObjectCategories/'
# directory of testing data
test_data_dir = '../data/'
# directory of infe... |
# Solution 1
# O(n^2) time | O(n) space
def longestIncreasingSubsequence(array):
if len(array) <= 1:
return array
sequences = [None for _ in range(len(array))]
lengths = [1 for _ in range(len(array))]
maxLenIdx = 0
for i in range(len(array)):
curNum = array[i]
for j in ra... |
class Auth:
class general:
token = None # Token for general authentication
class live:
result = None # JSON result of the Live Auth request;
class Me(object):
def __init__(self):
self.id = None
self.username = None
self.auth = Auth
cl... |
# MIT License
#
# Copyright (c) 2020 Evgeny Medvedev, evge.medvedev@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
"""
pyrtf-ng Errors and Exceptions
"""
class RTFError(Exception):
pass
class ParseError(RTFError):
"""
Unable to parse the RTF data.
"""
|
def pytrades():
pass
def DiffEvol():
pass
def PyPolyChord():
pass
def PolyChord():
pass
def celerite():
pass
def ttvfast():
pass
def george():
pass
def batman():
pass
def dynesty():
pass
## absurd workaround to fix the lack of celerite in the system
def Celerite_QuasiPeriodi... |
NO_ROLE_CODE = ''
TRUSTEE_CODE = '0'
STEWARD_CODE = '2'
TGB_CODE = '100'
TRUST_ANCHOR_CODE = '101'
|
class PartialCumulativeClass:
'''
the concept:
'''
def __init__(self, conf, shared):
self.conf = conf
self.shared = shared
self.sharedAnalysis = None
# define data source / destination
# define data source / destination
self.dataSourceFilePath = ''
... |
# -*- coding: utf-8 -*-
# @Time: 2020/8/26 20:27
# @Author: GraceKoo
# @File: interview_38.py
# @Desc: https://leetcode-cn.com/problems/er-cha-shu-de-shen-du-lcof/
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
... |
'''
You are given an integer array nums sorted in non-decreasing order.
Build and return an integer array result with the same length as
nums such that result[i] is equal to the summation of absolute
differences between nums[i] and all the other elements in the
array.
In other words, result[i] is equal to sum(|num... |
#Servo test
e1 = Entry(root)
e1.grid(row=0, column=1)
def cal():
global dc
deg = abs(float(deg1))
dc = 0.056*deg + 2.5
p.ChangeDutyCycle(dc)
print(deg, dc) |
# Weight converter
weight = float(input("Weight?"))
unit = input("(L)bs or (K)g?")
if unit.upper() == "K":
print(weight*2.2)
elif unit.upper() == "L":
print(weight*0.45)
else:
print("Error, please verify your input") |
def stair_ways(n):
ways = [0] * n
ways[0] = 1
if n > 1:
ways[1] = 1
if n > 2:
ways[2] = 1
for p in range(0, n):
if p + 1 < n:
ways[p+1] += ways[p]
if p + 2 < n:
ways[p+2] += ways[p]
if p + 3 < n:
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 28 00:08:24 2017
@author: soumi
"""
## scale canvas pixels to android screen pixel
class SketchDipCalculator:
def __init__(self, width, height):
self.mHeightPx=height
self.mWidthPx = width
## default screen size consid... |
#!/usr/bin/env python
a = 0
b = 1
while b < 100:
print(b)
a,b = b,a+b
|
"""
``pysiml`` is a python library for similarity measures
"""
__version__ = '0.1.0'
|
class state:
def __init__(self, name, population, area, capital):
self.name = name
self.population = population
self.area = area
self.capital = capital
def calc_density(self):
return self.area/self.population
state_1 = state('guj', 50000000, 40000000, 'gandhinagar')
sta... |
puffRstring = '''
impute_zeros <- function(x, y, bw){
k <- ksmooth(x=x, y=y, bandwidth=bw)
y[y == 0] <- k$y[y == 0]
return(y)
}
mednorm <- function(x){x/median(x)}
mednorm.ksmooth <-function(x,y,bw){mednorm(ksmooth(x=x,y=y,bandwidth = bw)$y)}
mednorm.ksmooth.norm <-function(x,y,bw,norm.y){mednorm.ksmooth(... |
# -----------------
# User Instructions
#
# In this problem, you will generalize the bridge problem
# by writing a function bridge_problem3, that makes a call
# to lowest_cost_search.
def bridge_problem3(here):
"""Find the fastest (least elapsed time) path to
the goal in the bridge problem."""
# your co... |
#
# PySNMP MIB module Unisphere-Data-IP-PROFILE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-IP-PROFILE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:31:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... |
#
# crc32.py
#
# Copyright © 2020 Foundation Devices, Inc.
# Licensed under the "BSD-2-Clause Plus Patent License"
#
# From: https://bitbucket.org/isode/cbor-lite/raw/6c770624a97e3229e3f200be092c1b9c70a60ef1/include/cbor-lite/codec.h
# This file is part of CBOR-lite which is copyright Isode Limited
# and others and r... |
def checkInline(s):
i = 0
while True:
try:
if s[i] == '$':
return i
except IndexError:
return -1
i += 1
def checkOutline(s):
return s == "<p class='md-math-block'>$"
def main():
f = open("./output.txt", "w")
while True:
s = ... |
## Read input as specified in the question.
## Print output as specified in the question.
N = int(input())
for i in range(1, N+1):
for j in range(0, i):
x = i - 1
if x == 0:
print("1", end='')
else:
if x == j or j == 0:
print(x, end = '')
e... |
def solution(n):
if str(n ** (1/2))[-2] == '.': return int(((n **(1/2))+1) ** 2)
else: return -1
print(solution(121))
print(solution(3)) |
# Find the thirteen adjacent digits in the 1000-digit number that have the
# greatest product. What is the value of this product?
# Problem taken from https://projecteuler.net/problem=8
number = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545... |
OPTIONAL_FIELDS = [
'tags', 'consumes', 'produces', 'schemes', 'security',
'deprecated', 'operationId', 'externalDocs'
]
OPTIONAL_OAS3_FIELDS = [
'components', 'servers'
]
|
rows=6
for num in range(rows):
for i in range(num):
print(num, end=" ")
print()
'''
Step for num in range(6):
step1:num=0
for i in range(0): 0,0
--------------------- skip
step2:num=1
for i in range(1): 0,1
1
step3:num=2
for i in ra... |
class NotImplementedException(Exception):
pass
class GeolocationBackend(object):
def __init__(self, ip):
self._ip = ip
self._continent = None
self._country = None
self._geo_data = None
self._raw_data = None
def geolocate(self):
raise NotImplementedException(... |
class Solution:
def missingNumber(self, arr: List[int]) -> int:
x=int(((len(arr)+1)/2)*(arr[0]+arr[-1]))
return x-sum(arr)
|
def deep_merge_dicts(dict1, dict2):
output = {}
# adds keys from `dict1` if they do not exist in `dict2` and vice-versa
intersection = {**dict2, **dict1}
for k_intersect, v_intersect in intersection.items():
if k_intersect not in dict1:
v_dict2 = dict2[k_intersect]
outp... |
def sayHello(name):
'''say hello to given name'''
print(f'Hello, {name}')
|
# Prepare the data
piedpiper=np.array([4.57, 4.55, 5.47, 4.67, 5.41, 5.55, 5.53, 5.63, 3.86, 3.97, 5.44, 3.93, 5.31, 5.17, 4.39, 4.28, 5.25])
endframe = np.array([4.27, 3.93, 4.01, 4.07, 3.87, 4. , 4. , 3.72, 4.16, 4.1 , 3.9 , 3.97, 4.08, 3.96, 3.96, 3.77, 4.09])
# Assumption check
check_normality(piedpiper)
check_nor... |
# The four adjacent digits in the 1000-digit number that have the greatest
# product are 9 × 9 × 8 × 9 = 5832.
#
# 73167176531330624919225119674426574742355349194934
# 96983520312774506326239578318016984801869478851843
# 85861560789112949495459501737958331952853208805511
# 12540698747158523863050715693290963295227443... |
# 1014. Произведение цифр
# solved
n = int(input())
result = ''
if n == 0:
result = '10'
elif n == 1:
result = '1'
else:
q = 0
p = 1
for i in range (9, 1, -1):
while n%i == 0:
q += p * i
p = p * 10
n = n / i
if n == 1:
result = str(q)
el... |
"""
segmentation.py
SCTE35 Segmentation Descriptor tables.
"""
"""
Table 20 from page 58 of
https://www.scte.org/SCTEDocs/Standards/ANSI_SCTE%2035%202019r1.pdf
"""
table20 = {
0x00: "Restrict Group 0",
0x01: "Restrict Group 1",
0x02: "Restrict Group 2",
0x03: "No Restrictions",
}
"""
table 22 from pa... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
图:
概念和性质:
图为一个二元组 G=(V, E)
1、V是非空有穷的顶点集合
2、E是顶点偶对(边)的集合,E属于VxV
3、V中的顶点也称为图G的顶点,E中的边也称为图G的边
有向图:边有方向,顶点是有序对
<v1, v2> 表示从v1到v2的边,v1-始点,v2-终点,翻转后表示另一条边
而无向图中表示同一条边
同时称v2为v1的邻接顶点(邻接点)
也称这条边与v1相关联的边
邻接关系
无向图:边没有方向,顶点是无序对
(v1, v2)
... |
pkgname = "pcre"
pkgver = "8.45"
pkgrel = 0
build_style = "gnu_configure"
configure_args = [
"--with-pic",
"--enable-utf8",
"--enable-unicode-properties",
"--enable-pcretest-libedit",
"--enable-pcregrep-libz",
"--enable-pcregrep-libbz2",
"--enable-newline-is-anycrlf",
"--enable-jit",
... |
"""@package gensolver_dumper
Abstract class for dumpers.
"""
class GenSolverDumper:
def __init__(self, output_file):
""" Abstract class for creating dumper objects.
:param str output_file: Path to the file to store output, if output_file == '' then will not output to file.
"""
se... |
c = float(input('Type a temperature in °C: '))
f = c * 1.8 + 32
print(f'{c}°C corresponds to {f}°F')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.