content stringlengths 7 1.05M |
|---|
# Copyright 2018 Xanadu Quantum Technologies 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 agre... |
'''
There are a total of n courses you have to take, labeled from 0 to n-1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish all co... |
def validate_password_for_count(input_string):
rng_string, letter, password = input_string.split(' ')
letter = letter[:-1]
least, most = rng_string.split('-')
count = password.count(letter)
if int(least) <= count <= int(most):
return True
else:
return False
def validate_password... |
"""
"""
def get_remote_address(request):
"""
:param: request: request object of sanic
:return: the ip address of given request (or 127.0.0.1 if none found)
"""
# Check if request object has remote_addr attribute set
# Seems to break on sanic 19.6.3
if hasattr(request, 'remote_addr'):
... |
def generate_attributes(num_replications, num_global_memory_banks=32):
"""
Generates the kernel attributes for the global memory. They specify in which
global memory the buffer is located. The buffers will be placed using a
round robin scheme using the available global memory banks and the number of
... |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class UploadJARRequest(object):
"""Implementation of the 'Upload JAR Request.' model.
UploadMRJarViewPathWrapper contains jar name and local mount path where
the
Jars will be uploaded.
Attributes:
jar_name (string): JarName is the n... |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def audioFile():
http_archive(
name="AudioFile" ,
build_file="//bazel/deps/AudioFile:build.BUILD" ,
sha256="aa893a... |
#!/usr/bin/env python3
# Self powers
#Problem 48
#The series, 11 + 22 + 33 + ... + 1010 = 10405071317.
#Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000
result = 0
for num in range(1,1001):
result+= num**num
print(result % 10000000000)
# 9110846700 YAY
|
class Persona():
def __init__(self, edad, nombre, sexo, nivel):
self.edad = edad
self.nombre = nombre
self.sexo = sexo
self.nivel = nivel
def imprimir(self):
print(self.edad // self.nivel)
def nombrar(self):
if self.nombre == "Jesus":
print("Nad... |
ON_KAGGLE = False
ON_SERVER = True
DATA_ROOT = '/kaggle/input/3d-object-detection-for-autonomous-vehicles/' if ON_KAGGLE else '../input/'
DATA_DIR = '../../input/'
OUTPUT_ROOT = "../../../output/"
PROJECT_ROOT = "/home/tanya/lyft/progs/kaggle-lyft" if ON_SERVER else 'C:/Users/New/Documents/Challenges/lyft/progs'... |
# In and is conditional
# Is
a = None
if a is None:
print("yes")
else:
print("No")
# In
a = [45,65,6]
print(45 in a) #The Result is True
print(46 in a) #The Result is false |
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2018 all rights reserved
#
# declaration
class InfoZip:
"""
Mixin that knows how to pull information from {stat} structures
"""
# meta methods
def __init__(self, info, **kwds):
# chain up
super().__init__(**k... |
"""
This package contains various types of character controllers, handling basic
control mechanics and setting up collisions for them.
"""
|
class Header:
"""
3.2.1 Header
Transport headers for a message.
<type name="header" class="composite" source="list" provides="section">
<descriptor name="amqp:header:list" code="0x00000000:0x00000070"/>
<field name="durable" type="boolean" default="false"/>
<field name="priority... |
"""
A. As seen in the much yellower RSMs of the SimCLR encoder trained with only
2 negative pairs used in the contrastive loss, reducing the number of
negative pairs leads to a **substantial increase in the density of high
feature similarity values** (near 1). This is quantified in the histogram,
which sho... |
_base_ = [
'../../_base_/datasets/mmcls/cifar10_bs96_cutout.py',
'../../_base_/mmcls_runtime.py'
]
model = dict(
type='mmcls.ImageClassifier',
backbone=dict(
type='DartsBackbone',
in_channels=3,
base_channels=36,
num_layers=20,
num_nodes=4,
stem_multiplie... |
x = 15 / 100
y = 949
z = x * y
print(z) |
class characters():
def __init__(self,Id,Nombre,Status,Species,Tipo,Origen,Location,Id_locacion,Episode,Id_episodio,Url):
self._Id = Id
self._Nombre = Nombre
self._Status = Status
self._Species = Species
self._Origen = Origen
self._Tipo = Tipo
self._Locat... |
def all_equal(t):
"""
True if all elements in a table are equal.
"""
return not t[0] == ' ' and t[1:] == t[:-1]
def list_not_all_none(lst):
for el in lst:
if el is not None:
return True
return False
|
l = [1,2,3]
def oi(x):
return x == 2
a= list(filter(oi,l))
print(a) |
"""
This file is part of web2py Web Framework (Copyrighted, 2007)
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: GPL v2
"""
class Storage(dict):
"""
A Storage object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`.
>>> o = Storage(a=1)
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module contains project version information.
.. currentmodule:: howmanychairs.version
.. moduleauthor:: Clemens Jochum <clemens@jochum.email>
"""
__version__ = "0.0.1" #: the working version
__release__ = "0.0.1" #: the release version
|
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
pre = ""
if not strs:
return pre
for i in range(len(strs[0])):
pre = strs[0][:i + 1]
for j in range(1, len(strs)):
... |
class GeneratorInterface:
def __init__(self):
self.__params = {}
def register(self, name, type_, default):
if name in self.__params:
raise ValueError(f"param {name} already registered")
self.__params[name] = (type_, default,)
return self
@property
def params... |
n = int(input())
ls = list(map(int, input().split()))
ls.sort(reverse=True)
alice_point = 0
bob_point = 0
for i in range(n):
if i % 2 == 0:
alice_point += ls[i]
else:
bob_point += ls[i]
difference = alice_point - bob_point
print(difference)
|
# no completion must happen here
class Foo:
def bar(self):
__rxo
|
"""Humilis plug-in to deploy an AWS API Gateway proxy to AWS Kinesis."""
__version__ = "1.3.0"
__author__ = "German Gomez-Herrero, FindHotel BV"
|
l = float(input('\033[2;43;2mDigite a largura da parede: \033[m'))
a = float(input('Digite a altura da parede: '))
area = (l*a)
print('Sua parede tem a dimensão de {}x{} e sua área é de {:.2f}m²'.format(l,a,area))
print('Para pintar essa parede você precisará de {:.2f} litros de tinta.'.format((area/2))) |
"""
LC 76
Given a string and a pattern, find the smallest substring in the given string which has all the characters of the given pattern.
Example 1:
Input: String="aabdec", Pattern="abc"
Output: "abdec"
Explanation: The smallest substring having all characters of the pattern is "abdec"
Example 2:
Input: String="abd... |
"""
Data Mapper class.
"""
class DataMapperValue:
"""
Data Mapper Value.
"""
def __init__(self, param: str, default='', parser=None):
"""
Construct Data Mapper Value.
"""
self.param = param
self.default = default
self._parser = parser
def parsed(sel... |
# pop_pais = [1,3,5,4]
# pop_pais = sorted(pop_pais, reverse=True)
# print(pop_pais)
#
# pop_pais = pop_pais[:2]
# print(pop_pais)
# teste mutacao
# individuo_aux = 'abcd'
# individuo_aux = list(individuo_aux)
# print(individuo_aux)
# i_gene = 0
# individuo_aux[i_gene] = 'teste'
# print(individuo_aux)
# individuo_aux ... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache... |
class Solution:
def countTriples(self, n):
# precompute all powers from
pows = [x ** 2 for x in range(n)]
count = 0
for i in range(3, n - 1):
si = pows[i]
for j in range(i+1, n):
# c must be integer (perfect square)
m = sqrt(si ... |
# https://leetcode.com/problems/range-sum-query-immutable/
class NumArray(object):
# Runtime: 81 ms, faster than 70.94% of Python online submissions for Range Sum Query - Immutable.
# Memory Usage: 17.2 MB, less than 52.30% of Python online submissions for Range Sum Query - Immutable.
def __init__(se... |
nested1 = [['a', 'b', 'c'],['d', 'e'],['f', 'g', 'h']]
for x in nested1:
print("level1: ")
for y in x:
print(" level2: " + y)
print("\n")
nested2 = [1, 2, ['a', 'b', 'c'],['d', 'e'],['f', 'g', 'h']]
for x in nested2:
print("level1: ")
if type(x) is list:
for y in x:
pri... |
# 10
# 100~~01 100~~\ 100~~\ 000~0\ 0000 / 000~0001 _100__
# d000 001 d000 1000 000 0000/ 000 0000 000
# 0000__000 0000 0000 000 00/ 000 0000 000
# 1000 , 1000 1000 000 0 000 0000 000
# "00___/ "00__/ 100__/ ... |
def eh_mes_do_aniversario(mes):
if(mes == 11):
return "É o mês do aniversário do criador do exemplo!"
return "Não é o mês que eu queria :("
def eh_dia_do_aniversario(dia):
if(dia == 1):
return "É o dia do aniversário do criador do exemplo!"
return "Não é o dia que eu queria :(... |
def SSN():
ssndict = {}
while(True):
sname = input('Name: ')
# if no name entered print list and end.
if sname == '':
for key in ssndict:
print(key + ' has SSN ' + ssndict[key])
return
elif sname not in ssndict:
ssn ... |
def findZeroSum(arr):
length = len(arr)
if length < 3:
return []
elif length == 3:
if arr[0] + arr[1] + arr[2] == 0:
return [",".join([str(s) for s in arr])]
else:
return []
arr.sort()
results = []
for i, num in enumerate(arr[:-2]):
if i >... |
class ItemContainerTemplateSelector(object):
# no doc
def SelectTemplate(self,item,parentItemsControl):
""" SelectTemplate(self: ItemContainerTemplateSelector,item: object,parentItemsControl: ItemsControl) -> DataTemplate """
pass
|
# Maximum Depth of Binary Tree
'''
Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
Example 1:
Input: root = [3,9,20,null,null,15,7]
Output: 3
Example 2:
Input: root = [1,nul... |
A = int(input())
B = int(input())
print(A // B)
print(A / B)
|
"""
Definition of SegmentTreeNode:
class SegmentTreeNode:
def __init__(self, start, end, max):
self.start, self.end, self.max = start, end, max
self.left, self.right = None, None
"""
# Version 1
class Solution:
"""
@param root: The root of segment tree.
@param start: start v... |
WINDOW_SIZE = 10000
KMER_SIZE = 6
UPPER_THRESHOLD = 0.85
LOWER_THRESHOLD = 0.50
TUNE_METRIC = 1000
MINIMUM_GI_SIZE = 10000
|
# -*- coding: utf-8 -*-
__author__ = 'yshao'
def _truncate_seq_pair(tokens_a, tokens_b, max_length):
"""Truncates a sequence pair in place to the maximum length."""
# This is a simple heuristic which will always truncate the longer sequence
# one token at a time. This makes more sense than trunca... |
'''
A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. Note that the path does not need to pass through the root.
The path sum of a path is the sum of the node's values in the path.
Given th... |
S = input().strip()
L = len(S)
vowels = 'AEIOU'
score_vowels = 0
score_consonants = 0
for i in range(L):
# total sub strings which begin at this index
# As start position is fixed, only count each possibility of length.
total = L - i
if S[i] in vowels:
score_vowels = score_vowels + total
... |
"""Realizr una programa para crear la clase Calcular, ingresa los atributos
necesarios. Utilice el método constructor. Agregaremos el soporte
adecuado para operaciones matemáticas del atributo utilizando la
sobrecarga de operadores.
Realizar la sobrecarga de operadores de multiplicación, resta,
divisi... |
#! /usr/bin/env python3
# __author__ = "Praneesh Kataru"
# __credits__ = []
# __version__ = "0.1.1"
# __maintainer__ = "Praneesh Kataru"
# __email__ = "pranuvitmsse05@gmail.com"
# __status__ = "Prototype"
class UserTopicManager:
def __init__(self):
self.__topic_users_dict = dict()
... |
numbers =[7,-3,20]
def bits_war(numbers):
odd, even = "", ""
for i in numbers:
if i%2 == 1:
odd += bin(i)[2:]
else:
even += bin(i)[2:]
if int(odd, 2) > int(even, 2):
return "odds win"
elif int(even, 2) > int(odd, 2):
return "even win"
else:
... |
class Entity(object):
def __init__(self, id):
self._id = id
def __eq__(self, other):
return self.id == other.id
def __ne__(self, other):
return not self == other
@property
def id(self):
return self._id
|
class Solution:
def finalPrices(self, prices: List[int]) -> List[int]:
result = []
for i in range(len(prices) - 1):
dp = prices[i]
change = False
for j in range(i+1, len(prices)):
if (prices[i] - prices[j] >= 0) & (change == False):
... |
def main():
id = 123
print('foo', id)
main()
|
str=str(input("Enter string to check Palindrome or not :"))
rev_str=reversed(str)
if list(str)==list(rev_str):
print("Palindrome")
else:
print("Not Palindrome")
|
#
# PySNMP MIB module TUBS-NFS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TUBS-NFS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:20:38 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,... |
# fixtures.py
# Author: Thomas MINIER - MIT License 2017-2019
def index_scan_fixtures():
"""Get fixtures data for testing Index scans"""
return [
# spo
(
'http://db.uwaterloo.ca/~galuc/wsdbm/City102',
'http://www.geonames.org/ontology#parentCountry',
'http:/... |
DEFAULT_CHECK_COMMAND = "which"
WINDOWS_CHECK_COMMAND = "where"
TESSERACT_DATA_PATH_VAR = 'TESSDATA_PREFIX'
VALID_IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".gif", ".png", ".tga", ".tif", ".bmp"]
|
# Autogenerated config.py
# Documentation:
# qute://help/configuring.html
# qute://help/settings.html
# Uncomment this to still load settings configured via autoconfig.yml
config.load_autoconfig()
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'file://*')
# Enable JavaScript.
# ... |
for _ in range(int(input())):
s = sorted(input())
print(("no", "yes")[len(s) == len(set(s)) == (1 + ord(s[-1]) - ord(s[0]))])
|
class AbstractException(Exception):
"""Abstract exception to inherit from.
**Attributes**
:msg: Exception message. [str]
:desc: Exception description. [str]
"""
def __init__(self, msg, desc=None):
"""Constructor for 'AbstractException' exception.
**Args**
:... |
prsnt_world_map = 0
prsnt_all_items = 1
prsnt_killcount = 2
prsnt_upgrade_troops = 3
prsnt_mini_map = 4
prsnt_game_credits = 5
prsnt_game_profile_banner_selection = 6
prsnt_game_custom_battle_designer = 7
prsnt_game_multiplayer_admin_panel = 8
prsnt_multiplayer_welcome_message = 9
prsnt_multiplayer_team_select = 10
prs... |
string = str(input("Enter the string:"))
L = len(string)
for i in range(L, 0, -1):
for j in range(L):
if string[i] == string[j]:
print("Palindrome.")
else:
print("Not Palindrome.")
|
# You must configure these 3 values from Google APIs console
# https://code.google.com/apis/console
GOOGLE_CLIENT_ID = ""
GOOGLE_CLIENT_SECRET = ""
# the local path for the redirect URL you set in the APIs Console
GOOGLE_REDIRECT_URI = "/oauth2callback"
# Restrict logins to users from this GApps domain
GOOGLE_DOMAIN_CH... |
def datos_prueba_DP(request):
p21=Generadores(central=p1,codigo="C0848A",marca="ELIM",modelo="NA",cararcteristicas="U1",fecha_ingreso=date)
p21.save()
#ELIM U1
#2018
date=datetime.datetime(2018,1,11,16,58)
p31=Mediciones(central=p1,generador=p21,codigo_usuario="7807004",
#frecue... |
DEFAULT_OUTPUT_FORMAT = 'msi'
class WindowsMixin:
platform = 'windows'
|
largest = -1
smallest = None
largest=int(largest)
while True:
num = input("Enter a number: ")
if num == "done" : break
try:
n=int(num)
except:
print('Invalid input')
continue
if n > largest :
largest=n
if smallest is None :
smallest=n
elif n<smallest :... |
"""Meta and miscellaneous rules."""
load("@bazel_skylib//rules:build_test.bzl", _build_test = "build_test")
load("@bazel_skylib//:bzl_library.bzl", _bzl_library = "bzl_library")
build_test = _build_test
bzl_library = _bzl_library
more_shards = 4
most_shards = 8
version = "//tools/bazeldefs:version"
def short_path(pa... |
"""Package for processing Timeline project files.
Modules:
tl_file -- Provide a class for Timeline project file representation.
scene_event -- Provide a class for Timeline scene event representation.
dt_helper -- Provide helper functions for date/time processing.
tl_converter -- Provide a converter class for y... |
# -*- coding: utf-8 -*-
# (c) 2008-2010, Marcin Kasperski
"""
Embedded-id trick handling. See Topic.get_embedded_id for description
"""
PFX_EMBEDDED = "afaf"
PFX_OTHER = "bfbf"
PFX_LEN = 4
def qualify_id(id_text):
"""
Check given id_text for embedded id. Returns it if present,
otherwise ret... |
"""
entradas:
ValorA-->int-->A
ValorB-->int-->B
ValorC-->int-->C
ValorD-->int-->D
Salidas:
valor-->str->v
"""
datos = input("Ingresar las variables A,B,C D: ").split()
a, b, c, d = datos
a = int(a)
b = int(b)
c = int(c)
d = int(d)
p = a * 1000
s = b*100
t = c*10
c = d*1
den = p+s+t+c
v = round(den, -2)
print("El valor ... |
#
# @lc app=leetcode id=722 lang=python3
#
# [722] Remove Comments
#
# @lc code=start
class Solution(object):
def removeComments(self, source):
"""
:type source: List[str]
:rtype: List[str]
"""
res, buffer, block_comment_open = [], '', False
for line in source:
... |
# Copyright 2015 IBM Corp.
#
# 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 a... |
# 1. Recrie a classe Carro e adicione um novo atributo e um novo método (função).
class Carro():
def __init__(self, litros, velocidade = 0, buzina = 'BIBI!!'):
self.litros = litros
self.velocidade = velocidade
self.buzina = buzina
def aciona_buzina(self, litros = 20):
print(sel... |
# Universal class for Place instances in Helsinki API
class Place:
def __init__(self, name='', address='', desc='', lat=0.0, lon=0.0, link=None, img_link=None):
self.name = name
self.address = address
self.desc = desc
self.lat = lat
self.lon = lon
self.open_hours = [... |
#----------------------------------------------------------------------------
# Copyright (c) Kauai Labs 2015. All Rights Reserved.
#
# Created in support of Team 2465 (Kauaibots). Go Purple Wave!
#
# Open Source Software - may be modified and shared by FRC teams. Any
# modifications to this code must be accompanied b... |
#
# PySNMP MIB module Unisphere-Data-ROUTER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-ROUTER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:30:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... |
#!/usr/bin/env python3
#https://codeforces.com/problemset/problem/166/E
#是一个对角为0的矩阵的快速幂,用线性的递推更快!?还是用log的矩阵快速幂更快?
#矩阵可以从4x4[0 1 1 1;1 0 1 1;..]简化到2x2[0 3;1 2]
def linear_solution(n):
dd,do = 1,0
for i in range(n):
t = do*3
do = (do<<1)+dd
dd = t
return dd
matrix_mult = lambda A,... |
def foo():
"""
Docstring for the function
:return: int
"""
print(42)
return 42
print(42)
res = 42 |
cookies_pool = [
"JSESSIONID=36B4E30CDFE059235541CC81C91743A3; bili_jct=520c3f01daf4d9732fdeb9d95586612c; SESSDATA=4b484445%2C1616518159%2Ca3c73*91; DedeUserID=416679427; sid=7r9xx2ji; buvid3=CDCFA651-49CB-4A84-B114-D107F6AD0B2E138364infoc; DedeUserID__ckMd5=a64ed305aa816673; _uuid=A60FD75F-122D-851F-7994-2DD115831... |
# encoding: utf-8
# module Autodesk.Revit.DB.Macros calls itself Macros
# from RevitAPI, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class AddInIdAttribute(Attribute, _Attribute):
"""
The custom AddInId attribute for ... |
dice_progression = ["d4", "d6", "d8", "d10", "d12"]
def display_dice(val):
"""
Converts a die-level into a more friendly dice-pool
:param int val: The die-level to display
:return str: pretty-printed dice value (eg: d4)
"""
d = ""
while val > 5:
val -= 5
d += "d12 "
if ... |
##Exercicio 7
def real():
dolar = float(input('Digite o valor em dolar:'))
real = 3.72
return(dolar * real)
print('Conversão de dolar para real=',real())
|
# 609.两数之和 / Two Sum - Less than or equal to target
# http://www.lintcode.com/zh-cn/problem/two-sum-less-than-or-equal-to-target/
# Given an array of integers, find how many pairs in the array such that their sum is less than or equal to a specific target number. Please return the number of pairs.
# 样例
# Given nums =... |
NUM_EPOCHS = 12
BATCH_SIZE = 64
LEARNING_RATE = 0.001
N_PIXEL = 784 # 28x28 |
def profile(request):
"""
This context processor adds a user's userprofile to the context if a user
is logged in.
"""
#This context processor is used by the RequestContext, see the settings.py
# TEMPLATE_CONTEXT_PROCESSORS variable for the other context processors.
if request.user.is_authe... |
""" Python module for the grid and a position in a grid """
class Grid(object):
""" This grid represents a rectangular plateau """
def __init__(self, max_x, max_y):
""" Initialize rover """
if type(max_x) != int:
raise ValueError(u'Max coordinate for X axis is not a number ')
... |
class ConsoleLogger:
def __init__(self, config):
self.interval = config['logging_interval']
def output(self, timestep, message):
if (timestep % self.interval) == 0:
print(message)
|
def result_calculator(data, multiplier):
impact = {}
# number of infected people in days from now
reported_cases = data.get('reportedCases')
impact['currentlyInfected'] = reported_cases * multiplier
total_number_of_days = data['timeToElapse']
periods_multplier = {'weeks': 7, 'months': 30}
... |
""" Project Storehouse """
class Equipment:
def __init__(self, name, count):
self.name = name
self.count = count
class Printer(Equipment):
def __init__(self, name, count, type_, model):
super.__init__(name, count)
self.type_ = type_
self.model = model
class Scanner(... |
# Lecture du contenu du md
def lecture(fichier): # fichier = pathlib
'''
Cette fonction permet de lire le fichier markdon passé en paramètre.
Elle renvoie un liste des lignes contenues dans ce fichier.
'''
lignes = list()
with fichier.open() as f:
contenu = f.read()
list_lignes... |
"""Parsers for TBGScraper."""
__all__="lxml html".split() # Laziology
# IDEA: a HTML parser via regex?
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Yu Zhou
# ****************
# 155. Min Stack
# Time: O(1)
# Space: O(n) using extra stack
# Descrption:
# Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
#
# push(x) -- Push element x onto stack.
# pop() -- Removes ... |
features_all = [ #Gender
#'GENDER',
# Education
'PRESENT STATE 13-46: (016) AGE LEFT SCHOOL',
'MOCA: YEARS OF EDUCATION',
'PRESENT STATE 13-46: (017) YEARS IN FU... |
# from https://github.com/allenai/hidden-networks
USABLE_TYPES = set([float, int])
def trim_preceding_hyphens(st):
i = 0
while st[i] == "-":
i += 1
return st[i:]
def arg_to_varname(st: str):
st = trim_preceding_hyphens(st)
st = st.replace("-", "_")
return st.split("=")[0]
def ar... |
def align():
'''Align selected bones to the active bone (or to their parent)
'''
pass
def armature_layers(
layers=(False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False,
False, False, False, F... |
# Demo Python Dictionaries - Dictionary
'''
Loop Through a Dictionary
You can loop through a dictionary by using a for loop.
When looping through a dictionary, the return value are the keys of the dictionary, but there are methods to return the values as well.
'''
# Print all key names in the dictionary, one by one... |
N,K=map(int,input().split())
H=list(map(int,input().split()))
count=0
for h in H:
if h>=K:
count+=1
print(count) |
def main():
print("\nDecimal to Roman numeral converter")
numbers = input("Number to convert: ")
numerals = {
0 : "I", # 1
1 : "V", # 5
2 : "X", # 10
3 : "L", # 50
4 : "C", # 100
5 : "D", # 500
6 : "M" # 1000
}
answer = ""
numeralpointer =... |
API_FACE_UUID = "uuid"
API_FACE_USE_MODEL = "model" # for future which model to use
API_FACE_NAME = "name"
API_FACE_ENCODINGS = "encodings"
API_FACE_UNCATEGORIZED_IMAGE = "uncategorized_image"
API_FACE_CHECK_ALL = "check_all"
API_FACE_GALLERY = "gallery"
API_FACE_GALLERIES = "galleries"
API_FACE_TOLERANCE = "tolerance... |
#!/usr/bin/env python
# # -*- coding: utf-8 -*-
"""
Utilities
"""
__copyright__ = 'Copyright (C) 2014-2015 by E.R. Uber'
__author__ = 'E.R. Uber (eruber@gmail.com)'
__license__ = 'ISCL'
__version__ = '0.0.0'
#-------------------------------------------------------------------------------
#-------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.