content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
N=int(input())
while N>2:
for i in range(2, N+1):
if(N%i==0):
print(i)
N=N//i
break
| n = int(input())
while N > 2:
for i in range(2, N + 1):
if N % i == 0:
print(i)
n = N // i
break |
##############################################################################
# The MIT License (MIT)
#
# Copyright (c) 2016-2019 Hajime Nakagami<nakagami@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), ... | excsat = 4161
syncctl = 4181
syncrsy = 4201
accsec = 4205
secchk = 4206
synclog = 4207
accrdb = 8193
bgnbnd = 8194
bndsqlstt = 8196
clsqry = 8197
cntqry = 8198
drppkg = 8199
dscsqlstt = 8200
endbnd = 8201
excsqlimm = 8202
excsqlstt = 8203
excsqlset = 8212
opnqry = 8204
prpsqlstt = 8205
rdbcmm = 8206
rdbrllbck = 8207
re... |
moves=[]
def f(n,namel,namer):
if n==1:
moves.append((namel,namer))
return
namemid=6-namel-namer
f(n-1,namel,namemid)
moves.append((namel,namer))
f(n-1,namemid,namer)
n=int(input())
f(n,1,3)
print(len(moves))
for move in moves:
print(move[0],move[1])
| moves = []
def f(n, namel, namer):
if n == 1:
moves.append((namel, namer))
return
namemid = 6 - namel - namer
f(n - 1, namel, namemid)
moves.append((namel, namer))
f(n - 1, namemid, namer)
n = int(input())
f(n, 1, 3)
print(len(moves))
for move in moves:
print(move[0], move[1]) |
my_dict = {'First': 'Python', 'Second': 'Java', 'Third': 'Ruby'}
print(my_dict.keys()) #get keys
print(my_dict.values()) #get values
print(my_dict.items()) #get key-value pairs
print(my_dict.get('First')) | my_dict = {'First': 'Python', 'Second': 'Java', 'Third': 'Ruby'}
print(my_dict.keys())
print(my_dict.values())
print(my_dict.items())
print(my_dict.get('First')) |
class Word(str):
def __init__(self , str1):
self.str1 = str1
self.count = 0
for each in self.str1:
if each == ' ':
break
else:
self.count += 1
def __lt__(self , other):
return self.count < other.c... | class Word(str):
def __init__(self, str1):
self.str1 = str1
self.count = 0
for each in self.str1:
if each == ' ':
break
else:
self.count += 1
def __lt__(self, other):
return self.count < other.count
def __le__(self, o... |
class NotexError(Exception):
pass
class PandocNotInstalled(NotexError):
pass
class ConversionError(NotexError):
pass
class MissingTitle(ConversionError):
pass
class NonUniqueTitle(ConversionError):
pass
class FileNotFound(NotexError):
pass
| class Notexerror(Exception):
pass
class Pandocnotinstalled(NotexError):
pass
class Conversionerror(NotexError):
pass
class Missingtitle(ConversionError):
pass
class Nonuniquetitle(ConversionError):
pass
class Filenotfound(NotexError):
pass |
class Solution:
def toGoatLatin(self, sentence: str) -> str:
vowelSet = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
sentList = sentence.split(' ')
for i in range(len(sentList)):
if sentList[i][0] in vowelSet:
sentList[i] += 'ma' + (i + 1) * 'a'
... | class Solution:
def to_goat_latin(self, sentence: str) -> str:
vowel_set = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
sent_list = sentence.split(' ')
for i in range(len(sentList)):
if sentList[i][0] in vowelSet:
sentList[i] += 'ma' + (i + 1) * 'a'
... |
class Response(object):
def __init__(self, value="", code=200):
self.code = code
self.value = "" if value is None else value
def __str__(self):
return "code: "+str(self.code)+", value: "+str(self.value)
| class Response(object):
def __init__(self, value='', code=200):
self.code = code
self.value = '' if value is None else value
def __str__(self):
return 'code: ' + str(self.code) + ', value: ' + str(self.value) |
def somar(x, y):
return x+y
def subtrair(x, y):
return x-y
| def somar(x, y):
return x + y
def subtrair(x, y):
return x - y |
# You will be given an integer n for the size of the mines field with square shape and another one for the number of
# bombs that you have to place in the field. On the next n lines, you will receive the position for each bomb.
# Your task is to create the game field placing the bombs at the correct positions and mark ... | def set_cell(cell: tuple, value: str) -> None:
global matrix
(i, j) = cell
matrix[i][j] = value
def get_cell(cell: tuple) -> str:
(i, j) = cell
return str(matrix[i][j])
def is_valid_cell(cell: tuple) -> bool:
if min(cell) >= 0 and max(cell) < matrix_size:
return True
else:
... |
print('--==--'*10)
print('Aprovacao de credito imobiliario')
print('--==--'*10)
casa = float(input('Qual o valor do imovel?'))
sal = float(input('Qual o valor da sua renda?'))
div = int(input('Em quantos anos pretende financiar?'))
minimo = sal*0.3
custo = casa / (div*12)
if custo <= minimo:
print(f'A casa podera s... | print('--==--' * 10)
print('Aprovacao de credito imobiliario')
print('--==--' * 10)
casa = float(input('Qual o valor do imovel?'))
sal = float(input('Qual o valor da sua renda?'))
div = int(input('Em quantos anos pretende financiar?'))
minimo = sal * 0.3
custo = casa / (div * 12)
if custo <= minimo:
print(f'A casa ... |
#!/usr/bin/env python
__name__ = "SciGen"
__author__ = "Samuel Schmidgall"
__license__ = "MIT"
__email__ = "sschmidg@masonlive.gmu.edu"
| __name__ = 'SciGen'
__author__ = 'Samuel Schmidgall'
__license__ = 'MIT'
__email__ = 'sschmidg@masonlive.gmu.edu' |
ord_names = {
1:'OleUIAddVerbMenuA',
2:'OleUICanConvertOrActivateAs',
3:'OleUIInsertObjectA',
4:'OleUIPasteSpecialA',
5:'OleUIEditLinksA',
6:'OleUIChangeIconA',
7:'OleUIConvertA',
8:'OleUIBusyA',
9:'OleUIUpdateLinksA',
10:'OleUIPromptUserA',
11:'OleUIObjectPropertiesA',
1... | ord_names = {1: 'OleUIAddVerbMenuA', 2: 'OleUICanConvertOrActivateAs', 3: 'OleUIInsertObjectA', 4: 'OleUIPasteSpecialA', 5: 'OleUIEditLinksA', 6: 'OleUIChangeIconA', 7: 'OleUIConvertA', 8: 'OleUIBusyA', 9: 'OleUIUpdateLinksA', 10: 'OleUIPromptUserA', 11: 'OleUIObjectPropertiesA', 12: 'OleUIChangeSourceA', 13: 'OleUIAdd... |
N = input()
List = []
for i in range(len(N)):
List.append(N[i])
List.sort()
for k in range(len(List)-1,-1,-1):
print(List[k], end = '')
| n = input()
list = []
for i in range(len(N)):
List.append(N[i])
List.sort()
for k in range(len(List) - 1, -1, -1):
print(List[k], end='') |
PACKAGE_NAME = "project"
PACKAGE_VERSION = "0.0.1"
PACKAGE_DESCRIPTION = "put your description here"
PACKAGE_AUTHOR = "Name"
PACKAGE_URL = "https://<not available>"
| package_name = 'project'
package_version = '0.0.1'
package_description = 'put your description here'
package_author = 'Name'
package_url = 'https://<not available>' |
POSTGRES_USER = 'postgres'
POSTGRES_PASSWORD = ''
POSTGRES_HOST = 'localhost'
POSTGRES_PORT = ''
POSTGRES_DATABASE = 'av_dashboard_test'
| postgres_user = 'postgres'
postgres_password = ''
postgres_host = 'localhost'
postgres_port = ''
postgres_database = 'av_dashboard_test' |
class EquipmentHandler:
def __init__(self):
self.slots = {
'mainhand': None,
'offhand': None,
'body': None,
'legs': None,
'shoes': None,
'accessory': None
}
def equip(self, object, owner):
target_slot = object.db.slo... | class Equipmenthandler:
def __init__(self):
self.slots = {'mainhand': None, 'offhand': None, 'body': None, 'legs': None, 'shoes': None, 'accessory': None}
def equip(self, object, owner):
target_slot = object.db.slot
if self.slots[target_slot] is not None:
self.unequip(targe... |
class Solution:
def destCity(self, paths):
dst = set()
for path in paths:
dst.add(path[1])
for path in paths:
if path[0] in dst:
dst.remove(path[0])
return list(dst)[0]
| class Solution:
def dest_city(self, paths):
dst = set()
for path in paths:
dst.add(path[1])
for path in paths:
if path[0] in dst:
dst.remove(path[0])
return list(dst)[0] |
tail = input()
body = input()
head = input()
# 01 solution basic
order_list = [head, body, tail]
print(order_list)
# # 02 solution swap elements in list[]
# some_list = [tail, body, head]
# some_list[0], some_list[2] = some_list[2], some_list[0]
# print(some_list)
| tail = input()
body = input()
head = input()
order_list = [head, body, tail]
print(order_list) |
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def encrypt(message, shift):
encrypted_message = []
for i in message:
try:
encrypted_message += alphabet[alphabet.index(i)+shift]
except... | alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def encrypt(message, shift):
encrypted_message = []
for i in message:
try:
encrypted_message += alphabet[alphabet.index(i) + shift]
except:
... |
header = pd.read_csv(DATA, nrows=0)
nrows, ncols, *class_labels = header.columns
label_encoder = dict(enumerate(class_labels))
result = (pd
.read_csv(DATA, names=COLUMNS, skiprows=1, nrows=25)
.replace(label_encoder)
)
| header = pd.read_csv(DATA, nrows=0)
(nrows, ncols, *class_labels) = header.columns
label_encoder = dict(enumerate(class_labels))
result = pd.read_csv(DATA, names=COLUMNS, skiprows=1, nrows=25).replace(label_encoder) |
# given a rectangular input matrix M, write a function which
# returns
# a boolean value True if and only if there exist two different rows
# in M,
# whose sum gives the null vector. Do the same for two different
# columns.
def check_null_vector(matrix):
_shallow_matrix = matrix
i=0
for row in matrix:
... | def check_null_vector(matrix):
_shallow_matrix = matrix
i = 0
for row in matrix:
j = i + 1
while j < len(matrix):
if sum(row) + sum(matrix[j]) == 0:
return True
j += 1
i += 1
return False
if __name__ == '__main__':
print(check_null_vect... |
# Copyright (c) 2016-2022, Adam Karpierz
# Licensed under the BSD license
# https://opensource.org/licenses/BSD-3-Clause
__import__("pkg_about").about("pcap-ct")
__copyright__ = f"Copyright (c) 2016-2022, {__author__}" # noqa
| __import__('pkg_about').about('pcap-ct')
__copyright__ = f'Copyright (c) 2016-2022, {__author__}' |
# 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 buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode:
if len(preorder) == 0:
... | class Solution:
def build_tree(self, preorder: List[int], inorder: List[int]) -> TreeNode:
if len(preorder) == 0:
return None
num_to_node_dict = dict([(num, tree_node(num)) for num in preorder])
root = numToNodeDict[preorder[0]]
confirmed = set()
while True:
... |
class ContactVariables:
def __init__(self):
self.CALLSIGN = None
self.ENDPOINT = None
self.ICONSETPATH = None
self.UID = None
self.NAME = None
@classmethod
def connection(cls):
cls.CALLSIGN = None
cls.ENDPOINT = None
cls.ICONSETPATH = None
... | class Contactvariables:
def __init__(self):
self.CALLSIGN = None
self.ENDPOINT = None
self.ICONSETPATH = None
self.UID = None
self.NAME = None
@classmethod
def connection(cls):
cls.CALLSIGN = None
cls.ENDPOINT = None
cls.ICONSETPATH = None
... |
radius = 5.5
area = radius * radius * 3.14
perimeter = 2 * radius * 3.14
print("Area: {}".format(area))
print("Perimeter: {}".format(perimeter))
| radius = 5.5
area = radius * radius * 3.14
perimeter = 2 * radius * 3.14
print('Area: {}'.format(area))
print('Perimeter: {}'.format(perimeter)) |
def text_to_code(text, separator='-', blocks=4, block_size=4, round_count=32):
iter_by = lambda iterator, count: [iterator[index:index + count] for index in range(0, len(iterator), count)]
squash = lambda x: (x & 0xFF) ^ ((x >> 8) & 0xFF) ^ ((x >> 16) & 0xFF) ^ ((x >> 24) & 0xFF)
base = [0xC9, 0x4F, 0x69, 0... | def text_to_code(text, separator='-', blocks=4, block_size=4, round_count=32):
iter_by = lambda iterator, count: [iterator[index:index + count] for index in range(0, len(iterator), count)]
squash = lambda x: x & 255 ^ x >> 8 & 255 ^ x >> 16 & 255 ^ x >> 24 & 255
base = [201, 79, 105, 114, 17, 254, 160, 66, ... |
# Q1:
# Practice with range
# For each below, match the input code to the appropriate output.
# [0, 1, 2, 3]
print(list(range(4)))
# [4, 5, 6, 7]
print(list(range(4,8)))
# [4, 6, 8]
print(list(range(4,10,2)))
# []
# Remember that range is tail-exclusive, and default step value = +1 (offset per round)
print(list(ra... | print(list(range(4)))
print(list(range(4, 8)))
print(list(range(4, 10, 2)))
print(list(range(0, -5)))
colors = ['Red', 'Blue', 'Green', 'Purple']
lower_colors = []
for color in colors:
lower_colors.append(color.lower())
print(lower_colors) |
# Input:
# 1
# 6
# 1 2 3 4 5 6
#
# Output:
# 6 5 4 3 2 1
def reverseList(self):
if self.head is None:
return None
prev = None
cur = self.head
while cur != None:
temp = cur.next
cur.next = prev
prev = cur
cur = temp
self.head... | def reverse_list(self):
if self.head is None:
return None
prev = None
cur = self.head
while cur != None:
temp = cur.next
cur.next = prev
prev = cur
cur = temp
self.head = prev |
# There are n guilty people in a line, the i-th of them holds a claw with length L[i]. The bell rings
# and every person kills some of people in front of him. All people kill others at the same time.
# Namely, the i-th person kills the j-th person if and only if j < i and j >= i-L[i]. We are given
# lengths of the claw... | def wrath(L):
t = [0] * (len(L) + 10)
for i in range(len(L)):
T[max(0, i - L[i])] += 1
T[i] -= 1
result = len(L)
for i in range(len(L)):
T[i] += T[i - 1]
if T[i] > 0:
result -= 1
return result
l = [1, 0, 0, 1, 1, 3, 2, 0, 0, 2, 3]
print(wrath(L)) |
class User:
def __init__(self, id: str):
self.id = id
def deleteUser():
pass
# def
| class User:
def __init__(self, id: str):
self.id = id
def delete_user():
pass |
# Time limit exeeded
while True:
try:
N, Q = map(int, input().split())
X = list(map(int, input().split()))
for k in range(Q):
C = list(map(int, input().split()))
if C[0] == 1:
X[C[1] - 1] = C[2]
else:
s = 0
... | while True:
try:
(n, q) = map(int, input().split())
x = list(map(int, input().split()))
for k in range(Q):
c = list(map(int, input().split()))
if C[0] == 1:
X[C[1] - 1] = C[2]
else:
s = 0
for w in X[C[1] - 1:... |
class Main:
def __init__(self, ownerComp):
self.owner = ownerComp
return
def SyncMonitors(self):
monitorsDat = self.owner.op('monitors')
uiWidth = self.owner.par.Uiresx
uiHeight = self.owner.par.Uiresy
mainWidth = uiWidth
mainHeight = uiHeight
for i in range(1, monitorsDat.numRows):
monW... | class Main:
def __init__(self, ownerComp):
self.owner = ownerComp
return
def sync_monitors(self):
monitors_dat = self.owner.op('monitors')
ui_width = self.owner.par.Uiresx
ui_height = self.owner.par.Uiresy
main_width = uiWidth
main_height = uiHeight
... |
print("Task Manager")
choice=1
listoftask=[]
while(choice!=4):
choice=int(input("Enter \n 1 Enter a task in task manager. \n 2 Display Task manager. \n 3 Remove item from task manager. \n 4 Exit "))
if choice==1:
a=input("\nEnter the task you want to add in task manager : ")
if a in listoftask:
... | print('Task Manager')
choice = 1
listoftask = []
while choice != 4:
choice = int(input('Enter \n 1 Enter a task in task manager. \n 2 Display Task manager. \n 3 Remove item from task manager. \n 4 Exit '))
if choice == 1:
a = input('\nEnter the task you want to add in task manager : ')
if a in l... |
# This is a comment
def foo():
"docstring"
with open('asdf', mode='rt') as handle:
x = [1, 2, 3]
y = x[1]
return handle.read() | def foo():
"""docstring"""
with open('asdf', mode='rt') as handle:
x = [1, 2, 3]
y = x[1]
return handle.read() |
#!/usr/bin/env python
#coding: utf-8
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param head, a ListNode
# @param x, an integer
# @return a ListNode
def partition(self, head, x):
st, sd = ListNo... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def partition(self, head, x):
(st, sd) = (list_node(0), list_node(0))
st.next = head
(t, k) = (sd, st)
while k.next:
if k.next.val < x:
kn = k.next
... |
def something():
global foo
foo = 3
| def something():
global foo
foo = 3 |
#
# PySNMP MIB module HUAWEI-DIE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-DIE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:32:15 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... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, constraints_intersection, single_value_constraint, value_range_constraint) ... |
def pinakasProsthesis():
for i in range(10):
for j in range(10):
print(str(i+j).rjust(4),end = '')
print()
pinakasProsthesis() | def pinakas_prosthesis():
for i in range(10):
for j in range(10):
print(str(i + j).rjust(4), end='')
print()
pinakas_prosthesis() |
COMODO_SERVER_TYPES = {
'AOL':1,
'Apache/ModSSL':2,
'Apache-ModSSL':2,
'Apache-SSL (Ben-SSL, not Stronghold)':3,
'C2Net Stronghold':3,
'Cisco 3000 Series VPN Concentrator':33,
'Citrix':34,
'Cobalt Raq':5,
'Covalent Server Software':6,
'IBM HTTP Server':7,
'IBM Internet Connec... | comodo_server_types = {'AOL': 1, 'Apache/ModSSL': 2, 'Apache-ModSSL': 2, 'Apache-SSL (Ben-SSL, not Stronghold)': 3, 'C2Net Stronghold': 3, 'Cisco 3000 Series VPN Concentrator': 33, 'Citrix': 34, 'Cobalt Raq': 5, 'Covalent Server Software': 6, 'IBM HTTP Server': 7, 'IBM Internet Connection Server': 8, 'iPlanet': 9, 'Jav... |
# operasi yg dapat dilakukan dengan penyingkatan
# operasi ditambah dengan assignment
a = 5 #adalah assignment
print('nilai a =',a)
a += 1 # artinya adalah (a = a + 1)
print('nilai a += 1, nilai a menjadi ',a)
a -= 2 # artinya adalah (a = a - 2)
print('nilai a -= 2, nilai a menjadi ',a)
a *= 5 # artiny... | a = 5
print('nilai a =', a)
a += 1
print('nilai a += 1, nilai a menjadi ', a)
a -= 2
print('nilai a -= 2, nilai a menjadi ', a)
a *= 5
print('nilai a *= 5, nilai a menjadi ', a)
a /= 2
print('nilai a /= 2, nilai a menjadi ', a)
b = 10
b %= 3
print('\nnilai b %= 3, nilai b menjadi ', b)
b = 10
b //= 3
print('nilai b //=... |
description = 'memograph readout'
group = 'optional'
devices = dict(
t_in_poli = device('nicos_mlz.devices.memograph.MemographValue',
hostname = 'memograph-uja01.care.frm2',
group = 2,
valuename = 'T_in POLI',
description = 'inlet temperature memograph',
fmtstr = '%.2F',
... | description = 'memograph readout'
group = 'optional'
devices = dict(t_in_poli=device('nicos_mlz.devices.memograph.MemographValue', hostname='memograph-uja01.care.frm2', group=2, valuename='T_in POLI', description='inlet temperature memograph', fmtstr='%.2F', warnlimits=(-1, 17.5), unit='degC'), t_out_poli=device('nicos... |
class PopcornPopper:
def __init__(self) -> None:
super().__init__()
def on(self):
print('PopcornPopper is on!')
def off(self):
print('PopcornPopper is off!')
def pop(self):
print('PopcornPopper is popping!')
class Light:
def __init__(self) -> None:
supe... | class Popcornpopper:
def __init__(self) -> None:
super().__init__()
def on(self):
print('PopcornPopper is on!')
def off(self):
print('PopcornPopper is off!')
def pop(self):
print('PopcornPopper is popping!')
class Light:
def __init__(self) -> None:
super... |
class DidNotUnderstand(Exception):
def __str__(self) -> str:
return "I didn't understand what you said"
class CannotOpenApplication(Exception):
def __str__(self) -> str:
return "Couldn't open specified application"
class CannotCloseApplication(Exception):
def __str__(self) -> str:
... | class Didnotunderstand(Exception):
def __str__(self) -> str:
return "I didn't understand what you said"
class Cannotopenapplication(Exception):
def __str__(self) -> str:
return "Couldn't open specified application"
class Cannotcloseapplication(Exception):
def __str__(self) -> str:
... |
# -*- coding: utf-8 -*-
def add_layoutlmv2_config(cfg):
_C = cfg
# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------
_C.MODEL.MASK_ON = True
# When using pre-trained m... | def add_layoutlmv2_config(cfg):
_c = cfg
_C.MODEL.MASK_ON = True
_C.MODEL.PIXEL_STD = [57.375, 57.12, 58.395]
_C.MODEL.BACKBONE.NAME = 'build_resnet_fpn_backbone'
_C.MODEL.FPN.IN_FEATURES = ['res2', 'res3', 'res4', 'res5']
_C.MODEL.ANCHOR_GENERATOR.SIZES = [[32], [64], [128], [256], [512]]
_... |
def calificaciones():
#definicion de variables y otros
notaA="A"
notaB="B"
notaC="C"
notaD="D"
notaF="F"
#datos de entrada
notaX=int(input("ingrese la nota:"))
#proceso
if notaX>9 and notaX<11:
notaX=notaA
elif notaX>8 and notaX<10:
notaX=notaB
elif notaX>7 and notaX<9:
notaX=notaC
... | def calificaciones():
nota_a = 'A'
nota_b = 'B'
nota_c = 'C'
nota_d = 'D'
nota_f = 'F'
nota_x = int(input('ingrese la nota:'))
if notaX > 9 and notaX < 11:
nota_x = notaA
elif notaX > 8 and notaX < 10:
nota_x = notaB
elif notaX > 7 and notaX < 9:
nota_x = nota... |
# https://leetcode.com/problems/encode-and-decode-tinyurl
class Codec:
count = 0
tiny_to_url = {}
url_to_tiny = {}
tiny_url_prefix = 'http://tinyurl.com/'
def encode(self, longUrl: str) -> str:
if longUrl in self.url_to_tiny:
return self.url_to_tiny[longUrl]
tiny_url =... | class Codec:
count = 0
tiny_to_url = {}
url_to_tiny = {}
tiny_url_prefix = 'http://tinyurl.com/'
def encode(self, longUrl: str) -> str:
if longUrl in self.url_to_tiny:
return self.url_to_tiny[longUrl]
tiny_url = self.tiny_url_prefix + str(self.count)
self.url_to_... |
###
# The captcha requires you to review a sequence of digits (your puzzle input) and
# find the sum of all digits that match the next digit in the list.
# The list is circular, so the digit after the last digit is the first digit in the list.
#
# Sample test cases
# 1111 -> 4
# 1110 -> 2
# 234872 -> 2
# 87327329 -> 0
... | input_number = int(input('Enter a number:-'))
previous_digit = input_number % 10
input_number //= 10
sum_of_same_digits = 0
last_digit = previous_digit
while input_number > 9:
current_digit = input_number % 10
if current_digit == previous_digit:
sum_of_same_digits += current_digit
previous_digit = c... |
STATIC_KEY = "static_key"
GLOBAL_KEY = "global_key"
GLOBAL_LSN = "global_lsn"
VAL = "value"
REF = "ref"
LBRACKET = "LBRACKET"
RBRACKET = "RBRACKET"
EOF_NAME = "EOF"
METADATA = "metadata"
SPARSE_CHECKPOINTS = "sparse_checkpoints"
ITERATIONS_COUNT = "iterations_count"
PKL_SFX = ".pkl"
| static_key = 'static_key'
global_key = 'global_key'
global_lsn = 'global_lsn'
val = 'value'
ref = 'ref'
lbracket = 'LBRACKET'
rbracket = 'RBRACKET'
eof_name = 'EOF'
metadata = 'metadata'
sparse_checkpoints = 'sparse_checkpoints'
iterations_count = 'iterations_count'
pkl_sfx = '.pkl' |
circle_config = {
"speed":0.1,
"scale": 0.17,
"height_scale": 8,
"offset_height":12,
"character":"x"
} | circle_config = {'speed': 0.1, 'scale': 0.17, 'height_scale': 8, 'offset_height': 12, 'character': 'x'} |
n,k = [int(x) for x in input().split()]
best = float("-inf")
for _ in range(n):
f, t = [int(x) for x in input().split()]
best = max(best, f - (t - k) if t > k else f)
print(best)
| (n, k) = [int(x) for x in input().split()]
best = float('-inf')
for _ in range(n):
(f, t) = [int(x) for x in input().split()]
best = max(best, f - (t - k) if t > k else f)
print(best) |
class Error(Exception):
def __init__(self, message="psimi module error"):
super(Error,self).__init__(message)
class EvidTypeError(Error):
def __init__(self, message="Unsupported EvidType"):
super(EvidTypeError,self).__init__(message)
class MissingParentError(Error):
def __init__(self, me... | class Error(Exception):
def __init__(self, message='psimi module error'):
super(Error, self).__init__(message)
class Evidtypeerror(Error):
def __init__(self, message='Unsupported EvidType'):
super(EvidTypeError, self).__init__(message)
class Missingparenterror(Error):
def __init__(self,... |
def fpath(y, d):
return f"year{y}/day{d}/input.txt"
def input_list_string(year, day):
with open(fpath(year, day), "r") as f:
return f.read().splitlines()
def input_list_integer(year, day):
with open(fpath(year, day), "r") as f:
return [int(x) for x in f.read().splitlines()]
def input_i... | def fpath(y, d):
return f'year{y}/day{d}/input.txt'
def input_list_string(year, day):
with open(fpath(year, day), 'r') as f:
return f.read().splitlines()
def input_list_integer(year, day):
with open(fpath(year, day), 'r') as f:
return [int(x) for x in f.read().splitlines()]
def input_inte... |
a=int(input("Enter the a value"))
b=int(input("Enter the b value"))
c=int(input("Enter the c value"))
if a ==b and b==c:
d=(a+b+c)*3
print(d)
else:
print(a+b+c)
| a = int(input('Enter the a value'))
b = int(input('Enter the b value'))
c = int(input('Enter the c value'))
if a == b and b == c:
d = (a + b + c) * 3
print(d)
else:
print(a + b + c) |
myl1 = [12,10,38,22]
myl1.sort(reverse = True)
print(myl1)
myl1.sort(reverse = False)
print(myl1)
| myl1 = [12, 10, 38, 22]
myl1.sort(reverse=True)
print(myl1)
myl1.sort(reverse=False)
print(myl1) |
# make extension icon
# settings
size(20, 20)
margin = 0.18
oncurve_point_size = 4.8
offcurve_point_size = 3.36
handle_stroke = 1.17
points_stroke = 1.68
box_stroke = 0.94
save_img = True
# box points
p0_x, p0_y = width() * margin, height() * margin
p1_x, p1_y = width() * margin, height() * (1.0 - margin)
p2_x, p... | size(20, 20)
margin = 0.18
oncurve_point_size = 4.8
offcurve_point_size = 3.36
handle_stroke = 1.17
points_stroke = 1.68
box_stroke = 0.94
save_img = True
(p0_x, p0_y) = (width() * margin, height() * margin)
(p1_x, p1_y) = (width() * margin, height() * (1.0 - margin))
(p2_x, p2_y) = (width() * (1.0 - margin), height() ... |
#
# PySNMP MIB module CISCO-IPSLA-ETHERNET-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IPSLA-ETHERNET-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:02:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, single_value_constraint, constraints_intersection) ... |
# Copyright (C) 2016 NooBaa
{
'includes': ['common_third_party.gypi'],
'targets': [{
'target_name': 'cm256',
'type': 'static_library',
'sources': [
'cm256/cm256.cpp',
'cm256/cm256.h',
'cm256/gf256.cpp',
'cm256/gf256.h',
],
}]
}
| {'includes': ['common_third_party.gypi'], 'targets': [{'target_name': 'cm256', 'type': 'static_library', 'sources': ['cm256/cm256.cpp', 'cm256/cm256.h', 'cm256/gf256.cpp', 'cm256/gf256.h']}]} |
'''
Created on 1.12.2016
@author: Darren
''''''
Write a function to find the longest common prefix string amongst an array of strings.
"
'''
| """
Created on 1.12.2016
@author: Darren
Write a function to find the longest common prefix string amongst an array of strings.
"
""" |
'''input
6
-679 -2409 -3258 3095 -3291 -4462
21630
21630
19932
8924
21630
19288
3
3 5 -1
12
8
10
5
1 1 1 2 0
4
4
4
2
4
'''
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
spot_count = int(input())
spots = [0] + list(map(int, input(... | """input
6
-679 -2409 -3258 3095 -3291 -4462
21630
21630
19932
8924
21630
19288
3
3 5 -1
12
8
10
5
1 1 1 2 0
4
4
4
2
4
"""
if __name__ == '__main__':
spot_count = int(input())
spots = [0] + list(map(int, input().split())) + [0]
total_distance = 0
total_cost = 0
for i in range(spot_count + 1):
... |
def check_arg(arg, types):
if not isinstance(arg, types):
if not isinstance(types, (tuple, list)):
types = (types,)
raise ValueError("Expected one of {}, got {}.".format(types, type(arg)))
| def check_arg(arg, types):
if not isinstance(arg, types):
if not isinstance(types, (tuple, list)):
types = (types,)
raise value_error('Expected one of {}, got {}.'.format(types, type(arg))) |
#!/usr/bin/python3
with open('04_input', 'r') as f:
lines = f.readlines()
start, end = [int(i) for i in lines[0].strip().split('-')]
def valid(n):
n_str = str(n)
if sorted(n_str) != list(n_str):
return False
if n_str[0] == n_str[1] or \
n_str[1] == n_str[2] or \
n_str[2] == ... | with open('04_input', 'r') as f:
lines = f.readlines()
(start, end) = [int(i) for i in lines[0].strip().split('-')]
def valid(n):
n_str = str(n)
if sorted(n_str) != list(n_str):
return False
if n_str[0] == n_str[1] or n_str[1] == n_str[2] or n_str[2] == n_str[3] or (n_str[3] == n_str[4]) or (n_... |
def main():
i, j = 0, 0
h, w = 9, 9
M = [[0 for x in range(w)] for y in range(h)]
# M[i-1][j-1] = i-1 * j-1
while( i < 10): #rows
#M[0..i-1][j] #M contains row of multiples of i, 0 -> n
while( j < 10): #cols
M[i][j] = i * j # M[i-1][j-1] contains multiples of ... | def main():
(i, j) = (0, 0)
(h, w) = (9, 9)
m = [[0 for x in range(w)] for y in range(h)]
while i < 10:
while j < 10:
M[i][j] = i * j
j += 1
i += 1
main() |
expected_output = {
"GigabitEthernet0/0/0/0": {
"auto_negotiate": False,
"bandwidth": 768,
"carrier_delay": "10",
"counters": {
"carrier_transitions": 0,
"in_abort": 0,
"in_broadcast_pkts": 0,
"in_crc_errors": 0,
"in_discard... | expected_output = {'GigabitEthernet0/0/0/0': {'auto_negotiate': False, 'bandwidth': 768, 'carrier_delay': '10', 'counters': {'carrier_transitions': 0, 'in_abort': 0, 'in_broadcast_pkts': 0, 'in_crc_errors': 0, 'in_discards': 0, 'in_frame': 0, 'in_frame_errors': 0, 'in_giants': 0, 'in_ignored': 0, 'in_multicast_pkts': 0... |
name = " Fabiano Florentino "
# Left strip
print(f"\nLeft: " + name.lstrip() + "\n")
# Right strip
print(f"Right:" + name.rstrip() + "\n")
# All strip
print(f"All: " + name.strip() + "\n") | name = ' Fabiano Florentino '
print(f'\nLeft: ' + name.lstrip() + '\n')
print(f'Right:' + name.rstrip() + '\n')
print(f'All: ' + name.strip() + '\n') |
n = int(input('Digite um numero: '))
cont = m = n
while cont != 1:
cont -= 1
m = m * cont
print(m) | n = int(input('Digite um numero: '))
cont = m = n
while cont != 1:
cont -= 1
m = m * cont
print(m) |
def zera(a,b):
A = [[0 for i in range(a)] for j in range(b)]
return A
def id(n):
A = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
for j in range(n):
if i==j or i == n-1-j:
A[i][j] = 1
return A
def wyswietl(l):
for x in l:
print... | def zera(a, b):
a = [[0 for i in range(a)] for j in range(b)]
return A
def id(n):
a = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
for j in range(n):
if i == j or i == n - 1 - j:
A[i][j] = 1
return A
def wyswietl(l):
for x in l:
print... |
class MessageFormatter:
header = '\n' + '*' * 24 + '\n'
footer = '\n' + '*' * 24
def format(self, *args):
return self.header + '\n'.join(args) + self.footer
| class Messageformatter:
header = '\n' + '*' * 24 + '\n'
footer = '\n' + '*' * 24
def format(self, *args):
return self.header + '\n'.join(args) + self.footer |
days = ('Mon', 'Tue', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun')
num_of_day = int(input('Enter number of day: '))
print('The day of the week is: ' + days[num_of_day - 1])
| days = ('Mon', 'Tue', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun')
num_of_day = int(input('Enter number of day: '))
print('The day of the week is: ' + days[num_of_day - 1]) |
def merge_the_tools(string, k):
t = [string[i:i+k] for i in range(0,len(string),k)]
u = []
for i in enumerate(t):
u.append(''.join([b for a,b in enumerate(t[i]) if b not in t[i][:a]]))
for i in enumerate(u):
print(u[i])
# your code goes here
if __name__ == '__main__':
... | def merge_the_tools(string, k):
t = [string[i:i + k] for i in range(0, len(string), k)]
u = []
for i in enumerate(t):
u.append(''.join([b for (a, b) in enumerate(t[i]) if b not in t[i][:a]]))
for i in enumerate(u):
print(u[i])
if __name__ == '__main__':
(string, k) = (input(), int(in... |
def getData(loop=False):
while True:
with open("2018/data/day1") as data:
yield from data
if not loop:
break
def part1():
return sum(map(int, getData()))
def part2():
seen = {0}
currentFrequency = 0
for frequency in map(int, getData(True)):
current... | def get_data(loop=False):
while True:
with open('2018/data/day1') as data:
yield from data
if not loop:
break
def part1():
return sum(map(int, get_data()))
def part2():
seen = {0}
current_frequency = 0
for frequency in map(int, get_data(True)):
curre... |
class Solution:
def xorGame(self, nums: List[int]) -> bool:
res = 0
for i in nums:
res ^= i
return res == 0 or len(nums)%2 == 0
| class Solution:
def xor_game(self, nums: List[int]) -> bool:
res = 0
for i in nums:
res ^= i
return res == 0 or len(nums) % 2 == 0 |
class Schedule:
def is_scheduled(self, schedulable, start_date, end_date):
print('This %s is not scheduled' % schedulable.__class__)
print('between %s and %s' % (start_date, end_date))
| class Schedule:
def is_scheduled(self, schedulable, start_date, end_date):
print('This %s is not scheduled' % schedulable.__class__)
print('between %s and %s' % (start_date, end_date)) |
def buy_and_sell_stock_once(prices):
maxProfit, currentMaxValue = 0, 0
for price in reversed(prices):
currentMaxValue = max(currentMaxValue, price)
profit = currentMaxValue - price
maxProfit = max(profit, maxProfit)
return maxProfit
print(buy_and_sell_stock_once([12,678,346,345,456,5... | def buy_and_sell_stock_once(prices):
(max_profit, current_max_value) = (0, 0)
for price in reversed(prices):
current_max_value = max(currentMaxValue, price)
profit = currentMaxValue - price
max_profit = max(profit, maxProfit)
return maxProfit
print(buy_and_sell_stock_once([12, 678, 3... |
class Solution:
def combinationSum(self, candidates, target):
self.ans = []
self.dfs(sorted(candidates), 0, [], target)
return self.ans
def dfs(self, candidates, index, path, target):
if target == 0:
self.ans.append(list(path))
for i in range(index, len(... | class Solution:
def combination_sum(self, candidates, target):
self.ans = []
self.dfs(sorted(candidates), 0, [], target)
return self.ans
def dfs(self, candidates, index, path, target):
if target == 0:
self.ans.append(list(path))
for i in range(index, len(can... |
#
# PySNMP MIB module ADTRAN-AOS-MEF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-AOS-MEF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:14:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (ad_gen_aos_mef, ad_gen_aos) = mibBuilder.importSymbols('ADTRAN-AOS', 'adGenAOSMef', 'adGenAOS')
(ad_shared, ad_identity_shared) = mibBuilder.importSymbols('ADTRAN-MIB', 'adShared', 'adIdentityShared')
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Inte... |
expected_output= {
'summary': 0,
'vbond_counts': 0,
'vmanage_counts': 1,
'vsmart_counts': 6,
}
| expected_output = {'summary': 0, 'vbond_counts': 0, 'vmanage_counts': 1, 'vsmart_counts': 6} |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def trim(s):
# check parameter instance type
if not isinstance(s, str):
raise TypeError('error type of s')
# calculate position of space
if s == '':
return s
elif s[0] == ' ':
return trim(s[1:])
elif s[-1] == ' ':
r... | def trim(s):
if not isinstance(s, str):
raise type_error('error type of s')
if s == '':
return s
elif s[0] == ' ':
return trim(s[1:])
elif s[-1] == ' ':
return trim(s[:len(s) - 1])
else:
return s
if __name__ == '__main__':
l = ['Michael', 'Sarah', 'Tracy',... |
def calculate(row_start, row_end, col_start, col_end, row, col, type = 'r', base_add = 1000, size = 2):
if type == 'r':
print('Base address + ((number of full rows*number of columns) + number of partial columns)*size of data type')
print('{} + (({} - {} + 1)x({} - {} + 1) + ({} - {} + 1))x{}'.format... | def calculate(row_start, row_end, col_start, col_end, row, col, type='r', base_add=1000, size=2):
if type == 'r':
print('Base address + ((number of full rows*number of columns) + number of partial columns)*size of data type')
print('{} + (({} - {} + 1)x({} - {} + 1) + ({} - {} + 1))x{}'.format(base_... |
class Node:
def __init__(self, value=None, next_node=None):
self.value = value
self.next_node = next_node
class OneLinkedList:
def __init__(self):
self.first = None
self.last = None
self.length = 0
def clear(self):
self.__init__()
def append(self, data... | class Node:
def __init__(self, value=None, next_node=None):
self.value = value
self.next_node = next_node
class Onelinkedlist:
def __init__(self):
self.first = None
self.last = None
self.length = 0
def clear(self):
self.__init__()
def append(self, dat... |
balance = 320000
annualInterestRate = 0.2
monthlyInterestRate = annualInterestRate / 12.0
a = balance
lo = balance / 12.0
hi = balance * (1 + monthlyInterestRate) ** 12 / 12.0
monthlyPayment = round((lo + hi) / 2, 2)
while True:
monthlyPayment = round((lo + hi) / 2, 2)
a = balance
for month in range(12):
... | balance = 320000
annual_interest_rate = 0.2
monthly_interest_rate = annualInterestRate / 12.0
a = balance
lo = balance / 12.0
hi = balance * (1 + monthlyInterestRate) ** 12 / 12.0
monthly_payment = round((lo + hi) / 2, 2)
while True:
monthly_payment = round((lo + hi) / 2, 2)
a = balance
for month in range(1... |
# the transfer function class
class tf:
def __init__(self, n, d):
self.num = n
self.denom = d
| class Tf:
def __init__(self, n, d):
self.num = n
self.denom = d |
class Car():
def __init__(self, color, model):
self.x = 0
self.y = 0
self.direction = 90
self.color = color
self.model = model
def turn_right(self):
self.direction += 90
def turn_left(self):
self.direction -=90
def move_forward(self, distance):
... | class Car:
def __init__(self, color, model):
self.x = 0
self.y = 0
self.direction = 90
self.color = color
self.model = model
def turn_right(self):
self.direction += 90
def turn_left(self):
self.direction -= 90
def move_forward(self, distance):
... |
t = int(input())
def solve():
n = int(input())
total = 0
score = 0
for _ in range(n):
s, c = map(float, input().split())
total += int(s)
score += c * s
print("{} {:.1f}".format(total, score / total))
for _ in range(t):
solve()
| t = int(input())
def solve():
n = int(input())
total = 0
score = 0
for _ in range(n):
(s, c) = map(float, input().split())
total += int(s)
score += c * s
print('{} {:.1f}'.format(total, score / total))
for _ in range(t):
solve() |
'''
1. Write a Python program to copy the contents of a file to another file .
2. Write a Python program to combine each line from first file with the corresponding line in second file.
3. Write a Python program to read a random line from a file.
'''
| """
1. Write a Python program to copy the contents of a file to another file .
2. Write a Python program to combine each line from first file with the corresponding line in second file.
3. Write a Python program to read a random line from a file.
""" |
'''
Created on 2014-03-31
@author: Nich
'''
class NamesSystem(object):
'''
Attach all the things that a person can see to that person so that the parser knows what's available
'''
def __init__(self, node_factory):
self.node_factory = node_factory
def get_nodes(self):
nodes = sel... | """
Created on 2014-03-31
@author: Nich
"""
class Namessystem(object):
"""
Attach all the things that a person can see to that person so that the parser knows what's available
"""
def __init__(self, node_factory):
self.node_factory = node_factory
def get_nodes(self):
nodes = self... |
# Getting number of strings to be provided
t=int(input())
lis = []
# Getting marks
for i in range(t):
lis.append(int(input()))
gender = input()
# Getting sex(b:boy,g:girl)
if gender == 'b':
ini = 0
else:
ini = 1
su = 0
# Calculating sum of marks
while ini < len(lis):
su += lis[ini]
ini ... | t = int(input())
lis = []
for i in range(t):
lis.append(int(input()))
gender = input()
if gender == 'b':
ini = 0
else:
ini = 1
su = 0
while ini < len(lis):
su += lis[ini]
ini += 2
print(su) |
def handler(event, context):
return {
'body': 'Hello from gfs-finspace-challenge-teamb',
'statusCode': '200'
} | def handler(event, context):
return {'body': 'Hello from gfs-finspace-challenge-teamb', 'statusCode': '200'} |
size=11
am=[[0 for x in range(size)] for y in range(size)]
bm=am
N=5
route=[]
def visit(x,y):
#limit
if(x<0 or x>=size or y<0 or y>=size):return
#same value
if(am[x][y]!=N):return
#visited
if(bm[x][y]==1):return
route.append([x,y])
bm[x][y]=1
visit(x-1,y)
visit(x+1,y)
visit(x... | size = 11
am = [[0 for x in range(size)] for y in range(size)]
bm = am
n = 5
route = []
def visit(x, y):
if x < 0 or x >= size or y < 0 or (y >= size):
return
if am[x][y] != N:
return
if bm[x][y] == 1:
return
route.append([x, y])
bm[x][y] = 1
visit(x - 1, y)
visit(x ... |
#Classes
'''
Add a method to the Car class called age that returns how old the car is (2020 - year)
*Be sure to return the age, not print it*
class Car:
def __init__(self,year, make, model):
self.year = year
self.make = make
self.model = model'''
class Car:
def __init__(self,year, mak... | """
Add a method to the Car class called age that returns how old the car is (2020 - year)
*Be sure to return the age, not print it*
class Car:
def __init__(self,year, make, model):
self.year = year
self.make = make
self.model = model"""
class Car:
def __init__(self, year, make, mode... |
N, K = list(map(int,input().split())) # 10/10 IO
class BFSItem:
def __init__(self, mins: int, pos: int):
'''
Very old school python haven't bothered to learn new stuff
'''
self.mins = mins
self.pos = pos
bfsqueue = []
bfsqueue.append(BFSItem(0, N));
v = [None] * 100002
v[N] =... | (n, k) = list(map(int, input().split()))
class Bfsitem:
def __init__(self, mins: int, pos: int):
"""
Very old school python haven't bothered to learn new stuff
"""
self.mins = mins
self.pos = pos
bfsqueue = []
bfsqueue.append(bfs_item(0, N))
v = [None] * 100002
v[N] = True
... |
# Function to find whether the given strings are Anagram or Not
def anagram(S1, S2):
# Make the two string lower cased.
S1 = S1.replace(' ', '').lower()
S2 = S2.replace(' ', '').lower()
# Check whether the length of two strings are equal or not.
if len(S1) != len(S2):
return False
# In... | def anagram(S1, S2):
s1 = S1.replace(' ', '').lower()
s2 = S2.replace(' ', '').lower()
if len(S1) != len(S2):
return False
count = {}
for letter in S1:
if letter in count:
count[letter] += 1
else:
count[letter] = 1
for letter in S2:
if lett... |
#
# PySNMP MIB module ELTEK-COMMON-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEK-COMMON-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:45:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ... |
#Checking if an item exists in a tuple or not
animals=("Lion","Zebra","Elephant","leopard")
if "Lion" in animals:
print("true")
#Other conditions
animals=("Lion","Zebra","Elephant","leopard")
if "Frog" in animals:
print("false")
else:
print("Not there")
| animals = ('Lion', 'Zebra', 'Elephant', 'leopard')
if 'Lion' in animals:
print('true')
animals = ('Lion', 'Zebra', 'Elephant', 'leopard')
if 'Frog' in animals:
print('false')
else:
print('Not there') |
user = "temp"
password = "temp"
array = "arr"
pool = "pool1"
volume_name = "volume"
snapshot_name = "snapshot"
snapshot_volume_wwn = "12345678"
snapshot_volume_name = "snapshot_volume"
clone_volume_name = "clone_volume"
| user = 'temp'
password = 'temp'
array = 'arr'
pool = 'pool1'
volume_name = 'volume'
snapshot_name = 'snapshot'
snapshot_volume_wwn = '12345678'
snapshot_volume_name = 'snapshot_volume'
clone_volume_name = 'clone_volume' |
# Modified from https://www.wizards.com/dnd/drdg/index.htm
list = [
["This hall stinks with the wet, pungent scent of mildew. Black mold grows in tangled veins across the walls and parts of the floor. Despite the smell, it looks like it might be safe to travel through.",
["event", "enemy", ["zombie", "skele... | list = [['This hall stinks with the wet, pungent scent of mildew. Black mold grows in tangled veins across the walls and parts of the floor. Despite the smell, it looks like it might be safe to travel through.', ['event', 'enemy', ['zombie', 'skeleton']]], ['The scent of earthy decay assaults your nose upon peering thr... |
def ask(m):
print(m)
return input()
def lib():
a = ask(" Books in stock:\n"
"Harry Potter - 1 in Stock\n"
"Percy Jackson - Out of Stock\n"
"Mind stuff - 1 in Stock\n").strip().lower()
if a == "harry potter":
print("Alright, here is your copy of Harry... | def ask(m):
print(m)
return input()
def lib():
a = ask(' Books in stock:\nHarry Potter - 1 in Stock\nPercy Jackson - Out of Stock\nMind stuff - 1 in Stock\n').strip().lower()
if a == 'harry potter':
print('Alright, here is your copy of Harry Potter. Have a nice day!')
elif a == 'per... |
#
# PySNMP MIB module CISCO-REPEATER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-REPEATER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:53:55 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
packages = {
'org.test.package': {
'variant1': {
'version': 22,
'versionName': '2.02',
'fileName':'testVariant1'
}
}
}
| packages = {'org.test.package': {'variant1': {'version': 22, 'versionName': '2.02', 'fileName': 'testVariant1'}}} |
# class Tree:
# def __init__(self, val, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def solve(self, root):
# Write your code here
nodeLevel = {}
def deepest(root,level=0):
if root is None:
... | class Solution:
def solve(self, root):
node_level = {}
def deepest(root, level=0):
if root is None:
return
else:
if level not in nodeLevel:
nodeLevel[level] = []
nodeLevel[level].append(root.val)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.