content stringlengths 7 1.05M |
|---|
"""
PASSENGERS
"""
numPassengers = 3262
passenger_arriving = (
(3, 6, 4, 4, 3, 0, 2, 7, 3, 3, 0, 0), # 0
(3, 7, 9, 2, 1, 0, 3, 12, 1, 6, 2, 0), # 1
(3, 10, 6, 3, 0, 0, 6, 6, 7, 5, 0, 0), # 2
(5, 6, 12, 6, 0, 0, 8, 9, 3, 5, 2, 0), # 3
(3, 10, 4, 1, 1, 0, 9, 8, 5, 3, 0, 0), # 4
(4, 8, 3, 6, 2, 0, 5, 7, 7, 4... |
## =========================================================
## Copyright 2019 Dietrich Bollmann
##
## 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/license... |
class Route:
def __init__(self, routes, graph):
self.routes = routes
self.graph = graph
self.v_start = graph[0]
self.dist = self.route_dist()
def route_dist(self):
'''total route distance (fitness)'''
total_dist = 0
for route in self.routes:
... |
#Given two (singly) linked lists, determine if the two lists intersect. Return the intersecting node . Note that the intersetion is defined
#based on reference, not value. That is if kth node of the first linked list is the exact same node(by reference) as the jth node of the
#second linked list, the they are intersec... |
EPOCHS = 3
LOG_ITER = 25
TEST_ITER = 50
WRITE_PERIOD = 100
#1440 train examples
#360 train examples |
class BaseLinOp:
def __init__(self):
pass
@property
def T(self):
return Adjoint(self)
def __add__(self, other):
if isinstance(other, BaseLinOp):
return Sum(self, other)
else:
return ScalarSum(self, other)
def __radd__(self, other):
i... |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-LogicalProcessorMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-LogicalProcessorMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:19:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.... |
'''
Leetcode problem No 81 Search in Rotated Sorted Array II
Solution written by Xuqiang Fang on 11 May, 2018
'''
class Solution(object):
def search(self, nums, target):
"""
:type nums : List[int]
:type target: int
:rtype: bool
"""
if len(nums) == 0 : return False
... |
# © 2016 Opener B.V. (<https://opener.am>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Technical features group",
"summary": "Access to technical features without activating debug mode",
"version": "14.0.1.0.0",
"category": "Usability",
"website": "https://github.... |
txt = "one one was a race horse, two two was one too."
x = txt.replace("one", "three", 2)
print(x)
|
"""
all the different icons we have to represent different types of AIS stations
ICONS(dict): keys are the AIS station type as a string, values are the filename
of the icon
"""
ICONS = {'Base Station': 'basestn.png',
'Class A': 'classa.png',
'Navigation Aid': 'navaid.png',
'Cla... |
description = 'Verify the user can create a new page from the project page'
pages = ['login',
'common',
'index',
'project_pages']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
index.create_access_project('test')
common.navigate_menu('Pages')
def test(data)... |
class PatternLibraryException(Exception):
pass
class TemplateIsNotPattern(PatternLibraryException):
pass
class PatternLibraryEmpty(PatternLibraryException):
pass
|
def load_input():
cases = open("input.txt", "r").readlines()
for i in range(len(cases)):
cases[i] = cases[i].replace('\n','')
return cases
groups = []
def parse_input():
inp = load_input()
inp_len = len(inp)
group = []
for i in range(inp_len):
line = inp[i]
if line ... |
USCIS_CONFIG = {
'hostname': 'egov.uscis.gov',
'endpoint': '/casestatus/mycasestatus.do',
'querytype': 'CHECK STATUS'
}
|
# -*- coding: utf-8 -*-
bind = '{{ gunicorn_bind }}'
pidfile = '{{ gunicorn_pidfile }}'
proc_name = 'slugify'
user = '{{ web_user }}'
loglevel = 'warn'
errorlog = '-'
accesslog = '-'
|
def quicksort(items):
"""O(n * log n)."""
if len(items) < 2:
return items
else:
pivot_index = len(items) // 2
pivot = items[pivot_index]
left = [num for i, num in enumerate(items) if num <= pivot and i != pivot_index]
right = [num for i, num in enumerate(items) if num... |
budget_for_the_film = float(input("Enter the budget for the film: "))
number_of_extras = int(input("Enter the number of extras: "))
clothes_price_per_extra = float(input("Enter the price of the clothes per extra: "))
decor_price = budget_for_the_film * 0.1
clothes_price = number_of_extras * clothes_price_per_extra
if... |
class graph(object):
def __init__(self, nodes, edge_list = None):
self.N = nodes
self.A = [[False for i in range(self.N+1)] for j in range(self.N+1)] # initialise the adjacency matrix as an (N+1)*(N+1) array, so we can use indexes from 1.
if edge_list != None: # let's optionally give this c... |
#
# PySNMP MIB module UCD-SNMP-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/UCD-SNMP-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:32:22 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( Oc... |
def printing(T):
print (f'hello {T}')
w=__name__
if w=="__main__":
printing("wajaht") |
x = [1, [2, None]]
y = [1, 2]
z = [1, 2]
x[1][0] = y # should nudge y to over the right
z[1] = x # should nudge BOTH x and y over to the right
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s = input("Введите предложение: ")
g = s.split(' ')
for i in g:
if g[i].find('к') == 0:
print(g[i])
break
|
"""
Regular expression matching using simplified and memoized Brzozowski
derivatives.
"""
def match(re, s):
for c in s:
re = re(c)
return re.nullable
def mark(nullable, deriv):
deriv.nullable = nullable
return deriv
fail = mark(False, lambda c: fail)
empty = mark(True, lambda c: fail)
def _l... |
# earth_coords.py
#
# For coordinates relative to Earth's surface,
# in terms of latitude, longitude, and altitude.
# All stored as floats.
#
# E.g., the GPS antenna in our window in the APCR-DRDL lab is at:
# latitude = 30.428236 degrees (N)
# longitude = -84.285 degrees (W)
# altitude = 40 m... |
class Car:
someStaticPublicVar = 'Abc'
def __init__(self, name, make, year):
self.name = name
self.make = make
self.year = year
def drive(self):
print(self.name + " started")
@staticmethod
def hello():
print("Hello from car")
@classmethod
def show(... |
# Author : @Moglten
# Fizz , Buzz and Fizzbuzz
# from 1 to 100
def printFizzBuzz(n) :
for x in range(1,n+1) : print(x) if print_FizzBuzz(x) else None
def print_FizzBuzz(n):
if n % 5 == n % 3 == 0:
print( "FizzBuzz" )
return False
else: return print_Buzz( n )
def print_Buz... |
def Union2SortedArrays(arr1, arr2):
m = arr1[-1]
n = arr2[-1]
ans = 0
if m > n:
ans = m
else:
ans = n
returner = []
newtable = [0] * (ans + 1)
returner.append(arr1[0])
newtable[arr1[0]] += 1
for i in range(1, len(arr1)):
if arr1[i] != arr1[i - 1]:
returner.append(arr1[i])
n... |
"""Module containing an exception class for Surgeo"""
class SurgeoException(Exception):
"""This is an application specific Exception class."""
pass
|
#!/usr/bin/env python
# encoding: utf-8
class Solution:
def nthUglyNumber(self, n: int) -> int:
if n == 0: return 0
seen = {1, }
heap = []
heapq.heappush(heap, 1)
for _ in range(n):
ugly_number = heapq.heappop(heap)
for i in [2, 3, 5]:
... |
filename = 'alice.txt'
# with open(filename, encoding='utf-8') as file_object:
# contents = file_object.read()
try:
with open(filename, encoding='utf-8') as file_object:
contents = file_object.read()
except FileNotFoundError:
print(f"Sorry, the file {filename} does not exist.")
else:
# Calculat... |
# Basic Calculator II: https://leetcode.com/problems/basic-calculator-ii/
# Given a string s which represents an expression, evaluate this expression and return its value.
# The integer division should truncate toward zero.
# Note: You are not allowed to use any built-in function which evaluates strings as mathematica... |
class Solution:
def __init__(self):
self.keys = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
'7': 'pqrs',
'8': 'tuv',
'9': 'wxyz'
}
# straightforward solution, easier to understand
... |
wildcards = ['wildcard1', 'wildcard2', 'wildcard3', 'wildcard4']
class Player:
def __init__(self, name, rfid, skills):
self.name = name
self.rfid = rfid
self.skills = skills
def __str__(self):
return 'Player {} ({}, {})'.format(self.name, self.rfid, list(self.skills))
def ... |
saarc = [
'Afganistan',
'Bangladesh',
'Bhutan',
'Nepal',
'India',
'Pakistan',
'Sri Lanka'
]
print(saarc)
if "Bangladesh" in saarc:
print("Bangladesh is in Saarc")
|
def isOneAway(s1, s2):
if len(s1) == len(s2):
# check replace
replace = False
for c1, c2 in zip(s1, s2):
if c1 != c2:
if replace:
return False
else:
replace = True
return True
elif len(s1) == len(... |
class Coord:
def __init__(self, x, y):
self.x = x
self.y = y
class Ball:
def __init__(self, x, y):
self.diameter = 0.1
self.x = x
self.y = y
self.coord = Coord(x,y)
class ObjectBall(Ball):
pass
class One(ObjectBall):
pass
class Two(ObjectBall):
pas... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Copyright 2017 Ronnasayd Machado <ronnasayd@hotmail.com>
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.... |
class ZomatoLocation():
def __init(self, entity_type, entity_id, title, latitude, longitude, city_id, city_name, country_id, country_name):
self.entity_type = entity_type
self.entity_id = entity_id
self.title = title
self.latitude = latitude
self.longitude = longitude
... |
g=open(accountList, r)
pickle.load(adminUsers)
print("Welcome to AdminTools!")
print("Please enter your official AdminTools account credentials:")
print("NOTE: You may enter your PythonG Live account credentials if you have access.")
print("Please enter your admin username:")
adminu = input()
print("Please enter your a... |
#!/usr/bin/env python
# Day 12 solution of Advent Of Code 2020 by Riccardo Negri
# First part answer: 1533
# Second part answer: 25235
# left 90° --> (x, y) = (y*-1, x*1) --> -1+1
# right 90° --> (x, y) = (y*1, x*-1) --> +1-1
# rotate P about F
def rotate(P, F, angle):
temp = [P[0]-F[0], P[1]-F... |
#자료구조의 변경
number={1,2,3,4}
print(number, type(number))
number=list(number)
print(number, type(number))
number=tuple(number)
print(number, type(number))
number=set(number)
print(number, type(number)) |
# Event: LCCS Python Fundamental Skills Workshop
# Date: Dec 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Purpose: A program to demonstrate recursion
def fib(n):
"""Recursive function to
return the nth Fibonacci number """
if n <= 1:
return n
else:
return(fi... |
"""
164. Maximum Gap
Example 1:
Input: [3,6,9,1]
Output: 3
Explanation: The sorted form of the array is [1,3,6,9], either
(3,6) or (6,9) has the maximum difference 3.
Example 2:
Input: [10]
Output: 0
Explanation: The array contains less than 2 elements, therefore return 0.
"""
class Sol... |
'''
Copyright [2020] [Timothy Chua]
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, software
... |
"""
NOTE:
the below code is to be maintained Python 2.x-compatible
as the whole Cookiecutter Django project initialization
can potentially be run in Python 2.x environment.
TODO: ? restrict Cookiecutter Django project initialization to Python 3.x environments only
"""
project_slug = '{{ cookiecutter.proje... |
D, J = [map(int, input().split()) for _ in range(2)]
ans = 0
for d, j in zip(D, J):
ans += max(d, j)
print(ans)
|
#!/usr/bin/python3.4
count = 0
while count < 9:
print("The count is: ", count)
count = count + 1
print("Good bye")
|
"""
@Author: Abel Hristodor
@Description: SDA (AZS) Telegram bot made for Romanian churches
@Date: 10/12/2020
@Github: github.com/AbelHristodor/azs-telegram-bot
Contains the messages used by the bot.
"""
WELCOME_MESSAGE = "<i>Bine ati venit in grupul Bisericii Adventiste de Ziua a Saptea din Verona: <strong>$user</st... |
def ColourNames(filename) -> dict:
rtn = {}
with open(filename) as handle:
for line in handle:
line = line.strip()
r, g, b, name = line.split(maxsplit=3)
rtn[name] = [int(r), int(g), int(b)]
return rtn
|
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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
#
# U... |
# model
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{3, 2, 2, 2}")
i2 = Input("op2", "TENSOR_FLOAT32", "{2, 2}")
act = Int32Scalar("act", 0) # an int32_t scalar fuse_activation
i3 = Output("op3", "TENSOR_FLOAT32", "{3, 2, 2, 2}")
model = model.Operation("SUB", i1, i2, act).To(i3)
# Example 1. Input in operand... |
# int: signed, unlimited signed precision integer
# specified in decimal by default
print("Decimal 10: " + str(10))
print("Binary 10: " + str(0b10))
print("Octal 10: " + str(0o10))
print("Hex 10: " + str(0x10))
# Conversation from float (rounded off to nearest int towards 0)
print("3.5 in int is " + str(in... |
load("@rules_jvm_external//:defs.bzl", "maven_install")
def hocon_repositories():
maven_install(
name = "hocon_maven",
artifacts = [
"com.typesafe:config:1.3.3",
"org.rogach:scallop_2.12:3.3.2",
],
repositories = [
"https://repo.maven.apache.org/m... |
#The database URI that should be used for the connection.
#fomate: dialect+driver://username:password@host:port/database
#mysql format : mysql://scott:tiger@localhost/database_name
SQLALCHEMY_DATABASE_URI = 'mysql://root:63005610@localhost/cuit_acm'
#A dictionary that maps bind keys to SQLAlchemy connection URIs.
SQL... |
# a2_q2.py
def check_teams(graph, csp_sol):
total_var = len(csp_sol)
for i in range(total_var):
for j in range(1,total_var):
if csp_sol[i] == csp_sol[j]:
if j in graph[i]:
return False
return True
|
SHAPES = ['pin', 'airport', 'hospital', 'home', 'dot', 'start', 'heart',
'flag']
COLORS = {
'amber' : ('FFC107', 'FF6F00'),
'blakwhite' : ('000000', 'FFFFFF'),
'blue' : ('2196F3', '0D47A1'),
'bluewhite' : ('0277BD', 'FFFFFF'),
'cyan' : ('00BCD4', '006064'),
'deeppurple':... |
"""
You have d dice, and each die has f faces numbered 1, 2, ..., f.
Return the number of possible ways (out of fd total ways) modulo 10^9 + 7 to
roll the dice so the sum of the face up numbers equals target.
Example 1:
Input: d = 1, f = 6, target = 3 Output: 1
Explanation: You... |
#! /usr/bin/python3
#! @authot: @ruhend (Mudigonda Himansh)
#! CRC Encoder
def list2int(mylist):
char_divisor = [str(integer) for integer in mylist]
str_divisor = "". join(char_divisor)
int_divisor = int(str_divisor,2 )
return int_divisor
def DecimalToBinary(num):
answer = []
if num >= 1:
... |
class PexOSDeprovisionHandler(object):
def __init__(self):
pass
def run(self, force=False, deluser=False):
return
def run_changed_unique_id(self):
return
|
class TPDO:
def __init__(self, index):
pass
class RPDO:
def __init__(self, index):
pass
|
class Field(object):
def __init__(self, name):
self.name = name
self.internal_name = '_' + self.name
def __get__(self, instance, instance_type):
if instance is None:
return self
return getattr(instance, self.internal_name, '')
def __set__(self, instance, value):... |
def merge_notch_list(notch_list_1, notch_list_2):
"""Merge two notches list
Parameters
----------
notch_list_1 : list
First notch list to merge
notch_list_2 : list
Second notch list to merge
Returns
-------
notch_list : list
list of dictionary with key: "begin_... |
"""pywxclient package module."""
__version__ = '0.1.2'
|
# Classificador de idade
# Escreva uma função que recebe um número inteiro representando a idade de uma pessoa e devolve uma string conforme a seguinte regra: "crianca" se a pessoa tem até 11 anos, inclusive; "adolescente" se a pessoa tem entre 12 e 17 anos, inclusive; "adulto" se a pessoa tem 18 anos ou mais. Obse... |
"""Você deve criar uma classe carro que vai possuir
dois atributos compostos por outras duas classes:
1.Motor
2.Direção
O Motor terá a responsabilidade de controlar a velocidade.
Ele oferece os seguintes atributos:
1.Atributo de dado velocidade
2.Método acelerar, que deverá incremetar a velocidade de ... |
# Copyright 2012 Google Inc. 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 law or a... |
# 第一遍
# 直接使用递归方法:自顶向下;具有自相似性的部分是左子树的上限是当前值,右子树的下限是当前值,根结点无下限无上限
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isValidBST(self, root: TreeNode) -> bool:
def helper(root, lo... |
'''THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OT... |
fname = input('Enter a filename:')
try:
fhand = open(fname)
except:
print('File cannot be opened:', fname)
exit()
for line in fhand:
words = line.split()
if len(words) >= 3 and words[0] == 'From':
print(words[2])
|
load(
":poms_for_testing.bzl",
"COMPLEX_POM",
"GRANDPARENT_POM",
"MERGED_EXPECTED_POM",
"PARENT_POM",
)
load(":testing.bzl", "asserts", "test_suite")
load("//maven:poms.bzl", "poms")
load("//maven:xml.bzl", "xml")
def merge_properties_test(env):
parent = """<project><properties>
<foo>fo... |
# n is the number of rows in which
# star is going to be printed.
n=11
# i is going to be enabled to
# range between n-i t 0 with a
# decrement of 1 with each iteration.
# and in print function, for each iteration,
# ” ” is multiplied with n-i and ‘*’ is
# multiplied with i to create correct
# space before of the star... |
"""
Classes to represent error states
"""
class Error(Exception):
"""Base exception class for NPC"""
pass
class FormatError(Error):
"""
Raised when trying to use a malformed file
Attributes:
strerror (str): Error message describing what happened
"""
def __init__(self, strerror):
... |
def main():
lM = lambda arg: arg * 2
print(lM(5)) # 10
print(lM(0)) # 0
print(lM(10)) # 20
my_list = [1, 5, 4, 6, 8, 11, 3, 12]
new_list = list(filter(lambda x: (x%2 == 0), my_list))
print(new_list)
pass
if __name__ == "__main__":
main() |
input = """
n(1).
n(2).
n(3).
n(4).
a(1,2).
a(1,3).
a(4,3).
a(3,1).
a(2,3).
a(1,4).
b(1,2,1).
b(1,1,1).
b(2,1,2).
b(3,1,1).
b(2,2,2).
c(1,2,3,4).
c(1,2,3,5).
c(4,3,2,1).
c(1,2,4,3).
c(2,1,3,4).
d(1,2,3,4,5).
d(5,4,3,2,1).
d(1,2,3,5,1).
%p(X,Y) v q(X,Z) v r(X,Y,Z,U,W) :- n(X), a(X,Y), b(X,Y,Z), c(X,Y,Z,U),
%d(X,Y,... |
N=10
for x in range (N):
for y in range (N):
print (x,y,x*y)
|
'''
Exercise 2:
Write in pseudo code a function merge(listA: List, listB: List) that returns a
sorted list containing the elements of both list where listA and listB are two sorted lists
of integers. If an element exists in both lists, it must appear multiple times in the returned list.
For example:
>>> merge([1,3,4,7]... |
"""
PSET-4
Word Game Part 6: Playing a Game
A game consists of playing multiple hands. We need to implement one
final function to complete our word-game program. Write the code that
implements the playGame function. You should remove the code that is
currently uncommented in the playGame body. Read through the
spe... |
def max_digit(number: int) -> int:
# your code here
# # 1. 기본적인 답
# maxValue = -1
# for i in str(number):
# maxValue = max(int(i),maxValue)
# return maxValue
# 2. one-liner
# String max() 활용
return int(max(str(number)))
if __name__ == '__main__':
print("Example:")
prin... |
"""
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
Example:
Input: "25525511135"
Output: ["255.255.11.135", "255.255.111.35"]
input: "010010"
output: ["0.10.0.10","0.100.1.0"]
最大为255.255.255.255
"""
# 2018-6-29
# Restore IP Address
# DFS
# LTE
class Solut... |
"""
Space : O(n)
Time : O(n)
"""
class Solution:
def reverseStr(self, s: str, k: int) -> str:
ans = ''
n = len(s)
rev = True
for i in range(0, n, k):
chunk = s[i:i+k]
if rev:
ans += "".join(chunk[::-1])
rev = False
... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
def unique_paths_with_obstacles(obstacle_grid):
if obstacle_grid is None or len(obstacle_grid) == 0 or obstacle_grid[0] is None or len(obstacle_grid[0]) == 0:
return 0
m = len(obstacle_grid)
n = len(obstacle_grid[0])
dp = [0 for i in range(n)]
for i in range(n):
if obstacle_grid[0]... |
def undocumented(f):
"""
Apply the undocumented decorator to handler methods if they should not turn up in the API help
"""
f.undocumented = True
return f
|
########################################################################
#
# License: BSD
# Created: February 25, 2005
# Author: Ivan Vilata - reverse:net.selidor@ivan
#
# $Id$
#
########################################################################
"""
Parameters for PyTables.
Misc variabl... |
a=float(input())
b=float(input())
c=float(input())
d=float(input())
e=float(input())
f=float(input())
x=0
y=0
if a>=0:
x=x+1
y=y+a
if b>=0:
x=x+1
y=y+b
if c>=0:
x=x+1
y=y+c
if d>=0:
x=x+1
y=y+d
if e>=0:
x=x+1
y=y+e
if f>=0:
x=x+1
y=y+f
media=y/x
print("%d valores positivos"%x)
print("%.... |
"""Constants for HACS"""
VERSION = "0.12.1"
NAME_LONG = "HACS (Home Assistant Community Store)"
NAME_SHORT = "HACS"
DOMAIN = "hacs"
PROJECT_URL = "https://github.com/custom-components/hacs/"
CUSTOM_UPDATER_LOCATIONS = [
"{}/custom_components/custom_updater.py",
"{}/custom_components/custom_updater/__init__.py",... |
def main():
SX, SY, GX, GY = map(int, input().split())
print((SY*GX+SX*GY) / (SY+GY))
if __name__ == "__main__":
main()
|
'''Implement a program to calculate sum of odd digits present in the given number
Input Format
a number from the user
Constraints
n>0
Output Format
print sum of odd digits
Sample Input 0
123
Sample Output 0
4
Sample Input 1
101
Sample Output 1
2'''
#solution
n = input()
sum = 0
for i in n:
if int(i)%2 ==... |
def GetCardType(models):
return "Japanese (recognition&recall)"
def MakeCard(data):
result = {}
if 'front_word' not in data and 'back_word' not in data or 'read_word' not in data:
return result
result['Expression'] = data['front_word']
result['Meaning'] = data['back_word']
result['Rea... |
class Solution:
def containsNearbyAlmostDuplicate(self, nums: List[int], k: int, t: int) -> bool:
if t < 0 or k <= 0:
return False
table = {}
w = 1 + t
for i, num in enumerate(nums):
curr = num // w
if curr in table:
return True
... |
def make_devision(n: float):
"""
This closure returns a function that returns the devision of an x number by n
"""
def division(x: float) -> float:
return x / n
return division
def run():
n = float(input('Insert n: '))
devision_n = make_devision(n)
x = float(input('Insert x:... |
while True:
try:
a,b=map(int,input().split())
c=a^b
print(c)
except EOFError:break
|
def subsets(arr):
return return_subsets(arr, 0)
def return_subsets(arr, index): # [5,7] # [7] # []
"""
:param: arr - input integer array
Return - list of lists (two dimensional array) where each list represents a subset
TODO: complete this method to return subsets of an array
"""
if len(a... |
catlog = ['Show Filter On Binary', 'Show Smooth The Rec', 'Show Smooth The Gear', 'Show Dog The Gear',
'Show QRCode Art', '-', 'Show Dilation', 'Show Erosion', 'Show Open And Close', '-', 'Show Fill Holes',
'Show Outline', 'Show ConvexHull', 'Show Skeleton', '-', 'Show Distance', 'Show Max Circle', 'Show Medial Axis'... |
limit = 25
subreddit = 'cscareerquestions'
client_id = '???'
client_secret = '???'
user_agent = 'python:X.Y.Z:v1.0.0 (by /u/???)'
gmail_user = '???@???.???'
gmail_password = '???'
sender = '???@???.???'
recipient = '???@???.???'
subject = 'Top Trending on /r/%s' % (subreddit)
|
NOT_ALLOWED = ["", None, True, False, [], {}]
def arrayLength(arr, length):
if len(arr) == length:
return True
else:
return False
def checkFields(staticFields, dataFields):
requiredfields = list(set(staticFields) - set(dataFields))
extraFields = list(set(dataFields) - set(staticField... |
# TODO get wall-tower headings for Transdec regions
# PINGER_FREQUENCY = 30000 # Region A
# PINGER_FREQUENCY = 40000 # Region B
# PINGER_FREQUENCY = 25000 # Region C
# PINGER_FREQUENCY = 35000 # Region D
PINGER_FREQUENCY = 30000
TRACK_MAG_THRESH = 10.8
TRACK_COOLDOWN_SAMPLES = 188000
RIGHT_HANDED = False
PATH_1_BEND... |
"""
Circular Queue
Problem Statement:
Circular Queue is a linear data structure which follows FIFO principle
The difference is that the last position is connected back to the first position to make a circle.
Perform insertion, deletion and traversal operations on Circular Queue.
"""
class CircularQueue:
... |
manager22222
ssssss
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.