content stringlengths 7 1.05M |
|---|
"""
lab 7
"""
# 3.1
i = -1
while i <6:
i = i+1
if i ==3 or i ==6:
continue
print(i)
# 3.2
i=1
result = 1
while i <=5:
#print(i)
result = result *i
i = i+1
print(result)
# 3.3
i = 1
result = 0
while i <=5:
result = result +i
i = i+1
print(result)
# 3.4
i = 3
result = 1
whi... |
"""582. Word Break II
"""
class Solution:
"""
@param: s: A string
@param: wordDict: A set of words.
@return: All possible sentences.
"""
def wordBreak(self, s, wordDict):
# write your code here
return self.dfs(0, s, wordDict, {})
def dfs(self, idx, s, dict, memo):
if... |
#Extensions:
# I have Taken Example 5.9 and extended it to dictionary
#no users:
usernames = {
'aes':{
'password':'64545465',
'key' : '56'
},
'bes':{
'password':'64545465',
'key' : '56'
},
'ces':{
'password':'64546545',
'key' : '56'
},
'ad... |
MACS_VERSION = "3.0.0a7"
MAX_PAIRNUM = 1000
MAX_LAMBDA = 100000
FESTEP = 20
BUFFER_SIZE = 100000 # np array will increase at step of 1 million items
READ_BUFFER_SIZE = 10000000 # 10M bytes for read buffer size
N_MP = 2 # Number of processers
|
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 30 16:26:18 2018
Accelerator BPM
@author: xf18id
"""
bpm17_1x = EpicsSignalRO("SR:C17-BI{BPM:1}Pos:X-I", name="bpm17_1x")
bpm17_1y = EpicsSignalRO("SR:C17-BI{BPM:1}Pos:Y-I", name="bpm17_1y")
bpm17_2x = EpicsSignalRO("SR:C17-BI{BPM:2}Pos:X-I", name="bpm17_2x")
bpm17_2y =... |
# error if not grade for a student
# OPTION 2: change the policy
def get_stats(class_list):
new_stats = []
for item in class_list:
new_stats.append([item[0], item[1], avg(item[1])])
return new_stats
def avg(grades):
try:
return sum(grades)/len(grades)
except ZeroDivisionError:
... |
class BaseHelper:
def __init__(self, device):
self.device = device
def params(self, locals_: dict):
params = locals_.copy()
params.pop('self')
return params
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Watchdog(object):
KEEP_ALIVE = '\n'
DEVICE = '/dev/watchdog'
# STOP = 'V' in bleaglebone black not works
def __init__(self):
pass
def notify(self, device, msg):
'''
/dev/watchdog is opened and will reboot un... |
def CheckBinarySearchTreeSequence(arr: iter):
"""
Checks if a binary search sequence can is feasible
:param arr: An array containing the binary search tree sequence
:type arr: iter
"""
invalidSequenceString = "sequence is invalid: %s %s %s."
searchVal = arr[-1]
minVal = min(arr) - 1
maxVal = max(ar... |
''' 012 Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto'''
valor = float(input('Digite o valor do protudo: R$ '))
print(f'O Valor do produto com 5% de desconto é {valor - (valor * 5)/100:.2f}') |
"""Macros to simplify generating maven files.
"""
load("@google_bazel_common//tools/maven:pom_file.bzl", default_pom_file = "pom_file")
def pom_file(name, targets, artifact_name, artifact_id, packaging = None, **kwargs):
default_pom_file(
name = name,
targets = targets,
preferred_group_ids... |
class Solution:
def backspaceCompare(self, S: str, T: str) -> bool:
s_bcount, t_bcount = 0, 0
s_idx, t_idx = len(S) - 1, len(T) - 1
while s_idx >= 0 or t_idx >= 0:
while s_idx >= 0:
if S[s_idx] == '#':
s_bcount += 1
... |
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
if endWord not in wordList:
return 0
result = 0
l = len(beginWord)
beginSet = {beginWord}
endSet = {endWord}
wordList = set(wordList)
... |
# coding: utf8
# try something like
# coding: utf8
# try something like
def index():
rows = db((db.activity.type=='stand')&(db.activity.status=='accepted')).select()
if rows:
return dict(projects=rows)
else:
return plugin_flatpage()
|
#re-learning about class and objects.
class MyClass: #ini class, class adalah blueprint dari object
var = "blah" #variable ini adalah object didalan class
def function(self): #ini adalah fungsi didalam class
print("This is a message inside the class.")
myobjectx = MyClass() #myobjectx adalah variabl... |
class Profiler(object):
def __init__(self, config, paths):
pass
def dependencies(self):
"""Returns list of needed app dependencies,like com.quicinc.trepn, [] if none"""
raise NotImplementedError
def load(self, device):
"""Load (and start) the profiler process on the device... |
input = """
% map date to weekday (mon =1, ..., sun = 7);
% The tour starts on Monday.
weekday(1,1).
weekday(D,W) :- D=D1+1, W=W1+1, weekday(D1,W1), W1 < 7.
weekday(D,1) :- D=D1+1, weekday(D1,7).
% connections with default costs (capitols of the Austrian federal states).
conn(brg,ibk,2).
conn(ibk,s... |
def lend_money(debts, person, amount):
value = debts.get(person, 0)
quantity = [amount]
if value != 0:
debts[person] = value + quantity
else:
debts[person] = quantity
print(debts)
def amount_owed_by(debts, person):
value = debts.get(person, [0])
out = sum(va... |
class ALU():
def __init__(self):
self.Rs = None
self.Rt = None
self.Rd = None
def alu(self, opcode):
if (opcode == 0):
self.Rd = self.Rs + self.Rt
return self.Rd
elif (opcode == 1):
self.Rd = self.Rs - self.Rt
return self.... |
kwh_used = 1000
out = 0
if(kwh_used < 500):
out += 500 * 0.45
elif(kwh_used >= 500 and kwh_used < 1500):
out += 500 * 0.45 + ((kwh_used - 500) * 0.74)
elif(kwh_used >= 1500 and kwh_used < 2500):
out += 500 * 0.45 + ((kwh_used - 500) * 0.74) + ((kwh_used - 1500) * 1.25)
elif(kwh_used >= 2500):
out += 50... |
def solution(A):
list_range = len(A)
difference_list = []
for p in range(1, list_range):
post_sum = sum(A[p:])
behind_sum = sum(A[:p])
difference = behind_sum - post_sum
if difference < 0:
difference *= -1
difference_list.append(difference)
retur... |
def heapify(heap, root):
newRoot = root
leftChild = 2*root+1
rightChild = 2*root+2
if leftChild < len(heap) and heap[leftChild] > heap[newRoot]:
newRoot = leftChild
if rightChild < len(heap) and heap[rightChild] > heap[newRoot]:
newRoot = rightChild
if root!=newRoot:
heap[root],heap[newRoot]=heap[newRoot],h... |
EXAMPLES1 = (
('1122', 3),
('1111', 4),
('1234', 0),
('91212129', 9)
)
EXAMPLES2 = (
('1212', 6),
('1221', 0),
('123425', 4),
('123123', 12),
('12131415', 4)
)
INPUT = '31813174349235972159811869755166343882958376474278437681632495222499211488649543755655138842553... |
"""
Provide the class Message and its subclasses.
"""
class Message(object):
message = ''
message_args = ()
def __init__(self, filename, loc):
self.filename = filename
self.lineno = loc.lineno
self.col = getattr(loc, 'col_offset', 0)
def __str__(self):
return '%s:%s: ... |
p = np.eye(3)[y][:, None]
grad_d = q - p
grad_C = grad_d @ U.T
grad_b = (C.T @ grad_d ) * Drelu(A@x+b)
grad_A = grad_b @ x.T |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
class MandatoryOptions(object):
def __init__(self,options):
self.options=options
def __getattr__(self,name):
call=getattr(self.options,name)
def require(*args,**kwargs):
value=call(*args,*... |
class Queue():
# Queue Initialization
def __init__(self):
self.MAX = 5
self.queue = []
# OVERFLOW CONDITION
def OVERFLOW(self):
if len(self.queue) == self.MAX:
return True
else:
return False
# UNDERFLOW CONDITION
def UNDERFLOW(self):
if len(self.queue) == 0:
return True
else:
return Fals... |
#超分倍率
scale=2
#参数路径,可更换
model_path2 = "weights_v3/up2x-latest-denoise3x.pth"
model_path3 = "weights_v3/up3x-latest-denoise3x.pth"
model_path4 = "weights_v3/up4x-latest-denoise3x.pth"
#早期显卡开半精度不会提速,但是开半精度可以省显存。
half=True
#tile分为0~4一共5个mode。0在推理时不对图像进行切块,最占内存,mode越提升越省显存,但是可能会降低GPU利用率,降低推理速度
tile=2
#超图像设置
device="cuda... |
# input
N, X, r = map(int, input().split())
MOD = pow(10, 9)
# compute
# output
print(X * (pow(r, N, MOD) - 1) % MOD)
|
class Solution(object):
def subtractProductAndSum(self, n):
"""
:type n: int
:rtype: int
"""
prod = 1
n = [int(x) for x in list(str(n))]
for i in n:
prod *= i
return prod - sum(n)
if __name__ == '__main__':
obj = Solution()
n = 10... |
class DefaultConfigs(object):
# 1.string parameters
train_data = "./data/train/"
test_data = "./data/test/"
test_one_data = "./data/onetest/"
val_data = "no"
model_name = "resnet50"
weights = "./checkpoints/"
best_models = weights + "best_model/"
submit = "./submit/"
logs = "./lo... |
boys = ['John', 'Jack', 'Jeremy']
girls = ['Mary', 'Nancy', 'Joyce']
names = [*boys, *girls]
|
'''
@author: Sevval MEHDER
Filling one cell: O(1)
Filling all cells: O(2xn) = O(n)
'''
def find_maximum_cost(Y):
values = [[0 for _ in range(2)] for _ in range(len(Y))]
# Go on with adding these 2 options
i = 1
while i < len(Y):
# Put these two options
values[i][0] =... |
"""
Geometry and colour info.
@author Li Xiao-Tian
"""
class Point2d():
def __init__(self, x, y):
self.x = x;
self.y = y;
COLOURS = {
'u': '#A9A9A9',
'w': '#F9F9F9',
'r': '#D8251A',
'b': '#0194dd',
'g': '#2EFE2E',
'o': '#F0A226',
'y': '#FFFF00',
}
class Col... |
def can_build(plat):
return (plat == "android")
def configure(env):
if env["platform"] == "android":
# Amazon dependencies
env.android_add_dependency("compile fileTree(dir: '../../../modules/godotamazon/android/lib/', include: ['*.jar'])")
env.android_add_java_dir("android/src")
... |
"""Wrapper class for DNS actions"""
class ZoneController(object):
def __init__(self, zone):
"""Initialize zone controller given a zone"""
self.zone = zone
def create_zone(self, **kwargs):
"""Create a zone under the specific cloud"""
return self.zone.cloud.ctl.dns.create_zone(... |
"""Migration for a given Submitty course database."""
def up(config, database, semester, course):
"""
Run up migration.
:param config: Object holding configuration details about Submitty
:type config: migrator.config.Config
:param database: Object for interacting with given database for environme... |
# by Kami Bigdely
# Inline method.
# TODO: Refactor this program to improve its readability.
class Person:
def __init__(self, my_age):
self.age = my_age
self.LEGAL_DRINKING_AGE = 18
def enter_night_club(self, my_age):
if older_than_18_year_old(my_age):
print("Allowed to ent... |
# Copyright (c) 2017 Dustin Doloff
# Licensed under Apache License v2.0
load(
"//assert:assert.bzl",
"assert_equal",
)
load(
"//control_flow:control_flow.bzl",
"while_loop",
)
def run_all_tests():
test_while_loop()
def incr(state):
if type(state) == "dict":
state["incr_calls"] = state... |
fixed_time_entries = [{'stop': '2018-03-05T18:08:21+00:00', 'at': '2018-03-05T18:08:21+00:00', 'duration': 70,
'guid': '68c5136314e9680a54d0a28508139836', 'start': '2018-03-05T18:08:15+00:00', 'id': 1,
'description': 'task-1', 'duronly': False, 'uid': 2488778, 'billable': F... |
#!/usr/bin/env python
#
# Copyright 2018 - The Android Open Source Project
#
# 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 requir... |
# from django.conf.urls import url, include
# from rest_framework import routers
# from planex.site import views
# router = routers.SimpleRouter()
# router.register(r'pages', views.PageViewSet, basename='pages')
# router.register(r'documents', views.DocumentViewSet, basename='documents')
urlpatterns = []
# url(r'^... |
def solution(phone_book):
answer = True
phone_book = sorted(phone_book, key=(lambda x: len(x)))
for i, item in enumerate(phone_book):
for j in range(0, i):
if item.find(phone_book[j])==0:
return False
return answer
|
lst2 = list(map(lambda x: 2 ** x, range(5)))
print(lst2)
for i in list(map(lambda x: x ** 2, lst2)):
print(i, end=" ")
print()
print(list(map(lambda x: 1 if x % 2 == 0 else 0, lst2)))
|
class Viewport_Mixin(object):
"""
Mixin to help move around the image
"""
def update(self):
"""
Call update to get fresh data.
"""
pass
def reset(self):
""" Reset the viewport """
self._position = (0, 0)
def set_position(self, xy):
self._position = xy
def move_left(self)... |
#
# Copyright 2013-2022 The Foundry Visionmongers Ltd
#
# 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 app... |
# This file contains configuration variables that shouldn’t be in version control. This includes things like API keys
# and database URIs containing passwords. This also contains variables that are specific to this particular instance
# of your application. For example, you might have DEBUG = False in config.py, but se... |
# -*- coding: utf-8 -*-
"""Top-level package for Pytropic."""
__author__ = """Will Fitzgerald"""
__email__ = 'will.fitzgerald@gmail.com'
__version__ = '0.1.0'
|
# encoding: UTF-8
LOADING_ERROR = 'Error occurred when loading the config file, please check.'
CONFIG_KEY_MISSING = 'Key missing in the config file, please check.'
DATA_SERVER_CONNECTED = 'Data server connected.'
DATA_SERVER_DISCONNECTED = 'Data server disconnected'
DATA_SERVER_LOGIN = 'Data server login compl... |
'''
DESKRIPSI SOAL
Diberikan sebuah fungsi f(n) dengan beberapa syarat berikut :
1. Jika n=0, maka f(n)=10.
2. Jika n lebih dari 0 dan n genap, maka f(n) = 4xf(n/2).
3. Jika n lebih dari 0 dan n ganjil, maka f(n) = f(n-1)+1.
PETUNJUK MASUKAN
Input terdiri atas 1 buah bilangan bulat n (0≤n≤200)
PETUNJUK KELUARAN
... |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 3 10:06:06 2020
@author: Tarun Jaiswal
"""
x1=range(10)
print(x1)
x2=range(2,10)
print(x2)
x3=range(2,10,3)
print(x3)
print("X1=",end="")
for item in x1:
print(item,end=",")
print("X2=")
for item in x2:
print(item,end=",")
print("X3=",end="")
for item in x3:
... |
stevilka = ''.join(list(map(str.strip, list(open('euler8.txt','r')))))
stevilke = stevilka.split('0')
stevilke = [stevilka for stevilka in stevilke if len(stevilka) > 12]
def produkt_niza(n):
produkt = 1
for i in n:
produkt *= int(i)
return produkt
def produkt_prvih_trinajst(n):
return produkt... |
GPIO_BASE_PATH = "/sys/class/gpio"
MOTOR_PIN = "13"
PIR_PIN = "12"
DONALD_TRACK = "donald_duck.mp3" |
#
# @lc app=leetcode id=717 lang=python3
#
# [717] 1-bit and 2-bit Characters
#
# https://leetcode.com/problems/1-bit-and-2-bit-characters/description/
#
# algorithms
# Easy (49.13%)
# Likes: 325
# Dislikes: 844
# Total Accepted: 52.5K
# Total Submissions: 107K
# Testcase Example: '[1,0,0]'
#
# We have two speci... |
ACRONYM = "BSC"
def transcription_factor_regulatory_site(**identifier_properties):
unique_data_string = [
identifier_properties.get("absolutePosition", "NoAbsolutePosition"),
identifier_properties.get("leftEndPosition", "NoLEND"),
identifier_properties.get("rightEndPosition", "NoREND")
... |
"""
Bool : Whether it is True or False
True / False
if string, list, tuple, dictionary are empty (don't have element)
it is False. also 'None' is false, too
Contents Source : https://wikidocs.net/17
""" |
"""
Example dataset fetching utility. Used in docs.
"""
src = 'https://raw.githubusercontent.com/ResidentMario/geoplot-data/master'
def get_path(dataset_name):
"""
Returns the URL path to an example dataset suitable for reading into ``geopandas``.
"""
if dataset_name == 'usa_cities':
return f... |
# -*- coding: utf-8 -*-
# @Time : 2019/10/15 0015 16:21
# @Author : Erichym
# @Email : 951523291@qq.com
# @File : 520.py
# @Software: PyCharm
class Solution:
def detectCapitalUse(self, word: str) -> bool:
if 97<=ord(word[0])<=122:
for i in range(1,len(word),1):
if ord(wo... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyErubis(RubyPackage):
"""Erubis is a fast, secure, and very extensible implementation of eRuby.
"""
... |
def waxs_S_edge_guil(t=1):
dets = [pil300KW]
names = ['sample02', 'sample03', 'sample04', 'sample05', 'sample06', 'sample07', 'sample08', 'sample09', 'sample10', 'sample11', 'sample12']
x = [26500, 21500, 16000, 10500, 5000, 0, -5500, -10500, 16000, -21000, -26500]#, -34000, -41000]
y = [600, 600,... |
class ThePhantomMenace:
def find(self, doors, droids):
greatest_min = -1
best_door = doors[0]
for idx, door in enumerate(doors):
greatest_distance = 9999
for droid in droids:
distance = abs(droid - door)
if distance < greatest_dista... |
def get_index_of(sequence, item):
for i in range(len(sequence)):
if sequence[i] == item:
return i
numbers = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
thirteenIndex = get_index_of(numbers, 13)
print("13 is at:", thirteenIndex)
|
num1 =100
num2 = 200
num3 = 300
num5 =500
|
# pw2wannier stores the k index in 4 digits, which crashes computations on grids larger than 9999. This fixes it.
f = open("silicon.amn")
out = open("silicon.amn.new", "w")
out.write(f.readline())
out.write(f.readline())
for line in f:
line = line[0:10] + " " + line[10:]
out.write(line)
f = open("silicon.... |
# Admin specfic links
ADMIN_HANDLE = "@kwokyto"
# Bot settings
NUMBER_TO_NOTIFY = 5
NUMBER_TO_BUMP = 5
# Messages sent to the user
INVALID_FORMAT_MESSAGE = "Simi? I can only read text, don't send me anything else."
NO_COMMAND_MESSAGE = "What are you saying?? Send a proper command lah please."
START_MESSAGE = "Harlo a... |
# dataset settings
ann_type = 'tanz_base' # * _base or _evaluation
videos_per_gpu_train = 8 if ann_type == 'tanz_base' else 4
workers_per_gpu_train = 1
num_classes = 9 if ann_type == 'tanz_base' else 42
## * model settings
model = dict(
type='Recognizer3D',
backbone=dict(
type='ResNet3d', # p... |
class IFingerSetterService(Interface):
def setUser(user, status):
"""Set the user's status to something"""
# Advantages of latest version
@implementer(IFingerService, IFingerSetterService)
class MemoryFingerService(service.Service):
def __init__(self, **kwargs):
self.users = kwargs
def ... |
class Solution:
MIN_VALUE = -(2 ** 31)
MAX_VALUE = 2 ** 31 - 1
def myAtoi(self, string: str) -> int:
try:
return self._fit_in_range(self._parse_number(string))
except ValueError:
return 0
def _parse_number(self, string: str) -> str:
string = string.stri... |
#Colors to be used in the plots
color = ["#f94144","#f3722c","#f8961e","#f9c74f","#90be6d","#43aa8b","#577590"]
sns.palplot(color)
|
class Shirt:
def __init__(self, size, color):
self.size = size.lower()
self.color = color.lower()
def __repr__(self):
return str(self.size + "&" + self.color) |
def is_number(value):
'''Checks if a string can be converted into
a float (or int as a by product). Helper function
for string_cols_to_numeric'''
try:
float(value)
return True
except ValueError:
return False
|
#!/usr/bin/python3
class strategyBase(object):
def __init__(self):
pass
def _get_data(self):
pass
def _settle(self):
pass
if __name__ == "__main__":
pass
|
# by Kami Bigdely
# Extract Class
foods = {'butternut squash soup':[45, True, 'soup','North African',\
['butter squash','onion','carrot', 'garlic','butter','black pepper', 'cinnamon','coconut milk']\
,'1. Grill the butter squash, onion, carrot and garlic in the oven until'
'they get soft and g... |
def leia_Int(msg):
ok = False
valor = 0
while True:
n = str(input(msg))
if n.isnumeric():
valor = int(n)
ok = True
else:
print('\033[0;31m ERRO! Digite um valor inteiro! \033[m')
if ok:
break
return valor
n = leia_Int('Di... |
def decimal_to_binary(num):
if (num == 0):
return 0
return num%2+10*decimal_to_binary(num//2)
print(decimal_to_binary(2))
|
# yacctab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMODAUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EX... |
# -*- coding: utf-8 -*-
__all__ = ['StatesSet']
class StatesSet:
STATE, CAPTURED = range(2)
def __init__(self):
self._list = []
self._set = set()
def __len__(self):
return len(self._list)
def __bool__(self):
return bool(self._list)
def __iter__(self):
... |
load("@rules_cc//cc:defs.bzl", "cc_library")
# https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library
cc_library(
name = "cpp-utils",
srcs = glob(["src/*.cpp"]),
hdrs = glob(["inc/*.h"]),
includes = ["inc"],
visibility = ["//visibility:public"],
deps = [
"@com_github_spdlog//... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""
spyderlib.widgets.externalshell
===============================
External Shell widget: execute Python script/terminal in a separate process
"""
|
#-*- coding: UTF-8 -*-
class quick_sort():
a=[]
def __init__(self,data):
self.a=data[:]
def sort(self,left,right):
if left!=right:
mid=left+int((right-left)/2)
self.sort(left,mid)
self.sort(mid+1,right)
b=[]
i=0
for i in... |
# Home work #5. Ternary Operators. String function
print("---- Task 1. Work day/Weekend")
# Task #1. Input a day of the week number (1-7) to the variable num_of_day.
# Using ternary operators, assign the value “Weekend” to the variable day if week number is 6 or 7, otherwise “Work day”.
num_of_day = int(input("Plea... |
listinha=[]
adc=0
op=''
while True:
adc=int(input("Adicione um valor para a lista: "))
if adc in listinha:
print('Valor já contido na lista')
else:
listinha.append(adc)
op=input("Deseja continuar?[S/N]: ").upper()
if op in 'NAO':
break
print(f'você adicionou os valores {listi... |
"""
Example docstring 1
* A thing.
* Another thing.
or
1. Item 1.
2. Item 2.
3. Item 3.
or
- Some.
- Thing.
- Different.
+------------+------------+-----------+
| Header 1 | Header 2 | Header 3 |
+============+============+===========+
| body row 1 | column 2 | column 3 |
+------------+------------+------... |
#
# PySNMP MIB module CISCO-SNA-LLC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SNA-LLC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:35:59 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
OUR_APP_NAME = 'Demo'
SECTION_NAME = 'Manufacturer'
SECTION_ITEMS = 'Products'
|
SSID1 = 'ap1'
PASSWORD1 = 'pw1'
SSID2 = 'ap2'
PASSWORD2 = 'pw2'
MQTT_PORT = '1883'
MQTT_USER = 'useri'
MQTT_PASSWORD = 'salari'
MQTT_SERVER = 'ip'
WEBREPL_PASSWORD = "pw"
CLIENT_ID = "ESP32-aurinkopaneeli"
DHCP_NAME = "ESP32-aurinkopaneeli"
TOPIC_ERRORS = 'errors/home/esp32'
TOPIC_TEMP = 'koti/ulko/aurinkop... |
n=int(input())
a=[]
for i in range(0,n):
ele=int(input())
a.append(ele)
print(list(set(a)))
lower=int(input())
upper=int(input())
b=[x for x in range(lower,upper+1) if ( int(x**0.5))**2==x and sum(list(map(int,str(x))))<10 ]
a=[(x,x**2)for x in range(lower,upper+1)]
print(b)
n=int(input())
m=i... |
def add(x, y):
return x+y
result = add(1, 2)
print(f"This is the sum: , {result}")
|
ld,lm,ly = map(int,input().split())
dd,dm,dy = map(int,input().split())
if ly< dy:
print('0')
elif ly > dy:
print('10000')
elif lm > dm:
print(500*(lm-dm))
elif lm < dm:
print('0')
elif ld > dd:
print(15*(ld-dd))
else:
print('0')
|
"""
Functions to sort variants
"""
CHROMOSOMES = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',
'13', '14', '15', '16', '17', '18', '19', '20', '21', '22', 'X',
'Y', 'MT')
# Maps chromosomes to integers
CHROMOSOME_INTEGERS = {chrom: i+1 for i, chrom in enumerate(CHR... |
"""
Functions of the `sample_project.calculator.calc` module.
"""
def check_power_of_2(value: int) -> bool:
"""
Returns `True` if `value` is power of 2 else `False`.
See code explanation in [StackOverflow
](https://stackoverflow.com/questions/57025836).
"""
return (value != 0) and (not value &... |
{
"targets": [
{
"target_name": "pm",
"sources": [
"src/pm.cpp",
"src/pm.h"
],
'conditions': [
['OS=="win"',
{
'sources': [
"src/pm_win.cpp"
]
}
],
['OS=="mac"',
{
'sourc... |
index_template = (
lambda: """from pantam import Pantam
pantam = Pantam(debug=True)
app = pantam.build()
"""
)
action_template = lambda class_name: """from pantam import PlainTextResponse
class {class_name}:
def fetch_all(self, request):
\"\"\"Fetch all items\"\"\"
return PlainTextResponse(... |
# coding: utf-8
# input
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
# solve(TLE)
"""
flag = 1
for i in range(N):
for j in range(N):
if (flag == 1):
num = a[i] + b[j]
flag = 0
else:
num = num ^ (a[i] + b[j])
print(num)... |
def perfect_array(length):
return ' '.join(['1']*length)
def main():
t = int(input())
for _ in range(t):
length = int(input())
print(perfect_array(length))
main()
|
def _toolchain_configure_impl(repository_ctx):
tool_path = ""
if repository_ctx.attr.tool_path:
tool_path = repository_ctx.attr.tool_path
elif repository_ctx.which("databricks"):
tool_path = repository_ctx.which("databricks")
config_file = ""
if repository_ctx.attr.config_file:
... |
# Copyright 2019 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
# Package initialisation for Doctor.
# Mightn't be necessary to declare __all__ at time of writing because it lists
# everything.
__all__ = ['comment_block.py',
'comment_line.py',
'doc_markdown.py',
'doctor_class.py... |
def hello(s):
print("Hello, %s!!!" % s)
hello('world')
hello('python')
hello('Sasha') |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def score(str_in):
garbage = False
cnt = 1
out = 0
stack = []
garbage_cnt = 0
skip = False
for i in str_in:
if skip:
skip = False
continue
if i == '!':
skip = True
continue
... |
FILL_WORDS = ['zur', 'der', 'des']
BOOK_TYPES = ['Buch', 'Foliant', 'Libre', 'Werk', 'Almanach', 'Atlas', 'Sammlung']
THEME = ['innere Ebenen', 'Fakten', 'Reise', 'Mischung', 'Vernichtung', 'Begründung', 'Evocation', 'Transmutation',
'Karten', 'Divination', 'Conjuration', 'Ichiban']
OF_SOMETHING = ['Otter', 'H... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.