content stringlengths 7 1.05M |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def menu(food, **meal):
print(f"Food: {food}")
for meal, name in meal.items():
print(f"{name}")
if __name__ == '__main__':
menu(
"Прием пищи",
breakfast="Блинчики с творогом",
dinner="Суп с грибами",
supper="Рыба с ово... |
# define a function that display the output heading
def output_heading():
print('Programmer: Emily')
print('Course: COSC146')
print('Lab#: 0')
print('Due Date: 02-19-2019')
#define a function that takes a number and returns that number + 10
def plus10(value):
... |
class Codec:
url_list = []
def encode(self, longUrl):
self.url_list.append(longUrl)
return len(self.url_list) - 1
def decode(self, shortUrl):
return self.url_list[shortUrl]
if __name__ == '__main__':
codec = Codec()
print(codec.decode(codec.encode('xxxxx')))
print(c... |
class BaseEndpoint():
def __repr__(self):
return f'<metrics.tools Endpoint [{self.endpoint}]>'
if __name__ == '__main__':
pass |
"""
Given a pattern and a string str, find if str follows the same pattern.
Here follow means a full match, such that there is a bijection between a
letter in pattern and a non-empty word in str.
Example:
Input: pattern = "abba", str = "dog cat cat dog"
Output: true
Example:
Input:pa... |
tupla = ('un','deux','trois','quatre','cinq')
n = int(input('Choisissez un chiffres de 1 à 5: '))
while n < 1 or n > 5:
n = int(input('Réponse invalide. Choisissez un chiffres de 1 à 5: '))
print('Vouz avez choisi le chiffres',tupla[n-1])
|
s = input()
start = s.find('A')
stop = s.rfind('Z')
print(stop - start + 1)
|
# ~autogen spec_version
spec_version = "spec: 0.9.3-pre-r2, kernel: v3.16.7-ckt16-7-ev3dev-ev3"
# ~autogen
|
def sol():
N = int(input())
string = input()
count = 0
while N > 0:
count += int(string[N - 1])
N -= 1
print(count)
if __name__ == "__main__":
sol()
|
# list
a = 'orange'
print(a[::-1])
print(a[1:4:2])
b = [1,2,3,34,5, 1]
print(b.count(1))
|
N = int(input())
A, B = map(int, input().split())
counts = [0, 0, 0]
P = map(int, input().split())
for p in P:
if p <= A:
counts[0] += 1
elif p <= B:
counts[1] += 1
else:
counts[2] += 1
print(min(counts))
|
#!/bin/python3
print("Status: 200")
print("Content-Type: text/plain")
print()
print("Hello World!")
|
color = {
"black":(0, 0, 0, 255), "white":(255, 255, 255, 255),
"red":(255, 0, 0, 255), "green":(0, 255, 0, 255),
"blue":(0, 0, 255, 255), "yellow":(255, 255, 0, 255),
"cyan":(0, 255, 255, 255), "magenta":(255, 0, 255, 255),
"silver":(192, 192, 192, 255), "gray":(128, 128, 128, 255),
"maroon":(1... |
_base_ = [
'../_base_/models/fast_scnn.py', '../_base_/datasets/pascal_escroom.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
# Re-config the data sampler.
data = dict(samples_per_gpu=2, workers_per_gpu=4)
# Re-config the optimizer.
optimizer = dict(type='SGD', lr=0.12, momentum... |
NBA_GAME_TIME = 48
def nba_extrap(points_per_game: float, minutes_per_game: float) -> float:
if minutes_per_game < 0.001:
return 0.0
else:
return round(points_per_game/minutes_per_game * NBA_GAME_TIME, 1) |
'''
num = int(input('Digite um valor: '))
listaNum = [num]
print('Adicionado na posição 0 da lista...')
for cont in range(1, 5):
num = int(input('Digite um valor: '))
if num <= min(listaNum):
listaNum.insert(0, num)
print('Adicionado na posição 0 da lista...')
elif num >= max(listaNum):
... |
#!/usr/bin/python3
class Humano:
# atributo de classe
especie = 'Homo Sapiens'
def __init__(self, nome):
self.nome = nome
def das_cavernas(self):
self.especie = 'Homo Neanderthalensis'
return self
if __name__ == '__main__':
jose = Humano('José')
grokn = Humano('Grok... |
#!/usr/bin/env python3
# Common physical "constants"
# Universal gas constant (J/K/mol)
R_gas = 8.3144598
# "Standard gravity": rate of gravitational acceleration at Earth's surface (m/s2)
g0 = 9.80665
# Avogadro's number (molec/mol)
avog = 6.022140857e23
# Molar mass of dry air (g/mol)
MW_air = 28.97
# Radius o... |
# Write programs that read a sequence of integer inputs and print
# a. The smallest and largest of the inputs.
# b. The number of even and odd inputs.
# c. Cumulative totals. For example, if the input is 1 7 2 9, the program should print
# 1 8 10 19.
# d. All adjacent duplicates. For example, if the ... |
def check_palindrome(str):
return str == str[::-1]
print(check_palindrome('palpa'))
print(check_palindrome('radar')) |
# coding=utf8
# Copyright 2018 JDCLOUD.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.0
#
# Unless required by applicable law or agreed ... |
# Copyright 2017 The Forseti Security 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 ap... |
def write(_text):
return 0
def flush():
pass
def _emit_ansi_escape(_=''):
def inner(_=None):
pass
return inner
clear_line = _emit_ansi_escape()
clear_end = _emit_ansi_escape()
hide_cursor = _emit_ansi_escape()
show_cursor = _emit_ansi_escape()
factory_cursor_up = lambda _: _emit_ansi_esca... |
class Solution(object):
def computeArea(self, A, B, C, D, E, F, G, H):
"""
:type A: int
:type B: int
:type C: int
:type D: int
:type E: int
:type F: int
:type G: int
:type H: int
:rtype: int
"""
rec1 = (C - A) * (D - B)
... |
fibona = 89
anterior = 34
while fibona > 0:
print(fibona)
fibona -= anterior
anterior = fibona - anterior
if fibona == 0:
print(fibona) |
def search(blocking, requester, task, keyword, tty_mode):
# the result of the task the hub thread submitted to us
# will not be available right now
task.set_async()
blocking.search_image(requester, task.return_result, keyword, tty_mode)
|
class Solution:
def getRow(self, rowIndex: int) -> List[int]:
n=rowIndex
if n==0:
return [1]
if n==1:
return [1,1]
arr=[[1],[1,1]]
k=1
for i in range(2,n+1):
arr.append([])
arr[i].append(1)
for j in range(1,k... |
class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
y = 0
xx = x
while x != 0:
t = x % 10
y = y * 10 + t
x = x // 10
return y == xx
|
def kangaroo(x1, v1, x2, v2):
while (True):
if (x2 > x1 and v2 >= v1) or (x2 < x1 and v2 <= v1):
print('NO')
return 'NO'
x1 += v1
x2 += v2
if x1 == x2:
print('YES')
return 'YES' |
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
nums.sort()
result = float("inf")
for i in range(len(nums) - 2):
l, r = i + 1, len(nums) - 1
while l < r:
s = nums[i] + nums[l] + nums[r]
if s == target:
... |
print("Hours in a year =")
print(24*365)
print("Minutes in a decade =")
print(60*24*365*10)
print("My age in seconds =")
print((365*27+6+2+31+30+31+30+16)*24*1440)
print("Andreea's age =")
print(48618000/(365*24*1440))
print("?!")
print(1<<2)
# ** = ^
# << = bitshift
# % = modulus
print('Hello world')
print('')
p... |
terminalfont = {
"width": 6,
"height": 8,
"start": 32,
"end": 127,
"data": bytearray([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x5F, 0x06, 0x00,
0x00, 0x07, 0x03, 0x00, 0x07, 0x03,
0x00, 0x24, 0x7E, 0x24, 0x7E, 0x24,
0x00, 0x24, 0x2B, 0x6A, 0x12, 0x00,
0x00, 0x63, 0x13, 0x08, 0x64, 0x63,
0x00, 0x36, 0x49,... |
# Einfache Rechenoperationen
# Addition und Subtraktion
1 + 2
1 - 2
# Multiplikation und Division
1 * 2
1 / 2
# Rechenregeln
(1 + 2) * 3
1 + 2 * 3
print("Hello World!") |
def build_model_filters(model, query, field):
filters = []
if query:
# The field exists as an exposed column
if model.__mapper__.has_property(field):
filters.append(getattr(model, field).like("%{}%".format(query)))
return filters
|
test = {
'name': 'Problem 9',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (lambda (x y) (+ x y))
d579a305762000c8ae036c510fb2baf6
# locked
""",
'hidden': False,
'locked': True
},
{
'code... |
"""
Codemonk link: https://www.hackerearth.com/problem/algorithm/little-monk-and-goblet-of-fire-3c1c6865/
Albus Dumbledore announced that the school will host the legendary event known as Wizard Tournament where four magical
schools are going to compete against each other in a very deadly competition by facing some da... |
count=0
num=336
for i in range(2,num+1):
while num%i==0:
num=num//i
if i == 2:
count=count+1
print(count)
'''
num=32546845
count=0
while num>0:
digit=num%10
num=num//10
if digit%2==0:
count=count+1
print(count)
'''
'''
count=0
for i in range(1,101):
while i%5==... |
n=int(input())
for i in range(n):
D = dict()
for j in range(ord('a'),ord('z')+1):
D[j] = 0
a=input()
a=a.lower()
for j in a:
if ord('a') <= ord(j) <=ord('z'):
D[ord(j)] += 1
num = min(D.values())
print("Case {}:".format(i+1),end=" ")
if num == 0:
... |
GAME_RESET = "on_reset"
GOAL_SCORED = "on_goal_scored"
START_PENALTY = "on_penalty_start"
END_PENALTY = "on_penalty_end"
|
#!/bin/python3
__author__ = "Adam Karl"
"""Find the sum of all numbers below N which divide the sum of the factorial of their digits"""
#https://projecteuler.net/problem=34
digitFactorials = []
def sumCuriousNumbersUnderN(n):
"""Return a sum of all numbers that evenly divide the sum of the factorial of their dig... |
array = [1,2,3,4]
result = [24,12,8,6]
def product_except_itself_2(nums):
output = []
L = []
R = []
temp = 1
for x in nums:
L.append(temp)
temp = temp * x
temp = 1
for y in nums[::-1]:
R.append(temp)
temp = temp * y
for i in range(len(R)):
ou... |
# UUU F CUU L AUU I GUU V
# UUC F CUC L AUC I GUC V
# UUA L CUA L AUA I GUA V
# UUG L CUG L AUG M GUG V
# UCU S CCU P ACU T GCU A
# UCC S CCC P ACC T GCC A
# UCA S CCA P ACA T GCA A
# UCG S CCG P ACG T ... |
DB_PATH = 'assets/survey_data.db'
REVIEWS_PATH = 'static/files/reviews.csv'
QUESTIONS_PATH = 'static/files/questions.csv'
USER_TABLE = 'users'
STMT_USER_TABLE = f'''CREATE TABLE IF NOT EXISTS {USER_TABLE}
(netid int PRIMARY KEY, age int, internet_use int)'''
REVIEWS_TABLE = 'reviews'
STMT_REVIEWS_TA... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isBalanced(self, root: TreeNode) -> bool:
if self.height(root) is None:
return False... |
# 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 cloc():
http_archive(
name="cloc" ,
build_file="//bazel/deps/cloc:build.BUILD" ,
sha256="da1a0de6d8ce2f4e80fa7... |
valid_names = ["Danilo", "Daniel", "Dani"]
class NameError(Exception): pass
def handler(event, context):
name = event.get("name",None)
if name:
if name in valid_names:
return event
else:
raise NameError("WrongName")
else:
raise NameError("NoName")
|
class SparseTable:
def __init__(self,array,func):
self.array = array
self.func = func
self._log = self._logPreprocess()
self.sparseTable = self._preprocess()
def _logPreprocess(self):
n = len(self.array);
_log = [0] * (n+1)
for i in range(2,n+1):
_log[i] = _log[n//2] + 1
return _log
def _pre... |
class SampleNotMatchedError(Exception):
pass
class InvalidRangeError(Exception):
pass
|
cat=int(input("Ingrese la categoria del trbajdor: "))
suel=int(input("Ingrese el sueldo bruto del trabajador: "))
if(cat==1):
suelt1=suel* 0.10
suelt= suelt1+suel
print("Categoria: " +str(cat))
print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP")
elif(cat==2):
suelt1=suel* 0.15
... |
Train_0 = ['P26', 'P183', 'P89', 'P123', 'P61', 'P112', 'P63', 'P184', 'P100', 'P11', 'P111', 'P28', 'P192', 'P35',
'P27', 'P113', 'P33', 'P17', 'P126', 'P176', 'P46', 'P44', 'P137', 'P13', 'P74', 'P134', 'P128', 'P0',
'P157', 'P161', 'P163', 'P38', 'P190', 'P12', 'P115', 'P122', 'P144', 'P15', 'P... |
def registry_metaclass(storage):
class RegistryMeta(type):
def __init__(cls, name, bases, attrs):
super(RegistryMeta, cls).__init__(name, bases, attrs)
id = getattr(cls, 'id', None)
if not id:
return
if id in storage:
raise Ke... |
class Solution:
def findSubstringInWraproundString(self, p):
res, l = {i: 1 for i in p}, 1
for i, j in zip(p, p[1:]):
l = l + 1 if (ord(j) - ord(i)) % 26 == 1 else 1
res[j] = max(res[j], l)
return sum(res.values()) |
# TODO: Turn this into a generator?
def get_tiles(image, tile_size):
"""Splits an image into multiple tiles of a certain size"""
tile_images = []
x = 0
y = 0
while y < image.height:
im_tile = image.crop((x, y, x+tile_size, y+tile_size))
tile_images.append(im_tile)
if x < i... |
# day_1/vars.py
# <-- This symbol makes a line a comment
""" <-- These make a multi line comment. Both typs of comments are ignored by
python. But you need to close multiline comments --> """
"""
The first thing we should talk about is how to get output out of your program.
In python we use the print function. Yo... |
def return_decoded_value(value):
if type(value) is bytes:
value = value.decode('utf-8')
elif type(value) is not str:
value = value.decode("ascii", "ignore")
else:
value = value
return value.strip('\r\n')
|
f=open("input.txt")
Input = f.read().split("\n")
f.close()
x=0
y=0
count=0
while(y < len(Input)):
count += Input[y][x%len(Input[0])] == "#"
x += 3
y += 1
print(count)
|
# https://www.codewars.com/kata/52fba66badcd10859f00097e
def disemvowel(str):
return "".join(filter(lambda c: c not in "aeiouAEIOU", str))
print(disemvowel("This website is for losers LOL!"))
|
def doSomethingWithString(str):
print(" Input is "+str, end = '\n')
split = str.split(" ")
print(split)
split.pop(2)
print(split)
def secondFun():
s = [10,20]
x = [20,30]
return s, x
x = 10
y = 11.2
dict = {1:'Alfa', 2:'Beta'}
k = "A sample approach"
doSomethingWithString(k)
x, y = s... |
# If you want to print something customized in your terminal
# Use my custom color and fonts styles in order to print wyw
# Refer to it with this kind of formation and formulation:
# Example:
# customization.color.BOLD + "String" + customization.color.END
class Colors:
# String to purple color
PURPLE = '\033[9... |
with open('DOCKER_VERSION') as f:
version = f.read()
with open('DOCKER_VERSION', 'w') as f:
major, minor, patch = version.split('.')
patch = int(patch) + 1
f.write('{}.{}.{}\n'.format(major, minor, patch))
|
'''
Created on Feb 8, 2017
@author: PJ
'''
class TempRetrofillSrFromOfficialResults:
def populate_sr(self, **kargs):
return kargs
def save_sr(self, score_result_type, match, team, **kargs):
sr_search = score_result_type.objects.filter(match=match, team=team)
if len(sr_search) == 0... |
lista = []
pares = []
impar = []
for i in range(20):
lista.append(int(input("Digite um numero: ")))
for i in lista:
if i % 2 == 0:
pares.append(i)
else:
impar.append(i)
print(f"Lista = {lista}")
print(f"Pares = {pares}")
print(f"impar = {impar}") |
'''
Created on 2015年12月4日
given [1, [2,3], [[4]]], return sum. 计算sum的方法是每向下一个level权重+1,
例子的sum = 1 * 1 + (2 + 3) * 2 + 4 * 3。follow up:每向下一个level 权重 - 1, sum = 3 * 1 +(2 + 3)* 2 + 4 * 1
@author: Darren
'''
def levelSum(string):
pass
print(levelSum("[1, [2,3], [2,3],[[4]]]") ) |
sehirler=['Adana','Gaziantep']
plakalar=[1,27]
print(plakalar[sehirler.index('Gaziantep')])
plakalar={'Adana':1,'Gaziantep':27}
print(plakalar['Gaziantep'])
plakalar['Ankara']=6
print(plakalar)
users={'SudeSezen':{
'age':36,
'roles':['user'],
'email':'aaaaa@aa.com',
'address':'KOMPLE... |
# Queue using Two Stacks
# Create a queue data structure using two stacks.
#
# https://www.hackerrank.com/challenges/queue-using-two-stacks/problem
#
in_stack = []
out_stack = []
for _ in range(int(input())):
op = list(map(int, input().split()))
# push back
if op[0] == 1:
in_stack.append(op[1])
... |
class HxCType(object):
"""
Enum and static methods for manipulating the C type defined by
HexRays. This is a wrapper on top of the ``ctype_t`` enum: ``cot_*``
are for the expresion (``cexpr_t`` in ida, :class:`HxCExpr` in bip )
and ``cit_*`` are for the statement (``cinsn_t`` in ida... |
#list of group members
#MATSIKO BRUNO 2020/BSE/165/PS
#DAVID NYAMUTALE 2020/BSE/057/PS
#MAWANDA DENNIS 2020/BSE/155/PS
#AKANDWANAHO NICKSON 2020/BSE/006/PS
# strt with an empty list
list_of_items_to_capture = []
#create a loop for capturing values
random_number = 1
while random_number == 1:
inputedV... |
class TrieNode:
def __init__(self):
self.val = None
self.children = [None] * 26
class MapSum:
def __init__(self):
self.root = TrieNode()
def insert(self, key: str, val: int) -> None:
p = self.root
for c in key:
offset_c = ord(c) - 97
... |
# -*- python -*-
"""@file
@brief crc8 calculator for Pato packets
Copyright (c) 2014-2015 Dimitry Kloper <kloper@users.sf.net>.
All rights reserved.
@page License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redist... |
def int_to_Roman(num):
val = [
1000, 900, 500, 400,
100, 90, 50, 40,
10, 9, 5, 4,
1
]
syb = [
"M", "CM", "D", "CD",
"C", "XC", "L", "XL",
"X", "IX", "V", "IV",
"I"
]
roman_num = ''
i = 0
while num > 0: # girilen sayı 0 d... |
__all__ = ('InvalidOption')
class InvalidOption(Exception):
"""
Raises when user call methods
with incorrect arguments.
"""
|
class PolydatumException(Exception):
pass
class ServiceError(PolydatumException):
code = 500
class NotFound(ServiceError):
code = 404
class ErrorsOnClose(PolydatumException):
"""
Deprecated 0.8.4 as Resources errors on exit
are suppressed
"""
def __init__(self, message, exceptions)... |
# Created from ttf-fonts/Entypo.otf with freetype-generator.
# freetype-generator created by Meurisse D ( MCHobby.be ).
Entypo_23 = {
'width' : 0x16,
'height' : 0x17,
33:( 0x800000, 0x980000, 0xbc0000, 0xbe0000, 0xbe0000, 0xbc0000, 0xbc0000, 0x9c0000, 0x9e0000, 0x8f0000, 0x8f8000, 0x87c600, 0x83ef00, 0x81ff80, 0x807f8... |
class AndroidKey:
# Key code constant: Unknown key code.
UNKNOWN = 0
# Key code constant: Soft Left key.
# Usually situated below the display on phones and used as a multi-function
# feature key for selecting a software defined function shown on the bottom left
# of the display.
SOFT_LEFT =... |
class Fracao():
def __init__(self, n,d): # inicializa o numerador e denominador
try:
if d != 0:
self.n = n
self.d = d
else:
raise Exception
except Exception:
print('zero nao')
def __add__(self, other): # sobrescreve +
d = self.d * other.d
n = self.n * other.d + other.n * self.d
return... |
def value_matcher(value):
if value.type.tag == "rat64": return Rat64Printer(value)
return None
class Rat64Printer(object):
def __init__(self, value):
self.value = value
def to_string(self):
numerator = self.value["numerator"]
denominator = self.value["denominator"]
return str(numerator) + "/" +... |
def fn():
print('Generate cache')
cache = {}
def get_from_cache(key):
res = cache.get(key)
if res:
print('From cache')
return res
else:
print('Calculate and save')
res = 'value ' + str(key)
cache[key] = res
return get_fr... |
def __get_ints(line: str) -> list[int]:
strings = line.strip().split(' ')
return list(map(lambda x: int(x), strings))
def read_case_from_file(file_path: str) -> tuple[list[int], list[int]]:
with open(file_path, 'r') as file:
lines = file.readlines()
assert len(lines) == 4
ranks = ... |
'''
The count-and-say sequence is the sequence of integers with the first five terms as following:
1. 1
2. 11
3. 21
4. 1211
5. 111221
1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.
Given an integer n where 1 ≤ n ≤ 30, generate the n... |
#
# PySNMP MIB module CMM4-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CMM4-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:09:18 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, 09:23:1... |
class SampleSheetError(Exception):
"""An exception raised when errors are encountered with a sample sheet.
Examples include when a sample sheet can't be parsed because it's garbled, or
if IRIDA rejects the creation of a run because fields are missing or invalid
from the sample sheet.
"""
def __... |
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""File's labels and properties."""
class TransformationCSVFields(object):
"""To transformation fields of CSV files."""
# pylint: disable=too-few-public-methods
REVISION_DATE = "Revision Date"
|
class Container:
"""A container that holds objects.
This is an abstract class. Only child classes should be instantiated.
"""
def add(self, item):
"""Add <item> to this Container.
@type self: Container
@type item: Object
@rtype: None
"""
raise NotImple... |
""" Package exception types """
__all__ = ["FileFormatError", "AliasError", "UndefinedAliasError"]
class FileFormatError(Exception):
""" Exception for invalid file format. """
pass
class AliasError(Exception):
""" Alias related error. """
pass
class UndefinedAliasError(AliasError):
""" Alias ... |
class Solution:
def nextPermutation(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
Array.
Running time: O(n) where n == len(nums).
"""
if not nums:
return None
n = len(nums)
p = n - 1
whi... |
# visible_spectrum.py
# 2021-05-27 version 1.2
# Copyright 2021 Cedar Grove Studios
# Spectral Index to Visible (Rainbow) Spectrum RGB Converter Helper
# Based on original 1996 Fortran code by Dan Bruton:
# physics.sfasu.edu/astro/color/spectra.html
def index_to_rgb(index=0, gamma=0.5):
"""
Converts a spectr... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#生成基本json模板
outbound={
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "",
"port": 0,
"users": [
{
... |
# ----------------------------------------------------------------------------
# Copyright (c) 2022, Franck Lejzerowicz.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------... |
"""
Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, m... |
''' Creating a class
Created with the keyword class followed by a name,
Common practice is to make the names Pascal Casing: Example
''' |
__all__ = [
"accuracy",
"confusion_matrix",
"multi_class_acc",
"top_k_svm",
"microf1",
"macrof1",
]
|
def add_native_methods(clazz):
def init__java_lang_String__boolean__(a0, a1):
raise NotImplementedError()
def indicateMechs____():
raise NotImplementedError()
def inquireNamesForMech____(a0):
raise NotImplementedError()
def releaseName__long__(a0, a1):
raise NotImpleme... |
class PyVeeException(Exception):
pass
class InvalidAddressException(PyVeeException):
pass
class InvalidParameterException(PyVeeException):
pass
class MissingPrivateKeyException(PyVeeException):
pass
class MissingPublicKeyException(PyVeeException):
pass
class MissingAddressException(PyVeeEx... |
# test builtin type
print(type(int))
try:
type()
except TypeError:
print('TypeError')
try:
type(1, 2)
except TypeError:
print('TypeError')
# second arg should be a tuple
try:
type('abc', None, None)
except TypeError:
print('TypeError')
# third arg should be a dict
try:
type('abc', (), N... |
# The MIT License (MIT)
# Copyright (c) 2021 Ian Buttimer
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... |
indexes = [(row, col) for row in range(5) for col in range(5)]
class Board:
def __init__(self, board: list[list[tuple[int, bool]]]) -> None:
self.board = board
self.done = False
def set(self, n: int):
if self.done:
return True
for row, col in indexes:
... |
#annapolis
latitude = 38.9784
# longitude = -76.4922
longitude = 283.5078
height = 13 |
# C++ implementation to convert the
# given BST to Min Heap
# structure of a node of BST
class Node:
# Constructor to create a new node
def __init__(self, data):
self.data = data
self.left = None
self.right = None
# function for the inorder traversal
# of the tree so as to store the node
# values in 'arr' in... |
""""Name : ADVAIT GURUNATH CHAVAN ; PRN : 4119008"""
file = open('name_prn.txt', 'w')
file.write("NAME : ADVAIT GURUNATH CHAVAN \n")
file.write("PRN : 4119008")
file.close()
file = open('name_prn.txt', 'r')
for line in file:
print(line, "\n")
file.close()
|
""" Constants """
MAX_PARTICLES = 5_000
SCREEN_SIZE = (1250, 750)
FPS = 60
MAX_SPEED = 500
MAX_BARRIER_DIST = 500
MAX_REPEL_DIST = 500
MAX_MOUSE_DIST = 500
""" Butterfly mode
MAX_SPEED = 1
MAX_BARRIER_DIST = 0
MAX_MOUSE_DIST = 1
MAX_REPEL_DIST = 0
magnitude <= 100
"""
""" FONT """
DEFAULT_FONT = "Quicksand-Light.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.