content stringlengths 7 1.05M |
|---|
#!/bin/python3
[n,k] = [int(x) for x in input().split()]
k -= 1
factorial = [1 for _ in range(n+1)]
for i in range(1,n+1):
factorial[i] = factorial[i-1] * i
ans = []
perm = [0]
used = [False for _ in range(n)]
for i in range(n-1):
possible = []
for j in range(1,n):
if not used[j]:
po... |
class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
start_i = 0
end_i = len(nums) - 1
while start_i <= end_i:
index = (start_i + end_i) // 2
if nums[index] == target:
return index
elif nums[index] > target:... |
##
# IO Events
##
CONNECT = 'connect'
CONNECT_ERROR = 'connect_error'
DISCONNECT = 'disconnect'
###
# Client Events
###
CLIENT_DATA = 'client_data'
REGISTER_PLAYER = 'register_player'
PLAYER_MOVE = 'player_move'
###
# Server Events
###
REQUEST_REGISTER = 'register_player_request'
... |
__appname__ = 'qpropgen'
__version__ = '0.1.0'
__license__ = 'Apache 2.0'
DESCRIPTION = """\
Generate a QML-friendly QObject-based C++ class from a class definition file.
"""
|
class Product:
def __init__(self, name, description, seller, price, availability):
self.name = name
self.description = description
self.seller = seller
self.reviews = []
self.price = price
self.availability = availability
def __str__(self):
return f"Produ... |
class AuthFailed(Exception):
pass
class SearchFailed(Exception):
pass
|
tilt_id = "a495bb30c5b14b44b5121370f02d74de"
tilt_sg_adjust = 0
read_interval = 15
dropbox_token = ""
dropbox_folder = "data"
brewfatherCustomStreamURL = "" |
str = "moam"
str=str.casefold()
#for case sensitive string
str1=reversed(str)
#reversed the string
if list(str)==list(str1):
print("it is palindrome string")
else:
print("It is not palindrome String") |
input = "input1.txt"
depthReadings = []
changes = [] # 1 = increase, 0 = no change, -1 = decrease
with open(input) as f:
for l in f:
depthReadings.append(int(l.strip()))
i = 1
changes.append(0)
while i < len(depthReadings):
if depthReadings[i] < depthReadings[i-1]:
changes.append(-1)
... |
ans = {}
for i in range(10):
n = int(input()) % 42
ans[n] = 1;
print(len(ans)) |
__all__ = ['OptimizelyError', 'BadRequestError', 'UnauthorizedError',
'ForbiddenError', 'NotFoundError', 'TooManyRequestsError',
'ServiceUnavailableError', 'InvalidIDError']
class OptimizelyError(Exception):
""" General exception for all Optimizely Experiments API related issues."""
pass... |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Find Factors Down to Limit
#Problem level: 8 kyu
def factors(integer, limit):
return [x for x in range(limit,(integer//2)+1) if not integer%x] + ([integer] if integer>=limit else [])
|
class SOAPError(Exception):
"""
**Custom SOAP exception**
Custom SOAP exception class.
Raised whenever an error response has been received during action invocation.
"""
def __init__(self, description, code):
self.description = description
self.error = code
class ... |
# File: signalfx_consts.py
# Copyright (c) 2021 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
# Define your constants here
# exception handling
ERR_CODE_MSG = "Error code unavailable"
ERR_MSG_UNAVAILABLE = "Error message unavailable. Please check the asset configuration ... |
# # For loops
# emails = ["email1@email.com", "email2@gmail.com", "email3@email.com"]
#
# for email in emails:
# print(email)
# pass
# # For loops advance
# emails = ["email1@email.com", "email2@gmail.com", "email3@email.com"]
# for email in emails:
# if 'gmail' in email:
# print(email)
# # el... |
# Copyright 2012-2020 James Geboski <jgeboski@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
# to use, copy, modify,... |
#!/usr/bin/python3
fo = open("1/input.txt", "r")
input = []
for line in fo.readlines():
line = line.strip()
input.append(int(line))
def part1():
#init
prev = input[0]
counter = 0
#calc
for line in input[1:]:
if line > prev:
counter += 1
prev = li... |
# -*- coding: utf-8 -*-
def get_autosuggest_url(tag_type, language, geography):
base_url = "https://" + geography + ".openfoodfacts.org"
autosuggest = base_url + "/cgi/suggest.pl?lc=" + language
autosuggest += "&tagtype=" + tag_type
return autosuggest
|
class Metrics:
received_packets: int = 0
sent_packets: int = 0
forward_key_set: int = 0
forward_key_del: int = 0
lost_packet_count: int = 0
out_of_order_count: int = 0
delete_unknown_key_count: int = 0
|
alcohol_cases = None
with open('../static/alcohol_cases.txt', 'r') as f:
alcohol_cases = f.readlines()
smoke_cases = None
with open('../static/smoke_cases.txt', 'r') as f:
smoke_cases = f.readlines()
with open('../static/alcohol_and_cig_cases.txt', 'w') as f:
for i in smoke_cases:
if i in alcohol_... |
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style licence that can be
# found in the LICENSE file.
{
'variables': {
'custom_ld_target%': '',
'custom_ld_host%': '',
},
'conditions': [
['"<(custom_ld_target)"!=""', {
'make_global_settings':... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# version: 1.0.0
# author:Zhang Zhijun
# time: 2021-03-13
# file: errorcode.py
# function:
# modify:
class ResponseCode(object):
"""
成功类错误码:20000000 ~ 20099999
错误类错误码:40000000 ~ 40099999
服务器错误码:50000000 ~ 50099999
通用成功类错误码:20000000
登录注册类错误码:20... |
def mean(data):
"""Return the sample arithmetic mean of data."""
n = len(data)
if n < 1:
raise ValueError('mean requires at least one data point')
return sum(data)/n # in Python 2 use sum(data)/float(n)
def _ss(data):
"""Return sum of square deviations of sequence data."""
c = ... |
class Solution:
"""
@param nums: an array with positive and negative numbers
@param k: an integer
@return: the maximum average
"""
def maxAverage(self, nums, k):
if not nums:
return 0
min_num = min(nums)
max_num = max(nums)
while ... |
def isPalindrome(x):
if x == x[::-1]:
print("A palavra é palíndromo!")
else:
print("A palavra não é palíndromo!")
isPalindrome("arara") |
class Chess:
tag = 0
camp = 0
x = 0
y = 0
|
# Desafio 069 -> Faça um pgr. que leia a idade e o sexo de varias pessoas. a cada pessoa cadastarada
# o programa, o programa deverá perguntar se o usuário quer continuar. no final mostre:
# A) Quantas pessoas tem mais de 18 anos
# B) Quantos homens foram cadastrados
# ... |
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.39
工具: python == 3.7.3
"""
"""
思路:
递归
结果:
执行用时 : 32 ms, 在所有 Python3 提交中击败了99.37%的用户
内存消耗 : 13.8 MB, 在所有 Python3 提交中击败了5.10%的用户
"""
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
... |
def test_even():
for i in range(0, 6):
yield is_even, i
def is_even(i):
assert i % 2 == 0
|
"""
uci_bootcamp_2021/examples/while_loops.py
Demonstrate basic while loop usage
"""
def get_valid_input(
prompt: str, valid_minimum: int = 0, valid_maximum: int = 100
) -> int:
# initialize valid to False.
valid = False
result = -1
# loop while the user hasn't given us a suitable value.
whi... |
#
# PySNMP MIB module HP-SN-MPLS-TE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-SN-MIBS
# Produced by pysmi-0.3.4 at Mon Apr 29 19:23:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 20... |
contacts = {}
while True:
tokens = input()
if 'Over' == tokens:
break
[first_value, second_value] = tokens.split(' : ')
if second_value.isdigit():
contacts[first_value] = second_value
else:
contacts[second_value] = first_value
print(("\n".join([f'{key} -> {value}' for key... |
# Roll no.:
# Registration no.:
# Evaluate fibonacci numbers and calculate the limit of the numbers.
def fibo(n):
"""Returns nth fibonacci number."""
a, b = 0, 1
for i in range(1, n):
a, b = b, a+b
return b
def calc_ratio():
"""Calculates the limit of the ratio of fibonacci numbers correct to 4th decimal place... |
"""
@author: ctralie / IDS 301 Class
Purpose: To show how to dynamically fill in a dictionary
using loops, and also to make sure students
are comfortable with nested dictionaries
(dictionaries that have keys whose values are
themselves dictionaries)
"""
# The main dictionary has th... |
# coding=utf-8
"""
Manages the server computer
"""
|
# Params change with every run of the application and will be changed by the UI
MEASUREMENT_ID = ''
COMMENT = 'preliminary data'
SONDE_NAME = '2015083012lin.txt'
OVL_FILES = ['15083000_607.dat']
POLLY_FILES = ['2015_05_01_Fri_DWD_00_03_31.nc']
|
class LightSupport:
EFFECT = 4
FLASH = 8
TRANSITION = 32
|
def flatten(iterable: list) -> list:
"""
A function that accepts an arbitrarily-deep
nested list-like structure and returns a
flattened structure without any nil/null values.
For Example:
input: [1,[2,3,null,4],[null],5]
output: [1,2,3,4,5]
:param iterable:
:return:
"""... |
# -*- coding: utf-8 -*-
stopwords = [
'a',
'ao',
'aos',
'aquela',
'aquelas',
'aquele',
'aqueles',
'aquilo',
'as',
'até',
'com',
'como',
'da',
'das',
'de',
'dela',
'delas',
'dele',
'deles',
'depois',
'do',
'dos',
'e',
'ela',... |
# -*- coding: utf-8 -*-
"""Basic Grid
description:
content:
- SquareGrid
- GridWithWeights
reference:
1. https://www.redblobgames.com/pathfinding/a-star/implementation.html
author: Shin-Fu (Kelvin) Wu
latest update: 2019/05/10
"""
class SquareGrid(object):
def __init__(self, width, height):
... |
# 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 pruneTree(self, root: TreeNode) -> TreeNode:
if not root:
return None
root.... |
class Node(object):
def __init__(self, data = None):
self.left = None
self.right = None
self.data = data
def setLeft(self, node):
self.left = node
def setRight(self, node):
self.right = node
def getLeft(self):
return self.left
def getRight(self):
... |
"""Should raise SyntaxError: cannot assign to __debug__ in Py 3.8
and assignment to keyword before."""
__debug__ = 1
|
load("//rust:rust_proto_compile.bzl", "rust_proto_compile")
load("//rust:rust_proto_lib.bzl", "rust_proto_lib")
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library")
def rust_proto_library(**kwargs):
# Compile protos
name_pb = kwargs.get("name") + "_pb"
name_lib = kwargs.get("name") + "_lib"
rust... |
message = "Hello charm"
print(message)
# called string methods
print(message.title())
print(message.upper())
print(message.lower())
myint1 = 7
myint2 = 20
print(myint1 + myint2)
myfloat1 = 1.5
myfloat2 = 2.5
print(myfloat1 + myfloat2)
#convert int to str
print("Happy " + str(myint2) + " birthday") |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: the root
@return: the second minimum value in the set made of all the nodes' value in the whole tree
"""
def findSecondMini... |
# Copyright (c) 2015 Joshua Coady
# 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
# to use, copy, modify, merge, publish, distri... |
class RoutingPath:
"""Holds a list of block_ids and has section_id, list_item_id and list_name attributes"""
def __init__(self, block_ids, section_id, list_item_id=None, list_name=None):
self.block_ids = tuple(block_ids)
self.section_id = section_id
self.list_item_id = list_item_id
... |
def iterSects(activeOnly=True):
for sect in sections:
options = {}
if type(sect) is tuple:
sect, options = sect
try:
active = options['active']
except KeyError:
active = True
if active or not activeOnly:
yield ... |
name = "Manish"
age = 30
print("This is hello world!!!")
print(name)
print(float(age))
age = "31"
print(age)
print("this", "is", "cool", "and", "awesome!")
|
def ficha(nome='desconhecido', gols=0 ):
print(f'O jogador {nome} marcou {gols} no campeonato.')
jogador = str(input('Nome do jogador: '))
golos = str(input('Quantos golos marcados: '))
if golos.isnumeric():
golos = int(golos)
else:
golos = 0
if jogador.strip() == '':
ficha(gols=golos)
els... |
try:
x=int(input())
y=int(input())
if(x>y):
print(x)
else :
print(y)
except : # if error occurse then except will work
print("Bokachoda")
else : # else will run if no error occur
print("All Done")
finally : # finally will work if it has error or not
print("D")
# cant use... |
# Copyright 2016 Ifwe Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
#
# PySNMP MIB module CASA-802-TAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CASA-802-TAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:29:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
# Záplava čísel
# Na vstupe získate reťazec obsahujúci iba číslice. Vypíšte na výstup reťazec, ktorý bude obsahovať každú číslicu zo vstupu toľko krát, koľko je hodnota číslice (tj. Dve dvojky, päť pätiek atď ...).
# Sample Input:
# 25104
# Sample Output:
# 225555514444
vstup = input()
for i in vstup:
print(int... |
#
# PySNMP MIB module DOCS-IETF-CABLE-DEVICE-NOTIFICATION-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/DOCS-IETF-CABLE-DEVICE-NOTIFICATION-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:09:52 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python ... |
#
# PySNMP MIB module MY-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MY-VLAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:16:48 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, 0... |
name, age = "ansan p", 18
username = "ansanpsam710*"
print ('Hello!')
print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
|
class Stack:
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
def push(self, data):
self.items.append(data)
def pop(self):
return self.items.pop()
def display(self):
for data in reversed(self.items):
print(data)... |
class BotError(RuntimeError):
def __init__(self, message = "An unexpected error occurred with the bot!"):
self.message = message
class DataError(RuntimeError):
def __init__(self, message = "An unexpected error occurred when accessing/saving data!"):
self.message = message |
print('='*8,'Tinta para Pintar Parede','='*8)
l = float(input('Qual a largura da parede em metros?'))
a = float(input('Qual a altura da parede em metros?'))
a2 = a*l
qt = a2/2
print('''As dimensoes dessa parede sao de {}x{}.
A area desta parede equivale a {} metros quadrados.
Para pinta-la serao necessarios cerca de {}... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 2 10:24:43 2020
@author: roger luo
"""
def fun_add(x, y):
"""add numbers
.. _x-y-z:
Parameters
----------
x : TYPE
DESCRIPTION.
y : TYPE
DESCRIPTION.
Returns
-------
None.
"""
... |
def get_all_files_in_folder(folder, types):
files_grabbed = []
for t in types:
files_grabbed.extend(folder.rglob(t))
files_grabbed = sorted(files_grabbed, key=lambda x: x)
return files_grabbed
def yolo2voc(image_height, image_width, bboxes):
"""
yolo => [xmid, ymid, w, h] (normalized)
... |
# File: terraformcloud_consts.py
# Copyright (c) 2020 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
TERRAFORM_DEFAULT_URL = "https://app.terraform.io"
TERRAFORM_BASE_API_ENDPOINT = "/api/v2"
TERRAFORM_ENDPOINT_WORKSPACES = "/organizations/{organization_name}/workspaces"
T... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 22 21:18:39 2017
@author: maque
the demo code is from the book <Problem solving with algorithms and data
structure >
"""
class Stack:
"""
A stack (sometimes called a “push-down stack”) is an ordered collection of
items where the... |
# This problem was recently asked by Uber:
# Imagine you are building a compiler. Before running any code, the compiler must check that the parentheses in the program are balanced. Every opening bracket must have a corresponding closing bracket. We can approximate this using strings.
# Given a string containing just... |
# result = {"Borough Park" : [[lat1, lon1], [lat2, lon2], ...]}
"""
polygons =
{
"Borough Park" : {Lat : [], Lon : []}
"East Flushing" : {Lat : [], Lon : []}
"Auburndale" : {Lat : [], Lon : []}
.
.
.
"Elmhurst" : {Lat : [], Lon : []}
}
"""
def process_coordinates(result):
"""
A function read the dictionary co... |
fin = open('Assignment-2-data.txt', 'r')
data = fin.readlines()
for n in range(len(data)):
data[n] = data[n].split()
fin.close()
fout = open('Assignment-2-table.txt', 'w')
for n in range(1, 75):
fout.write(str(n) + ' & ' + data[n - 1][0] + ' & ' + data[n - 1][1] + ' & \\includegraphics[width=.3\\columnwidth]{... |
#!/usr/bin/python
# Python built-in function range() generates the integer numbers between the given start integer to the stop integer, i.e., range() returns a range object.
# Using for loop, we can iterate over a sequence of numbers produced by the range() function.
# It only allows integer type numbers as arguments.... |
def test_e1():
x: i32
s: str
x = 0
s = 's'
print(x+s)
|
def func():
print("func")
func() # $ resolved=func
class MyBase:
def base_method(self):
print("base_method", self)
class MyClass(MyBase):
def method1(self):
print("method1", self)
@classmethod
def cls_method(cls):
print("cls_method", cls)
@staticmethod
def stat... |
frase =[]
maiuscula= ''
def maiusculas(frase):
maiuscula= ''
for i in frase:
letra = i
if letra.isalpha():
letra_m = letra.upper()
if letra_m == letra.upper():
if letra == letra_m:
maiuscula += letra
print(maiuscula)
return maiusc... |
inp = """L.LL.LL.LL
LLLLLLL.LL
L.L.L..L..
LLLL.LL.LL
L.LL.LL.LL
L.LLLLL.LL
..L.L.....
LLLLLLLLLL
L.LLLLLL.L
L.LLLLL.LL"""
inp = """LLLLLLLLLL.LLLLLL.LLLLLLLLLLLL.LL.LLLL.LLLLL.LLLLLLL.LLLLLL.LLLLLL.LLLLLL.LLLLLLLLLLLLLLLLLL
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLL.LLLLLLL.LLLLLLLLLLLLL.LLLL.L.LLLLLLLLL... |
'''
Leetcode problem No 859 Buddy Strings
Solution written by Xuqiang Fang on 24 June, 2018
'''
class Solution(object):
def buddyStrings(self, A, B):
if len(A) != len(B):
return False
dica = {}
dicb = {}
c = 0
for i in range(len(A)):
a = A[i]
... |
nin=input()
x=[]
for i in range(len(nin)):
x.append(int(nin[i]))
list_of_numbers=[]
status='qualified'
majority=0
for i in range(len(x)):
status='qualified'
if i==0:
list_of_numbers.append([])
list_of_numbers[i].append(x[i])
else:
for j in range(len(list_of_numbers)):
... |
def index():
images = team_db().select(team_db.image.ALL, orderby=team_db.image.category_id)
categories = team_db().select(team_db.category.ALL, orderby=team_db.category.priority)
return dict(images=images, categories=categories)
def download():
return response.download(request, team_db)
|
# -*- coding: utf-8 -*-
value1 = input()
value2 = input()
prod = value1+value2
print("SOMA = " + str(prod))
|
'''
Por convenção:
- Função é tudo que retorna valor
- Método não retorna valor
'''
class Calculadora:
def __init__(self, num1, num2):
self.valorA = num1
self.valorB = num2
def soma(self):
return self.valorA + self.valorB
def subtracao(self):
return self.valo... |
"""
NAME
binary_search - binary search template
DESCRIPTION
This module implements the many version of binary search.
* bisect binary search the only true occurrence
* bisect_left binary search the left-most occurrence
* bisect_rigth binary search the right-most occurrence
* bisect_fi... |
class Solution:
def minimumSize(self, nums: List[int], maxOperations: int) -> int:
lo, hi = 1, 1_000_000_000
while lo < hi:
mid = lo + hi >> 1
if sum((x-1)//mid for x in nums) <= maxOperations: hi = mid
else: lo = mid + 1
return lo |
class sequenceObjects(object):
"""generate objects for each vertical and horizontal sequences"""
def __init__(self, index, length, sumOfInts, isHorizontal):
self.isFilled = False
self.index = index
self.lengthOfSequence = length
self.sumOfInts = sumOfInts
reverseIndex = reversed(self.inde... |
'''Faça um programa que leia três números e mostre qual é o maior e qual é o menor.'''
n1 = float(input('\033[30mDigite o primeiro número:\033[m '))
n2 = float(input('\033[31mDigite o segundo número:\033[m '))
n3 = float(input('\033[32mDigite o terceiro número:\033[m '))
if n1 > n2 and n1 > n3:
print('\033[33mMaior... |
#!/usr/bin/python
"""
"""
class Vegetable:
"""A vegetable is the main resource for making a great soup.
More seriously, a vegtable represents the basic abstraction of a web page
element. It provides default access operation over such element namely :
* Finding element(s) from tag name using attribut... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author : ilpan
@contact : pna.dev@outlook.com
@file : __init__.py.py
@desc :
@time : 18-3-16 上午11:15
"""
__description__ = "genlog: a tool that can randomly generate logs and send them to specified host:port"
__version__ = '1.0.2.1'
__author__ = 'ilpan'
__... |
# simple result class
class SerfResult(object):
"""
Result object for responses from a Serf agent.
"""
def __init__(self, head=None, body=None):
self.head, self.body = head, body
def __iter__(self):
"""
Iterator.
Used for assignment, i.e.::
head, bod... |
BINDIR = '/usr/local/bin'
BLOCK_MESSAGE_KEYS = []
BUILD_TYPE = 'app'
BUNDLE_NAME = 'pebble.pbw'
DEFINES = ['RELEASE']
LIBDIR = '/usr/local/lib'
LIB_DIR = 'node_modules'
LIB_JSON = []
MESSAGE_KEYS = {}
MESSAGE_KEYS_HEADER = '/mnt/files/scripts/pebble/pebble-navigation/pebble/build/include/message_keys.auto.h'
NODE_PATH ... |
'''
crie uma funcao1 que receba uma funcao2 como parametro e reotrne o valorda
funcao2 executada, faça a funcao1 executar duas funcoes que recebam um numero
diferente de argumentos
'''
def mestre(funcao, *args, **kwargs):
return funcao(*args, **kwargs)
def fala_oi(nome):
return f'oi {nome}'
def saudacao(nome... |
CONF = {
"git_bash" : {
"name": "Git BRanch on bash prompt",
"commands": """
# ref: https://coderwall.com/p/fasnya/add-git-branch-name-to-bash-prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="[\$(date +%k:%M:%S)] \\u@\h \[\033[3... |
"""
Stores a Boolean indicating if the app should run in debug mode or not.
This option can be set with -d or --debug on start.
"""
debug = False
"""
Variable storing a reference to the container backend implementation the API should use.
This option can be set with --container-backend CONTAINER_BACKEND on start.
"... |
# faça um programa que refaça o 051 lendo o primeiro termo e a razão de uma PA,
# mostrando os 10 primeiros termos da progressão usando a estrutura while
#decimo = n + (10 - 1) * r
n = int(input('Digite o primeiro termo: '))
r = int(input('Digite a razão: '))
decimo = 0
while decimo != 10:
print(n, end=' ')
n =... |
test = dict(
batch_size=8,
num_workers=2,
eval_func="default_test",
clip_range=None,
tta=dict( # based on the ttach lib
enable=False,
reducation="mean", # 'mean', 'gmean', 'sum', 'max', 'min', 'tsharpen'
cfg=dict(
HorizontalFlip=dict(),
VerticalFlip=... |
# Latihan menampilkan deret fibonacci dengan fungsi rekursif
def fibonacci(n):
if n == 0 or n == 1:
return n
else:
return (fibonacci(n-1) + fibonacci(n-2))
input_nilai = 6
for i in range(input_nilai):
print(fibonacci(i), end=' ') |
"""
34. Find First and Last Position of Element in Sorted Array
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.
If target is not found in the array, return [-1, -1].
Follow up: Could you write an algorithm with O(log n) runtime complexity?
... |
# Auth Constants
TOKEN_HEADER = {"alg": "RS256", "typ": "JWT", "kid": "flask-jwt-oidc-test-client"}
BASE_AUTH_CLAIMS = {
"iss": "test_issuer",
"sub": "43e6a245-0bf7-4ccf-9bd0-e7fb85fd18cc",
"aud": "test_audience",
"exp": 21531718745,
"iat": 1531718745,
"jti": "flask-jwt-oidc-test-support",
... |
# Works from Zero til One Thousand!
def InWords(num):
# We must define all unique numbers
TillFifteen = {0: "zero", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight",
9: "nine", 10: "ten", 11: "eleven", 12: "twelve", 13: "thirteen", 15: "fifteen"}
# Mul... |
#
# PySNMP MIB module MBG-SNMP-LT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MBG-SNMP-LT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:00:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
"""
* Assignment: OOP Method Syntax
* Required: yes
* Complexity: easy
* Lines of code: 3 lines
* Time: 3 min
English:
1. Define class `Calculator`
2. Define method `add` in class `Calculator`
3. Method `add` take `a` and `b` as arguments
4. Method returns sum of `a` and `b`
5. Run doctests - all m... |
"""A generate file containing all source files used to produce `cargo-bazel`"""
# Each source file is tracked as a target so the `cargo_bootstrap_repository`
# rule will know to automatically rebuild if any of the sources changed.
CARGO_BAZEL_SRCS = [
"@rules_rust//crate_universe:src/cli.rs",
"@rules_rust//cra... |
"""
File: boggle.py
Name:Jacky
----------------------------------------
This program lets user to input alphabets which arrange on square.
And this program will print words which combined on the neighbor alphabets.
"""
# This is the file name of the dictionary txt file
# we will be checking if a word exists by searchi... |
class Request(dict):
def __init__(self, server_port=None, server_name=None, remote_addr=None,
uri=None, query_string=None, script_name=None, scheme=None,
method=None, headers={}, body=None):
super().__init__({
"server_port": server_port,
"server_nam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.