content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
word_size = 27
num_words = 512
words_per_row = 4
local_array_size = 60
output_extended_config = True
output_datasheet_info = True
netlist_only = True
nominal_corner_only = True
| word_size = 27
num_words = 512
words_per_row = 4
local_array_size = 60
output_extended_config = True
output_datasheet_info = True
netlist_only = True
nominal_corner_only = True |
'''
Created on Dec 19, 2013
@author: kyle
'''
def convert_array_to_YxZ(val, z):
out_list_list = []
for i in xrange(len(val)/z + 1):
out_list_list.append([])
for j in xrange(z):
if i*z+j < len(val):
out_list_list[i].append( val[i*z+j] )
return out_list_list
| """
Created on Dec 19, 2013
@author: kyle
"""
def convert_array_to__yx_z(val, z):
out_list_list = []
for i in xrange(len(val) / z + 1):
out_list_list.append([])
for j in xrange(z):
if i * z + j < len(val):
out_list_list[i].append(val[i * z + j])
return out_list_... |
class Metric(object):
def reset(self):
raise NotImplementedError
def update(self, x, y):
raise NotImplementedError
def score(self):
raise NotImplementedError
def mean(self):
raise NotImplementedError
| class Metric(object):
def reset(self):
raise NotImplementedError
def update(self, x, y):
raise NotImplementedError
def score(self):
raise NotImplementedError
def mean(self):
raise NotImplementedError |
def gcd(a,b):
return gcd(b,a%b) if b else a
def lcm3(a,b,c):
return a*b*c*gcd(gcd(a,b),c)//gcd(a,b)//gcd(b,c)//gcd(a,c)
x=[*map(int,input().split())]
r=100**5
for i in range(5):
for j in range(i+1,5):
for k in range(j+1,5):
n=lcm3(x[i],x[j],x[k])
r=min(n,r)
print(r) | def gcd(a, b):
return gcd(b, a % b) if b else a
def lcm3(a, b, c):
return a * b * c * gcd(gcd(a, b), c) // gcd(a, b) // gcd(b, c) // gcd(a, c)
x = [*map(int, input().split())]
r = 100 ** 5
for i in range(5):
for j in range(i + 1, 5):
for k in range(j + 1, 5):
n = lcm3(x[i], x[j], x[k])
... |
for _ in range(int(input())):
v,e=input().split()
v=float(v)
if e=="kg":print("%.4f"%(v*2.2046),"lb")
if e=="lb":print("%.4f"%(v*0.4536),"kg")
if e=="l":print("%.4f"%(v*0.2642),"g")
if e=="g":print("%.4f"%(v*3.7854),"l") | for _ in range(int(input())):
(v, e) = input().split()
v = float(v)
if e == 'kg':
print('%.4f' % (v * 2.2046), 'lb')
if e == 'lb':
print('%.4f' % (v * 0.4536), 'kg')
if e == 'l':
print('%.4f' % (v * 0.2642), 'g')
if e == 'g':
print('%.4f' % (v * 3.7854), 'l') |
coordinates_E0E1E1 = ((126, 108),
(127, 80), (127, 81), (127, 100), (127, 108), (127, 120), (128, 78), (128, 79), (128, 81), (128, 89), (128, 99), (128, 100), (128, 108), (128, 109), (128, 120), (129, 75), (129, 81), (129, 87), (129, 89), (129, 98), (129, 101), (129, 108), (129, 109), (129, 120), (130, 75), (130, 77)... | coordinates_e0_e1_e1 = ((126, 108), (127, 80), (127, 81), (127, 100), (127, 108), (127, 120), (128, 78), (128, 79), (128, 81), (128, 89), (128, 99), (128, 100), (128, 108), (128, 109), (128, 120), (129, 75), (129, 81), (129, 87), (129, 89), (129, 98), (129, 101), (129, 108), (129, 109), (129, 120), (130, 75), (130, 77)... |
P4_PLUGIN = 'q-p4-plugin'
P4_AGENT = 'q-p4-agent'
P4MODULE = 'p4-module'
CONFIGURATION = 'p4-config'
| p4_plugin = 'q-p4-plugin'
p4_agent = 'q-p4-agent'
p4_module = 'p4-module'
configuration = 'p4-config' |
def isPalindrome(s):
return s == ''.join(list(reversed(s)))
nums = sorted([x*y for x in range(1000) for y in range(x+1)], reverse=True)
for x in nums:
if isPalindrome(str(x)):
print(x)
break
| def is_palindrome(s):
return s == ''.join(list(reversed(s)))
nums = sorted([x * y for x in range(1000) for y in range(x + 1)], reverse=True)
for x in nums:
if is_palindrome(str(x)):
print(x)
break |
vendas = [ [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]
maior = marca = media = contador = maior1 = maior2 = maior3 = maior4 = maior5 = maior6 = maiorN = anoo = 0
for l in range(0, 4):
for c in range(0, 6):
vendas[l][c] = int(input("Digite os dados para a tabela: "))
for l... | vendas = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]
maior = marca = media = contador = maior1 = maior2 = maior3 = maior4 = maior5 = maior6 = maior_n = anoo = 0
for l in range(0, 4):
for c in range(0, 6):
vendas[l][c] = int(input('Digite os dados para a tabela: '))
for l... |
class Solution:
def maxAbsValExpr(self, arr1: List[int], arr2: List[int]) -> int:
result = 0
n = len(arr1)
dirs = [[1, 1], [1, -1], [-1, 1], [-1, -1]]
for x, y in dirs:
right = x * arr1[0] + y * arr2[0] + 0
for i in range(n):
left = x * arr1[i]... | class Solution:
def max_abs_val_expr(self, arr1: List[int], arr2: List[int]) -> int:
result = 0
n = len(arr1)
dirs = [[1, 1], [1, -1], [-1, 1], [-1, -1]]
for (x, y) in dirs:
right = x * arr1[0] + y * arr2[0] + 0
for i in range(n):
left = x * a... |
#Create a range from 0 to 50, excluding 50.
rng = range(0, 50)
print(list(rng))
#===============================
#Create a range from 0 to 10 with steps of 2.
rng = range(0, 10, 2)
print(list(rng))
#==========================
#Create a range from 100 to 160 with steps of 10. Then print it as a list.
rng = range(10... | rng = range(0, 50)
print(list(rng))
rng = range(0, 10, 2)
print(list(rng))
rng = range(100, 160, 10)
print(list(rng))
rng = range(800, 1400, 100)
rng = list(rng)
rng.sort(reverse=True)
print(rng) |
#
# PySNMP MIB module Wellfleet-LAPB-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-LAPB-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:40:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
# https://leetcode.com/problems/coin-change-2/
class Solution:
def change(self, amount: int, coins: list[int]) -> int:
dp = [0 for _ in range(amount + 1)]
dp[0] = 1
for coin in coins:
for amount_idx in range(coin, len(dp)):
dp[amount_idx] += dp[amount_idx - coin]... | class Solution:
def change(self, amount: int, coins: list[int]) -> int:
dp = [0 for _ in range(amount + 1)]
dp[0] = 1
for coin in coins:
for amount_idx in range(coin, len(dp)):
dp[amount_idx] += dp[amount_idx - coin]
return dp[-1] |
# Map
# Looping without a loop
# Basic usage - count len
people = ['Matt', 'Bryan', 'Nicole', 'Tammy']
# OLD way
'''count = []
for x in people:
count.append(len(x))
print(f'Old way:\n{count}')'''
# MODERN way
print(f'Map function:\n{list(map(len,people))}')
# COMBINE ELEMENTS
# Notice different lengs, we are... | people = ['Matt', 'Bryan', 'Nicole', 'Tammy']
"count = []\nfor x in people:\n count.append(len(x))\nprint(f'Old way:\n{count}')"
print(f'Map function:\n{list(map(len, people))}')
base = ('Pie', 'Cake', 'Brownies')
toppings = ('Apple', 'Chocolate', 'Fudge', 'Pizza')
def merg(a, b):
return a + ' ' + b
x = map(mer... |
# returns minimum value from list of bms data parameter
def bms_param_min(bms_param_data):
if len(bms_param_data) !=0:
return round(min(bms_param_data),3)
return "Data not available"
# returns maximum value from list of bms data parameter
def bms_param_max(bms_param_data):
if len(bms_param_data) !=... | def bms_param_min(bms_param_data):
if len(bms_param_data) != 0:
return round(min(bms_param_data), 3)
return 'Data not available'
def bms_param_max(bms_param_data):
if len(bms_param_data) != 0:
return round(max(bms_param_data), 3)
return 'Data not available'
def display_output(bms_data)... |
#
# PySNMP MIB module STN-SYSTEM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-SYSTEM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:11:42 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, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, value_range_constraint, single_value_constraint, constraints_intersection) ... |
stuff = []
x = True
while x is True:
y = input("")
if y.lower() != 'done':
stuff.append(y)
else:
print(stuff)
print(len(stuff))
break
| stuff = []
x = True
while x is True:
y = input('')
if y.lower() != 'done':
stuff.append(y)
else:
print(stuff)
print(len(stuff))
break |
# Define the path to the DNSMasq Lease file
dnsmasq_lease_file = '/var/lib/misc/dnsmasq.leases'
# Read list of hosts to ping from csv file ping_hosts
ping_hosts = 'ping_hosts'
| dnsmasq_lease_file = '/var/lib/misc/dnsmasq.leases'
ping_hosts = 'ping_hosts' |
def main():
l,mn,ma = list(map(int, input().split()))
if mn>l :
mn = l
if ma>l :
ma = l
mn_sum = l-mn+1
c = 1
for i in range(mn-1):
c *= 2
mn_sum += c
c = 1
mx_sum = 1
for i in range(1,ma):
c *= 2
mx_sum += c
mx_sum += (l-ma)*c
... | def main():
(l, mn, ma) = list(map(int, input().split()))
if mn > l:
mn = l
if ma > l:
ma = l
mn_sum = l - mn + 1
c = 1
for i in range(mn - 1):
c *= 2
mn_sum += c
c = 1
mx_sum = 1
for i in range(1, ma):
c *= 2
mx_sum += c
mx_sum += ... |
# Collection.find() function with hardcoded values
myColl = db.get_collection('my_collection')
myRes1 = myColl.find('age = 15').execute()
# Using the .bind() function to bind parameters
myRes2 = myColl.find('name = :param1 AND age = :param2').bind('param1','jack').bind('param2', 17).execute()
# Using named p... | my_coll = db.get_collection('my_collection')
my_res1 = myColl.find('age = 15').execute()
my_res2 = myColl.find('name = :param1 AND age = :param2').bind('param1', 'jack').bind('param2', 17).execute()
myColl.modify('name = :param').set('age', 37).bind('param', 'clare').execute()
my_res3 = myColl.find('name like :param').... |
courses = ['History', 'Math', 'Physics', 'CompSci']
for item in courses:
print(item)
# loop with an index
for index, course in enumerate(courses):
print(index, course)
# loop with a starting index value
for index, course in enumerate(courses, start=1):
print(index, course)
| courses = ['History', 'Math', 'Physics', 'CompSci']
for item in courses:
print(item)
for (index, course) in enumerate(courses):
print(index, course)
for (index, course) in enumerate(courses, start=1):
print(index, course) |
# settings.py - place to store constants for template-gen
ACS_API = '2016-03-30'
BASE_API = '2016-09-01'
COMP_API = '2017-03-30'
#COMP_API = '2016-04-30-preview'
INSIGHTS_API = '2015-04-01'
INSIGHTS_METRICS_API = '2016-03-01'
INSIGHTS_PREVIEW_API = '2016-06-01'
MEDIA_API = '2015-10-01'
NETWORK_API = '2016-09-01'
STORA... | acs_api = '2016-03-30'
base_api = '2016-09-01'
comp_api = '2017-03-30'
insights_api = '2015-04-01'
insights_metrics_api = '2016-03-01'
insights_preview_api = '2016-06-01'
media_api = '2015-10-01'
network_api = '2016-09-01'
storage_api = '2016-01-01' |
fileref = open("olympics.txt", "r")
## Mind it the file should be in the same folder of the program execution.
lines = fileref.readlines()
print(len(lines))
total_char = 0
for line in lines:
total_char += len(line)
print(line.strip())
print(total_char)
fileref.close()
| fileref = open('olympics.txt', 'r')
lines = fileref.readlines()
print(len(lines))
total_char = 0
for line in lines:
total_char += len(line)
print(line.strip())
print(total_char)
fileref.close() |
################################################################################
#
# Author: francescodilillo
# Purpose: practice with dictionaries
# Last Edit Date: 18-03-2020
#
#
################################################################################
person = {"name": "Francesco", "gender": "M", "age": 27,... | person = {'name': 'Francesco', 'gender': 'M', 'age': 27, 'address': '15 Rue de Ville, Luxembourg', 'phone': 34566112233}
request = input('What info would you need to learn about the person? ').lower()
output = person.get(request, "The request can't be fulfilled since there is no field " + request)
print(request, ': ', ... |
EXPERIMENTAL_MODE = True
# header chunk id
HEADER = 0x1
class Chunks13:
SHADERS = 0x2
VISUALS = 0x3
PORTALS = 0x4
LIGHT_DYNAMIC = 0x6
GLOWS = 0x7
SECTORS = 0x8
VB = 0x9
IB = 0xa
SWIS = 0xb
class Chunks12:
SHADERS = 0x2
VISUALS = 0x3
PORTALS = 0x4
LIGHT_DYNAMIC = 0... | experimental_mode = True
header = 1
class Chunks13:
shaders = 2
visuals = 3
portals = 4
light_dynamic = 6
glows = 7
sectors = 8
vb = 9
ib = 10
swis = 11
class Chunks12:
shaders = 2
visuals = 3
portals = 4
light_dynamic = 6
glows = 7
sectors = 8
ib = 9
... |
class Solution:
# time: O(1)
# space: O(1)
def findComplement(self, num: int) -> int:
i = 1
while i <= num:
i = i << 1
return (i - 1) ^ num
| class Solution:
def find_complement(self, num: int) -> int:
i = 1
while i <= num:
i = i << 1
return i - 1 ^ num |
def anagrams(word, words):
#your code here
word_list = list(word)
word_list.sort()
l = []
for i in words:
j = list(i)
j.sort()
if(j == word_list):
l.append(i)
return l | def anagrams(word, words):
word_list = list(word)
word_list.sort()
l = []
for i in words:
j = list(i)
j.sort()
if j == word_list:
l.append(i)
return l |
#!/usr/bin/env python3
#! @author: @ruhend(Mudigonda Himansh)
'''
Here in this program i have used one function to do both the encoding and decoding part of it.
this works with the basic principle, of division.
while division the remainder is returned.
Encoding doesnt make use of it, but while decoding... | """
Here in this program i have used one function to do both the encoding and decoding part of it.
this works with the basic principle, of division.
while division the remainder is returned.
Encoding doesnt make use of it, but while decoding the remainder is == 0, if True, then it is not corrupted, else... |
class ExerciseStep:
def __init__(self, main_text:str, sub_text=""):
self.main_text = main_text
self.sub_text = sub_text | class Exercisestep:
def __init__(self, main_text: str, sub_text=''):
self.main_text = main_text
self.sub_text = sub_text |
class BackEnd:
def __init__(self, id, Nome, Descricao, Versao):
self.id = id
self.nome = Nome
self.descricao = Descricao
self.versao = Versao
def __str__(self):
return f"{self.id},{self.nome},{self.descricao},{self.versao}" | class Backend:
def __init__(self, id, Nome, Descricao, Versao):
self.id = id
self.nome = Nome
self.descricao = Descricao
self.versao = Versao
def __str__(self):
return f'{self.id},{self.nome},{self.descricao},{self.versao}' |
_base_ = [
'../_base_/models/faster_rcnn_r50_fpn.py',
'../_base_/datasets/rect_blur_detection.py',
'../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py']
optimizer = dict(type='SGD', lr=0.0005, momentum=0.9, weight_decay=0.0001)
model = dict(
roi_head=dict(
type='DoubleHeadRoIHe... | _base_ = ['../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/rect_blur_detection.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py']
optimizer = dict(type='SGD', lr=0.0005, momentum=0.9, weight_decay=0.0001)
model = dict(roi_head=dict(type='DoubleHeadRoIHead', reg_roi_scale_factor=1.3... |
trip_price = float(input())
money_balance = float(input())
spend_times = 0
days_count = 0
while spend_times < 5 and money_balance < trip_price:
action = input()
sum = float(input())
days_count += 1
if action == "spend":
spend_times += 1
if sum >= money_balance:
money_balanc... | trip_price = float(input())
money_balance = float(input())
spend_times = 0
days_count = 0
while spend_times < 5 and money_balance < trip_price:
action = input()
sum = float(input())
days_count += 1
if action == 'spend':
spend_times += 1
if sum >= money_balance:
money_balance ... |
def floodFill(graph, visited, start):
if (start == -1):
return(0)
s = 0
if (not visited[start]):
s += 1
visited[start] = 1
for v in graph[start]:
s += floodFill(graph, visited, v)
return(s)
size = int(input())
graph = [[] for i in range(size)]
for i in range(... | def flood_fill(graph, visited, start):
if start == -1:
return 0
s = 0
if not visited[start]:
s += 1
visited[start] = 1
for v in graph[start]:
s += flood_fill(graph, visited, v)
return s
size = int(input())
graph = [[] for i in range(size)]
for i in range(size ... |
def keyword_from_deeper_submodule():
return 'hi again'
class Sub:
def keyword_from_class_in_deeper_submodule(self):
return 'bye'
| def keyword_from_deeper_submodule():
return 'hi again'
class Sub:
def keyword_from_class_in_deeper_submodule(self):
return 'bye' |
#!/usr/bin/python
# -*- coding: utf-8 -*-
print("Note : Starting GUI...")
| print('Note : Starting GUI...') |
#
# PySNMP MIB module CISCO-CDSTV-INGESTMGR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CDSTV-INGESTMGR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:53:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ... |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(S, P, Q):
# write your code in Python 3.6
A = [0]*len(S)
APrefixSum = [0]*len(S)
C = [0]*len(S)
CPrefixSum = [0]*len(S)
G = [0]*len(S)
GPrefixSum = [0]*len(S)
T = [0]*le... | def solution(S, P, Q):
a = [0] * len(S)
a_prefix_sum = [0] * len(S)
c = [0] * len(S)
c_prefix_sum = [0] * len(S)
g = [0] * len(S)
g_prefix_sum = [0] * len(S)
t = [0] * len(S)
t_prefix_sum = [0] * len(S)
for index in range(len(S)):
if S[index] == 'A':
A[index] = 1
... |
#! /usr/bin/env python
# coding: utf-8
class ClientError(Exception):
def __init__(self):
pass
class BadRequest(ClientError):
def __init__(self, key, detail=None):
self.key = key
self.detail = detail
class ConflictRequest(ClientError):
def __init__(self, detail=None):
... | class Clienterror(Exception):
def __init__(self):
pass
class Badrequest(ClientError):
def __init__(self, key, detail=None):
self.key = key
self.detail = detail
class Conflictrequest(ClientError):
def __init__(self, detail=None):
self.detail = detail
class Resourcenotfou... |
class TimeRegister:
def __init__(self, emp_id, date, hours):
self.emp_id = emp_id
self.date = date
self.hours = hours
def get_emp_id(self):
return self.emp_id
def set_emp_id(self, new_id):
self.emp_id = new_id
def get_date(self):
return self.__date
d... | class Timeregister:
def __init__(self, emp_id, date, hours):
self.emp_id = emp_id
self.date = date
self.hours = hours
def get_emp_id(self):
return self.emp_id
def set_emp_id(self, new_id):
self.emp_id = new_id
def get_date(self):
return self.__date
... |
def isPalindrome (input):
input = [int(i) for i in str(input)]
length = int(len(input))
if length % 2 == 0:
part1 = (input[0: int(length / 2)])
part2 = (input[int(length / 2):])
part2 = list(reversed(part2))
else:
part1 = (input[0: int(length // 2)])
part... | def is_palindrome(input):
input = [int(i) for i in str(input)]
length = int(len(input))
if length % 2 == 0:
part1 = input[0:int(length / 2)]
part2 = input[int(length / 2):]
part2 = list(reversed(part2))
else:
part1 = input[0:int(length // 2)]
part2 = input[int(len... |
source_urls = {
"2014": [
"https://raw.githubusercontent.com/tech-conferences/conference-data/master/conferences/2014/javascript.json",
"https://raw.githubusercontent.com/tech-conferences/conference-data/master/conferences/2014/ruby.json",
"https://raw.githubusercontent.com/tech-conferences/... | source_urls = {'2014': ['https://raw.githubusercontent.com/tech-conferences/conference-data/master/conferences/2014/javascript.json', 'https://raw.githubusercontent.com/tech-conferences/conference-data/master/conferences/2014/ruby.json', 'https://raw.githubusercontent.com/tech-conferences/conference-data/master/confere... |
class Solution:
def maxValue(self, events: List[List[int]], k: int) -> int:
e = sorted(events)
@lru_cache(None)
def dp(i, k):
if k == 0 or i == len(e):
return 0
# binary search events to find the first index j s.t. e[j][0] > e[i][1]
j = bisect.bisect(e, [e[i][1], math.inf, math... | class Solution:
def max_value(self, events: List[List[int]], k: int) -> int:
e = sorted(events)
@lru_cache(None)
def dp(i, k):
if k == 0 or i == len(e):
return 0
j = bisect.bisect(e, [e[i][1], math.inf, math.inf], i + 1)
return max(dp(i +... |
l,r = input().split()
l,r = int(l), int(r)
if l == 0 and r == 0:
print("Not a moose")
elif l == r:
print("Even", l+r)
elif l != r:
mx = max(l,r)
print("Odd", mx*2)
| (l, r) = input().split()
(l, r) = (int(l), int(r))
if l == 0 and r == 0:
print('Not a moose')
elif l == r:
print('Even', l + r)
elif l != r:
mx = max(l, r)
print('Odd', mx * 2) |
bot_fav_color = "blue"
# Creating a parent class to use for various games
class Player:
def __init__(self, name, fav_color):
self.name = name
self.fav_color = fav_color
def __str__(self):
if self.fav_color == "blue":
return f"Hi {self.name}! My favorite color is... | bot_fav_color = 'blue'
class Player:
def __init__(self, name, fav_color):
self.name = name
self.fav_color = fav_color
def __str__(self):
if self.fav_color == 'blue':
return f'Hi {self.name}! My favorite color is also blue!'
return f'Hi {self.name}! {self.fav_color}... |
# subtraction with two number with user input
a = int(input("Enter The First Value:"))
b = int(input("Enter The Seceond Value:"))
if a>b:
Subtraction = a - b # In capital letters
print("subtraction OF:",Subtraction)
else:
subtraction = b - a # Small... | a = int(input('Enter The First Value:'))
b = int(input('Enter The Seceond Value:'))
if a > b:
subtraction = a - b
print('subtraction OF:', Subtraction)
else:
subtraction = b - a
print('Substraction OF: -', subtraction) |
# Copyright 2020 The Elekto Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | csrf_state = 'state'
auth_state = 'authentication'
github_authorize = 'https://github.com/login/oauth/authorize'
github_access = 'https://github.com/login/oauth/access_token'
github_profile = 'https://api.github.com/user'
elec_stat_completed = 'completed'
elec_stat_running = 'running'
elec_stat_upcoming = 'upcoming'
ca... |
#
# PySNMP MIB module SPAGENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SPAGENT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:02:25 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, 0... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, single_value_constraint, value_range_constraint) ... |
class ShippingMethodType:
PRICE_BASED = "price"
WEIGHT_BASED = "weight"
CHOICES = [
(PRICE_BASED, "Price based shipping"),
(WEIGHT_BASED, "Weight based shipping"),
]
class PostalCodeRuleInclusionType:
INCLUDE = "include"
EXCLUDE = "exclude"
CHOICES = [
(INCLUDE, "... | class Shippingmethodtype:
price_based = 'price'
weight_based = 'weight'
choices = [(PRICE_BASED, 'Price based shipping'), (WEIGHT_BASED, 'Weight based shipping')]
class Postalcoderuleinclusiontype:
include = 'include'
exclude = 'exclude'
choices = [(INCLUDE, 'Shipping method should include post... |
# Create a variable called 'name' that holds a string
name = "Homer Simpson"
# Create a variable called 'country' that holds a string
country = "United States"
# Create a variable called 'age' that holds an integer
age = 25
# Create a variable called 'hourly_wage' that holds an integer
hourly_wage = 15
# Create a v... | name = 'Homer Simpson'
country = 'United States'
age = 25
hourly_wage = 15
weekly_hours = '40'
daily_wage = hourly_wage * 8
weekly_wage = hourly_wage * int(weekly_hours)
satisfied = True
print(f'Hello, {name}!')
print(f'You live in {country}.')
print(f'You are {str(age)} years old.')
print(f'You make {str(daily_wage)} ... |
# Joshua Nelson Gomes (Joshua)
# CIS 41A Spring 2020
# Unit C Take-Home Assignment
# First Script - Working with List
list1 = list()
list1.extend([1,3,5])
list2 = [1, 2, 3, 4]
list3 = list1 + list2
print (f'd) list3 is: {list3}')
print (f'e) list3 contains a 3: {3 in list3}')
print (f'f) list3 contains {list3.count... | list1 = list()
list1.extend([1, 3, 5])
list2 = [1, 2, 3, 4]
list3 = list1 + list2
print(f'd) list3 is: {list3}')
print(f'e) list3 contains a 3: {3 in list3}')
print(f'f) list3 contains {list3.count(3)} 3s')
print(f'h) The index of the first 3 contained in list3 is {list3.index(3)}')
print(f'h) first3 = {list3.pop(list3... |
class Solution:
def findMissingRanges(self, nums: List[int], lower: int, upper: int) -> List[str]:
# need to consider low and upper element because res.append(str(nums[i]+1)) and we use range 2 (nums[i+1] - nums[i] == 2)
# for example: [1], low = 0, upper = 100.
nums = [lower-1] + nums + [u... | class Solution:
def find_missing_ranges(self, nums: List[int], lower: int, upper: int) -> List[str]:
nums = [lower - 1] + nums + [upper + 1]
res = []
for i in range(len(nums) - 1):
if nums[i + 1] - nums[i] == 2:
res.append(str(nums[i] + 1))
elif nums[... |
with open("input.txt") as f:
lines = [line.strip() for line in f.readlines()]
tiles = {} # (e, ne) => is_black
# decomposes a movement direction on a hex grid to one or two movements in two axes (this allows for unique coords)
def decompose(direction: str) -> list:
if direction == "se":
return ["e",... | with open('input.txt') as f:
lines = [line.strip() for line in f.readlines()]
tiles = {}
def decompose(direction: str) -> list:
if direction == 'se':
return ['e', 'sw']
elif direction == 'nw':
return ['w', 'ne']
else:
return [direction]
for line in lines:
directions = []
... |
__name__ = "lbry"
__version__ = "0.44.1"
version = tuple(__version__.split('.'))
| __name__ = 'lbry'
__version__ = '0.44.1'
version = tuple(__version__.split('.')) |
class MSImageCollection(object):
def __init__(self, images):
self._images = images
@property
def images(self):
# <list>
return self._images
| class Msimagecollection(object):
def __init__(self, images):
self._images = images
@property
def images(self):
return self._images |
class ResourceNames():
def __init__(self, log_group_name: str, log_stream_name: str):
self.log_group_name = log_group_name
self.log_stream_name = log_stream_name
def get_log_group_name(self) -> str:
return self.log_group_name
def get_log_stream_name(self) -> str:
... | class Resourcenames:
def __init__(self, log_group_name: str, log_stream_name: str):
self.log_group_name = log_group_name
self.log_stream_name = log_stream_name
def get_log_group_name(self) -> str:
return self.log_group_name
def get_log_stream_name(self) -> str:
return self... |
n = int(input())
num1 = ""
num2 = ""
num3 = ""
num4 = ""
for a in range(1111, 9999 + 1):
num1 = str(a)[0]
num2 = str(a)[1]
num3 = str(a)[2]
num4 = str(a)[3]
if int(num1) != 0 and int(num2) != 0 and int(num3) != 0 and int(num4) != 0:
if n % int(num1) == 0 and n % int(num2) == 0 and n % int(nu... | n = int(input())
num1 = ''
num2 = ''
num3 = ''
num4 = ''
for a in range(1111, 9999 + 1):
num1 = str(a)[0]
num2 = str(a)[1]
num3 = str(a)[2]
num4 = str(a)[3]
if int(num1) != 0 and int(num2) != 0 and (int(num3) != 0) and (int(num4) != 0):
if n % int(num1) == 0 and n % int(num2) == 0 and (n % i... |
IR_Sensor_1 = 6 #GPIO number
IR_Sensor_2 = 13 #GPIO number
IR_Sensor_3 = 19 #GPIO number
IR_Sensor_4 = 26 #GPIO number
IR_Sensor_5 = 12 #GPIO number
IR_Sensor_6 = 16 #GPIO number
IR_Sensor_7 = 20 #GPIO number
IR_Sensor_8 = 21 #GPIO number
I_Restart = 5 #GPIO number
I_Pair = 11 #GPIO number
IR_time = 500 # time in ms
Re... | ir__sensor_1 = 6
ir__sensor_2 = 13
ir__sensor_3 = 19
ir__sensor_4 = 26
ir__sensor_5 = 12
ir__sensor_6 = 16
ir__sensor_7 = 20
ir__sensor_8 = 21
i__restart = 5
i__pair = 11
ir_time = 500
restart_time = 5000
pair_time = 200 |
__title__ = 'MeteorTears'
__description__ = 'Even the most boring times in life are limited.'
__url__ = 'https://github.com/xiaoxiaolulu/MeteorTears'
__version__ = '1.0.1'
__author__ = 'Null'
__author_email__ = '546464268@qq.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2018 Null'
| __title__ = 'MeteorTears'
__description__ = 'Even the most boring times in life are limited.'
__url__ = 'https://github.com/xiaoxiaolulu/MeteorTears'
__version__ = '1.0.1'
__author__ = 'Null'
__author_email__ = '546464268@qq.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2018 Null' |
# 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 binaryTreePaths(self, root: Optional[TreeNode]) -> List[str]:
result = []
path = []
... | class Solution:
def binary_tree_paths(self, root: Optional[TreeNode]) -> List[str]:
result = []
path = []
def backtrack(root):
if not root:
return
if not root.left and (not root.right):
path.append(str(root.val))
resul... |
class MultiprocessingUtils(object):
@staticmethod
def get_array_split_indices(array_length, thread_count):
array_length += 1
indices = range(0, array_length, array_length / thread_count)[:thread_count]
indices.append(array_length)
return indices
@staticmethod
def star... | class Multiprocessingutils(object):
@staticmethod
def get_array_split_indices(array_length, thread_count):
array_length += 1
indices = range(0, array_length, array_length / thread_count)[:thread_count]
indices.append(array_length)
return indices
@staticmethod
def start_... |
def smallestDifference(arrayOne, arrayTwo):
arrayOne.sort()
arrayTwo.sort()
ans = [0, float('inf')]
i = j = 0
while i < len(arrayOne) and j < len(arrayTwo):
if abs(ans[0] - ans[1]) > abs(arrayOne[i] - arrayTwo[j]):
ans[0], ans[1] = arrayOne[i], arrayTwo[j]
if ans[... | def smallest_difference(arrayOne, arrayTwo):
arrayOne.sort()
arrayTwo.sort()
ans = [0, float('inf')]
i = j = 0
while i < len(arrayOne) and j < len(arrayTwo):
if abs(ans[0] - ans[1]) > abs(arrayOne[i] - arrayTwo[j]):
(ans[0], ans[1]) = (arrayOne[i], arrayTwo[j])
if ans... |
CATEGORIES = ["Gents", "Ladies", "Giants", "Boys", "Girls", "Kids", "Children"]
BRANDS = [
"",
"PRIDE",
"DEBONGO",
"VKC DEBONGO",
"KAPERS",
"STILE",
"L.PRIDE",
"SMARTAK",
]
| categories = ['Gents', 'Ladies', 'Giants', 'Boys', 'Girls', 'Kids', 'Children']
brands = ['', 'PRIDE', 'DEBONGO', 'VKC DEBONGO', 'KAPERS', 'STILE', 'L.PRIDE', 'SMARTAK'] |
murder_note = "You may call me heartless, a killer, a monster, a murderer, but I'm still NOTHING compared to the villian that Jay was. This whole contest was a sham, an elaborate plot to shame the contestants and feed Jay's massive, massive ego. SURE you think you know him! You've seen him smiling for the cameras, laug... | murder_note = "You may call me heartless, a killer, a monster, a murderer, but I'm still NOTHING compared to the villian that Jay was. This whole contest was a sham, an elaborate plot to shame the contestants and feed Jay's massive, massive ego. SURE you think you know him! You've seen him smiling for the cameras, laug... |
class ColorTerminal:
prRed = '\033[91m'
prGreen = '\033[92m'
prLightPurple = '\033[94m'
prCyan = '\033[96m'
endc = '\033[0m'
| class Colorterminal:
pr_red = '\x1b[91m'
pr_green = '\x1b[92m'
pr_light_purple = '\x1b[94m'
pr_cyan = '\x1b[96m'
endc = '\x1b[0m' |
class Solution:
def generate(self, numRows: 'int') -> 'List[List[int]]':
if numRows<1:
return []
rst = []
if numRows == 1:
rst.append([1])
elif numRows == 2:
rst.append([1])
rst.append([1,1])
else:
rst.append([1])
... | class Solution:
def generate(self, numRows: 'int') -> 'List[List[int]]':
if numRows < 1:
return []
rst = []
if numRows == 1:
rst.append([1])
elif numRows == 2:
rst.append([1])
rst.append([1, 1])
else:
rst.append([1]... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: Philip J Grabner <phil@canary.md>
# date: 2016/09/14
# copy: (C) Copyright 2016-EOT Canary Health, Inc., All Rights Reserved.
#--------------------------------------------------------------------... | undefined = object()
class Error(Exception):
pass
class Precompilerunavailable(Error):
pass
class Templatecollision(Error):
pass |
a = int(input())
b = int(input())
if a == b:
print(0)
elif a > b:
print(1)
else:
print(2) | a = int(input())
b = int(input())
if a == b:
print(0)
elif a > b:
print(1)
else:
print(2) |
############################################################################
# Generic script applicable on any Operating Environments (Unix, Windows)
# ScriptName : wls_deploy.py
# Properties : weblogic.properties test.properties
# Author : Kevin Yuan
######################################################... | connect('@WL_USR@', '@WL_PWD@', 't3://@WL_HOST@:@WL_PORT@')
edit()
start_edit()
deploy(appName='@appName@', path='@testDir@/@earName@', targets='@TARGET_SERVER@')
save()
activate()
exit() |
class DroneTemplate:
__attr__ = ('id', 'name', 'namespace', 'data')
def __init__(self, data: dict):
self._data = data
@property
def id(self):
return self._data.get('id')
@property
def name(self):
return self._data.get('name')
@property
def namespace(self):
... | class Dronetemplate:
__attr__ = ('id', 'name', 'namespace', 'data')
def __init__(self, data: dict):
self._data = data
@property
def id(self):
return self._data.get('id')
@property
def name(self):
return self._data.get('name')
@property
def namespace(self):
... |
A = float(raw_input())
B = float(raw_input())
MEDIA = ((A*3.5)+(B*7.5))/11
print ("MEDIA = %.5f" %MEDIA)
| a = float(raw_input())
b = float(raw_input())
media = (A * 3.5 + B * 7.5) / 11
print('MEDIA = %.5f' % MEDIA) |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
if len(set(l))<n:
print("YES")
else:
print("NO") | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
if len(set(l)) < n:
print('YES')
else:
print('NO') |
def ParseXMLWithXPath(xmlString, xpath):
return | def parse_xml_with_x_path(xmlString, xpath):
return |
#
# PySNMP MIB module ZXR10-T128-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZXR10-T128-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:42:31 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, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ... |
class CDCAbstract:
def __init__(self, username, pw, headless=False):
self.username = username
self.password = pw
self.headless = headless
# vars (practical)
self.available_days_practical = []
self.available_days_in_view_practical = []
self.available_times_pr... | class Cdcabstract:
def __init__(self, username, pw, headless=False):
self.username = username
self.password = pw
self.headless = headless
self.available_days_practical = []
self.available_days_in_view_practical = []
self.available_times_practical = []
self.av... |
'''OrderState data structure.'''
__copyright__ = "Copyright (c) 2008 Kevin J Bluck"
__version__ = "$Id$"
class OrderState(object):
'''Data structure containing attributes to describe the status of an
order.
'''
def __init__(self, status="", init_margin="", maint_margin="", equity_with_loan="", ... | """OrderState data structure."""
__copyright__ = 'Copyright (c) 2008 Kevin J Bluck'
__version__ = '$Id$'
class Orderstate(object):
"""Data structure containing attributes to describe the status of an
order.
"""
def __init__(self, status='', init_margin='', maint_margin='', equity_with_loan='', comm... |
class Token:
def __init__(self, token, start_pos=-1, action="", change_seq=0):
self._token = token
self._start_pos = start_pos
self._action = action
self._change_seq = change_seq
@property
def start_pos(self):
return self._start_pos
@start_pos.setter
def sta... | class Token:
def __init__(self, token, start_pos=-1, action='', change_seq=0):
self._token = token
self._start_pos = start_pos
self._action = action
self._change_seq = change_seq
@property
def start_pos(self):
return self._start_pos
@start_pos.setter
def st... |
#!/usr/bin/env python3
class Solution:
def getRow(self, rowIndex):
ret, numer, denom = [1], 1, 1
for i in range(0, rowIndex):
numer *= (rowIndex-i)
denom *= (1+i)
ret.append(numer//denom)
return ret
sol = Solution()
for i in range(10):
print(sol.getR... | class Solution:
def get_row(self, rowIndex):
(ret, numer, denom) = ([1], 1, 1)
for i in range(0, rowIndex):
numer *= rowIndex - i
denom *= 1 + i
ret.append(numer // denom)
return ret
sol = solution()
for i in range(10):
print(sol.getRow(i)) |
counter = 0
arr = []
while counter != 3:
ss = input("Shop stock: ")
if "cam" in ss.lower():
counter += 1
arr.append(ss)
else:
pass
arr.sort(reverse=True)
print(f"Proposals: {arr[0]}, {arr[1]}, {arr[2]}") | counter = 0
arr = []
while counter != 3:
ss = input('Shop stock: ')
if 'cam' in ss.lower():
counter += 1
arr.append(ss)
else:
pass
arr.sort(reverse=True)
print(f'Proposals: {arr[0]}, {arr[1]}, {arr[2]}') |
#!/usr/bin/env python
class ListInstance:
def __attrnames(self):
result = ''
for attr in sorted(self.__dict__):
result += '\t%s=%s\n' % (attr, self.__dict__[attr])
return result
def __str__(self):
return '<Instance of %s, address %s:\n%s>' % (
self._... | class Listinstance:
def __attrnames(self):
result = ''
for attr in sorted(self.__dict__):
result += '\t%s=%s\n' % (attr, self.__dict__[attr])
return result
def __str__(self):
return '<Instance of %s, address %s:\n%s>' % (self.__class__.__name__, id(self), self.__att... |
#from datetime import datetime
#time=str(datetime.now())
#time=time[0:4]+time[5:7]+time[8:10]+time[11:13]+time[14:16]+time[17:19]+time[20:22]
#print(time)
print(float("01")) | print(float('01')) |
#!/usr/bin/env python3
total = 0
n = int(input())
n = (n * (n % 2))
total = total + n
n = int(input())
n = (n * (n % 2))
total = total + n
n = int(input())
n = (n * (n % 2))
total = total + n
n = int(input())
n = (n * (n % 2))
total = total + n
n = int(input())
n = (n * (n % 2))
total = total + n
n = int(input()... | total = 0
n = int(input())
n = n * (n % 2)
total = total + n
n = int(input())
n = n * (n % 2)
total = total + n
n = int(input())
n = n * (n % 2)
total = total + n
n = int(input())
n = n * (n % 2)
total = total + n
n = int(input())
n = n * (n % 2)
total = total + n
n = int(input())
n = n * (n % 2)
total = total + n
n = ... |
n = 4
arr = []
for _ in range(n):
s = list(input())
arr.append(s)
def check(arr, paint='#'):
possible = False
Y = len(arr)
X = len(arr[0])
for y in range(1, Y):
for x in range(1, X):
if arr[y-1][x] == paint and arr[y][x-1] == paint and arr[y-1][x-1] == paint:
... | n = 4
arr = []
for _ in range(n):
s = list(input())
arr.append(s)
def check(arr, paint='#'):
possible = False
y = len(arr)
x = len(arr[0])
for y in range(1, Y):
for x in range(1, X):
if arr[y - 1][x] == paint and arr[y][x - 1] == paint and (arr[y - 1][x - 1] == paint):
... |
chars = [0]*26
str = input().strip()
odds = 0
for i in range(0, len(str)):
chars[ord(str[i])-97] += 1
for i in range(0, 26):
if chars[i] % 2 == 1:
odds += 1
if odds > 1:
print("NO")
else:
print("YES") | chars = [0] * 26
str = input().strip()
odds = 0
for i in range(0, len(str)):
chars[ord(str[i]) - 97] += 1
for i in range(0, 26):
if chars[i] % 2 == 1:
odds += 1
if odds > 1:
print('NO')
else:
print('YES') |
## DP 100%
class Solution:
def updateMatrix(self, matrix: List[List[int]]) -> List[List[int]]:
m, n = len(matrix), len(matrix[0])
dp = [[1000]*n for _ in range(m)]
for i in range(m):
for j in range(n):
if (matrix[i][j] == 0):
dp[i][j] = 0
... | class Solution:
def update_matrix(self, matrix: List[List[int]]) -> List[List[int]]:
(m, n) = (len(matrix), len(matrix[0]))
dp = [[1000] * n for _ in range(m)]
for i in range(m):
for j in range(n):
if matrix[i][j] == 0:
dp[i][j] = 0
... |
src = Split('''
fota_test.c
''')
component = aos_component('fota_test', src)
component.add_comp_deps('middleware/uagent/uota') | src = split('\n fota_test.c\n')
component = aos_component('fota_test', src)
component.add_comp_deps('middleware/uagent/uota') |
{
"targets": [
{
"target_name": "modsecurity",
"sources": [ "modsecurity_wrap.cxx" ],
"include_dirs": ['usr/local/modsecurity/include/modsecurity',],
"libraries": ['/usr/local/modsecurity/lib/libmodsecurity.a',
'/usr/local/modsecurity/lib/libmodsecurity.dylib',
'/usr/local/mods... | {'targets': [{'target_name': 'modsecurity', 'sources': ['modsecurity_wrap.cxx'], 'include_dirs': ['usr/local/modsecurity/include/modsecurity'], 'libraries': ['/usr/local/modsecurity/lib/libmodsecurity.a', '/usr/local/modsecurity/lib/libmodsecurity.dylib', '/usr/local/modsecurity/lib/libmodsecurity.la', '/usr/local/mods... |
def candy_crush(string):
char_pointer = string[0]
result_string = ""
counter = 1
for c in string[1:]:
if not c == char_pointer:
result_string += char_pointer
char_pointer = c
else:
counter += 1
if counter == 3:
counter = 1
... | def candy_crush(string):
char_pointer = string[0]
result_string = ''
counter = 1
for c in string[1:]:
if not c == char_pointer:
result_string += char_pointer
char_pointer = c
else:
counter += 1
if counter == 3:
counter = 1
... |
# running use IDEL: tired of waiting
x=8
ans = 0
while ans**3 < abs(x):
ans = ans # replace the statement ans = ans + 1 by ans = ans
# ans = ans + 1
if ans**3 != abs(x):
print(x, 'is not a perfect cube')
else:
if x < 0:
ans = -ans
print('Cube root of', x,'is', ans)
| x = 8
ans = 0
while ans ** 3 < abs(x):
ans = ans
if ans ** 3 != abs(x):
print(x, 'is not a perfect cube')
else:
if x < 0:
ans = -ans
print('Cube root of', x, 'is', ans) |
#!/usr/bin/env python3
class ZotlerError(Exception):
pass
class InvalidModeError(ZotlerError):
pass
| class Zotlererror(Exception):
pass
class Invalidmodeerror(ZotlerError):
pass |
class StarwarsUniverse:
# creates a member of the starwars universe
def __init__(self, name, birth, gender):
self._name = name
self.birth = birth
self.gender = gender
def says(self, words):
return f"{self.name} says {words}"
class Robot(StarwarsUniverse):
# creates a robot fro... | class Starwarsuniverse:
def __init__(self, name, birth, gender):
self._name = name
self.birth = birth
self.gender = gender
def says(self, words):
return f'{self.name} says {words}'
class Robot(StarwarsUniverse):
def __init__(self, name, birth, gender, classification, side... |
class Magic:
def __init__(self, username, password):
self.username = username
self.password = password
def start(self):
print(self.username)
print(self.password)
class StartMagic(Magic):
def gg(self):
return self.password
while True:
s = StartMagic(1,2)
s.start()
print(s.password)
| class Magic:
def __init__(self, username, password):
self.username = username
self.password = password
def start(self):
print(self.username)
print(self.password)
class Startmagic(Magic):
def gg(self):
return self.password
while True:
s = start_magic(1, 2)
... |
def add_num(a,b):
'''Return sum of two numbers'''
s=a+b
return s
n1=input('enter first number:')
n1=int(n1)
n2=input('enter second number:')
n2=int(n2)
s = add_num(n1,n2)
print ('sum is: ',s); | def add_num(a, b):
"""Return sum of two numbers"""
s = a + b
return s
n1 = input('enter first number:')
n1 = int(n1)
n2 = input('enter second number:')
n2 = int(n2)
s = add_num(n1, n2)
print('sum is: ', s) |
class Transaction:
def __init__(self, trans_type, amount=0):
self.trans_type = trans_type
self.amount = amount
def display(self):
print('Super class display')
| class Transaction:
def __init__(self, trans_type, amount=0):
self.trans_type = trans_type
self.amount = amount
def display(self):
print('Super class display') |
class PolishWordnetParser:
__LEXICAL_UNIT = 'lexical-unit'
__SYNSET_UNIT = 'synset'
__LEXICAL_RELATIONS = 'lexicalrelations'
__SYNSET_RELATIONS = 'synsetrelations'
def __init__(self, version):
self.version = version
def lexical_unit(self):
return self.__LEXICAL_UNIT
def ... | class Polishwordnetparser:
__lexical_unit = 'lexical-unit'
__synset_unit = 'synset'
__lexical_relations = 'lexicalrelations'
__synset_relations = 'synsetrelations'
def __init__(self, version):
self.version = version
def lexical_unit(self):
return self.__LEXICAL_UNIT
def sy... |
def register_to(bot):
def sauce(*args):
_, msg, _ = args
msg.reply('https://gitlab.stusta.mhn.de/stustanet/prism/').send()
return True
bot.respond('gimme-sauce', sauce,
help_text='gimme-sauce: posts the url of the source')
bot.respond('invoke-gpl', sauce, help_text... | def register_to(bot):
def sauce(*args):
(_, msg, _) = args
msg.reply('https://gitlab.stusta.mhn.de/stustanet/prism/').send()
return True
bot.respond('gimme-sauce', sauce, help_text='gimme-sauce: posts the url of the source')
bot.respond('invoke-gpl', sauce, help_text=None)
bot.r... |
def main(N, M, A):
memo = N - sum(A)
if memo >= 0:
return memo
else:
return -1
if __name__ == '__main__':
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
# N = 314
# M = 15
# A = list(map(int, "9 26 5 35 8 9 79 3 23 8 46 2 6 43 3".split()))
... | def main(N, M, A):
memo = N - sum(A)
if memo >= 0:
return memo
else:
return -1
if __name__ == '__main__':
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
print(main(N, M, A)) |
class TEST_MODULE:
def __init__(self, parent):
self.parent = parent
self.test = "test"
self.new_commands = {
"big_test": self.testf,
}
self.add_self()
# or just
# self.parent.parser.commands.update(self.new_commands)
# but I figured a function would be kinda better in special use cases
def testf... | class Test_Module:
def __init__(self, parent):
self.parent = parent
self.test = 'test'
self.new_commands = {'big_test': self.testf}
self.add_self()
def testf(self, arg=None):
print(self.test)
self.parent.command_out_set(f'{self.test}')
self.parent.comman... |
#
# PySNMP MIB module Wellfleet-DIFFSERV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-DIFFSERV-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:39:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, value_size_constraint, constraints_union, single_value_constraint) ... |
def get_ref(db, col, identifier, obj):
for doc in db.collection(col).where(identifier, u'==', obj).stream():
return doc.reference
return None
def get_field(ref, field):
return ref.get().to_dict()[field]
def update(ref, key, val):
return ref.set({key: val}, merge=True)
def addEntry(ref, key, v... | def get_ref(db, col, identifier, obj):
for doc in db.collection(col).where(identifier, u'==', obj).stream():
return doc.reference
return None
def get_field(ref, field):
return ref.get().to_dict()[field]
def update(ref, key, val):
return ref.set({key: val}, merge=True)
def add_entry(ref, key, ... |
# Momijigaoka
if sm.hasQuest(57106):
sm.warp(807030000, 0)
elif sm.hasQuest(57107):
sm.warp(807030100, 0)
else:
sm.systemMessage("There is nothing to see here.")
#sm.warp(807030200, 0) | if sm.hasQuest(57106):
sm.warp(807030000, 0)
elif sm.hasQuest(57107):
sm.warp(807030100, 0)
else:
sm.systemMessage('There is nothing to see here.') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.