content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#
# PySNMP MIB module UPPHONEDOTCOM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/UPPHONEDOTCOM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:21:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) ... |
users_interests = [
["Hadoop", "Big Data", "HBase", "Java", "Spark", "Storm", "Cassandra"],
["NoSQL", "MongoDB", "Cassandra", "HBase", "Postgres"],
["Python", "scikit-learn", "scipy", "numpy", "statsmodels", "pandas"],
["R", "Python", "statistics", "regression", "probability"],
["machine learning", ... | users_interests = [['Hadoop', 'Big Data', 'HBase', 'Java', 'Spark', 'Storm', 'Cassandra'], ['NoSQL', 'MongoDB', 'Cassandra', 'HBase', 'Postgres'], ['Python', 'scikit-learn', 'scipy', 'numpy', 'statsmodels', 'pandas'], ['R', 'Python', 'statistics', 'regression', 'probability'], ['machine learning', 'regression', 'decisi... |
puzzle_input = '''vxupkizork-sgmtkzoi-pkrrehkgt-zxgototm-644[kotgr]
mbiyqoxsm-pvygob-nocsqx-900[obmqs]
veqtekmrk-ikk-hitpscqirx-334[nrtws]
gvcskirmg-fyrrc-irkmriivmrk-932[rikmc]
xmtjbzidx-xviyt-yzqzgjkhzio-187[yzfeu]
bwx-amkzmb-kivlg-kwibqvo-lmaqov-798[bkmva]
vcibutulxiom-ohmnuvfy-yaa-mylpcwym-890[iyaun]
ajvyjprwp-lqxl... | puzzle_input = 'vxupkizork-sgmtkzoi-pkrrehkgt-zxgototm-644[kotgr]\nmbiyqoxsm-pvygob-nocsqx-900[obmqs]\nveqtekmrk-ikk-hitpscqirx-334[nrtws]\ngvcskirmg-fyrrc-irkmriivmrk-932[rikmc]\nxmtjbzidx-xviyt-yzqzgjkhzio-187[yzfeu]\nbwx-amkzmb-kivlg-kwibqvo-lmaqov-798[bkmva]\nvcibutulxiom-ohmnuvfy-yaa-mylpcwym-890[iyaun]\najvyjprwp... |
expected_output = {
'interfaces': {
'TenGigabitEthernet0/0/0.10': {
'acl': {
'inbound': {
'acl_name': 'DELETE_ME',
'direction': 'in',
},
'outbound': {
'acl_name': 'TEST-OUT',
... | expected_output = {'interfaces': {'TenGigabitEthernet0/0/0.10': {'acl': {'inbound': {'acl_name': 'DELETE_ME', 'direction': 'in'}, 'outbound': {'acl_name': 'TEST-OUT', 'direction': 'out'}}, 'description': 'MPLS1', 'encapsulation_dot1q': '10', 'ipv4': {'10.114.11.1': {'ip': '10.114.11.1', 'netmask': '255.255.255.252', 'p... |
# CompresssionIsBetterWithXORPatterns.py
# use python3 not python2
# This XOR pattern compresses
# to 35 bytes. xorpattern is
# only 35 bytes. With it we
# acheive better compression
# than the newest gzip version
# By finding a pattern in XOR
# We can repeat this message
# many more times than gzip
# with much small... | def n():
global x, j
j = j ^ -x
x = x << 1
def p():
global x, j
j = j ^ x
x = x << 1
what = b'CompresssionIsBetterWithXORPatterns'
j = 1
x = 2
xorpattern = 1253701310082798857714472649037381798772545443176083147054309325165401383010204792462
pattern = bin(xorpattern)[2:]
repetition = 1000
for y... |
# encoding: utf-8
# This module is based on paste.registry (c) 2005 Ben Bangert, released under
# the MIT license.
'''Object proxy
'''
class ObjectProxy(object):
'''Proxy an arbitrary object, making it possible to change values that are
passed around.
'''
def __new__(cls, obj=None):
'''Create a new ObjectP... | """Object proxy
"""
class Objectproxy(object):
"""Proxy an arbitrary object, making it possible to change values that are
passed around.
"""
def __new__(cls, obj=None):
"""Create a new ObjectProxy
"""
self = object.__new__(cls)
self.__dict__['__object__'] = obj
return s... |
with open('input.txt') as f:
input = f.read().splitlines()
algorithm = ""
for char in input[0]:
if char == ".":
algorithm += "0"
elif char == "#":
algorithm += "1"
image = []
for line in input[2:]:
y = []
for x in line:
if x == ".":
y.append(0)
elif x ==... | with open('input.txt') as f:
input = f.read().splitlines()
algorithm = ''
for char in input[0]:
if char == '.':
algorithm += '0'
elif char == '#':
algorithm += '1'
image = []
for line in input[2:]:
y = []
for x in line:
if x == '.':
y.append(0)
elif x == '... |
# Python Tutorial for Beginners 7: Loops and Iterations - For/While Loops
# Corey Schafer (YouTube)
# https://youtu.be/6iF8Xb7Z3wQ?list=PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU
nums = [1, 2, 3, 4, 5]
for num in nums:
print(num)
# break statement
for num in nums:
if num ==3:
print('Found It!')
... | nums = [1, 2, 3, 4, 5]
for num in nums:
print(num)
for num in nums:
if num == 3:
print('Found It!')
break
print(num)
for num in nums:
if num == 3:
print('Found It!')
continue
print(num)
for num in nums:
for letter in 'abc':
print(num, letter)
for r in rang... |
encoding="UTF-8"
FileOutput="data/release/suggidx"
FileOutputItemSet="data/release/suggidx.itemset"
### server
ifPY=1
| encoding = 'UTF-8'
file_output = 'data/release/suggidx'
file_output_item_set = 'data/release/suggidx.itemset'
if_py = 1 |
# coding=utf-8
CHARS_ASCII = {
"arrow": ">",
"block": "#",
"left-edge": "|",
"right-edge": "|",
"selected": "*",
"unselected": ".",
}
COLOURS = {
"blue": "\x1b[34m",
"cyan": "\x1b[36m",
"green": "\x1b[32m",
"grey": "\x1b[30m",
"magenta": "\x1b[35m",
"red": "\x1b[31m",
... | chars_ascii = {'arrow': '>', 'block': '#', 'left-edge': '|', 'right-edge': '|', 'selected': '*', 'unselected': '.'}
colours = {'blue': '\x1b[34m', 'cyan': '\x1b[36m', 'green': '\x1b[32m', 'grey': '\x1b[30m', 'magenta': '\x1b[35m', 'red': '\x1b[31m', 'white': '\x1b[37m', 'yellow': '\x1b[33m'}
cursor = {'bol': '\x1b[1K',... |
SECRET_KEY = "B6269F7c2bFf50EF5DF9AfD1e0e0F7be" # CHANGE THIS
LOG_FILE = "errors.log"
TEMPLATES_AUTO_RELOAD = True
SECRET_PASSPHRASE = "changeme" | secret_key = 'B6269F7c2bFf50EF5DF9AfD1e0e0F7be'
log_file = 'errors.log'
templates_auto_reload = True
secret_passphrase = 'changeme' |
def main():
print('Use filler.py to create salted / unsalted / encrypted shadow file systems')
print('Use pwd_cracker.py to crack salted / unsalted / encrypted shadow files (you need rainbow tables)')
print('\tNote: add "help" after the call to a file for more info about the file and how to use it')
if __name__... | def main():
print('Use filler.py to create salted / unsalted / encrypted shadow file systems')
print('Use pwd_cracker.py to crack salted / unsalted / encrypted shadow files (you need rainbow tables)')
print('\tNote: add "help" after the call to a file for more info about the file and how to use it')
if __na... |
# This class represents a node
class Node:
# Initialize the class
def __init__(self, position: (), parent: ()):
self.position = position
self.parent = parent
self.g = 0 # Distance to start node
self.h = 0 # Distance to goal node
self.f = 0 # Total cost
# Compare ... | class Node:
def __init__(self, position: (), parent: ()):
self.position = position
self.parent = parent
self.g = 0
self.h = 0
self.f = 0
def __eq__(self, other):
return self.position == other.position
def __lt__(self, other):
return self.f < other.f... |
settings = {
'log': False,
'verbosity': False,
'vcolored': True,
}
| settings = {'log': False, 'verbosity': False, 'vcolored': True} |
#!/usr/bin/env python3
# Conditional loops
def greater_than(x, y):
if x > y:
return x
elif y > x:
return y
elif x == y:
return "These numbers are the same"
def graduation_reqs(credits):
if credits >= 120:
return "You have enough credits to graduate!"
print(graduati... | def greater_than(x, y):
if x > y:
return x
elif y > x:
return y
elif x == y:
return 'These numbers are the same'
def graduation_reqs(credits):
if credits >= 120:
return 'You have enough credits to graduate!'
print(graduation_reqs(120)) |
#
# PySNMP MIB module SRED-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SRED-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:10:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) ... |
#----------* CHALLENGE 8 *----------
#Ask for the total price of the bill, then ask how many diners there are. Divide the total bill by the number of diners and show how much each person must pay.
bill = int(input("What's the total price of the bill?: "))
diners = int(input("How many diners there are?: "))
each... | bill = int(input("What's the total price of the bill?: "))
diners = int(input('How many diners there are?: '))
each_one = bill // diners
print('Each person should pay:', eachOne) |
#Debangshu Roy
# XII - B
# 40
#Write a program to display only three lettered words
#from a text file named 'Three.txt'. Also return the count
#of such words returned.
def insertData(Data):
F = open("Three.txt", 'a+')
F.writelines(Data)
F.close()
def finalDataReading():
F = open("Three.txt", 'r... | def insert_data(Data):
f = open('Three.txt', 'a+')
F.writelines(Data)
F.close()
def final_data_reading():
f = open('Three.txt', 'r+')
x = F.readlines()
num = 0
try:
while F:
for i in x:
y = i.split()
for g in y:
if len(... |
# Declaraation
Eno=input("Empoyee number:")
Ename=input("Emplyee name:")
salary=input("Salary:")
#display
print ("Employee no=",Eno)
print ("Employee name=",Ename)
print("Employee Salary=",salary)
anualsalary=float (salary)*12
print("Anual Salary=",anualsalary)
| eno = input('Empoyee number:')
ename = input('Emplyee name:')
salary = input('Salary:')
print('Employee no=', Eno)
print('Employee name=', Ename)
print('Employee Salary=', salary)
anualsalary = float(salary) * 12
print('Anual Salary=', anualsalary) |
def primesieve(start, end):
prime = []
for x in range(1, end + 1, 2):
prime.append(x)
l = len(prime)
for i in range(1, (l//2 + 1)):
if prime[i] != 0:
a = i + prime[i]
while a < l:
prime[a] = 0
a += prime[i]
prime1... | def primesieve(start, end):
prime = []
for x in range(1, end + 1, 2):
prime.append(x)
l = len(prime)
for i in range(1, l // 2 + 1):
if prime[i] != 0:
a = i + prime[i]
while a < l:
prime[a] = 0
a += prime[i]
prime1 = []
for i... |
class Prefix:
def longestCommonPrefix(strs) :
if len(strs) == 0:
return ""
mini_length = len(strs[0])
for i in range(1,len(strs)):
if mini_length > len(strs[i]): mini_length= len(strs[i])
for k in range(0,... | class Prefix:
def longest_common_prefix(strs):
if len(strs) == 0:
return ''
mini_length = len(strs[0])
for i in range(1, len(strs)):
if mini_length > len(strs[i]):
mini_length = len(strs[i])
for k in range(0, mini_length):
... |
# directory that should be watched for changes
wpath = "/repo/ubuntu"
## Not implemented yet:
# exclude list for rsync
#rexcludes = [
# "/localhost",
#]
rnodes = [ "10.0.0.2" ]
# event mask (only sync on these events)
emask = {
"IN_CLOSE_WRITE": "/usr/local/bin/sync-copy",
"IN_CREATE": "/usr/local/bin/sync-co... | wpath = '/repo/ubuntu'
rnodes = ['10.0.0.2']
emask = {'IN_CLOSE_WRITE': '/usr/local/bin/sync-copy', 'IN_CREATE': '/usr/local/bin/sync-copy', 'IN_MOVED_TO': '/usr/local/bin/sync-copy', 'IN_DELETE': '/usr/local/bin/sync-remove', 'IN_MOVED_FROM': '/usr/local/bin/sync-remove'} |
'''
Description:
Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive).
The binary search tree is guaranteed to have unique values.
Example 1:
Input: root = [10,5,15,3,7,null,18], L = 7, R = 15
Output: 32
Example 2:
Input: root = [10,5,15,3,7,... | """
Description:
Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive).
The binary search tree is guaranteed to have unique values.
Example 1:
Input: root = [10,5,15,3,7,null,18], L = 7, R = 15
Output: 32
Example 2:
Input: root = [10,5,15,3,7,... |
'''
@lanhuage: python
@Descripttion:
@version: beta
@Author: xiaoshuyui
@Date: 2020-06-10 09:20:18
LastEditors: xiaoshuyui
LastEditTime: 2021-01-04 13:56:17
'''
def rm(filepath):
p = open(filepath, 'r+')
lines = p.readlines()
d = ""
for line in lines:
c = line.replace('"group_id": "null",',... | """
@lanhuage: python
@Descripttion:
@version: beta
@Author: xiaoshuyui
@Date: 2020-06-10 09:20:18
LastEditors: xiaoshuyui
LastEditTime: 2021-01-04 13:56:17
"""
def rm(filepath):
p = open(filepath, 'r+')
lines = p.readlines()
d = ''
for line in lines:
c = line.replace('"group_id": "null",', '"... |
#Program Name: range.py
#Assignment Module 1
#Class 44680 Block 44599 Section 01
#Michael Baumli
#Date: 20210512
print('Range: ',min(47,95,88,73,88,84), '-',
max(47,95,88,73,88,84)) | print('Range: ', min(47, 95, 88, 73, 88, 84), '-', max(47, 95, 88, 73, 88, 84)) |
class DvcLiveError(Exception):
pass
class InitializationError(DvcLiveError):
def __init__(self):
super().__init__(
"Initialization error - call `dvclive.init()` before "
"`dvclive.log()`"
)
| class Dvcliveerror(Exception):
pass
class Initializationerror(DvcLiveError):
def __init__(self):
super().__init__('Initialization error - call `dvclive.init()` before `dvclive.log()`') |
class Solution:
def climbStairs(self, n: 'int') -> 'int':
return self.dp(n, memo={1: 1, 2: 2})
def dp(self, n, memo):
if n in memo:
return memo[n]
else:
memo[n] = self.dp(n - 1, memo) + self.dp(n - 2, memo)
return memo[n]
if __name__ == '__main__':
... | class Solution:
def climb_stairs(self, n: 'int') -> 'int':
return self.dp(n, memo={1: 1, 2: 2})
def dp(self, n, memo):
if n in memo:
return memo[n]
else:
memo[n] = self.dp(n - 1, memo) + self.dp(n - 2, memo)
return memo[n]
if __name__ == '__main__':
... |
BLOCKS_LAYOUT_FILE = "blocks_layout.txt"
PELLETS_LAYOUT_FILE = "pellets_layout.txt"
class Layout:
def __init__(self, dirpath=None):
self.dirpath = dirpath
def read_layout(self, filename):
f = open(self.dirpath + filename, 'r')
layout = [line.split() for line in f]
f.close()
return layout
#layout =... | blocks_layout_file = 'blocks_layout.txt'
pellets_layout_file = 'pellets_layout.txt'
class Layout:
def __init__(self, dirpath=None):
self.dirpath = dirpath
def read_layout(self, filename):
f = open(self.dirpath + filename, 'r')
layout = [line.split() for line in f]
f.close()
... |
# -*- coding: utf-8 -*-
#O(1)
def run_O1(n):
sum = (1+n)*n/2
print("sum:%s" % sum)
#O(n)
def run_ON(n):
list = [i for i in range(n)]
print('list:%s' % list)
#O(logN)
def run_OlogN(n):
count=1
while(count<n):
count = count*2
print('count:%s' % count)
#O(N^2)
def run_ONpower2(n):... | def run_o1(n):
sum = (1 + n) * n / 2
print('sum:%s' % sum)
def run_on(n):
list = [i for i in range(n)]
print('list:%s' % list)
def run__olog_n(n):
count = 1
while count < n:
count = count * 2
print('count:%s' % count)
def run_o_npower2(n):
for i in range(n):
for j in r... |
#
# PySNMP MIB module TIMETRA-DA-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-DA-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:17:13 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, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ... |
class day_count_basis(object):
basis_30360 \
, basis_act_360 \
, basis_act_365 \
, basis_act_act = range(4)
day_count_basis_strings = (
"basis_30360"
, "basis_act_360"
, "basis_act_365"
, "basis_act_act"
)
| class Day_Count_Basis(object):
(basis_30360, basis_act_360, basis_act_365, basis_act_act) = range(4)
day_count_basis_strings = ('basis_30360', 'basis_act_360', 'basis_act_365', 'basis_act_act') |
# Autogenerated file, do not edit!
__version__ = '0.1'
__ipex_gitrev__ = '6e1404c165151b4463f6f45b39924749975a73cf'
__torch_gitrev__ = ''
| __version__ = '0.1'
__ipex_gitrev__ = '6e1404c165151b4463f6f45b39924749975a73cf'
__torch_gitrev__ = '' |
class Solution:
# my solution
def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]:
for row in A:
for i in range(len(row) // 2):
row[i], row[-i-1] = row[-i-1], row[i]
for i in range(len(row)):
row[i] = 0 if row[i] ==... | class Solution:
def flip_and_invert_image(self, A: List[List[int]]) -> List[List[int]]:
for row in A:
for i in range(len(row) // 2):
(row[i], row[-i - 1]) = (row[-i - 1], row[i])
for i in range(len(row)):
row[i] = 0 if row[i] == 1 else 1
retur... |
# What will the output of this be?
term1 = 5
term2 = 10
sum = term1+term2
print(sum) | term1 = 5
term2 = 10
sum = term1 + term2
print(sum) |
class LazyClass:
def __getattr__(
self, attribute
): # called when there is no such attribute set; for lazy instantiation
if attribute == "be_lazy":
value = self.expensive_operation()
setattr(self, attribute, value) # sets the attribute
print("Set " + str(at... | class Lazyclass:
def __getattr__(self, attribute):
if attribute == 'be_lazy':
value = self.expensive_operation()
setattr(self, attribute, value)
print('Set ' + str(attribute) + ' to ' + str(value))
return value
else:
raise AttributeError
... |
N = int(input())
paper = [[0]*101 for _ in range(101)]
count = [0]*(N+1)
for n in range(1, N+1):
data = list(map(int, input().split()))
for i in range(data[0], data[0]+data[2]):
for j in range(data[1], data[1]+data[3]):
paper[i][j] = n
for e in paper:
for a in e:
if a:
... | n = int(input())
paper = [[0] * 101 for _ in range(101)]
count = [0] * (N + 1)
for n in range(1, N + 1):
data = list(map(int, input().split()))
for i in range(data[0], data[0] + data[2]):
for j in range(data[1], data[1] + data[3]):
paper[i][j] = n
for e in paper:
for a in e:
if a... |
# Source : https://leetcode.com/problems/sum-of-digits-of-string-after-convert/
# Author : foxfromworld
# Date : 21/11/2021
# First attempt
class Solution:
def getLucky(self, s: str, k: int) -> int:
alpha = 'abcdefghijklmnopqrstuvwxyz'
newStr = ''
for i in range(len(s)):
newStr... | class Solution:
def get_lucky(self, s: str, k: int) -> int:
alpha = 'abcdefghijklmnopqrstuvwxyz'
new_str = ''
for i in range(len(s)):
new_str += str(alpha.index(s[i]) + 1)
temp = list(newStr)
ret = 0
for _ in range(k):
ret = sum([int(ch) for c... |
class Solution:
def consecutiveNumbersSum(self, N: int) -> int:
'''
N = (x + 1) + (x + 2) + ... + (x + k)
= xk + 1 + 2 + ... + k
= xk + k(k + 1) / 2
x = N / k - (k + 1) / 2
x >= 0 and x is integer
For x >= 0:
N / k >= (k + 1) / 2
k <= sqrt(... | class Solution:
def consecutive_numbers_sum(self, N: int) -> int:
"""
N = (x + 1) + (x + 2) + ... + (x + k)
= xk + 1 + 2 + ... + k
= xk + k(k + 1) / 2
x = N / k - (k + 1) / 2
x >= 0 and x is integer
For x >= 0:
N / k >= (k + 1) / 2
k <= sq... |
#######
#NODES#
#######
class Node:
def __init__(self, data, before=None, after=None):
self.data = data
self.before = before
self.after = after
########
#STACKS#
########
class Stack:
def __init__(self):
self.head = None
def isEmpty(self):
return self.head == None
... | class Node:
def __init__(self, data, before=None, after=None):
self.data = data
self.before = before
self.after = after
class Stack:
def __init__(self):
self.head = None
def is_empty(self):
return self.head == None
def pop(self):
output = self.head.da... |
#
# @lc app=leetcode id=572 lang=python3
#
# [572] Subtree of Another Tree
#
# https://leetcode.com/problems/subtree-of-another-tree/description/
#
# algorithms
# Easy (44.61%)
# Total Accepted: 320.4K
# Total Submissions: 718K
# Testcase Example: '[3,4,5,1,2]\n[4,1,2]'
#
# Given the roots of two binary trees root ... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def is_subtree(self, root: TreeNode, subRoot: TreeNode) -> bool:
if subRoot is None:
return True
queue = [root]
whil... |
#!/usr/bin/env/python3
# coding = utf-8
count = 0
def test_count():
global count
count += 1
if count % 40 == 0:
print("[{}] 40 times".format(count))
count = 0
if __name__ == '__main__':
for i in range(1, 1000):
test_count() | count = 0
def test_count():
global count
count += 1
if count % 40 == 0:
print('[{}] 40 times'.format(count))
count = 0
if __name__ == '__main__':
for i in range(1, 1000):
test_count() |
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2018 Datadog, Inc.
class ConfigProvider(object):
def collect(self):
'''Collect available c... | class Configprovider(object):
def collect(self):
"""Collect available configurations. Abstract."""
raise NotImplementedError
def validate_config(self, config):
"""Validates right config format"""
if not config or not isinstance(config, dict):
return False
re... |
#Exercise 6-10 Favorite Numbers
favorite_numbers = {
'claudia': [
1, 10, 11, 20, 21, 30
],
'vinicius': [
2, 9, 12, 19, 22, 81
],
'miguel': [
3, 8, 13, 18, 23, 21
],
'valdson': [
9, 10, 27, 30, 32, 37
],
'ozzy': [
5, 6, 15, 16, 19, 25
]
... | favorite_numbers = {'claudia': [1, 10, 11, 20, 21, 30], 'vinicius': [2, 9, 12, 19, 22, 81], 'miguel': [3, 8, 13, 18, 23, 21], 'valdson': [9, 10, 27, 30, 32, 37], 'ozzy': [5, 6, 15, 16, 19, 25]}
print('-' * 8, 'FAVORITE NUMBERS', '-' * 8)
for (name, number) in favorite_numbers.items():
print(name.title() + "'s favor... |
class DoconvException(Exception):
pass
class UnsatisfiedDependencyException(DoconvException):
pass
class FormatException(DoconvException):
pass
| class Doconvexception(Exception):
pass
class Unsatisfieddependencyexception(DoconvException):
pass
class Formatexception(DoconvException):
pass |
n = int(input())
if(n >= -128 and n <= 127):
print("byte\n")
elif(n >= -32768 and n <= 32767):
print("short\n")
elif(n >= -2147483648 and n <= 2147483647):
print("int\n")
elif(n >= -9223372036854775808 and n <= 9223372036854775807):
print("long\n")
else:
print("BigInteger\n")
| n = int(input())
if n >= -128 and n <= 127:
print('byte\n')
elif n >= -32768 and n <= 32767:
print('short\n')
elif n >= -2147483648 and n <= 2147483647:
print('int\n')
elif n >= -9223372036854775808 and n <= 9223372036854775807:
print('long\n')
else:
print('BigInteger\n') |
# SPDX-License-Identifier: BSD-2-Clause
# pylint: skip-file
#
# NOTE: this file, as all the others in this directory, run in the same global
# context as their runner (run_interactive_test).
just_run_vim_and_exit()
do_interactive_actions(
"vim1",
[
r"vim /usr/lib/vim/samples/numbers.txt{ret}",
r"{es... | just_run_vim_and_exit()
do_interactive_actions('vim1', ['vim /usr/lib/vim/samples/numbers.txt{ret}', '{esc}:29{ret}', '{down}', '{down}', '{down}', '{esc}:3{ret}', '{up}', '{up}', '{esc}:q{ret}'], false_positive_handler_vim) |
def flip(arr, k):
left, right = 0, k-1
while left < right:
arr[left], arr[right] = arr[right], arr[left]
left += 1
right -= 1
def pancake_sort(arr):
num_elements = len(arr)
for i in range(num_elements-1):
flip_index = get_max_index_in_prefix(arr, num_elements-i)
... | def flip(arr, k):
(left, right) = (0, k - 1)
while left < right:
(arr[left], arr[right]) = (arr[right], arr[left])
left += 1
right -= 1
def pancake_sort(arr):
num_elements = len(arr)
for i in range(num_elements - 1):
flip_index = get_max_index_in_prefix(arr, num_elements... |
a = float(input())
h = float(input())
area = a * h / 2
print('Triangle are = {0}'.format(area))
| a = float(input())
h = float(input())
area = a * h / 2
print('Triangle are = {0}'.format(area)) |
# A genericmap is a simple data holder to inherit from.
class GenericMap:
def __init__(self):
self._map = {}
def set(self, key, value):
self._map[key] = value
def get(self, key):
if key in self._map:
return self._map[key]
else:
raise Exception("No ... | class Genericmap:
def __init__(self):
self._map = {}
def set(self, key, value):
self._map[key] = value
def get(self, key):
if key in self._map:
return self._map[key]
else:
raise exception('No value for the key: ' + key)
def delete(self, key):
... |
T = input()
T = int(T)
for i in range(T):
try:
N, a, b = input().split(" ")
N = int(N)
a = int(a)
b = int(b)
A = input()
if (N % a) >= b or N < a:
print("ALICE")
else:
print("BOB")
except ValueError as e:
pass
| t = input()
t = int(T)
for i in range(T):
try:
(n, a, b) = input().split(' ')
n = int(N)
a = int(a)
b = int(b)
a = input()
if N % a >= b or N < a:
print('ALICE')
else:
print('BOB')
except ValueError as e:
pass |
class VIOTDatasetConfig:
fov={
"cup_0.5HZ":55.0,
"cup_0.9HZ":55.0,
"cup_1.1HZ":55.0,
"cup_1.5HZ":55.0,
"cup_1.8HZ":55.0,
"cup_2.1HZ":55.0,
"cup_3.2HZ":55.0,
"park_mavic_1":66.0,
"park_mavic_2":66.0,
"park_mavic_3":66.0,
"park_m... | class Viotdatasetconfig:
fov = {'cup_0.5HZ': 55.0, 'cup_0.9HZ': 55.0, 'cup_1.1HZ': 55.0, 'cup_1.5HZ': 55.0, 'cup_1.8HZ': 55.0, 'cup_2.1HZ': 55.0, 'cup_3.2HZ': 55.0, 'park_mavic_1': 66.0, 'park_mavic_2': 66.0, 'park_mavic_3': 66.0, 'park_mavic_4': 66.0, 'park_mavic_5': 66.0, 'park_mavic_6': 66.0, 'park_mavic_7': 66.... |
class BaseException(Exception):
def __init__(self, message: str) -> None:
super().__init__(message)
self.message = message
class InvalidCredentialsException(BaseException):
def __init__(self, message: str) -> None:
super().__init__(f"The credentials are not valid. Reason: {message}")
... | class Baseexception(Exception):
def __init__(self, message: str) -> None:
super().__init__(message)
self.message = message
class Invalidcredentialsexception(BaseException):
def __init__(self, message: str) -> None:
super().__init__(f'The credentials are not valid. Reason: {message}')
... |
def isInAlphabeticalOrder(word):
sorted_word = "".join(sorted(word))
if word == sorted_word:
return True
else:
return False
print(isInAlphabeticalOrder('abczd'))
print(isInAlphabeticalOrder('abcdef'))
| def is_in_alphabetical_order(word):
sorted_word = ''.join(sorted(word))
if word == sorted_word:
return True
else:
return False
print(is_in_alphabetical_order('abczd'))
print(is_in_alphabetical_order('abcdef')) |
# -*- coding: utf-8 -*-
secrets = {
"cf_username": "user",
"cf_password": "pass"
}
| secrets = {'cf_username': 'user', 'cf_password': 'pass'} |
# Python Program To Accept A Dictionary And Display Its Elements
'''
Function Name : Accept A Dictionary And Display Its Elements.
Function Date : 13 Sep 2020
Function Author : Prasad Dangare
Input : String
Output : String
'''
def fun(dictionary):
for i, j in dictionary... | """
Function Name : Accept A Dictionary And Display Its Elements.
Function Date : 13 Sep 2020
Function Author : Prasad Dangare
Input : String
Output : String
"""
def fun(dictionary):
for (i, j) in dictionary.items():
print(i, '--', j)
d = {'a': 'Apple', 'b': 'Book', 'c': 'C... |
keep = list(range(1, 1501))
remove = False
while(len(keep) > 1):
n_keep = []
for person in keep:
if not remove:
n_keep.append(person)
remove = not remove
keep = n_keep
print(keep)
| keep = list(range(1, 1501))
remove = False
while len(keep) > 1:
n_keep = []
for person in keep:
if not remove:
n_keep.append(person)
remove = not remove
keep = n_keep
print(keep) |
def p() -> None:
print('hello')
a = p()
| def p() -> None:
print('hello')
a = p() |
#Find the missing number on an array from 1-n inclusive
#First solution using array sum n(n+1)/2
l1 = [1,2,4,5,6,7]
def findNumber(l1):
n = len(l1)+1
suma = n*(n+1)/2
for i in l1:
suma-=i
return suma
print(findNumber(l1))
#The solution using XOR
def xorSolution(l1):
x1 = l1[0... | l1 = [1, 2, 4, 5, 6, 7]
def find_number(l1):
n = len(l1) + 1
suma = n * (n + 1) / 2
for i in l1:
suma -= i
return suma
print(find_number(l1))
def xor_solution(l1):
x1 = l1[0]
x2 = 1
n = len(l1)
for i in range(x2 + 1, n + 2):
x2 ^= i
for i in range(1, len(l1)):
... |
categories = {product:{} for product in input().split(', ')}
n = int(input())
for _ in range(n):
token = input().split(' - ')
category = token[0]
item = token[1]
quantity = token[2].split(";")[0].split(':')[1]
quality = token[2].split(";")[1].split(':')[1]
categories[category][item] = (quantit... | categories = {product: {} for product in input().split(', ')}
n = int(input())
for _ in range(n):
token = input().split(' - ')
category = token[0]
item = token[1]
quantity = token[2].split(';')[0].split(':')[1]
quality = token[2].split(';')[1].split(':')[1]
categories[category][item] = (quantity... |
expected_output = {
'interfaces': {
'GigabitEthernet1/0/7' : {
'port_enable_administrative_configuration_setting' : 'Enabled',
'port_enable_operational_state' : 'Enabled',
'current_bidirectional_state' : 'Bidirectional'
}
}
}
| expected_output = {'interfaces': {'GigabitEthernet1/0/7': {'port_enable_administrative_configuration_setting': 'Enabled', 'port_enable_operational_state': 'Enabled', 'current_bidirectional_state': 'Bidirectional'}}} |
locadora = []
filme = {}
while True:
filme['titulo'] = str(input('TITULO DO FILME...: ')).title()
filme['ano'] = int(input('ANO DO FILME...: '))
filme['diretor'] = str(input('DIRETOR...: ')).title()
locadora.append(filme.copy())
resp = ' '
while resp not in 'SN':
resp = str(input('DESEJA... | locadora = []
filme = {}
while True:
filme['titulo'] = str(input('TITULO DO FILME...: ')).title()
filme['ano'] = int(input('ANO DO FILME...: '))
filme['diretor'] = str(input('DIRETOR...: ')).title()
locadora.append(filme.copy())
resp = ' '
while resp not in 'SN':
resp = str(input('DESEJA... |
def allSubArrays(L,L2=None):
if L2==None:
L2 = L[:-1]
if L==[]:
if L2==[]:
return []
return allSubArrays(L2,L2[:-1])
return [L]+allSubArrays(L[1:],L2)
def solve(arr):
c = 0
for i in arr:
if (len(i)%2==0):
arr1 = set(i)
... | def all_sub_arrays(L, L2=None):
if L2 == None:
l2 = L[:-1]
if L == []:
if L2 == []:
return []
return all_sub_arrays(L2, L2[:-1])
return [L] + all_sub_arrays(L[1:], L2)
def solve(arr):
c = 0
for i in arr:
if len(i) % 2 == 0:
arr1 = set(i)
... |
class Node:
''' Class To create a node object for the linked list '''
def __init__(self, item):
''' __init__ method to initialize the Node Object '''
self.item = item
self.next = None
self.previous = None
class d_LinkedList:
''' Class to create a ... | class Node:
""" Class To create a node object for the linked list """
def __init__(self, item):
""" __init__ method to initialize the Node Object """
self.item = item
self.next = None
self.previous = None
class D_Linkedlist:
""" Class to create a doubly linked list """
... |
class Node:
def __init__(self, val):
self.val = val
self.right = None
self.left = None
def find(root):
res = -999999999999
if not root:
return res
if root.left != None:
res = root.left.val
return max(find(root.left), res, find(root.right))
| class Node:
def __init__(self, val):
self.val = val
self.right = None
self.left = None
def find(root):
res = -999999999999
if not root:
return res
if root.left != None:
res = root.left.val
return max(find(root.left), res, find(root.right)) |
a = 33
b = 200
if b > a:
print("b is greater than a")
a = 33
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
b = 200
if b > a: print("*** b is greater than a ***")
a = 200
b = 33
c = 500
if a > b and c > a:
print("Both conditions are True") | a = 33
b = 200
if b > a:
print('b is greater than a')
a = 33
b = 33
if b > a:
print('b is greater than a')
elif a == b:
print('a and b are equal')
b = 200
if b > a:
print('*** b is greater than a ***')
a = 200
b = 33
c = 500
if a > b and c > a:
print('Both conditions are True') |
def merge(customList, l , m , r ):
#-- l : First Index
#-- m : Mid Index
#-- r : Last Index
n1 = m - l + 1 #-- Number of Elements in First SubArray
n2 = r - m #-- Number of Elements in Second SubArray
L = [0] * n1 #-- Temporary Array for First SubArray
R = [0] * n2 #-- Temporary Array fo... | def merge(customList, l, m, r):
n1 = m - l + 1
n2 = r - m
l = [0] * n1
r = [0] * n2
for i in range(0, n1):
L[i] = customList[l + i]
for j in range(0, n2):
R[j] = customList[m + 1 + j]
i = 0
j = 0
k = l
while i < n1 and j < n2:
if L[i] <= R[j]:
... |
hashtags = [
"#COVIDEmergency2021",
"#AmphotericinB",
"#CovidSOS",
"#LiposomalAmphotericin",
"#LiposomalAmphotericinB",
"#Tocilizumab400",
]
handles = [
"@COVResourcesIn",
"@IndiaCovidRes",
"@COVIDC... | hashtags = ['#COVIDEmergency2021', '#AmphotericinB', '#CovidSOS', '#LiposomalAmphotericin', '#LiposomalAmphotericinB', '#Tocilizumab400']
handles = ['@COVResourcesIn', '@IndiaCovidRes', '@COVIDCitizens', '@TeamSOSIndia'] |
# A program to pick the peaks from an array
data = [2,1,3,1,2,2,2,2]
pick = [-1]
peak = [0]
bracesSet = {}
for i in range(len(data)):
if data[i] > peak[0]:
peak[0] = data[i]
pick[0] = i
bracesSet.add("pos:", peak[0])
bracesSet.add("pos:", pick[0])
print(bracesSet) | data = [2, 1, 3, 1, 2, 2, 2, 2]
pick = [-1]
peak = [0]
braces_set = {}
for i in range(len(data)):
if data[i] > peak[0]:
peak[0] = data[i]
pick[0] = i
bracesSet.add('pos:', peak[0])
bracesSet.add('pos:', pick[0])
print(bracesSet) |
class RegtaException(Exception):
pass
class StopService(RegtaException):
pass
class IncorrectJobType(RegtaException):
def __init__(self, job, scheduler):
message = f"{job.__class__.__name__} is incorrect job type for {scheduler.__class__.__name__}"
super().__init__(message)
| class Regtaexception(Exception):
pass
class Stopservice(RegtaException):
pass
class Incorrectjobtype(RegtaException):
def __init__(self, job, scheduler):
message = f'{job.__class__.__name__} is incorrect job type for {scheduler.__class__.__name__}'
super().__init__(message) |
def sort_records(mylist):
slvi = []
mylist.sort(key=lambda x: x[1])
print(mylist)
for i in range(len(mylist)-1):
if mylist[i][1] < mylist[i+1][1] and len(slvi) == 0:
slvi.append(mylist[i+1])
elif mylist[i][1] < mylist[i+1][1] and len(slvi) != 0:
break
i... | def sort_records(mylist):
slvi = []
mylist.sort(key=lambda x: x[1])
print(mylist)
for i in range(len(mylist) - 1):
if mylist[i][1] < mylist[i + 1][1] and len(slvi) == 0:
slvi.append(mylist[i + 1])
elif mylist[i][1] < mylist[i + 1][1] and len(slvi) != 0:
break
... |
def plusOne(x):
return x + 1
def test_simple():
assert plusOne(7) == 8
| def plus_one(x):
return x + 1
def test_simple():
assert plus_one(7) == 8 |
langwithner = {
'arabic',
'chinese',
'traditional-chinese',
'classical-chinese',
'dutch',
'english',
'english-gum',
'english-lines',
'english-partut',
'french',
'french-partut',
'french-sequoia',
'french-spoken',
'german',
'german-hdt',
'ru... | langwithner = {'arabic', 'chinese', 'traditional-chinese', 'classical-chinese', 'dutch', 'english', 'english-gum', 'english-lines', 'english-partut', 'french', 'french-partut', 'french-sequoia', 'french-spoken', 'german', 'german-hdt', 'russian', 'russian-gsd', 'russian-taiga', 'spanish', 'spanish-gsd', 'vietnamese', '... |
def save_txt(name, pos_gt_bboxes_size_max, gt_bboxes_size_mean, gt_bboxes_size_std, initiallize_csv):
print("gt_bboxes_size_mean", gt_bboxes_size_mean)
print("gt_bboxes_size_std", gt_bboxes_size_std)
if initiallize_csv:
initiallize_csv = 0
headers = ['p3','p4','p5','p6','p7']
with o... | def save_txt(name, pos_gt_bboxes_size_max, gt_bboxes_size_mean, gt_bboxes_size_std, initiallize_csv):
print('gt_bboxes_size_mean', gt_bboxes_size_mean)
print('gt_bboxes_size_std', gt_bboxes_size_std)
if initiallize_csv:
initiallize_csv = 0
headers = ['p3', 'p4', 'p5', 'p6', 'p7']
wit... |
dbuser = 'root'
dbpasswd = 'Busine55'
dburi = 'localhost'
dbport = 3306
dbname = 'hawaii' | dbuser = 'root'
dbpasswd = 'Busine55'
dburi = 'localhost'
dbport = 3306
dbname = 'hawaii' |
# Write a function "comparison" that takes in a single parameter, a function.
#
# "comparison" will return another function that accepts list containing 2
# numbers.
#
# Each of these numbers will be invoked on the original function recieved as
# an argument by "comparison".
#
# When the numbers are invoke... | def negation(num):
return num * -1
neg = comparison(negation)
print(neg(1, 3))
print(neg(5, 3))
print(neg(7, 7))
def times_zero(num):
return num * 0
zeroed = comparison(times_zero)
print(zeroed(1, 3))
print(zeroed(5, 3))
def nth_perfect_square(num):
odds = list(filter(lambda num: num % 2, range(abs(num) *... |
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def isValidBST(self, root, lessThan = float('inf'), largerThan = float('-inf')):
if not root:
return True
... | class Treenode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def is_valid_bst(self, root, lessThan=float('inf'), largerThan=float('-inf')):
if not root:
return True
if root.val <= largerThan or root.... |
class Callback(object):
def __init__(self, func, action, obj):
self.function = func
self.action = action
self.object = obj
| class Callback(object):
def __init__(self, func, action, obj):
self.function = func
self.action = action
self.object = obj |
# Write a program that takes a list of strings and a string containing a single character, and prints a new list of all the strings containing that character.
word_list = ["My", "cat's", "name", "is", "Steve!"]
char = "e"
def letterCheck(my_list, subString):
new_list = []
for element in range(0, len(word_list... | word_list = ['My', "cat's", 'name', 'is', 'Steve!']
char = 'e'
def letter_check(my_list, subString):
new_list = []
for element in range(0, len(word_list)):
if word_list[element].find(char) != -1:
new_list.append(word_list[element])
print(new_list)
letter_check(word_list, char) |
def fibo(n):
a, b = 0, 1
res = []
while a <= n:
res.append(a)
a, b = b, a + b
return res
n = int(input("Enter number for fibonacci series : "))
print("Fibonacci series is up to entered number : ", fibo(n))
| def fibo(n):
(a, b) = (0, 1)
res = []
while a <= n:
res.append(a)
(a, b) = (b, a + b)
return res
n = int(input('Enter number for fibonacci series : '))
print('Fibonacci series is up to entered number : ', fibo(n)) |
db = None
resizer = None
storage = None
Storage = None
| db = None
resizer = None
storage = None
storage = None |
class ContentSecurityPolicyAnalyzer:
def __init__(self):
pass
def analyze(self, parse_results, headers, content):
results = parse_results["Content-Security-Policy"]
parts = []
if results["status"] == "CONTENT_SECURITY_POLICY_NONE":
parts.append({
"type" : "warning",
"message" : "Content-Security-... | class Contentsecuritypolicyanalyzer:
def __init__(self):
pass
def analyze(self, parse_results, headers, content):
results = parse_results['Content-Security-Policy']
parts = []
if results['status'] == 'CONTENT_SECURITY_POLICY_NONE':
parts.append({'type': 'warning', '... |
coordinates = []
min_x = 1000
max_x = 0
min_y = 1000
max_y = 0
for l in open('input/input06.txt').readlines():
coord = l.split(', ')
x = int(coord[0].strip())
y = int(coord[1].strip())
if x < min_x: min_x = x
if x > max_x: max_x = x
if y < min_y: min_y = y
if y > max_y: max_y = y
c... | coordinates = []
min_x = 1000
max_x = 0
min_y = 1000
max_y = 0
for l in open('input/input06.txt').readlines():
coord = l.split(', ')
x = int(coord[0].strip())
y = int(coord[1].strip())
if x < min_x:
min_x = x
if x > max_x:
max_x = x
if y < min_y:
min_y = y
if y > max_... |
DOMAIN = "corona_germany"
ATTR_CASES = "cases"
ATTR_DEATHS = "deaths"
ATTR_INCIDENCE = "incidence"
CONF_COUNTY = "county" | domain = 'corona_germany'
attr_cases = 'cases'
attr_deaths = 'deaths'
attr_incidence = 'incidence'
conf_county = 'county' |
class Landmark:
def __init__(self):
super(Landmark, self).__init__()
self.train_file = "./data/train_data.txt"
self.query_file = "./data/query_data.txt"
self.gallery_file = "./data/gallery_data.txt"
self.train = self._load_txt(self.train_file)
self.query = self._loa... | class Landmark:
def __init__(self):
super(Landmark, self).__init__()
self.train_file = './data/train_data.txt'
self.query_file = './data/query_data.txt'
self.gallery_file = './data/gallery_data.txt'
self.train = self._load_txt(self.train_file)
self.query = self._load... |
NAME = 'corona.py'
ORIGINAL_AUTHORS = [
'Angelo Giacco'
]
ABOUT = '''
provides information about the coronavirus pandemic
'''
COMMANDS = '''
>>> .corona
returns global coronavirus information
.corona <<country>>
returns coronavirus information for a specific country
'''
WEBSITE = ''
| name = 'corona.py'
original_authors = ['Angelo Giacco']
about = '\nprovides information about the coronavirus pandemic\n'
commands = '\n>>> .corona\nreturns global coronavirus information\n\n.corona <<country>>\nreturns coronavirus information for a specific country\n'
website = '' |
class Solution:
# brute force approach
# time: O(n^2)
# space: O(1)
# def twoSum(self, nums: list[int], target: int) -> list[int]:
# for i in range(len(nums)):
# for j in range(i + 1, len(nums)):
# if nums[i] + nums[j] == target:
# return [i, j]
... | class Solution:
def two_sum(self, nums: list[int], target: int) -> list[int]:
dic = {}
for (i, n) in enumerate(nums):
if n in dic:
return [dic[n], i]
dic[target - n] = i
return [] |
#set name
set_name('homeinit')
print("Initializing...")
#load plugins manually
load_module('mpd', address='localhost', port=6600)
print("Done!")
| set_name('homeinit')
print('Initializing...')
load_module('mpd', address='localhost', port=6600)
print('Done!') |
def main():
principal = float(input("Choose a number(principal): "))
interest = float(input("Choose another number(interest): "))
years = float(input("Choose another number(years): "))
return print("Simple interest = A = P(1 + rt) = %.2f" % ( principal*(1 + 0.01*interest*years) ))
if __name__ == '__ma... | def main():
principal = float(input('Choose a number(principal): '))
interest = float(input('Choose another number(interest): '))
years = float(input('Choose another number(years): '))
return print('Simple interest = A = P(1 + rt) = %.2f' % (principal * (1 + 0.01 * interest * years)))
if __name__ == '__... |
class NotFoundError(Exception):
def __init__(self, resource_name):
self.resource_name = resource_name
@property
def message(self):
return "No {} could be found.".format(self.resource_name)
class AlreadyExistsError(Exception):
def __init__(self, resource_name):
self.resource_na... | class Notfounderror(Exception):
def __init__(self, resource_name):
self.resource_name = resource_name
@property
def message(self):
return 'No {} could be found.'.format(self.resource_name)
class Alreadyexistserror(Exception):
def __init__(self, resource_name):
self.resource_n... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"ToTensor": "000_utils.ipynb",
"ToArray": "000_utils.ipynb",
"To3DTensor": "000_utils.ipynb",
"To2DTensor": "000_utils.ipynb",
"To1DTensor": "000_utils.ipynb",
"To... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'ToTensor': '000_utils.ipynb', 'ToArray': '000_utils.ipynb', 'To3DTensor': '000_utils.ipynb', 'To2DTensor': '000_utils.ipynb', 'To1DTensor': '000_utils.ipynb', 'To3DArray': '000_utils.ipynb', 'To2DArray': '000_utils.ipynb', 'To1DArray': '000_utils.i... |
def birthday(s, d, m):
c=0
sum=0
for i in range(0,len(s)):
sum += s[i]
if i >= m-1:
if sum == d:
c += 1
sum -= s[i-(m-1)]
return print(c)
if __name__ == '__main__':
n = int(input().strip())
s = list(map(int, input().rstrip().split()))
... | def birthday(s, d, m):
c = 0
sum = 0
for i in range(0, len(s)):
sum += s[i]
if i >= m - 1:
if sum == d:
c += 1
sum -= s[i - (m - 1)]
return print(c)
if __name__ == '__main__':
n = int(input().strip())
s = list(map(int, input().rstrip().spli... |
class C:
def foo(self) -> 'C': # C
pass
c = C()
c.foo() # foo
| class C:
def foo(self) -> 'C':
pass
c = c()
c.foo() |
choices = (
("Environment____Console",
"Environment :: Console"),
("Environment____Handhelds_PDA_s",
"Environment :: Handhelds/PDA's"),
("Environment____MacOS_X",
"Environment :: MacOS X"),
("Environment____No_Input_Output__Daemon",
"Environment :: No Input/Output (Da... | choices = (('Environment____Console', 'Environment :: Console'), ('Environment____Handhelds_PDA_s', "Environment :: Handhelds/PDA's"), ('Environment____MacOS_X', 'Environment :: MacOS X'), ('Environment____No_Input_Output__Daemon', 'Environment :: No Input/Output (Daemon)'), ('Environment____Other_Environment', 'Enviro... |
# from functools import partial
#
# def add(one,two):
# return one+two
#
# print(add(11,10))
# partF = partial(add,110)
# print(partF(100))
# import itertools
#
# testAry = [[1,2],[4,5]]
# print(testAry)
# testAry = list(itertools.chain(*testAry))
# print(testAry)
testAry = [1,2,3,4]
newAry = "&".join(map(str,te... | test_ary = [1, 2, 3, 4]
new_ary = '&'.join(map(str, testAry))
print(newAry)
if type(newAry[0]) == int:
print('Int')
elif type(newAry[0]) == str:
print('str')
else:
print('other') |
for name in input().split(", "):
current_username = name
after_digits = []
if 3 < len(name) < 16:
while "-" in name or "_" in name:
name = name.replace("-", "")
name = name.replace("_", "")
[after_digits.append(letter) for letter in name if not letter.isdigit()]
... | for name in input().split(', '):
current_username = name
after_digits = []
if 3 < len(name) < 16:
while '-' in name or '_' in name:
name = name.replace('-', '')
name = name.replace('_', '')
[after_digits.append(letter) for letter in name if not letter.isdigit()]
... |
class Node():
def __init__(self, value, nextNode):
self.value = value
self.nextNode = nextNode
def getNext(self):
return self.nextNode
def addNode(index, node, number):
if index == 0:
return Node(number, node)
return Node(node.value, addNode(index - 1, node.nextNode, ... | class Node:
def __init__(self, value, nextNode):
self.value = value
self.nextNode = nextNode
def get_next(self):
return self.nextNode
def add_node(index, node, number):
if index == 0:
return node(number, node)
return node(node.value, add_node(index - 1, node.nextNode, ... |
version="1.0"
default_armfunction="mov"
known_games=['Jak 1']
known_mod=['640x368']
known_offsetandval_w=['0001c2f0 5FF42070']
known_offsetandval_h=['0001c300 5FF4B870']
| version = '1.0'
default_armfunction = 'mov'
known_games = ['Jak 1']
known_mod = ['640x368']
known_offsetandval_w = ['0001c2f0 5FF42070']
known_offsetandval_h = ['0001c300 5FF4B870'] |
#Author: OMKAR PATHAK
#In this program we will see how to define a class
class MyFirstClass():
#Class Attributes
var = 10
firstObject = MyFirstClass()
print(firstObject) #Printing object's memory hex
print(firstObject.var) #Accessing Class Attributes
secondObject = MyFirstClass()
print(secondObject)
pr... | class Myfirstclass:
var = 10
first_object = my_first_class()
print(firstObject)
print(firstObject.var)
second_object = my_first_class()
print(secondObject)
print(secondObject.var) |
__author__ = 'katharine'
class PebbleHardware(object):
UNKNOWN = 0
TINTIN_EV1 = 1
TINTIN_EV2 = 2
TINTIN_EV2_3 = 3
TINTIN_EV2_4 = 4
TINTIN_V1_5 = 5
BIANCA = 6
SNOWY_EVT2 = 7
SNOWY_DVT = 8
SPALDING_EVT = 9
BOBBY_SMILES = 10
SPALDING = 11
SILK_EVT = 12
ROBERT_EVT =... | __author__ = 'katharine'
class Pebblehardware(object):
unknown = 0
tintin_ev1 = 1
tintin_ev2 = 2
tintin_ev2_3 = 3
tintin_ev2_4 = 4
tintin_v1_5 = 5
bianca = 6
snowy_evt2 = 7
snowy_dvt = 8
spalding_evt = 9
bobby_smiles = 10
spalding = 11
silk_evt = 12
robert_evt = ... |
a,b= map(int, input().split(" "))
if (a%b==0):
print("Sao Multiplos")
else:
if (b%a==0):
print("Sao Multiplos")
else:
print("Nao sao Multiplos") | (a, b) = map(int, input().split(' '))
if a % b == 0:
print('Sao Multiplos')
elif b % a == 0:
print('Sao Multiplos')
else:
print('Nao sao Multiplos') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.