content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#!/usr/bin/python3
#str = input("Please give me an integer: ")
#num = int(str)
num = 20
# I'm guessing we can optionally exception catch.
# Perhaps this alone makes people recommend Python over Java.
# Optional error handling was a feature of BASIC.
if num < 0:
#print(num = 0, "");
# Among other reasons, Python can... | num = 20
if num < 0:
print('Negative..')
elif num == 0:
print('Zero.')
elif num > 0:
print('Positive..')
if False:
pass
elif True:
print('Hmm')
words = ['my IME is not working', 'goodbye']
for w in words:
print(w, len(w))
room = {}
room['bear'] = 'inactive'
room['koala'] = 'active'
room['kangaro... |
STORAGE_ACCOUNT_NAME = " aibootcamp2019sa "
STORAGE_ACCOUNT_KEY = ""
BATCH_ACCOUNT_NAME = "aibootcamp2019ba"
BATCH_ACCOUNT_KEY = ""
BATCH_ACCOUNT_URL = "https://aibootcamp2019ba.westeurope.batch.azure.com"
ACR_LOGINSERVER = "athensaibootcampdemo.azurecr.io"
ACR_USERNAME = "athensaibootcampdemo"
ACR_PASSWORD = "" | storage_account_name = ' aibootcamp2019sa '
storage_account_key = ''
batch_account_name = 'aibootcamp2019ba'
batch_account_key = ''
batch_account_url = 'https://aibootcamp2019ba.westeurope.batch.azure.com'
acr_loginserver = 'athensaibootcampdemo.azurecr.io'
acr_username = 'athensaibootcampdemo'
acr_password = '' |
buf = b""
buf += b"\x48\x31\xc9\x48\x81\xe9\xb1\xff\xff\xff\x48\x8d\x05"
buf += b"\xef\xff\xff\xff\x48\xbb\xf8\x3d\x59\x54\x46\x6d\x59"
buf += b"\x99\x48\x31\x58\x27\x48\x2d\xf8\xff\xff\xff\xe2\xf4"
buf += b"\x04\x75\xda\xb0\xb6\x85\x95\x99\xf8\x3d\x18\x05\x07"
buf += b"\x3d\x0b\xc8\xae\x75\x68\x86\x23\x25\xd2\xcb\x98... | buf = b''
buf += b'H1\xc9H\x81\xe9\xb1\xff\xff\xffH\x8d\x05'
buf += b'\xef\xff\xff\xffH\xbb\xf8=YTFmY'
buf += b"\x99H1X'H-\xf8\xff\xff\xff\xe2\xf4"
buf += b'\x04u\xda\xb0\xb6\x85\x95\x99\xf8=\x18\x05\x07'
buf += b'=\x0b\xc8\xaeuh\x86#%\xd2\xcb\x98u'
buf += b'\xd2\x06^%\xd2\xcb\xd8u\xd2&\x16%V'
buf += b'.\xb2w\x14e\x8f%... |
class Utils(object):
# From https://gist.github.com/miohtama/5389146
@staticmethod
def get_decoded_email_body(msg, html_needed):
""" Decode email body.
Detect character set if the header is not set.
We try to get text/plain, but if there is not one then fallback to text/html.
... | class Utils(object):
@staticmethod
def get_decoded_email_body(msg, html_needed):
""" Decode email body.
Detect character set if the header is not set.
We try to get text/plain, but if there is not one then fallback to text/html.
:param html_needed: html if True, or plain if Fals... |
# Definition for an interval.
# class Interval:
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def insert(self, intervals, newInterval):
"""
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[Interval... | class Solution(object):
def insert(self, intervals, newInterval):
"""
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[Interval]
"""
n = len(intervals)
i = 0
while i < n and newInterval.start > intervals[i].end:
i +... |
def separate_speaker(speaker_npz_obj):
all_speaker = sorted(list(set(map(str, speaker_npz_obj.values()))))
all_keys = sorted(list(speaker_npz_obj.keys()))
speaker_individual_keys = [
[
key
for key in all_keys if speaker_npz_obj[key] == speaker
]
for speaker in all_sp... | def separate_speaker(speaker_npz_obj):
all_speaker = sorted(list(set(map(str, speaker_npz_obj.values()))))
all_keys = sorted(list(speaker_npz_obj.keys()))
speaker_individual_keys = [[key for key in all_keys if speaker_npz_obj[key] == speaker] for speaker in all_speaker]
return (all_speaker, speaker_indi... |
# Problem: Reshape the Matrix
# Difficulty: Easy
# Category: Array
# Leetcode 566: https://leetcode.com/problems/reshape-the-matrix/#/description
# Description:
"""
In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix
into a new one with different size but keep its original da... | """
In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix
into a new one with different size but keep its original data.
You're given a matrix represented by a two-dimensional array, and two positive integers
r and c representing the row number and column number of the ... |
def main():
# input
H, W = map(int, input().split())
Ass = [[*map(int, input().split())] for _ in range(H)]
# compute
ansss = []
for i in range(H):
ansss.append([sum(Ass[i])] * W)
for j in range(W):
tmp_sum = 0
for i in range(H):
tmp_sum += Ass[i][j]
... | def main():
(h, w) = map(int, input().split())
ass = [[*map(int, input().split())] for _ in range(H)]
ansss = []
for i in range(H):
ansss.append([sum(Ass[i])] * W)
for j in range(W):
tmp_sum = 0
for i in range(H):
tmp_sum += Ass[i][j]
for i in range(H):
... |
class MonsterClassificationAgent:
def __init__(self):
#If you want to do any initial processing, add it here.
self.default_monster_attributes = {
'size': ['tiny', 'small', 'medium', 'large', 'huge'],
'color': ['black', 'white', 'brown', 'gray', 'red', 'yellow', 'blue', 'gree... | class Monsterclassificationagent:
def __init__(self):
self.default_monster_attributes = {'size': ['tiny', 'small', 'medium', 'large', 'huge'], 'color': ['black', 'white', 'brown', 'gray', 'red', 'yellow', 'blue', 'green', 'orange', 'purple'], 'covering': ['fur', 'feathers', 'scales', 'skin'], 'foot-type': ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 18 17:40:33 2020
This time, write a procedure, called biggest, which returns the key
corresponding to the entry with the largest number of values associated with it.
If there is more than one such entry, return any one of the matching keys.
@author: MarcoSilva
"""
ani... | """
Created on Thu Jun 18 17:40:33 2020
This time, write a procedure, called biggest, which returns the key
corresponding to the entry with the largest number of values associated with it.
If there is more than one such entry, return any one of the matching keys.
@author: MarcoSilva
"""
animals = {'a': ['aardvark']... |
with open('inputs/input11.txt') as fin:
raw = fin.read()
def parse(raw):
x = tuple(x for x in raw.split('\n'))
return x
a = parse(raw)
def part_1(data):
test = data[:]
test2 = []
while test != test2:
test = data[:]
for i, x in enumerate(data):
for a, b in enumera... | with open('inputs/input11.txt') as fin:
raw = fin.read()
def parse(raw):
x = tuple((x for x in raw.split('\n')))
return x
a = parse(raw)
def part_1(data):
test = data[:]
test2 = []
while test != test2:
test = data[:]
for (i, x) in enumerate(data):
for (a, b) in enum... |
#############################################
### web face setting
#############################################
pretrain_model_path = 'E:/git/project/facenet/model/20180402-114759'
train_mode = 'TRAIN'
classify_mode = 'CLASSIFY'
profile_data_root_path = 'E:/temp/flask-upload-test/'
image_upload_path = 'E:/temp... | pretrain_model_path = 'E:/git/project/facenet/model/20180402-114759'
train_mode = 'TRAIN'
classify_mode = 'CLASSIFY'
profile_data_root_path = 'E:/temp/flask-upload-test/'
image_upload_path = 'E:/temp/flask-upload-test/'
detect_dir = 'detect'
post_process_image_size = 160
gpu_memory_fraction = 0.25
minsize = 20
threshol... |
str1 = "abcdefghijklmnopqrstuvwxyz"
# 1. Create a slice that produces "qpo"
print(str1[16:13:-1])
# 2. Slice the string to produce "edcba"
print(str1[4::-1])
# 3. Slice the string to produce the last 8 characters, in reverse order
print(str1[:-9:-1])
print(str1[-4:])
print(str1[-1:])
print(str1[:1])
print(str1[0... | str1 = 'abcdefghijklmnopqrstuvwxyz'
print(str1[16:13:-1])
print(str1[4::-1])
print(str1[:-9:-1])
print(str1[-4:])
print(str1[-1:])
print(str1[:1])
print(str1[0]) |
class AddInCommandBinding(object):
"""
This object represents a binding between a Revit command and one or more handlers which
override the behavior of the command in Revit.
"""
RevitCommandId = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""The Rev... | class Addincommandbinding(object):
"""
This object represents a binding between a Revit command and one or more handlers which
override the behavior of the command in Revit.
"""
revit_command_id = property(lambda self: object(), lambda self, v: None, lambda self: None)
'The Revit command Id.\n\n\n\nGet... |
class Settings():
# APP SETTINGS
# ///////////////////////////////////////////////////////////////
ENABLE_CUSTOM_TITLE_BAR = True
MENU_WIDTH = 240
LEFT_BOX_WIDTH = 240
RIGHT_BOX_WIDTH = 240
TIME_ANIMATION = 500
# BTNS LEFT AND RIGHT BOX COLORS
BTN_LEFT_BOX_COLOR = "background-color:... | class Settings:
enable_custom_title_bar = True
menu_width = 240
left_box_width = 240
right_box_width = 240
time_animation = 500
btn_left_box_color = 'background-color: rgb(44, 49, 58);'
btn_right_box_color = 'background-color: rgb(255, 211, 0);'
menu_selected_stylesheet = '\n border-l... |
expected_output = {
'instance': {
'test': {
'vrf': {
'default': {
'interfaces': {
'Ethernet1/1.115': {
'adjacencies': {
'R2_xr': {
... | expected_output = {'instance': {'test': {'vrf': {'default': {'interfaces': {'Ethernet1/1.115': {'adjacencies': {'R2_xr': {'neighbor_snpa': {'fa16.3eff.4abd': {'level': {'1': {'hold_time': '00:00:09', 'state': 'UP'}, '2': {'hold_time': '00:00:07', 'state': 'UP'}}}}}}}, 'Ethernet1/2.115': {'adjacencies': {'R1_ios': {'nei... |
skip_list = [
{'scheme': 'kyber1024', 'implementation': 'm3', 'estmemory': 12288},
{'scheme': 'kyber512', 'implementation': 'm3', 'estmemory': 7168},
{'scheme': 'kyber768', 'implementation': 'm3', 'estmemory': 9216},
{'scheme': 'saber', 'implementation': 'm3', 'estmemory': 22528},
{'scheme': 'sikep4... | skip_list = [{'scheme': 'kyber1024', 'implementation': 'm3', 'estmemory': 12288}, {'scheme': 'kyber512', 'implementation': 'm3', 'estmemory': 7168}, {'scheme': 'kyber768', 'implementation': 'm3', 'estmemory': 9216}, {'scheme': 'saber', 'implementation': 'm3', 'estmemory': 22528}, {'scheme': 'sikep434', 'implementation'... |
class RougeDatasetResults(object):
""" Class for storing the results of the ROUGE evaluation for multiple texts.
"""
def __init__(self):
self.runs = 0
self.successes = 0
self.timeouts = 0
self.errors = 0
self.output = None
def add_success(self):
self.r... | class Rougedatasetresults(object):
""" Class for storing the results of the ROUGE evaluation for multiple texts.
"""
def __init__(self):
self.runs = 0
self.successes = 0
self.timeouts = 0
self.errors = 0
self.output = None
def add_success(self):
self.run... |
def add(a, b):
c = a + b
return c
c = add(1, 2)
print(c)
def subtraction(a, b):
return a - b
print(subtraction(b=5, a=10))
def division(a, b=1):
return a / b
print(division(5))
print(division(10, 5))
def print_a(a, *b):
print(a, b)
print_a(1, 2, 3, 4, 5, 6)
... | def add(a, b):
c = a + b
return c
c = add(1, 2)
print(c)
def subtraction(a, b):
return a - b
print(subtraction(b=5, a=10))
def division(a, b=1):
return a / b
print(division(5))
print(division(10, 5))
def print_a(a, *b):
print(a, b)
print_a(1, 2, 3, 4, 5, 6)
def print_b(a, **b):
print_a(a, b)... |
def problem_14():
"Which starting number, under one million, produces the longest [Collatz sequence] chain?"
longest_length = 0
longest_start = 0
# For each number between 1 and one million...
for i in range(1, 1000000):
# Take a copy of each number
n = i
# Set the length o... | def problem_14():
"""Which starting number, under one million, produces the longest [Collatz sequence] chain?"""
longest_length = 0
longest_start = 0
for i in range(1, 1000000):
n = i
length = 1
while n != 1:
if n % 2 == 0:
n /= 2
lengt... |
class SuperElasticHardeningModifications:
"""The SuperElasticHardeningModifications object specifies the variation of the
transformation stress levels of a material model.
Notes
-----
This object can be accessed by:
.. code-block:: python
import material
mdb.model... | class Superelastichardeningmodifications:
"""The SuperElasticHardeningModifications object specifies the variation of the
transformation stress levels of a material model.
Notes
-----
This object can be accessed by:
.. code-block:: python
import material
mdb.model... |
#!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, "/WorldClient.dll?View=Main")
| def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, '/WorldClient.dll?View=Main') |
def update_fields_widget(form, fields, css_class):
for field in fields:
form.fields[field].widget.attrs.update({'class': css_class})
| def update_fields_widget(form, fields, css_class):
for field in fields:
form.fields[field].widget.attrs.update({'class': css_class}) |
"""
Code for computing collected components.
"""
class Component:
"""
Holder for a connected component.
"""
def __init__(self, item):
self.id = item
self.items = {item}
def connected_components(f, g):
"""
Compute connected components of undirected edges (f[i], g[i]).
For... | """
Code for computing collected components.
"""
class Component:
"""
Holder for a connected component.
"""
def __init__(self, item):
self.id = item
self.items = {item}
def connected_components(f, g):
"""
Compute connected components of undirected edges (f[i], g[i]).
For ... |
"""http://stackoverflow.com/a/23173968/287297"""
################################################################################
def parse_newick(path):
"""Parse a newick-formated text file and return a "Tree" object."""
pass | """http://stackoverflow.com/a/23173968/287297"""
def parse_newick(path):
"""Parse a newick-formated text file and return a "Tree" object."""
pass |
# A base Class for the various kinds of 2d-rules used to update the playing field
class BaseRule:
def __init__(self, rule_str="", mode=None, num_states=0):
self.rule_str = rule_str
self.mode = mode
self.num_states = num_states
def apply(self, curr_state: int, num_neighbors: int) -> i... | class Baserule:
def __init__(self, rule_str='', mode=None, num_states=0):
self.rule_str = rule_str
self.mode = mode
self.num_states = num_states
def apply(self, curr_state: int, num_neighbors: int) -> int:
pass |
def resizeApp(app, dx, dy):
switchApp(app)
corner = find(Pattern("1273159241516.png").targetOffset(3,14))
dragDrop(corner, corner.getCenter().offset(dx, dy))
resizeApp("Safari", 50, 50)
# exists("1273159241516.png")
# click(Pattern("1273159241516.png").targetOffset(3,14).similar(0.7).firstN(2))
# with Region(10,100... | def resize_app(app, dx, dy):
switch_app(app)
corner = find(pattern('1273159241516.png').targetOffset(3, 14))
drag_drop(corner, corner.getCenter().offset(dx, dy))
resize_app('Safari', 50, 50) |
a = input("Immetti il coefficiente a ")
b = input("Immetti il coefficiente b ")
c = input("Immetti il coefficiente c ")
print ("Data l'equazione algebrica " + str(a) +
"*X^2+" + str(b) + "*X+" + str(c) + "=0 ")
delta = b * b - 4 * a * c
if delta >= 0:
rad_delta = delta**0.5
x1 = -(b - rad_delta) / (2 * ... | a = input('Immetti il coefficiente a ')
b = input('Immetti il coefficiente b ')
c = input('Immetti il coefficiente c ')
print("Data l'equazione algebrica " + str(a) + '*X^2+' + str(b) + '*X+' + str(c) + '=0 ')
delta = b * b - 4 * a * c
if delta >= 0:
rad_delta = delta ** 0.5
x1 = -(b - rad_delta) / (2 * a)
... |
'''
PROBLEM STATEMENT:
Given an array of integers of size n, where n denotes number of books and each element of an array denotes the number of pages in the ith book, also given another integer
denoting number of students. The task is to allocate books to the given number of students so that maximum number of pag... | """
PROBLEM STATEMENT:
Given an array of integers of size n, where n denotes number of books and each element of an array denotes the number of pages in the ith book, also given another integer
denoting number of students. The task is to allocate books to the given number of students so that maximum number of pages a... |
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"feature",
"flag_group",
"flag_set",
"tool_path",
)
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
# This file has been written based off the variable definitions in the following
# files:
# - https://github.c... | load('@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl', 'feature', 'flag_group', 'flag_set', 'tool_path')
load('@bazel_tools//tools/build_defs/cc:action_names.bzl', 'ACTION_NAMES')
build_f_cpu = '240000000L'
runtime_ide_version = '10607'
build_board = 'ESP32_DEV'
build_arch = 'ESP32'
build_variant = 'esp32'
build_e... |
"""
python_gtk_kiosk module entry point.
"""
__author__ = 'KuraLabs S.R.L'
__email__ = 'info@kuralabs.io'
__version__ = '0.1.0'
| """
python_gtk_kiosk module entry point.
"""
__author__ = 'KuraLabs S.R.L'
__email__ = 'info@kuralabs.io'
__version__ = '0.1.0' |
'''
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Follow up:
Coud you solve it without converting the integer to a string?
TODO
'''
class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
... | """
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Follow up:
Coud you solve it without converting the integer to a string?
TODO
"""
class Solution:
def is_palindrome(self, x):
"""
:type x: int
:rtype: bool
""... |
sum_ = 0
for n in range(1, 1000):
if n % 3 == 0 or n % 5 == 0:
print(n, end=", ")
sum_ += n
print("sum =", sum_) | sum_ = 0
for n in range(1, 1000):
if n % 3 == 0 or n % 5 == 0:
print(n, end=', ')
sum_ += n
print('sum =', sum_) |
'''
Print the following pattern for the given N number of rows.
Pattern for N = 4
1234
123
12
1
'''
rows=int(input())
n=rows
for i in range(rows):
value=1
for j in range(n,0,-1):
print(value,end="")
value=value+1
n=n-1
print()
| """
Print the following pattern for the given N number of rows.
Pattern for N = 4
1234
123
12
1
"""
rows = int(input())
n = rows
for i in range(rows):
value = 1
for j in range(n, 0, -1):
print(value, end='')
value = value + 1
n = n - 1
print() |
"""------------------------------------------------------------------------
#3 totalQuantity() function calculates the total quantity of orders.
------------------------------------------------------------------------"""
def totalQuantity(TEMP):
total = float(0)
for i in range(len(TEMP)):
to... | """------------------------------------------------------------------------
#3 totalQuantity() function calculates the total quantity of orders.
------------------------------------------------------------------------"""
def total_quantity(TEMP):
total = float(0)
for i in range(len(TEMP)):
total = ... |
# URL: https://www.geeksforgeeks.org/python-list/
myList = []
print("Intial List : ")
print(myList)
# Addition of Elements in the list
myList.append(1)
myList.append(2)
myList.append(4)
print("\nList after addition of three elements : ")
print(myList)
# Adding elements to the list using Iterator
for i in range(1, 4)... | my_list = []
print('Intial List : ')
print(myList)
myList.append(1)
myList.append(2)
myList.append(4)
print('\nList after addition of three elements : ')
print(myList)
for i in range(1, 4):
myList.append(i)
print('\nList after adding the element 1 to 3 : ')
print(myList)
length = len(myList)
print(f'\nTotal number ... |
n = int(input())
for i in range(0, n):
line = input()
total = 0
k = int(line.split()[0])
for j in range(0, k):
o = int(line.split()[j+1])
total += o
total -= k - 1
print(total)
| n = int(input())
for i in range(0, n):
line = input()
total = 0
k = int(line.split()[0])
for j in range(0, k):
o = int(line.split()[j + 1])
total += o
total -= k - 1
print(total) |
#
# Solution to Project Euler Problem 8
# by Lucas Chen
#
# Answer: 23514624000
#
DIGITS = 13
NUM = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445... | digits = 13
num = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493... |
units = 'nm'
vdw ={
"H" : 0.11000,
"He" : 0.14000,
"Li" : 0.18200,
"Be" : 0.15300,
"B" : 0.19200,
"C" : 0.17000,
"N" : 0.15500,
"O" : 0.15200,
"F" : 0.14700,
"Ne" : 0.15400,
"Na" : 0.22700,
"Mg" : 0.17300,
"Al" : 0.18400,
"Si" : 0.21000,
"P" : 0.18000,
"S" : 0.18000,
"Cl" : 0.17500,
"Ar" : 0.18800,
... | units = 'nm'
vdw = {'H': 0.11, 'He': 0.14, 'Li': 0.182, 'Be': 0.153, 'B': 0.192, 'C': 0.17, 'N': 0.155, 'O': 0.152, 'F': 0.147, 'Ne': 0.154, 'Na': 0.227, 'Mg': 0.173, 'Al': 0.184, 'Si': 0.21, 'P': 0.18, 'S': 0.18, 'Cl': 0.175, 'Ar': 0.188, 'K': 0.275, 'Ca': 0.231, 'Sc': 0.215, 'Ti': 0.211, 'V': 0.207, 'Cr': 0.206, 'Mn'... |
s1=str(input())
s2=str(input())
n=len(s1)
m=len(s2)
a=[0]*n
b=[0]*m
for i in range(0,n-2):
if s1[i]=='1':
a[i]=a[i]+1
a[i+1]+=a[i]
a[i+2]+=a[i];
if(s1[n-2]=='1'):
a[n-2]+=1
if(s1[n-1]=='1'):
a[n-1]+=1
for i in range(0,m-2):
if s2[i]=='1':
++b[i];
b[i+1]+=b[i]
b[i+2]+=b[i]... | s1 = str(input())
s2 = str(input())
n = len(s1)
m = len(s2)
a = [0] * n
b = [0] * m
for i in range(0, n - 2):
if s1[i] == '1':
a[i] = a[i] + 1
a[i + 1] += a[i]
a[i + 2] += a[i]
if s1[n - 2] == '1':
a[n - 2] += 1
if s1[n - 1] == '1':
a[n - 1] += 1
for i in range(0, m - 2):
if s2[i] == '1'... |
def new_queue():
return []
def enqueue(a, element):
a.append(element);
def dequeue(a):
if (len(a)):
return a.pop(0)
def is_empty(a):
return True if len(a) == 0 else False | def new_queue():
return []
def enqueue(a, element):
a.append(element)
def dequeue(a):
if len(a):
return a.pop(0)
def is_empty(a):
return True if len(a) == 0 else False |
#
# PySNMP MIB module GAMATRONIC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GAMATRONIC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:04:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) ... |
# Generated with generatedevices.py
class Device:
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key])
devices = [
Device(devid="at90can128", name="AT90CAN128", signature=0x978103f, flash_size=0x20000, flash_pagesize=0x100, reg_dwdr=None, reg_spmcsr=0x37),
D... | class Device:
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key])
devices = [device(devid='at90can128', name='AT90CAN128', signature=158863423, flash_size=131072, flash_pagesize=256, reg_dwdr=None, reg_spmcsr=55), device(devid='at90can32', name='AT90CAN32', signatur... |
# pylint: disable=C0112,C0103,R0903,C0116,C0114,R0201
def read_int():
return int(input())
def read_int_array():
return [int(ss) for ss in input().split()]
def complete_sequence(xs, a, b, c, d, total_len):
"""
FB Hacker Cup-style for long lists
"""
for x in xs:
yield x
p, q = xs[-2... | def read_int():
return int(input())
def read_int_array():
return [int(ss) for ss in input().split()]
def complete_sequence(xs, a, b, c, d, total_len):
"""
FB Hacker Cup-style for long lists
"""
for x in xs:
yield x
(p, q) = (xs[-2], xs[-1])
for _ in range(total_len - len(xs)):
... |
"""
Copyright 2016 Deepgram
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
distri... | """
Copyright 2016 Deepgram
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
distri... |
#Embedded file name: ACEStream\Core\dispersy\encoding.pyo
def _a_encode_int(value, mapping):
value = str(value).encode('UTF-8')
return (str(len(value)).encode('UTF-8'), 'i', value)
def _a_encode_float(value, mapping):
value = str(value).encode('UTF-8')
return (str(len(value)).encode('UTF-8'), 'f', v... | def _a_encode_int(value, mapping):
value = str(value).encode('UTF-8')
return (str(len(value)).encode('UTF-8'), 'i', value)
def _a_encode_float(value, mapping):
value = str(value).encode('UTF-8')
return (str(len(value)).encode('UTF-8'), 'f', value)
def _a_encode_unicode(value, mapping):
value = val... |
n = int(input())
value = 0
max_value = 0
max_quality = 0
max_weight = 0
max_time = 0
for x in range(n):
weight = int(input())
time_needed = int(input())
quality = int(input())
value = (weight / time_needed) ** quality
if value > max_value:
max_value = value
max_quality = quality
... | n = int(input())
value = 0
max_value = 0
max_quality = 0
max_weight = 0
max_time = 0
for x in range(n):
weight = int(input())
time_needed = int(input())
quality = int(input())
value = (weight / time_needed) ** quality
if value > max_value:
max_value = value
max_quality = quality
... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def findBottomLeftValue(self, root: TreeNode) -> int:
stack = [root]
res = stack[0].val
while stack:
newstack =... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def find_bottom_left_value(self, root: TreeNode) -> int:
stack = [root]
res = stack[0].val
while stack:
newstack = []
for node in stac... |
night = 20
transport = 1.60
museum = 6
number_of_people = int(input())
number_of_nights = int(input())
number_of_cards = int(input())
number_of_tickets = int(input())
all_nights = night * number_of_nights
all_cards = transport * number_of_cards
all_museum = museum * number_of_tickets
total_per_person = all_nights + ... | night = 20
transport = 1.6
museum = 6
number_of_people = int(input())
number_of_nights = int(input())
number_of_cards = int(input())
number_of_tickets = int(input())
all_nights = night * number_of_nights
all_cards = transport * number_of_cards
all_museum = museum * number_of_tickets
total_per_person = all_nights + all_... |
into = [13,56,34,58,52,93,35,24]
print(into)
print("\sorted is =",
sorted(into))
print("\maximum is = ",
max(into))
print("\minimum is =",
min(into))
print("\length is = ",
len(into))
| into = [13, 56, 34, 58, 52, 93, 35, 24]
print(into)
print('\\sorted is =', sorted(into))
print('\\maximum is = ', max(into))
print('\\minimum is =', min(into))
print('\\length is = ', len(into)) |
"""Constants for frigate."""
# Base component constants
NAME = "Frigate"
DOMAIN = "frigate"
FRIGATE_VERSION_ERROR_CUTOFF = "0.8.4"
FRIGATE_RELEASES_URL = "https://github.com/blakeblackshear/frigate/releases"
FRIGATE_RELEASE_TAG_URL = f"{FRIGATE_RELEASES_URL}/tag"
# Icons
ICON_CAR = "mdi:shield-car"
ICON_CAT = "mdi:cat... | """Constants for frigate."""
name = 'Frigate'
domain = 'frigate'
frigate_version_error_cutoff = '0.8.4'
frigate_releases_url = 'https://github.com/blakeblackshear/frigate/releases'
frigate_release_tag_url = f'{FRIGATE_RELEASES_URL}/tag'
icon_car = 'mdi:shield-car'
icon_cat = 'mdi:cat'
icon_contrast = 'mdi:contrast-circ... |
# https://www.codechef.com/problems/CHOPRT
for T in range(int(input())):
a,b = map(int,input().split())
if(a>b): print(">")
if(a<b): print("<")
if(a==b): print("=") | for t in range(int(input())):
(a, b) = map(int, input().split())
if a > b:
print('>')
if a < b:
print('<')
if a == b:
print('=') |
###############################################################################
# Function: Sequence1Frames_set_timeslider
#
# Purpose:
# This is a callback function for sequence 1's IterateCallbackAndSaveFrames
# function. This function sets the time and updates the time slider so
# it has the right time value.
... | def sequence1_frames_set_timeslider(i, cbdata):
ts = cbdata
ret = set_time_slider_state(i)
query('Time')
time = get_query_output_value()
ts.text = 'Time = %1.5f' % time
return ret
def sequence2_frames_clip_cb(i, cbdata):
nts = cbdata[0]
clip = cbdata[1]
xmin = cbdata[2]
xmax = c... |
def printb(block):
print(bstr(block))
def bstr(block):
strs = []
types = ['res', 'com', 'ind']
for t in types:
bldg_strs = []
bldgs = list(block['buildings'][t].values())
bldgs = sorted(bldgs, key=lambda b: b['weight'])
for build in bldgs:
s = f" {build[... | def printb(block):
print(bstr(block))
def bstr(block):
strs = []
types = ['res', 'com', 'ind']
for t in types:
bldg_strs = []
bldgs = list(block['buildings'][t].values())
bldgs = sorted(bldgs, key=lambda b: b['weight'])
for build in bldgs:
s = f" {build['n... |
class MapSum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.d = {}
def insert(self, key, val):
"""
:type key: str
:type val: int
:rtype: None
"""
self.d[key] = val
def sum(self, prefix):
... | class Mapsum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.d = {}
def insert(self, key, val):
"""
:type key: str
:type val: int
:rtype: None
"""
self.d[key] = val
def sum(self, prefix):
... |
#/usr/bin/env python
'''
Classical algorithm
Hanoi Towel
'''
# No Import needed.
# No Global Variable.
# No Class definition.
def Hanoi( a , b , c , n ):
'''
a -- position for the plate need to move
b -- destination for the plate need to reach
c -- assistant plate
n -- count of p... | """
Classical algorithm
Hanoi Towel
"""
def hanoi(a, b, c, n):
"""
a -- position for the plate need to move
b -- destination for the plate need to reach
c -- assistant plate
n -- count of plate in a
"""
if n >= 1:
hanoi(a, c, b, n - 1)
move(a, b)
hanoi(c, b, a, n - ... |
NAME_FILE = "name.mp3"
TMP_DATA_DIR = "data/engagement"
TMP_RAW_NAME_FILE = f"{TMP_DATA_DIR}/raw-name.wav"
TMP_NAME_FILE = f"{TMP_DATA_DIR}/{NAME_FILE}"
FACES_DATA_DIR = "data/faces"
ENCODINGS_FILE_PATH = "data/encodings.pickle"
TRAINER_PROCESSED_FILE_PATH = "data/faces_processed.txt"
| name_file = 'name.mp3'
tmp_data_dir = 'data/engagement'
tmp_raw_name_file = f'{TMP_DATA_DIR}/raw-name.wav'
tmp_name_file = f'{TMP_DATA_DIR}/{NAME_FILE}'
faces_data_dir = 'data/faces'
encodings_file_path = 'data/encodings.pickle'
trainer_processed_file_path = 'data/faces_processed.txt' |
#!/usr/bin/env python3
txt = "w1{1wq87g_9654g"
flag = ""
for i in range(len(txt)):
if i % 2 == 0:
flag += chr(ord(txt[i])-5)
else:
flag += chr(ord(txt[i])+2)
print("picoCTF{%s}"%flag) | txt = 'w1{1wq87g_9654g'
flag = ''
for i in range(len(txt)):
if i % 2 == 0:
flag += chr(ord(txt[i]) - 5)
else:
flag += chr(ord(txt[i]) + 2)
print('picoCTF{%s}' % flag) |
# Write your code here
test = int(input())
while test > 0 :
n = input()
count = 0
l = ['a','e','i','o','u','A','E','I','O','U']
for i in n :
if i in l :
count += 1
print(count)
test -= 1
| test = int(input())
while test > 0:
n = input()
count = 0
l = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
for i in n:
if i in l:
count += 1
print(count)
test -= 1 |
def condition_check(string: str, condition: str) -> bool:
condition = chop_redundant_bracket(condition.strip()).strip()
level_dict = get_level_dict(condition)
if level_dict == {}:
return has_sub_string(string, condition)
else:
min_level = min(level_dict.keys())
min_level_dict = l... | def condition_check(string: str, condition: str) -> bool:
condition = chop_redundant_bracket(condition.strip()).strip()
level_dict = get_level_dict(condition)
if level_dict == {}:
return has_sub_string(string, condition)
else:
min_level = min(level_dict.keys())
min_level_dict = l... |
def find_largest(n: int, L: list) -> list:
"""Return the n largest values in L in order from smallest to largest.
>>> L= [3, 4, 7, -1, 2, 5]
>>> find_largest(3, L)
[4, 5, 7]
"""
copy=sorted(L)
return copy[-n:] | def find_largest(n: int, L: list) -> list:
"""Return the n largest values in L in order from smallest to largest.
>>> L= [3, 4, 7, -1, 2, 5]
>>> find_largest(3, L)
[4, 5, 7]
"""
copy = sorted(L)
return copy[-n:] |
for i in range (10,20):#imprime do ao 19, pois sao 10 numeros
print(i)
for i in range (10,20,2):#agora com numero 2 determino o salto de numeros
print(i) | for i in range(10, 20):
print(i)
for i in range(10, 20, 2):
print(i) |
def make_collector(cls, methodname):
storage = []
method = getattr(cls, methodname)
method = getattr(method, "__func__", method)
def collect(self, ctx):
storage.append(ctx)
return method(self, ctx)
class Collector(cls):
pass
collect.__name__ = methodname
Collector... | def make_collector(cls, methodname):
storage = []
method = getattr(cls, methodname)
method = getattr(method, '__func__', method)
def collect(self, ctx):
storage.append(ctx)
return method(self, ctx)
class Collector(cls):
pass
collect.__name__ = methodname
Collector._... |
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:
if obstacleGrid[0][0] == 1:
return 0
else:
obstacleGrid[0][0] = 1
numberOfRows = len(obstacleGrid)
numberOfColumns = len(obstacleGrid[0])
for col in range(1, numb... | class Solution:
def unique_paths_with_obstacles(self, obstacleGrid: List[List[int]]) -> int:
if obstacleGrid[0][0] == 1:
return 0
else:
obstacleGrid[0][0] = 1
number_of_rows = len(obstacleGrid)
number_of_columns = len(obstacleGrid[0])
for col in range... |
#
# PySNMP MIB module TRANGOP5830S-RU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRANGOP5830S-RU-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint, constraints_union) ... |
test = { 'name': 'q2_1_2',
'points': 1,
'suites': [ { 'cases': [ { 'code': '>>> # Make sure you can use any two movies;\n'
'>>> correct_dis = 0.000541242;\n'
'>>> dis = distance_two_features("clerks.", "the a... | test = {'name': 'q2_1_2', 'points': 1, 'suites': [{'cases': [{'code': '>>> # Make sure you can use any two movies;\n>>> correct_dis = 0.000541242;\n>>> dis = distance_two_features("clerks.", "the avengers", "water", "feel");\n>>> np.isclose(np.round(dis, 9), correct_dis)\nTrue', 'hidden': False, 'locked': False}, {'cod... |
# TC:O(N^N)
def queens_helper(n, row, col, asc_des, desc_des, possibilities):
curr_row = len(possibilities)
for curr_col in range(n):
if col[curr_col] and row[curr_row] and asc_des[curr_col+curr_row] and desc_des[curr_row-curr_col]:
row[curr_row] = False
col[curr_col] = False
... | def queens_helper(n, row, col, asc_des, desc_des, possibilities):
curr_row = len(possibilities)
for curr_col in range(n):
if col[curr_col] and row[curr_row] and asc_des[curr_col + curr_row] and desc_des[curr_row - curr_col]:
row[curr_row] = False
col[curr_col] = False
... |
SITE_NAME='Bitsbox'
SQLALCHEMY_TRACK_MODIFICATIONS=False
DEBUG=False
USER_CREATION_ALLOWED=False
GOOGLE_CLIENT_ID='YOUR_CLIENT_ID.apps.googleusercontent.com'
| site_name = 'Bitsbox'
sqlalchemy_track_modifications = False
debug = False
user_creation_allowed = False
google_client_id = 'YOUR_CLIENT_ID.apps.googleusercontent.com' |
"""Custom exceptions."""
class SlugError(Exception):
"""Slug error."""
| """Custom exceptions."""
class Slugerror(Exception):
"""Slug error.""" |
option_spec = {
"OIDCProvider": {
"REQUIRE_CONSENT": {
"type": "boolean",
"default": True,
"envvars": ("KOLIBRI_OIDC_PROVIDER_REQUEST_CONSENT",),
}
}
}
| option_spec = {'OIDCProvider': {'REQUIRE_CONSENT': {'type': 'boolean', 'default': True, 'envvars': ('KOLIBRI_OIDC_PROVIDER_REQUEST_CONSENT',)}}} |
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
s_dict = {}
t_dict = {}
if len(s) != len(t):
return False
for idx in range(len(s)):
s_char = s[idx]
t_char = t[idx]
if s_char not in s_dict:
... | class Solution:
def is_isomorphic(self, s: str, t: str) -> bool:
s_dict = {}
t_dict = {}
if len(s) != len(t):
return False
for idx in range(len(s)):
s_char = s[idx]
t_char = t[idx]
if s_char not in s_dict:
s_dict[s_char... |
base_dir = os.path.split(os.path.dirname(__file__))[0]
data_dir = os.path.join(
base_dir,
"data",
)
resource_dir = os.path.join(
base_dir,
"resources",
)
| base_dir = os.path.split(os.path.dirname(__file__))[0]
data_dir = os.path.join(base_dir, 'data')
resource_dir = os.path.join(base_dir, 'resources') |
# -*- coding: utf-8 -*-
#
#
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General infor... | source_suffix = '.rst'
master_doc = 'index'
project = u'Unreal Engine 4 Steamworks Callback Plugin'
copyright = u'2018, Daniel Nahle'
author = u'Daniel Nahle'
version = u'1.0'
release = u'1.0'
language = 'en'
pygments_style = 'sphinx'
html_scaled_image_link = False
html_theme = 'sphinx_rtd_theme'
html_theme_options = {... |
def pydemic():
"""
Patch the streamlit module
"""
| def pydemic():
"""
Patch the streamlit module
""" |
VALIDATION_EXCEPTION_MESSAGE = "Validation error has occurred : {0}"
WRONG_ID_FORMAT_MESSAGE = "Wrong {0} id format : {1}"
OBJECT_ALREADY_PROCESSING_MESSAGE = "object {0} is already processing. request cannot be completed."
# validation error messages
INVALID_SECRET_CONFIG_MESSAGE = "got an invalid secret config"
IN... | validation_exception_message = 'Validation error has occurred : {0}'
wrong_id_format_message = 'Wrong {0} id format : {1}'
object_already_processing_message = 'object {0} is already processing. request cannot be completed.'
invalid_secret_config_message = 'got an invalid secret config'
insufficient_data_to_choose_a_sto... |
stop_codon = ["UAA", "UAG", "UGA"]
amino_acid = ["Ala", "Arg", "Asn", "Asp", "Cys", "Glu", "Gln", "Gly", "His", "Ile", "Leu", "Lys",
"Met", "Phe", "Pro", "Ser", "Thr", "Trp", "Tyr", "Val"]
codon_U = ["UUU", "UUC", "UUA", "UUG",
"UCU", "UCC", "UCA", "UCG",
"UAU", "UAC", "UAA", "U... | stop_codon = ['UAA', 'UAG', 'UGA']
amino_acid = ['Ala', 'Arg', 'Asn', 'Asp', 'Cys', 'Glu', 'Gln', 'Gly', 'His', 'Ile', 'Leu', 'Lys', 'Met', 'Phe', 'Pro', 'Ser', 'Thr', 'Trp', 'Tyr', 'Val']
codon_u = ['UUU', 'UUC', 'UUA', 'UUG', 'UCU', 'UCC', 'UCA', 'UCG', 'UAU', 'UAC', 'UAA', 'UAG', 'UGU', 'UGC', 'UGA', 'UGG']
codon_c ... |
class Node(object):
def __init__(self, val, parent=None):
self.val = val
self.leftChild = None
self.rightChild = None
self.parent = parent
def getLeftChild(self):
return self.leftChild
def getRightChild(self):
return self.rightChild
def getParent(self)... | class Node(object):
def __init__(self, val, parent=None):
self.val = val
self.leftChild = None
self.rightChild = None
self.parent = parent
def get_left_child(self):
return self.leftChild
def get_right_child(self):
return self.rightChild
def get_parent(... |
def isMAC48Address(inputString):
str_split = inputString.split("-")
count = 0
if len(inputString) != 17:
return False
if len(str_split) != 6:
return False
for i in range(0, 6):
if str_split[i] == "":
return False
if re.search("[a-zG-Z]", str_split[i]):
... | def is_mac48_address(inputString):
str_split = inputString.split('-')
count = 0
if len(inputString) != 17:
return False
if len(str_split) != 6:
return False
for i in range(0, 6):
if str_split[i] == '':
return False
if re.search('[a-zG-Z]', str_split[i]):
... |
"""
Consider an array arr of distinct numbers sorted in increasing order.
Given that this array has been rotated (clockwise) k number of times. Given such an array, find the value of k.
"""
def find_rotations(arr: list):
min_val = arr[0]
n = len(arr)
min_index = -1
for i in range(0, n):
if mi... | """
Consider an array arr of distinct numbers sorted in increasing order.
Given that this array has been rotated (clockwise) k number of times. Given such an array, find the value of k.
"""
def find_rotations(arr: list):
min_val = arr[0]
n = len(arr)
min_index = -1
for i in range(0, n):
if min_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 27 11:06:10 2021
@author: q
Goal : Study Dynamic Programming Concepts for CGA Exam
Study Case : Fibonacci Numbers
- Binary Recursion
- Top-Down with Memoization
- Bottom-Up with Tabualtion
"""
def fiboRecursive(n):
... | """
Created on Sun Jun 27 11:06:10 2021
@author: q
Goal : Study Dynamic Programming Concepts for CGA Exam
Study Case : Fibonacci Numbers
- Binary Recursion
- Top-Down with Memoization
- Bottom-Up with Tabualtion
"""
def fibo_recursive(n):
""" Fibonacci numbers solved with binary recu... |
class Account:
def __init__(self, client):
self._client = client
def get_balance(self):
return self._client.get(self._client.host(), "/account/get-balance")
def topup(self, params=None, **kwargs):
return self._client.post(self._client.host(), "/account/top-up", params or kwargs)
... | class Account:
def __init__(self, client):
self._client = client
def get_balance(self):
return self._client.get(self._client.host(), '/account/get-balance')
def topup(self, params=None, **kwargs):
return self._client.post(self._client.host(), '/account/top-up', params or kwargs)
... |
#!/usr/bin/env python
# vim: set tabstop=4 shiftwidth=4 textwidth=79 cc=72,79:
"""
Original Author: Owain Jones [github.com/erinaceous] [odj@aber.ac.uk]
"""
__all__ = [
'data',
'fuzzy',
'utils',
'cmeans'
]
| """
Original Author: Owain Jones [github.com/erinaceous] [odj@aber.ac.uk]
"""
__all__ = ['data', 'fuzzy', 'utils', 'cmeans'] |
# Base architecture
alexnet = {}
alexnet['conv1'] = [64,3,11,11]
alexnet['conv2'] = [192,64,5,5]
alexnet['conv3'] = [384,192,3,3]
alexnet['conv4'] = [256,384,3,3]
alexnet['conv5'] = [256,256,3,3]
alexnet['fc'] = [100,256]
vgg8 = {}
vgg8['conv1'] = [64,3,3,3]
vgg8['conv2'] = [128,64,3,3]
vgg8['conv3'] = [256,128,3,... | alexnet = {}
alexnet['conv1'] = [64, 3, 11, 11]
alexnet['conv2'] = [192, 64, 5, 5]
alexnet['conv3'] = [384, 192, 3, 3]
alexnet['conv4'] = [256, 384, 3, 3]
alexnet['conv5'] = [256, 256, 3, 3]
alexnet['fc'] = [100, 256]
vgg8 = {}
vgg8['conv1'] = [64, 3, 3, 3]
vgg8['conv2'] = [128, 64, 3, 3]
vgg8['conv3'] = [256, 128, 3, ... |
strN = input("Please enter a number:")
N = int(strN)
#N = 10
total = 0
for current in range(N+1):
if current % 2 == 1:
total = total + current
print("summation 1..",N," for odd numbers is",total)
| str_n = input('Please enter a number:')
n = int(strN)
total = 0
for current in range(N + 1):
if current % 2 == 1:
total = total + current
print('summation 1..', N, ' for odd numbers is', total) |
#!/usr/bin/env python3
d = ['Sunny', 'Cloudy', 'Rainy']
N = input()
i = d.index(N)
print(d[(i + 1) % 3])
| d = ['Sunny', 'Cloudy', 'Rainy']
n = input()
i = d.index(N)
print(d[(i + 1) % 3]) |
version = '2.4.0'
author = 'maximilionus'
# Variables below was deprecated in 2.2.0
# and will be removed in 3.0.0 release
__version__ = version
__author__ = author
| version = '2.4.0'
author = 'maximilionus'
__version__ = version
__author__ = author |
"""Manager service."""
class Manager:
"""Encapsulation of manager service."""
def __init__(self) -> None:
self._instance: bool = True
| """Manager service."""
class Manager:
"""Encapsulation of manager service."""
def __init__(self) -> None:
self._instance: bool = True |
#!/usr/bin/env python3
"""Infoset-NG maintenance module.
Miscellaneous functions
"""
def print_ok(message):
"""Install python module using pip3.
Args:
module: module to install
Returns:
None
"""
# Print message
print('OK - {}'.format(message))
| """Infoset-NG maintenance module.
Miscellaneous functions
"""
def print_ok(message):
"""Install python module using pip3.
Args:
module: module to install
Returns:
None
"""
print('OK - {}'.format(message)) |
class bank:
def __init__(self,d,w):
self.deposit = d
self.withdrawl = w
def amount(self):
if self.withdrawl<=self.deposit:
print("remaining balance: %d " %(self.deposit - self.withdrawl))
else:
print("insufficient balance:")
d = int(input("... | class Bank:
def __init__(self, d, w):
self.deposit = d
self.withdrawl = w
def amount(self):
if self.withdrawl <= self.deposit:
print('remaining balance: %d ' % (self.deposit - self.withdrawl))
else:
print('insufficient balance:')
d = int(input('enter the... |
class Config:
framesPerExample = 512
exampleLength = 120
batch_size = 98 | class Config:
frames_per_example = 512
example_length = 120
batch_size = 98 |
__author__ = 'sarangis'
class ModulePass:
def __init__(self):
pass
def run_on_module(self, node):
raise NotImplementedError("Derived passes class should implement run_on_module")
class FunctionPass:
def __init__(self):
pass
def run_on_function(self, node):
raise NotIm... | __author__ = 'sarangis'
class Modulepass:
def __init__(self):
pass
def run_on_module(self, node):
raise not_implemented_error('Derived passes class should implement run_on_module')
class Functionpass:
def __init__(self):
pass
def run_on_function(self, node):
raise n... |
github_config = {
"base_url": "",
"org": "",
"access_token": ""
} | github_config = {'base_url': '', 'org': '', 'access_token': ''} |
"""Online Stock Span"""
class StockSpanner:
"""https://leetcode.com/problems/online-stock-span/"""
def __init__(self):
# monotone decreasing stack
self.min_stack = []
def next(self, price: int) -> int:
weight = 1
while self.min_stack and self.min_stack[-1][0] <= price:
... | """Online Stock Span"""
class Stockspanner:
"""https://leetcode.com/problems/online-stock-span/"""
def __init__(self):
self.min_stack = []
def next(self, price: int) -> int:
weight = 1
while self.min_stack and self.min_stack[-1][0] <= price:
weight += self.min_stack.po... |
notice ="""
Font Generator Program
-----------------------------------
| Copyright 2022 by Joel C. Alcarez |
| [joelalcarez1975@gmail.com] |
|-----------------------------------|
| We make absolutely no warranty |
| of any kind, expressed or implied |
|-----------------------------------|
| Contact ... | notice = '\n Font Generator Program\n -----------------------------------\n| Copyright 2022 by Joel C. Alcarez |\n| [joelalcarez1975@gmail.com] |\n|-----------------------------------|\n| We make absolutely no warranty |\n| of any kind, expressed or implied |\n|-----------------------------------|\n| ... |
class Solution:
def arrangeCoins(self, n: int) -> int:
l, r = 1, 2 ** 16
while l <= r:
m = (l + r) // 2
c = self._count(m)
if c <= n and self._count(m + 1) > n:
return m
elif c > n:
r = m - 1
else:
... | class Solution:
def arrange_coins(self, n: int) -> int:
(l, r) = (1, 2 ** 16)
while l <= r:
m = (l + r) // 2
c = self._count(m)
if c <= n and self._count(m + 1) > n:
return m
elif c > n:
r = m - 1
else:
... |
"""
from keras.layers import Input
from keras.engine.topology import Layer
import scipy as sci
import numpy as np
from scipy.stats import bernoulli
import random
class DropConnect(Layer):
def __init__(self, input_dim, output_dim, p):
self.train = True
self.prob = p or 0.5
if self.prob >=... | """
from keras.layers import Input
from keras.engine.topology import Layer
import scipy as sci
import numpy as np
from scipy.stats import bernoulli
import random
class DropConnect(Layer):
def __init__(self, input_dim, output_dim, p):
self.train = True
self.prob = p or 0.5
if self.prob >=... |
"""
Write a Python program to replace dictionary values with their sum.
"""
def sum_math_v_vi_average(list_of_dicts):
for d in list_of_dicts:
n1 = d.pop('V')
n2 = d.pop('VI')
d['V+VI'] = (n1 + n2)/2
return list_of_dicts
student_details= [
{'id' : 1, 'subject' : 'math', 'V' : 70, 'VI' ... | """
Write a Python program to replace dictionary values with their sum.
"""
def sum_math_v_vi_average(list_of_dicts):
for d in list_of_dicts:
n1 = d.pop('V')
n2 = d.pop('VI')
d['V+VI'] = (n1 + n2) / 2
return list_of_dicts
student_details = [{'id': 1, 'subject': 'math', 'V': 70, 'VI': 82... |
class Node:
def __init__(self, data) -> None:
self.data = data
self.next = None
class LinkedList:
def __init__(self, head=None) -> None:
self.head = Node(head)
def pushTop(self, val):
newNode = Node(val)
current = self.head
if not current.data:
... | class Node:
def __init__(self, data) -> None:
self.data = data
self.next = None
class Linkedlist:
def __init__(self, head=None) -> None:
self.head = node(head)
def push_top(self, val):
new_node = node(val)
current = self.head
if not current.data:
... |
# noinspection PyShadowingBuiltins,PyUnusedLocal
def compute(x, y):
return x+y
a = 2
b = 3
print(compute(a,b)) | def compute(x, y):
return x + y
a = 2
b = 3
print(compute(a, b)) |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
L = list(map(lambda x: 2 **x, range(7)))
X = 5
obj = 2 ** X
if obj in L:
print('at index', L.index(obj))
else:
print(X, 'not found')
| l = list(map(lambda x: 2 ** x, range(7)))
x = 5
obj = 2 ** X
if obj in L:
print('at index', L.index(obj))
else:
print(X, 'not found') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.