content stringlengths 7 1.05M |
|---|
class ServiceManager() :
"""
1. definition
2. table
"""
def get_view_obj(self):
"""
get view data for net config
:return:
"""
pass
def set_view_obj(self, obj):
"""
set net config data edited on view
:param obj:
:return:
... |
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"action_config",
"feature",
"flag_group",
"flag_set",
"tool",
"tool_path",
"with_feature_set",
)
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
def _impl(ctx):
if (ctx.attr.cpu == "k8" and ctx.a... |
for i in range(plan_arguments['RUN_NUM']):
############################################# CC #############################################
add_test(name='cc_feature_rtest',
tags=['L10', 'cc'],
args=[' -rtlarg +uvm_set_config_int=uvm_test_top,layers,%d ' % plan_arguments['LAYER_NUM'], ge... |
'''Example test script.
Basic checks of device before processed
Input Variables:
args - arguments dictionary given to demo tester that may be used to
changed nature of test.
dev - Example device under test
name - Name of test being run.
results - Results map of all tests.
Test Specifi... |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 4 20:13:02 2018
@author: User
"""
def checkit(s1, s2):
for i in s1:
for j in s2:
if i == j:
s1 = s1[1:]
s2 = s2[1:]
print(i,j, s1, s2)
if len(s1) >=1 and len(s2) ==0:
... |
# 3-9. Dinner Guests: Working with one of the programs from Exercises 3-4 through 3-7 (page 46),
# use len() to print a message indicating the number of people you are inviting to dinner.
guests = ['Antonio', 'Emanuel', 'Francisco']
message = "1.- Hello dear uncle " + guests[0] + ", I hope you can come this 16th for ... |
#https://adventofcode.com/2021/day/1
input2="""131
140
136
135
155
175
178
186
187
189
194
195
203
193
178
179
180
188
204
214
215
252
253
261
281
294
293
299
300
301
307
333
324
322
323
335
319
312
313
312
320
323
324
336
341
347
357
358
363
357
334
348
364
365
367
370
369
373
344
328
330
327
339
340
341
335
342
347... |
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
class TierFulfillmentMessages(object):
RROR_PROCESSING_TIER_REQUEST = 'There has been an error processing the tier config request. Error description: {}'
class BasePurchaseMessages:
pass
class BaseChangeMessages:
pass
class BaseSuspendMessages:
NOTHING_TO_DO = 'Suspend method for request {} - Nothi... |
#! /usr/bin/python
# -*- coding: iso-8859-15 -*-
n = int(input("Ingrese la cantidad de datos: "))
suma = 0
for i in range(n):
x = float(input("Ingrese el dato: "))
suma = suma + x
prom = suma / n
print("El promedio es: " ,prom) |
"""
.. module:: djstripe.management.
:synopsis: dj-stripe - management module, contains commands.
"""
|
N = int(input())
AS = [int(x) for x in input().split()]
ok = []
for i in range(N):
for j in range(N):
if i == j:
continue
if AS[i] % AS[j] == 0:
break
else:
ok.append(i)
print(len(ok))
|
class Point:
def __init__(self, x: int, y: int):
self.x = x
self.y = y
def getX(self) -> int:
return self.x
def getY(self) -> int:
return self.y
def setX(self, x: int) -> None:
self.x = x
def setY(self, y: int) -> None:
self.y = y
|
#!/usr/bin/env python3
usb_codes = {
0x04:"aA", 0x05:"bB", 0x06:"cC", 0x07:"dD", 0x08:"eE", 0x09:"fF",
0x0A:"gG", 0x0B:"hH", 0x0C:"iI", 0x0D:"jJ", 0x0E:"kK", 0x0F:"lL",
0x10:"mM", 0x11:"nN", 0x12:"oO", 0x13:"pP", 0x14:"qQ", 0x15:"rR",
0x16:"sS", 0x17:"tT", 0x18:"uU", 0x19:"vV", 0x1A:"wW", 0x1B:"xX",
0x1... |
# original problems
def easy_sum(a, b):
"""Takes two numbers and returns their sum"""
return a + b
def easy_product(a, b):
"""Takes two numbers and returns their product"""
return a * b
def easy_concat(a, b):
"""Takes two strings and returns their concatenation"""
return a + b
def easy_empty... |
"""
Function analysis module which sets function APIs based
on function's name matching impapi. This should ideally go
early in the module order to get the APIs marked asap.
"""
def analyzeFunction(vw, fva):
fname = vw.getName(fva)
api = vw.getImpApi(fname)
if api == None:
return
rettype,retna... |
class Solution:
def solve(self, matrix, target):
for r in range(len(matrix)):
for c in range(len(matrix[0])):
if r-1 >= 0: matrix[r][c] += matrix[r-1][c]
if c-1 >= 0: matrix[r][c] += matrix[r][c-1]
if r-1 >= 0 and c-1 >= 0: matrix[r][c] -= matrix[r... |
"""
File: settings.py
Author: Luke Mason
Description: Main application development settings file
"""
SCREEN_WIDTH = 1920
SCREEN_HEIGHT = 1080
WIDTH = 800
HEIGHT = 900
PAD = 15
APP_NAME = 'PyGraph' # Str of app name for window title
DEBUG = 1 # Puts the app in debug mode (extra logging to console).
LOG = 1 # Puts... |
'''Escreva um programa que leia dois numeros inteiros e compare-os, mostrando na tela uma
mensagem:
-0 primeiro valor é maior.
-0 segundo valor é maior.
-Não existe valor maior, os dois são iguais.'''
numero1 = int(input('Primeiro número: '))
numero2 = int(input('Segundo número: '))
if numero1 > numero2:
print('O p... |
__all__ = [
'cyclic',
'dep_expander',
'dep_manager',
'logger',
'package_filter',
'package',
'parse_input',
'sat_solver_satispy',
'topo_packages',
'util'
] |
#Aleyna Nur Kemik tarafından yazılmıştır.
print("""**********************
RSA Şifreleme
**********************""")
def aralarında_asal(n,fi):
if (n % fi != 0 and n % fi != 0 ):
print("{} ile {} aralarında asaldır." .format(n,fi))
return True
else:
return False... |
i = 1
while i != 0:
i = int(input())
if i > 100:
break
elif i < 10:
continue
else:
print(i)
|
n = int(input())
for i in range(n):
dias = 0
valor = float(input())
while valor>1:
valor = valor/2
dias += 1
print(dias, "dias") |
# -*- coding: utf-8 -*-
"""
plastiqpublicapi
This file was automatically generated by APIMATIC v3.0 (
https://www.apimatic.io ).
"""
class ClientSecretsResponse(object):
"""Implementation of the 'Client Secrets Response' model.
TODO: type model description here.
Attributes:
... |
n = int(input())
s = str(input())
removal = 0
counter = 0
for x in s:
if x != 'x':
if counter >= 3:
removal += counter - 2
counter = 0
elif x == 'x':
counter += 1
if counter >= 3:
removal += counter - 2
print(removal)
|
class MojUser:
"""
Authenticated user, similar to the Django one.
The built-in Django `AbstractBaseUser` sadly depends on a few tables and
cannot be used without a datbase so we had to create a custom one.
"""
def __init__(self, pk, token, user_data):
self.pk = pk
self.is_activ... |
"""Create a Character Generator for Fallout 4."""
# print("You awake from 200 years in deep freeze. The wasteland awaits you.")
# name = input("What's your name? ")
# gender = input("What's your gender? ")
# points = 21
# attributes = ("Strength", "Perception", "Endurance", "Charisma", "Intelligence", "Agility", "Luck... |
# -*- coding: utf-8 -*-
"""
foo
"""
bah = 1
|
"""
Projections
To add a custom projection, create a method accepting (x, y, z) Cartesian coordinates and add an entry to the
parse_projection method
"""
def parse_projection(name: str):
if name == "standard":
return standard_proj
raise ValueError("Unknown projection")
def standard_proj(x, y, z):
... |
i = 10
j = 0
while i > 2:
i = i - 1
j = j + 8 |
# LeetCode
# Level: Easy
# Date: 2021.11.17
class Solution:
def destCity(self, paths: List[List[str]]) -> str:
P = dict(paths)
PA = P.keys()
PB = P.values()
DC = PB - PA
for i in DC:
return(i) |
blacklist = [
"userQED",
"GGupzHH",
"nodejs-ma",
"linxz-coder",
"teach-tian",
"kevinlens",
"Pabitra-26",
"mangalan516",
"IjtihadIslamEmon",
"marcin-majewski-sonarsource",
"LongTengDao",
"JoinsG",
"safanbd",
"aly2",
"aka434112"
"SMAKSS",
"imbereket",
... |
"""
The Stock module is responsible for Stock management.
It includes models for:
- StockLocation
- StockItem
- StockItemTracking
"""
|
while True:
A,B,C=map(int,input().split())
if not A: exit()
if A+B+C<=max(A,B,C)*2: print('Invalid')
elif A==B==C: print('Equilateral')
elif True in (A==B,A==C,B==C): print('Isosceles')
else: print('Scalene') |
class BigO_of_1(object):
def check_index_0_is_int(self, value_list):
if value_list[0] == int(value_list[0]):
return True
class BigO_of_N(object):
def double_values(self, value_list):
for i in range(0, len(value_list)):
value_list[i] *= 2
return value_list
class B... |
class EmptyStackException(Exception):
pass
class Node:
def __init__(self, value=None):
self.value = value
self.next = None
class Stack:
def __init__(self, node=None):
self.top = node
def push(self, value):
if not self.top:
self.top = Node(value)
else:
node = Node(value)
... |
# Language: Python 3
if __name__ == '__main__':
s = input()
n = any(i.isalnum() for i in s)
a = any(i.isalpha() for i in s)
d = any(i.isdigit() for i in s)
l = any(i.islower() for i in s)
u = any(i.isupper() for i in s)
print(n, a, d, l, u, sep="\n") |
with open("input", 'r') as f:
lines = f.readlines()
# lines = [x.strip("\n") for x in lines]
lines.append("\n")
total = 0
answers = set()
for line in lines:
if line == "\n":
total += len(answers)
answers = set()
else:
for letter in line.strip("\n"):
answers.add(letter)
print("Total: {}".format(total))
|
#pass is just a placeholder which does nothing
def func():
pass
for i in [1,2,3,4,5]:
pass |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------
# LEIA E PREENCHA O CABEÇALHO
# NÃO ALTERE OS NOMES DAS FUNÇÕES
# NÃO APAGUE OS DOCSTRINGS
# NÃO INCLUA NENHUM OUTRO import ...
#------------------------------------------------------------------
'''
Nome: Rafael Prudênci... |
del_items(0x800A0E8C)
SetType(0x800A0E8C, "void VID_OpenModule__Fv()")
del_items(0x800A0F4C)
SetType(0x800A0F4C, "void InitScreens__Fv()")
del_items(0x800A103C)
SetType(0x800A103C, "void MEM_SetupMem__Fv()")
del_items(0x800A1068)
SetType(0x800A1068, "void SetupWorkRam__Fv()")
del_items(0x800A10F8)
SetType(0x800A10F8, "... |
def mergeSort(a, temp, leftStart, rightEnd):
if(leftStart >= rightEnd):
return
middle = int((leftStart + rightEnd) / 2)
mergeSort(a, temp, leftStart, middle)
mergeSort(a, temp, middle + 1, rightEnd)
merge(a, temp, leftStart, middle, rightEnd)
return
def merge(a, temp, leftStart, middle... |
print("BMI指数计算器\n")
inp_1 = input('请输入您的体重(kg):\n')
inp_2 = input('请输入您的身高(cm):\n')
try:
weight = float(inp_1)
except:
print('Please enter a number')
try:
height = float(inp_2)
except:
print('Please enter a number')
BMI = weight/(height/100)**2
if BMI<18.5:
print("您的体型偏瘦")
elif BMI<24 and BMI>=18.5:
p... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
"""Amazon Textract + LayoutLM model training and inference code package for SageMaker
Why the extra level of nesting? Because the src folder (even if __init__ is present) is not loaded
as a Python module during traini... |
a = int(input('Construa a tabuada do Número: '))
aux = 0
print('*' * 18)
print('Trabuada de {}'.format(a))
print('*' * 18)
while (aux <= 10):
print('{} X {:2} = {:4}'.format(a, aux, (a * aux)))
aux = aux + 1
|
def ans(n):
global fib
for i in range(1,99):
if fib[i]==n: return n
if fib[i+1]>n: return ans(n-fib[i])
fib=[1]*100
for i in range(2,100):
fib[i]=fib[i-1]+fib[i-2]
n=int(input())
print(ans(n)) |
#
# This file contains the Python code from Program 7.23 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by Bruno R. Preiss.
#
# Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm07_23.txt
#
class SortedList(O... |
"""
Ejercicio 15
Tomando como base los resultados obtenidos en un laboratorio de análisis clínicos, un médico determina si una persona tiene anemia o no, lo cual
depende de su nivel de hemoglobina en la sangre, de su edad y de su sexo. Si el nivel de hemoglobina que tiene una persona es menor que el rango
que le corres... |
'''Program to read a number and check whether it is duck number or not.
Hint: A duck number is a number which has zeros present in it, but no zero present in the begining of the number.
Input Format
a number from the user
Constraints
n>=0
Output Format
Yes or No
Sample Input 0
123
Sample Output 0
No
Sample Inp... |
def main():
# problem1()
# problem2()
# problem3()
# problem4()
problem5()
# Create a function with the variable below. After you create the variable do the instructions below that.
#
# arrayForProblem2 = ["Kenn", "Kevin", "Erin", "Meka"]
# a) Print the 3rd element of the numberList.
#
# b) Pr... |
consumer_key = "TSKf1HtYKBsnYU9qfpvbRJkxo"
consumer_secret = "Y5lH7u6MDu5DjV5hUxEkwUpPwugYvEuqfpqyvP7y5ulen9XUML"
access_token = '115029611-4TampaXbxHmUHcpK5Cll8h7rioP80SJMNneZiYCN'
access_secret = 'wx4iaVvgvY5ZknCn6bOiKFiTzAU62R5PXC8b29RC6alwU'
|
# Breadth First Search and Depth First Search
class BinarySearchTree:
def __init__(self):
self.root = None
# Insert a new node
def insert(self, value):
new_node = {
'value': value,
'left': None,
'right': None
}
if not self.root:
... |
#!/usr/bin/env python3
#encoding=utf-8
#-------------------------------------------------
# Usage: python3 factory.py
# Description: factory function
#-------------------------------------------------
def factory(aClass, *pargs, **kargs): # Varargs tuple, dict
return aClass(*pargs, **kargs) # Call aClass ... |
"""
Entradas:
Cantidad de naranjas ---> int ---> X
precio por docena--->float--->Y
valor venta--->float--->K
Salidas:
numero de docenas--->float--->docena
costo--->float--->precio
ganancia--->float--->ganancia
porcentaje ganancia--->float--->porcentaje
"""
X = int ( input ( "Numero de naranjas: " ))
Y = float ( input (... |
with open('input', 'r') as file:
aim = 0
horizontal = 0
depth = 0
simple_depth=0
for line in file:
[com, n] = line.split(' ')
n = int(n)
if com == 'forward':
horizontal += n
depth += aim * n
elif com == 'down':
aim += n
... |
class Solution:
# 1st solution
# O(n) time | O(n) space
def reverseWords(self, s: str) -> str:
lst = []
start = 0
for i in range(len(s)):
if s[i] == " ":
self.reverse(lst, start, i - 1)
start = i + 1
lst.append(s[i])
sel... |
class Solution:
def containsDuplicate(self, nums: [int]) -> bool:
return len(nums) != len(set(nums))
s = Solution()
print(s.containsDuplicate([1,2,3,1])) |
# Problem:
# Write a program that introduces hours and minutes of 24 hours a day and calculates how much time it will take
# after 15 minutes. The result is printed in hh: mm format.
# Hours are always between 0 and 23 minutes are always between 0 and 59.
# Hours are written in one or two digits. Minutes are always wri... |
class Solution:
"""
@param n: an integer
@return: the number of '1's in the first N number in the magical string S
"""
def magicalString(self, n):
# write your code here
if n == 0:
return 0
seed = list('122')
count = 1
i = 2
while len(seed... |
class Link:
def __init__(self, val, next=None):
self.val = val
self.next = next
def __repr__(self):
if not self.next:
return f"Link({self.val})"
return f"Link({self.val}, {self.next})"
def merge_k_linked_lists(linked_lists):
'''
Merge k sorted linked lists ... |
"""
Variable Scope.
Variables have a global or local "scope".
For example, variables declared within either the
setup() or draw() functions may be only used in these
functions. Global variables, variables declared outside
of setup() and draw(), may be used anywhere within the program.
If a local variable is declared... |
__all__ = [
"ffn",
"rbfn",
"ffn_bn",
"ffn_ace",
"ffn_lae",
"ffn_bn_vat",
"ffn_vat",
"cnn",
"vae1",
"cvae",
"draw_at_lstm1",
"draw_at_lstm2",
"draw_lstm1",
"draw_sgru1",
"lm_lstm",
"lm_lstm_bn",
"lm_gru",
"lm_draw"
]
|
'''
num1=1
num2=1
num3=num1+num2
print(num3)
sum=num1+num2+num3
for i in range(1,18,1):
num1=num2
num2=num3
num3=num1+num2
if num3%2==0:
print(num3)
'''
'''
for i in range(1,101):
if 100%i==0:
print(i)
'''
num1=int(input("Please input a number: "))
for i in range(1,num1+1):
if... |
'''
165. Compare Version Numbers
https://leetcode.com/problems/compare-version-numbers/
Compare two version numbers version1 and version2.
If version1 > version2 return 1;
if version1 < version2 return -1;
otherwise return 0.
You may assume that the version strings are:
non-empty and contain only digits and the . ch... |
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 013
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
''')
salario = float(input('Digite o salário: R$'))
aumento = float(input('Digite a porcentagem do aumento: '))
total = salario * aumento / 100
input(f'Aumento: R${total:.2f} \nAumento + Salár... |
l = {}
for _ in range(int(input())):
s = input().split()
l[s[0]] = sum([float(a) for a in s[1:]])/(len(s)-1)
print('%.2f' % l[input()]) |
"""
The module identify pull-up method refactoring opportunities in Java projects
"""
# Todo: Implementing a decent pull-up method identification algorithm.
|
BOT_NAME = 'p5_downloader_middleware_handson'
SPIDER_MODULES = ['p5_downloader_middleware_handson.spiders']
NEWSPIDER_MODULE = 'p5_downloader_middleware_handson.spiders'
ROBOTSTXT_OBEY = True
DOWNLOADER_MIDDLEWARES = {
'p5_downloader_middleware_handson.middlewares.SeleniumDownloaderMiddleware': 543,
}
SELENIUM_E... |
# 题目:企业发放的奖金根据利润提成。
# 利润(I)低于或等于10万元时,奖金可提10%;
# 利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可提成7.5%;
# 20万到40万之间时,高于20万元的部分,可提成5%
# 40万到60万之间时高于40万元的部分,可提成3%;
# 60万到100万之间时,高于60万元的部分,可提成1.5%,
# 高于100万元时,超过100万元的部分按1%提成,
# 从键盘输入当月利润I,求应发放奖金总数?
# !/usr/bin/python
# _*_ coding:UTF-8 _*_
li = ""
arr = [100000, 200000, 40... |
#!/usr/bin/env python3
# Nick Stucchi
# 03/23/2017
# Filter out words and replace with dashes
def replaceWord(sentence, word):
wordList = sentence.split()
newSentence = []
for w in wordList:
if w == word:
newSentence.append("-" * len(word))
else:
newSentence.append(... |
"""THIS FILE IS AUTO-GENERATED BY SETUP.PY."""
name = "popmon"
version = "0.3.12"
full_version = "0.3.12"
release = True
|
"""Settings for testing emencia.django.newsletter"""
SITE_ID = 1
USE_I18N = False
ROOT_URLCONF = 'emencia.django.newsletter.urls'
DATABASES = {'default': {'NAME': 'newsletter_tests.db',
'ENGINE': 'django.db.backends.sqlite3'}}
INSTALLED_APPS = ['django.contrib.contenttypes',
... |
#
# @lc app=leetcode id=647 lang=python3
#
# [647] Palindromic Substrings
#
# @lc code=start
class Solution:
def countSubstrings(self, s: str) -> int:
"""Find number of palindromic strings in s
Args:
s (str): String to analyze
Returns:
int: Count of palindromes
... |
"""
LC 6001
Return the rearranged number with minimal value.
Note that the sign of the number does not change after rearranging the digits.
Example 1:
Input: num = 310
Output: 103
Explanation: The possible arrangements for the digits of 310 are 013, 031, 103, 130, 301, 310.
The arrangement with the ... |
EF_UUID_NAME = "__specialEF__float32_UUID"
EF_ORDERBY_NAME = "__specialEF__int32_dayDiff"
EF_PREDICTION_NAME = "__specialEF__float32_predictions"
EF_DUMMY_GROUP_COLUMN_NAME = "__specialEF__dummy_group"
HMF_MEMMAP_MAP_NAME = "__specialHMF__memmapMap"
HMF_GROUPBY_NAME = "__specialHMF__groupByNumericEncoder"
|
SERVICES = [
'UserService',
'ProjectService',
'NotifyService',
'AlocateService',
'ApiGateway',
'Frontend'
]
METRICS = [
'files',
'functions',
'complexity',
'coverage',
'ncloc',
'comment_lines_density',
'duplicated_lines_density',
'security_rating',
'tests',
... |
# sAsync:
# An enhancement to the SQLAlchemy package that provides persistent
# item-value stores, arrays, and dictionaries, and an access broker for
# conveniently managing database access, table setup, and
# transactions. Everything can be run in an asynchronous fashion using
# the Twisted framework and its deferred ... |
class Vocab:
# pylint: disable=invalid-name,too-many-instance-attributes
ROOT = '<ROOT>'
SPECIAL_TOKENS = ('<PAD>', '<ROOT>', '<UNK>')
def __init__(self, min_count=None):
self._counts = {}
self._pretrained = set([])
self.min_count = min_count
self.size = 3
def idx(... |
# -*- coding:utf-8 -*-
"""
状态信息
Project: alphahunter
Author: HJQuant
Description: Asynchronous driven quantitative trading framework
"""
class State:
STATE_CODE_PARAM_MISS = 1 #交易接口初始化过程缺少参数
STATE_CODE_CONNECT_SUCCESS = 2 #交易接口连接成功
STATE_CODE_CONNECT_FAILED = 3 #交易接口连接失败
STATE_CODE_DISCONN... |
#
# PySNMP MIB module Wellfleet-FNTS-ATM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-FNTS-ATM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:33:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
class Middleware:
def __init__(self, context_manager, server_middleware):
"""
:param BaseMiddleware Your custom middleware
:param package Middleware from the middleware package
"""
self._service = context_manager
self._middleware = server_middleware.get_hooks_service_... |
routers = dict(
# base router
BASE=dict(
default_application='projeto',
applications=['projeto', 'admin',]
),
projeto=dict(
default_controller='initial',
default_function='principal',
controllers=['initial', 'manager'],
functions=['home', 'contact', 'about', 'user', '... |
class Coffee:
coffeecupcounter =0
def __init__(self, themilk, thesugar, thecoffeemate):
self.milk = themilk
self.sugar = thesugar
self.coffeemate = thecoffeemate
Coffee.coffeecupcounter=Coffee.coffeecupcounter+1
print(f'You now have your coffee with {self.milk} milk, {s... |
class Solution:
def threeSumMulti(self, arr, target):
c = Counter(arr)
ans, M = 0, 10**9 + 7
for i, j in permutations(c, 2):
if i < j < target - i - j:
ans += c[i]*c[j]*c[target - i - j]
for i in c:
if 3*i != target:
ans += c[i... |
n = int(input())
P = [] #pares
I = [] #ímpares
V = [] #Vetor principal
t = 0
for i in range (n):
V.append(int(input()))
for i in range(len(V)): #dividindo o vetor em 2 vetores menores (Par e Impar)
if V[i]%2==0:
P.append(V[i]) #dividindo para par
else:
I.append(V[i]) #dividindo para impar
... |
"""
Program Description :
List appender is a simple program that allows you to append data, either a single word or a sequence of words,
to a list. To stop adding elements, type !quit. It helps create lists easily when the number of elements
is a lot.
"""
def List_appender():
print("Start entering data to be appen... |
'''
Created on Jun 4, 2018
@author: nishant.sethi
'''
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def insert(self, data):
# Compare the new value with the parent node
if self.data:
if data < self.... |
name = input("Enter file:")
if len(name) < 1:
name = "mbox-short.txt"
handle = open(name)
hist=dict()
for line in handle:
if line.startswith('From:'):
words=line.split()
if words[1] not in hist:
hist[words[1]]=1
else:
hist[words[1]]=hist[words[1]]+1
#print(hist)
n... |
maior = 0
menor = 0
totalPessoas = 10
for pessoa in range(1, 11):
idade = int(input("Digite a idade: "))
if idade >= 18:
maior += 1
else:
menor += 1
print("Quantidade de pessoas maior de idade: ", maior)
print("Quantidade de pessoas menor de idade: ", menor)
print("Porcentagem de pessoas menores de idad... |
"""Dataset representation of fMRI data."""
class DatasetFMRI(object):
"""docstring for DatasetFMRI."""
def __init__(self):
"""Init."""
pass
|
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... |
#!/usr/bin/env python3
def runLittleMan(mem):
# Initialiser
ac = 0
pc = 0
running = True
# Kjør instruksjonssyklus
while running:
# Fetch
instr = mem[pc]
pc += 1
# Execute
if instr // 100 == 1: # ADD
ac += mem[instr % 100]
elif i... |
#
# PySNMP MIB module A3COM-HUAWEI-IFQOS2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-IFQOS2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:50:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
"""
Given head which is a reference node to a singly-linked list. The value of each node in the
linked list is either 0 or 1. The linked list holds the binary representation of a number.
Return the decimal value of the number in the linked list.
Example 1:
https://assets.leetcode.com/uploads/2019/12/05/graph-1.png
... |
lines = [line.strip() for line in open("input.txt", 'r') if line.strip() != ""]
startingNumbers = [int(i) for i in lines[0].split(",")]
##########################################
# PART 1 #
##########################################
def part1(startingNumbers, target):
i = 0
la... |
def load(h):
return ({'abbr': 'Reserved', 'code': 0, 'title': 'RESERVED Reserved Reserved'},
{'abbr': 'pres', 'code': 1, 'title': 'PRES Pressure Pa'},
{'abbr': 'msl', 'code': 2, 'title': 'MSL Mean sea level pressure Pa'},
{'abbr': 'ptend', 'code': 3, 'title': 'PTEND Pressure tend... |
def printom(str):
return f"ye hath mujhe {str}"
def add(n1, n2):
return n1 + n2 + 5
print("and the name is", __name__)
if __name__ == '__main__':
print(printom("de de thakur"))
o = add(4, 6)
print(o)
|
# Class to test the GrapherWindow Class
class GrapherTester:
def __init__(self):
subject = Grapher()
testFileName = 'TestData.csv'
testStockName = 'Test Stock'
testGenerateGraphWithAllPositiveNumbers(testFileName, testStockName)
def createTestData(xAxis, yAxis):
# Genera... |
#!/usr/bin/env python
# encoding: utf-8
"""
populate_next_right_pointers.py
Created by Shengwei on 2014-07-27.
"""
# https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/
# tags: medium, tree, pointer, recursion
"""Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
... |
class Policy:
def select_edge(self, board_state, score=None, opp_score=None):
raise NotImplementedError
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.