content stringlengths 7 1.05M |
|---|
class Color:
def __init__(self, r, g, b, alpha=255):
self.r = r
self.g = g
self.b = b
self.alpha = alpha
if self.r < 0 or self.g < 0 or self.b < 0 or self.alpha < 0:
raise ValueError("color values can't be below 0")
if self.r > 255 or self.g > 255 or self... |
def ConverterTempo(tempo, unidade):
if unidade == "m":
return tempo*60
if unidade == "s":
return tempo
def ConverteMetros(quantidade, unidade):
if unidade == "M":
return quantidade*100
if unidade == "m":
return quantidade |
class TokenType(object):
END = ""
ILLEGAL = "ILLEGAL"
# Operators
PLUS = "+"
MINUS = "-"
SLASH = "/"
AT = "@"
# Identifiers
NUMBER = "NUMBER"
MODIFIER = "MODIFIER"
# keywords
NOW = "NOW"
class Token(object):
def __init__(self, tok_type, tok_literal):
self.to... |
'''
* (210927) 최소직사각형
* https://programmers.co.kr/learn/courses/30/lessons/86491
'''
def solution(sizes):
width = []
height = []
for item in sizes:
if item[1] > item[0]:
item[0], item[1] = item[1], item[0]
width.append(item[0])
height.append(item[1])
... |
n = (int(input('Dgite um numero: ')),
int(input('Dgite outro numero: ')),
int(input('Dgite outro numero: ')),
int(input('Dgite outro numero: ')))
print(f'O valor 9 apareu {n.count(9)} vezes' if 9 in n else 'O numero 9 não foi digitado')
print(f'O valor 3 foi digitado na posição {n.index(3) + 1}' if 3 in ... |
def sort(L):
n = len(L)
# Build Heap
for i in range(n-1, -1, -1):
L = heapify(L, i, n)
for i in range(n-1, 0, -1):
L[i], L[0] = L[0], L[i]
n -= 1
heapify(L, 0, n)
return L
def heapify(L, _v, n): # v is index to be passed
v = _v + 1
largest = v
if 2*v <=... |
print('DESCUBRA O MAIOR NÚMERO')
num1 = float(input('Digite o primeiro número: '))
num2 = float(input('Digite o segundo número: '))
if num1 > num2 :
print('O primeiro número {} é maior que o segundo número {}'.format(num1, num2))
elif num2 > num1 :
print('O segundo número {} é maior que o primeiro número {}'.fo... |
####################################################
#
# Components applicable to all types of items
#
####################################################
# what type of item is this entity
# this is primarily used in iterable statements as a filter
class TypeOfItem:
def __init__(self, label=''):
self... |
def get_ages() -> list[int]:
with open('input.txt') as f:
line, = f.readlines()
return list(map(int, line.split(',')))
def step_day(ages: list[int]):
for i, age in enumerate(ages[:]):
age, *newborn = tick(age)
ages[i] = age
ages.extend(newborn)
def tick(age: int) -> list[... |
'''
Given an array of integers A sorted in non-decreasing order,
return an array of the squares of each number, also in sorted non-decreasing order.
Example 1:
Input: [-4,-1,0,3,10]
Output: [0,1,9,16,100]
Example 2:
Input: [-7,-3,2,3,11]
Output: [4,9,9,49,121]
Note:
1 <= A.length <= 10000
-10000 <= A[i] <= 1... |
tuple1 = ("apple", "banana", "cherry")
tuple2 = (1, 5, 7, 9, 3)
tuple3 = (True, False, False)
print(tuple1)
print(tuple2)
print(tuple3)
|
class Node:
def __init__(self,data):
self.data = data
self.previous = None
self.next = None
class removeDuplicates:
def __init__(self):
self.head = None
self.tail = None
def remove_duplicates(self):
if (self.head == None):
return
else:
... |
class Parameter:
def __init__(self, name: str, klass: str, data_member, required=True, array=False):
self._name = name
self._klass = klass
self._data_member = data_member
self._required = required
self._array = array
def __eq__(self, other):
return True if \
... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
"""Calculation history Class"""
class Calculations:
"""Calculation history Class"""
history = []
@staticmethod
def clear_history():
""" clear the history items"""
Calculations.history.clear()
return True
@staticmethod
def count_history():
""" get the length of h... |
fname = input('Enter the name of the file: ')
if(len(fname) < 1) : fname = 'clown.txt'
hand = open(fname)
di = dict()
for line in hand:
line = line.rstrip()
wds = line.split()
for w in wds:
##if not there, the count is zero
##if it is there, just add + 1
di[w] = di.get(w, 0) + 1
... |
class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
rows_to_zero = set()
cols_to_zero = set()
for row in range(len(matrix)):
for col in rang... |
def distinct(iterable, keyfunc=None):
seen = set()
for item in iterable:
key = item if keyfunc is None else keyfunc(item)
if key not in seen:
seen.add(key)
yield item |
'''
URL: https://leetcode.com/problems/binary-tree-level-order-traversal/
Difficulty: Medium
Description: Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree [3,9,20,null,null,15,7],
... |
def read_file():
content = open("C:/Users/DIPANSH KHANDELWAL/Desktop/Python Codes/PythonFiles/read_file/read_file.txt")
text = content.read()
print (text)
content.close()
read_file()
|
NAME='syslog'
CFLAGS = []
LDFLAGS = []
LIBS = []
GCC_LIST = ['syslog_plugin']
|
class DisjointSets(object):
"""A simple implementation of the Disjoint Sets data structure.
Implements path compression but not union-by-rank.
"""
def __init__(self, elements):
self.num_elements = len(elements)
self.num_sets = len(elements)
self.parents = {element: element for ... |
"""This module provides the client to make the connection with the given database."""
class DatabaseClient:
"""Initializes the connector with the DatabaseFactory object and provides a connector."""
def __init__(self, factory_obj) -> None:
"""
Initializes the factory object.
:factory_... |
#lambda is used to create an anonymous function (function with no name)
# It is an inline function that does not contain a return statement
a = lambda x: x*2
for i in range(1,6):
print(a(i)) |
def solve(a, b):
return a + b
def driver():
a, b = list(map(int, input().split(' ')))
result = solve(a, b)
print(solve(a, b))
return result
def main():
return driver()
if __name__ == '__main__':
main()
|
# Program to convert Miles to Kilometers
# Taking miles input from the user
miles = float(input("Enter value in miles: "))
# conversion factor
convFac = 0.621371
# calculate kilometers
kilometers = miles / convFac
print("%0.2f miles is equal to %0.2f kilometers" % (miles, kilometers))
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright © 2014-2016 NetApp, Inc. All Rights Reserved.
#
# CONFIDENTIALITY NOTICE: THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION OF
# NETAPP, INC. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR
# EXPRESS WRITTEN PERMISSION OF NETAPP, INC.
"""API Uti... |
def venda_mensal(*args):
telaCaixa = args[0]
telaMensal = args[1]
cursor = args[2]
QtWidgets = args[3]
data1 = telaMensal.data_mensal.text()
cursor.execute("select sum(qt_pizzas), sum(qt_esfihas), sum(qt_bebidas), sum(qt_outros), sum(total) from caixa where extract(year_month from data2) = %s ... |
class ApiException(Exception):
pass
class ResourceNotFound(ApiException):
pass
class InternalServerException(ApiException):
pass
class UserNotFound(ApiException):
pass
class Ratelimited(ApiException):
pass
class InvalidMetric(ApiException):
pass
class Authenti... |
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
arr = [0 for _ in range(len(nums))]
for num in nums:
arr[num - 1] += 1
ans = []
for i in range(len(arr)):
if arr[i] == 0:
ans.append(i + ... |
s = "abdcd"
count = 0
for vowelsItem in s:
if vowelsItem in "aeiou":
count += 1
print("Number of vowels: " + str(count)) |
# Python3 implementation to
# find first element
# occurring k times
# function to find the
# first element occurring
# k number of times
def firstElement(arr, n, k):
# dictionary to count
# occurrences of
# each element
count_map = {};
for i in range(0, n):
... |
rooms = int(input())
free_chairs = 0
game_on = True
for current_room in range(1, rooms + 1):
command = input().split()
chairs = len(command[0])
visitors = int(command[1])
if chairs > visitors:
free_chairs += chairs - visitors
elif chairs < visitors:
needed_chairs_in_room = visito... |
def main():
students = []
number_students = int(input())
while number_students > 0:
student = input()
students.append(student)
number_students -= 1
number_days = int(input())
all_missing_students = []
while number_days > 0:
curr_num_students = int(input())
... |
"""
Input Options
-------------
model_path : Input path to generated models - hdf5 file
input_catalog : Input catalog path
input_format : Input catalog format, see astropy.Table
documentation for available formats
z_col : Column name for source redshifts
ID_col : Column name for source IDs
flux_col_end... |
num = int(input('Digite um número: '))
op = int(input('''Escolha:
1 - Conversão binária;
2 - Conversão octal;
3 - conversão hexadecimal;
'''))
if op == 1:
binary = format(num, 'b')
print('Após escolher a opção {}, opnúmero {} em sua forma Binária equivale à {}'.format(op, num, binary))
elif op == 2:
octal =... |
def AAsInPeptideListCount(PeptidesListFileLocation):
PeptidesListFile = open(PeptidesListFileLocation, 'r')
Lines = PeptidesListFile.readlines()
PeptidesListFile.close
AminoAcidsCount = {'A':0, 'C':0, 'D':0, 'E':0,
'F':0, 'G':0, 'H':0, 'I':0,
'K':0, '... |
a = 25
b = 0o31
c = 0x19
print(a)
print(b)
print(c)
|
class MaxSparseList:
def __init__(self, firstMember, limit: int,
weight: callable = lambda x: x[0],
value: callable = lambda x: x[1]):
self.weight = weight
self.value = value
self.data = [firstMember]
self.limit = limit
return
def append... |
""" Python implementation of Paradox HD7X cameras (and future other modules)."""
class ParadoxModuleError(Exception):
"""Generic exception for Paradox modules."""
class ParadoxCameraError(ParadoxModuleError):
"""Generic exception for Camera modules."""
|
## Editing same list and then separating at the end
"""
# Definition for a Node.
class Node:
def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None):
self.val = int(x)
self.next = next
self.random = random
"""
class Solution:
def copyRandomList(self, head: 'Node') -> 'No... |
class RGBColor:
def __init__(self, r, g, b):
self.r = r
self.g = g
self.b = b
def __str__(self):
return "rgb({},{},{})".format(self.r, self.g, self.b)
def as_hex(self):
return HexColor("#%02x%02x%02x" % (self.r, self.g, self.b))
def as_cmyk(self):
k = m... |
class HightonConstants:
# is used for requests
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
DELETE = 'DELETE'
HIGHRISE_URL = 'highrisehq.com'
# Company
COMPANIES = 'companies'
COMPANY = 'company'
COMPANY_NAME = 'company-name'
COMPANY_ID = 'company-id'
# Case
KASES = 'kases... |
"""
we define a video object to record video information.
"""
# coding: utf-8
class Video:
"""
obj
"""
def __init__(self, video_id):
self.video_id = video_id
self.user_id = ''
self.title = ''
self.upload_time = '' # timestamp
self.avatar_path = ''
se... |
""" GLSL shader code to render bitmap glyphs.\
:download:`[source] <../../../litGL/glsl_bitmap.py>`
Author:
2020-2021 Nicola Creati
Copyright:
2020-2021 Nicola Creati <ncreati@inogs.it>
License:
MIT/X11 License (see
:download:`license.txt <../../../license.txt>`)
"... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def oddEvenList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head is None or head.next is None:
return ... |
class BraviaProtocol:
# def __init__():
# def makeQuery(self, parameters):
# queries = [];
# while parameters:
# if parameters[0] in self.protocol.keys():
# queries.append(self.protocol[parameters[0]] + "?")
# parameters = parameters[1:]
# retu... |
class Value():
def __init__(self):
self._value = None
def __set__(self, obj, value):
self._value = value
def __get__(self, obj, obj_type):
return self._value - obj.commission * self._value |
# Sieve of Eratosthenes Algorithm
def sieve(num):
'''
algorithm Sieve of Eratosthenes is
input: an integer n > 1.
output: all prime numbers from 2 through n.
let A be an array of Boolean values, indexed by integers 2 to n,
initially all set to true.
for i = 2, 3, 4, ..., not ex... |
# Given nums = [2, 7, 11, 15], target = 9,
# Because nums[0] + nums[1] = 2 + 7 = 9,
# return [0, 1].
# brute force - time complexity O(n^2)
def two_sum(list, target):
for f_index, f_value in enumerate(list):
for s_index, s_value in enumerate(list[f_index+1:]):
if (f_value + s_value) == target:... |
SECRET_KEY = 'XXX'
DEBUG=False
# API-specific
API_500PX_KEY = 'XXX'
API_500PX_SECRET = 'XXX'
API_RIJKS = 'XXX'
FLICKR_KEY = 'XXX'
FLICKR_SECRET = 'XXX'
# Database-specific
SQLALCHEMY_DATABASE_URI = 'postgresql://{}:{}@{}:{}/{}'.format('cctest',
'cctest',
... |
#!/usr/bin/env python3
"""Project Euler - Problem 17 Module"""
def problem17(limit):
"""Problem 17 - Number letter counts"""
# store known results
result = 0
for x in range(1, limit+1):
wl = 0
# thousends
t = int(x/THOUSAND)
if t > 0:
wl += len(LANGUAGE_DICT... |
_runs_on_key = "runs-on"
def execute(obj: dict) -> None:
default_runner = obj.get(_runs_on_key)
if not default_runner:
return
for job in obj.get("jobs", {}).values():
if _runs_on_key not in job:
job[_runs_on_key] = default_runner
# Clean up the left-overs
obj.pop(_run... |
class SisCheckpointSubstage(basestring):
"""
sis checkpoint sub-stage
Possible values:
<ul>
<li> "Sort_pass2" - Sorting the fingerprints for deduplication
</ul>
"""
@staticmethod
def get_api_name():
return "sis-checkpoint-substage"
|
# **args
def save_user(**user):
print(user['name'])
#**user retorna um dict
save_user(id=1, name='admin') |
class Service(object):
class Version(object):
def __init__(self, number, created_at, updated_at, deleted_at):
self.number = number
self.created_at = created_at
self.updated_at = updated_at
self.deleted_at = deleted_at
def __init__(self, id, name, versi... |
# keys TabbinPoint
OFFSET_DX = 'OFFSET_DX' # DOUBLE
OFFSET_DY = 'OFFSET_DY' # DOUBLE
OFFSET_DZ = 'OFFSET_DZ' ... |
# -*- coding: utf-8 -*-
"""
TSPL - TimScriptProgrammingLanguage
A simple programming language and interpreter in python
- more of a learning device than a practical use language
Created on Sat May 9 20:24:51 2020
@author: tim_s
"""
class Exp:
""" An expression to be evaluated
can put default... |
# Tests Python 3.5+'s ops
# BINARY_MATRIX_MULTIPLY and INPLACE_MATRIX_MULTIPLY
# code taken from pycdc tests/35_matrix_mult_oper.pyc.src
m = [1, 2] @ [3, 4]
m @= [5, 6]
|
apple=map(int,input().split())
high=int(input())+30
sum=0
for i in apple:
if i<=high:sum+=1
print(sum) |
TEST = """initial state: #..#.#..##......###...###
...## => #
..#.. => #
.#... => #
.#.#. => #
.#.## => #
.##.. => #
.#### => #
#.#.# => #
#.### => #
##.#. => #
##.## => #
###.. => #
###.# => #
####. => #
""".splitlines()
def read_lines():
with open('input.txt', 'r') as f:
return [l.strip() for l in f.re... |
# -*- coding: utf-8 -*-
SYSTEM = "O"
USER = "I"
TYPE_CHAT = (
(SYSTEM, u'Gozokia'),
(USER, u'User'),
)
|
class FluidSettings:
type = None
|
class AtbashCipher:
def encrypt(self, string):
lst = []
for elem in string.lower():
if elem.isalpha():
lst+=chr(219-ord(elem))
else:
lst+=[elem]
return ''.join(lst).lower()
def decrypt(self, string):
return self.encrypt(str... |
def forward(t):
t.penup()
t.forward(3)
def no_draw_forward(t):
t.pendown()
t.forward(3)
axiom = 'A'
n = 5
subs = {
'A': 'ABA',
'B': 'BBB'
}
graphics = {
'A': lambda t: forward(t),
'B': lambda t: no_draw_forward(t)
}
|
_base_ = "./FlowNet512_1.5AugCosyAAEGray_Aggressive_Flat_Pbr_01_ape.py"
OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_Aggressive_Flat_lmPbr_SO/benchvise"
DATASETS = dict(TRAIN=("lm_pbr_benchvise_train",), TEST=("lm_real_benchvise_test",))
# bbnc7
# objects benchvise Avg(1)
# ad_2 10.77 10... |
class ChannelLengthException(Exception):
'''channel searched is more than 16 characters
use with the command line functions
'''
pass
class ChannelCharactersException(Exception):
'''
it should not contain characters that cannot be used in a channel
'''
pass
class ChannelQuote... |
# Algorithm: Longest monotonic subsequence
# Overall Time Complexity: O(n^2).
# Space Complexity: O(n).
# Author: https://www.linkedin.com/in/kilar.
def monotonic_subsequence(arr):
Dict = {}
maximum = 0
for i in range(len(arr)):
Dict[i] = [arr[i]]
for j in range(i + 1, len(arr)):
... |
class ArticleCandidate:
"""This is a helpclass to store the result of an article after it was extracted. Every implemented extractor
returns an ArticleCanditate as result.
"""
url = None
title = None
description = None
text = None
topimage = None
author = None
publish_date = None... |
class Record:
def __init__(self, row_id):
self.row_id = row_id
class Table:
lookup_table = {}
@classmethod
def get_record(cls, row_id: int) -> Record:
"""
if row_id not in cls.lookup_table,
instantiate Record object on the fly.
"""
if row_id not in cls.... |
#!/usr/bin/env python3
# Количество программ с обязательным и избегаемым этапами
c = 0
def run(n, w10=False, w16=False):
global c
if n == 10:
w10 = True
if n == 16:
w16 = True
if n > 21:
return
elif n == 21:
if w10 and not w16:
c += 1
else:
run(n + 1, w10, w16)
run(n * 2, w10, w16)
run(1)
print(c)... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
def hangman(word):
wrong = 0
stages = ["",
"________ ",
"| ",
"| | ",
"| 0 ",
"| / | \ ",
"| / \ ",
"... |
class Solution:
def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
red = 0
white = 0
blue = 0
for i in nums:
if i == 0:
red += 1
elif i == 1:
wh... |
# p43.py
str1 = input().split()
str1.reverse()
def exp():
s = str1.pop()
if s[0] == '+':
return exp() + exp()
elif s[0] == '-':
return exp() - exp()
elif s[0] == '*':
return exp() * exp()
elif s[0] == '/':
return exp() / exp()
else:
retur... |
#!/usr/bin/env python3
# calculate path of lowest risk
# use Dijkstra algorithm
risk = []
with open('input', 'r') as data:
lines = data.readlines()
for line in lines:
risk.append([int(l) for l in line.strip()])
# prepare nodes
# we might get up with x <-> y again...
graph = []
for y in range... |
stack = []
stack.append("Moby Dick")
stack.append("The Great Gatsby")
stack.append("Hamlet")
stack.pop()
stack.append("The Iliad")
stack.append("Pride and Prejudice")
stack.pop()
stack.append("To Kill a Mockingbird")
stack.append("Gulliver's Travels")
stack.append("Don Quixote")
stack.pop()
stack.pop()
stack.pop()
stac... |
MOCK_PLAYER = {
"_id": 1234,
"uuid": "2ad3kfei9ikmd",
"displayname": "TestPlayer123",
"knownAliases": ["1234", "test", "TestPlayer123"],
"firstLogin": 123456,
"lastLogin": 150996,
"achievementsOneTime": ["MVP", "MVP2", "BedwarsMVP"],
"achievementPoints": 300,
"achievements": {"bedwar... |
# -*- coding: utf-8 -*
INN_TEST_WEIGHTS_10 = (2, 4, 10, 3, 5, 9, 4, 6, 8, 0)
INN_TEST_WEIGHTS_12_0 = (7, 2, 4, 10, 3, 5, 9, 4, 6, 8, 0, 0)
INN_TEST_WEIGHTS_12_1 = (3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8, 0)
def test_inn_org(inn):
""" returns True if inn of the organisation pass the check
"""
if len(inn) != 10:... |
class Solution:
def XXX(self, root: TreeNode) -> int:
self.maxleftlength = 0
self.maxrightlength = 0
return self.dp(root)
def dp(self,root):
if(root is None):
return 0
self.maxleftlength = self.dp(root.left)
self.maxrightlength = self.d... |
{'application':{'type':'Application',
'name':'GuiPyBlog',
'backgrounds': [
{'type':'Background',
'name':'bgTextRouter',
'title':'TextRouter 0.60',
'size':(650, 426),
'statusBar':1,
'icon':'tr.ico',
'style':['resizeable'],
'menubar': {'ty... |
"""
Given a string of numbers and operators, return all possible results from computing
all the different possible ways to group numbers and operators. The valid operators
are +, - and *.
Input: "2-1-1".
((2-1)-1) = 0
(2-(1-1)) = 2
Time complexity of this algorithm is Catalan number.
"""
def way_to_compute(input):
... |
WARNING_HEADER = '[\033[1m\033[93mWARNING\033[0m]'
def warning_message(message_text):
print('{header} {text}'.format(header=WARNING_HEADER, text=message_text))
|
class WebsocketError(Exception):
pass
class NoTokenError(WebsocketError):
pass
|
a,b=0,1
while b<10:
print(b)
a,b=b,a+b
|
# while loops
"""
a = 1
b = 10
while a < b:
print(a) #will go on forever
"""
# Docstringed loop above. Uncomment to see an infinite loop
# then kill it or wait for Python to reach an error
a = 1
b = 10
while a < b:
print(a)
a = a +1 # Now it will stop
# Bonus: calculate the iterations before this sto... |
def thank_you(donation):
if donation >= 1000:
print("Thank you for your donation! You have achieved platinum donation status!")
elif donation >= 500:
print("Thank you for your donation! You have achieved gold donation status!")
elif donation >= 100:
print("Thank you for your donation! You have achiev... |
'''
This file holds all the constants that are required for programming the LIS3DH
including register addresses and their values
'''
'''
The LIS3DH I2C address
'''
LIS3DH_I2C_ADDR = 0x18
'''
The LIS3DH Register Map
'''
#0x00 - 0x06 - reserved
STATUS_REG_AUX = 0x07
OUT_ADC1_L = 0x08... |
def moveDictionary():
electro_shock = {"Name" : "Electro Shock", \
"Kind" : "atk",\
"Pwr" : 25, \
"Acc" : 95, \
"Crit" : 80, \
"Txt" : "releases one thousand volts of static"}
#special ... |
sv = float(input('Salaria? R$'))
sn = sv + (sv * 15 / 100)
print('salario antigo R${:.2f}\nCom 15% de aumento\nsalário novo R${:.2f}'.format(sv, sn))
|
"""
limis management - messages
Messages used for logging and exception handling.
"""
COMMAND_CREATE_PROJECT_RUN_COMPLETED = 'Completed creating limis project: "{}".'
COMMAND_CREATE_PROJECT_RUN_ERROR = 'Error creating project in directory: "{}".\nError Message: {}'
COMMAND_CREATE_PROJECT_RUN_STARTED = 'Creating limis ... |
class Solution:
def rob(self, nums):
robbed, notRobbed = 0, 0
for i in nums:
robbed, notRobbed = notRobbed + i, max(robbed, notRobbed)
return max(robbed, notRobbed)
|
# Common package prefixes, in the order we want to check for them
_PREFIXES = (".com.", ".org.", ".net.", ".io.")
# By default bazel computes the name of test classes based on the
# standard Maven directory structure, which we may not always use,
# so try to compute the correct package name.
def get_package_name():
... |
numbers = [int(i) for i in input().split(" ")]
opposite_numbers = []
for current_num in numbers:
if current_num >= 0:
opposite_numbers.append(-current_num)
elif current_num < 0:
opposite_numbers.append(abs(current_num))
print(opposite_numbers) |
def finder(data, x):
if x == 0:
return data[x]
v1 = data[x]
v2 = finder(data, x-1)
if v1 > v2:
return v1
else:
return v2
print(finder([0, -247, 341, 1001, 741, 22])) |
def extractStrictlybromanceCom(item):
'''
Parser for 'strictlybromance.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('grave robbers\' chronicles', 'grave robbers\' chronicles', ... |
class Solution:
def largestTimeFromDigits(self, nums: List[int]) -> str:
res=[]
def per(depth):
if depth==len(nums)-1:
res.append(nums[:])
for i in range(depth,len(nums)):
nums[i],nums[depth]=nums[depth],nums[i]
... |
def fbx_references_elements(root, scene_data):
"""
Have no idea what references are in FBX currently... Just writing empty element.
"""
docs = elem_empty(root, b"References")
|
EPS = 1.0e-16
PI = 3.141592653589793
|
#all binary
allSensors = ['D021', 'D022', 'D023', 'D024',
'D025', 'D026', 'D027', 'D028', 'D029', 'D030', 'D031', 'D032', 'M001',
'M002', 'M003', 'M004', 'M005', 'M006', 'M007', 'M008', 'M009', 'M010',
'M011', 'M012', 'M013', 'M014', 'M015', 'M016', 'M017', 'M018', 'M019',
'M020']
doorSens... |
f = [1, 1, 2, 6, 4]
for _ in range(int(input())):
n = int(input())
if n <= 4:
print(f[n])
else:
print(0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.