content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class EvaluationResult:
def __init__(self, cost: float, config: dict = None, info: dict = None):
self.id = None
self.cost = cost
self.config = config if config is not None else {}
self.info = info if info is not None else {}
def set_id(self, id: int):
if self.id is None:... | class Evaluationresult:
def __init__(self, cost: float, config: dict=None, info: dict=None):
self.id = None
self.cost = cost
self.config = config if config is not None else {}
self.info = info if info is not None else {}
def set_id(self, id: int):
if self.id is None:
... |
x, y = 1, 2
a = ('line 1 {}'
' line 2 {}'.format(x, y))
b = ('line 1234567890 1234567890 1234567890 1234567890 {}'
' 1234567890 1234567890 1234567890 1234567890 {}'.format(x, y)) | (x, y) = (1, 2)
a = 'line 1 {} line 2 {}'.format(x, y)
b = 'line 1234567890 1234567890 1234567890 1234567890 {} 1234567890 1234567890 1234567890 1234567890 {}'.format(x, y) |
#
# PySNMP MIB module Unisphere-Data-OSPF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-OSPF-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:24:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint) ... |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Coupon_validity, obj[4]: Gender, obj[5]: Age, obj[6]: Children, obj[7]: Education, obj[8]: Occupation, obj[9]: Income, obj[10]: Bar, obj[11]: Coffeehouse, obj[12]: Restaurant20to50, obj[13]: Direction_same, obj[14]: Distance
# {"feature":... | def find_decision(obj):
if obj[8] > 1:
if obj[9] <= 6:
if obj[7] <= 1:
if obj[2] > 3:
if obj[10] > 0.0:
if obj[1] > 0:
return 'True'
elif obj[1] <= 0:
retur... |
# -*- coding: utf-8 -*-
class SmilepackError(Exception):
pass
class InternalError(SmilepackError):
pass
class BadRequestError(SmilepackError):
def __init__(self, message, at=None):
super().__init__('{}: {}'.format(at, message) if at else message)
self.message = message
self.at ... | class Smilepackerror(Exception):
pass
class Internalerror(SmilepackError):
pass
class Badrequesterror(SmilepackError):
def __init__(self, message, at=None):
super().__init__('{}: {}'.format(at, message) if at else message)
self.message = message
self.at = at
class Jsonvalidatione... |
# Bug busters.
# The issue here is that the number is not passed to the function. This can be fixed in the following:
def absolute_value(number):
if number < 0:
number *= -1
return number
def squared(input_number):
return input_number*input_number
def min_value_list(input_list):
minimum = inp... | def absolute_value(number):
if number < 0:
number *= -1
return number
def squared(input_number):
return input_number * input_number
def min_value_list(input_list):
minimum = input_list[0]
for num in input_list:
if num < minimum:
minimum = num
return minimum
def is_... |
try:
# If we don't expose object.__new__ (small ports), there's
# nothing to test.
object.__new__
except AttributeError:
print("SKIP")
raise SystemExit
class Singleton:
obj = None
def __new__(cls):
if cls.obj is None:
cls.obj = super().__new__(cls)
return cls.... | try:
object.__new__
except AttributeError:
print('SKIP')
raise SystemExit
class Singleton:
obj = None
def __new__(cls):
if cls.obj is None:
cls.obj = super().__new__(cls)
return cls.obj
s1 = singleton()
s2 = singleton()
print(s1 is s2)
print(isinstance(s1, Singleton), i... |
# from frappe import _
def get_data():
return {
'fieldname': 'invoice',
'transactions': [
{
'label': 'Payment Entry',
'items': ['Payment Entry']
}
]
} | def get_data():
return {'fieldname': 'invoice', 'transactions': [{'label': 'Payment Entry', 'items': ['Payment Entry']}]} |
def assign_location_values(target, origin):
if origin:
target.street = origin.street
target.postalCode = origin.postalCode
target.city = origin.city
target.state = origin.state
target.country = origin.country
target.latitude = origin.latitude
target.longitude ... | def assign_location_values(target, origin):
if origin:
target.street = origin.street
target.postalCode = origin.postalCode
target.city = origin.city
target.state = origin.state
target.country = origin.country
target.latitude = origin.latitude
target.longitude ... |
'''
Given an array of strings words, return the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below.
In the American keyboard:
the first row consists of the characters "qwertyuiop",
the second row consists of the characters "asdfghjkl", and
the third row con... | """
Given an array of strings words, return the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below.
In the American keyboard:
the first row consists of the characters "qwertyuiop",
the second row consists of the characters "asdfghjkl", and
the third row con... |
# Remove all elements from a linked list of integers that have value val.
# Example:
# Input: 1->2->6->3->4->5->6, val = 6
# Output: 1->2->3->4->5
# NOTE: The delete node method in the LinkedList class implemented is different from
# this, since that only deletes single node
class ListNode:
def __init__... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def remove_elements(self, head: ListNode, val: int) -> ListNode:
prev = None
while head and head.val == val:
head = head.next
cur = head
while cur:
if c... |
S = str(input())
if S == "Sunny":
print("Cloudy")
elif S == "Cloudy":
print("Rainy")
else:
print("Sunny") | s = str(input())
if S == 'Sunny':
print('Cloudy')
elif S == 'Cloudy':
print('Rainy')
else:
print('Sunny') |
#Sets
#In {} brakets always
#No need for keys and values are unique and non-repeatable.
mySet = {1,2,3,4,5,6,7}
#array to be converted to set, causing the arrays repeted values to be removed.
my_Array = [1,2,2,2,3,5,6,6,6,7]
#we force the array to become more a set
set(my_Array)
#Print
print(set(my_Array))
#you ca... | my_set = {1, 2, 3, 4, 5, 6, 7}
my__array = [1, 2, 2, 2, 3, 5, 6, 6, 6, 7]
set(my_Array)
print(set(my_Array))
print(3 in my_Array)
print(len(my_Array)) |
s, min = list(map(int, input().split())), float('inf')
for i in range(len(s)):
if s[i] > 0 and s[i] < min:
min = s[i]
print(min)
| (s, min) = (list(map(int, input().split())), float('inf'))
for i in range(len(s)):
if s[i] > 0 and s[i] < min:
min = s[i]
print(min) |
class Bitset:
def __init__(self, maxn, bucketSize=32):
self.maxn = maxn
self.bucket_bits = bucketSize
self.bits = [0] * ( (maxn // bucketSize) + 1)
def get(self, i):
m = i // self.bucket_bits
bucket_index = i - m * self.bucket_bits
B = self.bits[ m ]
return (B >> bucket_index) & 1
de... | class Bitset:
def __init__(self, maxn, bucketSize=32):
self.maxn = maxn
self.bucket_bits = bucketSize
self.bits = [0] * (maxn // bucketSize + 1)
def get(self, i):
m = i // self.bucket_bits
bucket_index = i - m * self.bucket_bits
b = self.bits[m]
return B... |
def pg_quote(value):
if value is None:
return 'null'
return 'e\'{}\''.format(
str(value)
.replace('\\', '\\\\')
.replace('\'', '\\\'')
.replace('\n', '\\n')
)
def pg_ident_quote(ident):
if ident is None:
raise ValueError('ident is None')
return '"{... | def pg_quote(value):
if value is None:
return 'null'
return "e'{}'".format(str(value).replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n'))
def pg_ident_quote(ident):
if ident is None:
raise value_error('ident is None')
return '"{}"'.format(str(ident).replace('"', '""'))
def ... |
#While Loop Printer:
#In this exercise I had to write a short program that prints the numbers 1 to 10 using a while loop.
#I instantiated my initial variable.
printedNumber = 1
#Created a While Loop that increments my initial variable by adding 1 for every loop as long as my variable is under 11.
#I also added a cond... | printed_number = 1
while printedNumber < 11:
print(printedNumber)
if printedNumber == 10:
break
printed_number += 1 |
#!/bin/python3
x = int(input())
y = int(input())
z = int(input())
n = int(input())
lg_order = [[i, j, k] for i in range(0, x + 1)
for j in range(0, y + 1)
for k in range(0, z + 1) if i + j + k != n]
print(lg_order)
| x = int(input())
y = int(input())
z = int(input())
n = int(input())
lg_order = [[i, j, k] for i in range(0, x + 1) for j in range(0, y + 1) for k in range(0, z + 1) if i + j + k != n]
print(lg_order) |
def rectangle_area(base, height):
return base * height
if __name__ == '__main__':
print(rectangle_area(2, 2))
| def rectangle_area(base, height):
return base * height
if __name__ == '__main__':
print(rectangle_area(2, 2)) |
#
# PySNMP MIB module ALTIGA-SYNC-STATS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-SYNC-STATS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:21:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (al_sync_mib_module,) = mibBuilder.importSymbols('ALTIGA-GLOBAL-REG', 'alSyncMibModule')
(al_sync_group, al_stats_sync) = mibBuilder.importSymbols('ALTIGA-MIB', 'alSyncGroup', 'alStatsSync')
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(name... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( degree , n ) :
deg_sum = sum ( degree )
if ( 2 * ( n - 1 ) == deg_sum ) :
return True
else :
... | def f_gold(degree, n):
deg_sum = sum(degree)
if 2 * (n - 1) == deg_sum:
return True
else:
return False
if __name__ == '__main__':
param = [([2, 3, 1, 1, 1], 5), ([2, 2, 1, 1, 2], 5), ([2, 2, 1, 1, 1], 5), ([0, 0, 0, 3, 3, 4], 6), ([-10, 12, 2], 3), ([1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1... |
def binary_search(list, item):
low = 0
high = len(list)-1
while low<=high:
mid = (low+high)//2
guess = list[mid]
if guess == item:
return mid
if guess > item:
high = mid -1
else :
low = mid + 1
return None
... | def binary_search(list, item):
low = 0
high = len(list) - 1
while low <= high:
mid = (low + high) // 2
guess = list[mid]
if guess == item:
return mid
if guess > item:
high = mid - 1
else:
low = mid + 1
return None
list1 = [1, 5,... |
def updateBoard(self, board, click):
(row, col), directions = click, ((-1, 0), (1, 0),
(0, 1), (0, -1), (-1, 1), (-1, -1), (1, 1), (1, -1))
if 0 <= row < len(board) and 0 <= col < len(board[0]):
if board[row][col] == 'M':
board[row][col] = 'X'
eli... | def update_board(self, board, click):
((row, col), directions) = (click, ((-1, 0), (1, 0), (0, 1), (0, -1), (-1, 1), (-1, -1), (1, 1), (1, -1)))
if 0 <= row < len(board) and 0 <= col < len(board[0]):
if board[row][col] == 'M':
board[row][col] = 'X'
elif board[row][col] == 'E':
... |
def test_healthcheck_endpoint(client):
res = client.get("/healthcheck")
assert res.status_code == 200
res = client.post("/healthcheck")
assert res.status_code == 405
res = client.delete("/healthcheck")
assert res.status_code == 405
res = client.put("/healthcheck")
assert res.status_code ... | def test_healthcheck_endpoint(client):
res = client.get('/healthcheck')
assert res.status_code == 200
res = client.post('/healthcheck')
assert res.status_code == 405
res = client.delete('/healthcheck')
assert res.status_code == 405
res = client.put('/healthcheck')
assert res.status_code ... |
'''
The rgb() method is incomplete. Complete the method so that passing in RGB decimal values will result in a hexadecimal representation being returned. The valid decimal values for RGB are 0 - 255. Any (r,g,b) argument values that fall out of that range should be rounded to the closest valid value.
The following are... | """
The rgb() method is incomplete. Complete the method so that passing in RGB decimal values will result in a hexadecimal representation being returned. The valid decimal values for RGB are 0 - 255. Any (r,g,b) argument values that fall out of that range should be rounded to the closest valid value.
The following are... |
num = 5
while num > 0 :
print(num)
num = num - 1
| num = 5
while num > 0:
print(num)
num = num - 1 |
class OSMNode:
def __init__(self, ident, lat, lon):
self.ident = ident
self.lat = float(lat)
self.lon = float(lon)
self.tags = {}
def __repr__(self):
return f"Node {self.ident}: {self.lat} {self.lon} {self.tags}"
def to_json(self):
ret = {'ident': self.iden... | class Osmnode:
def __init__(self, ident, lat, lon):
self.ident = ident
self.lat = float(lat)
self.lon = float(lon)
self.tags = {}
def __repr__(self):
return f'Node {self.ident}: {self.lat} {self.lon} {self.tags}'
def to_json(self):
ret = {'ident': self.iden... |
def add(l1, l2):
return [x + y for x, y in zip(l1, l2)]
def minus(l1, l2):
return [x - y for x, y in zip(l1, l2)]
def multiply(l1, l2):
return [x * y for x, y in zip(l1, l2)]
def divide(l1, l2):
return [x / y for x, y in zip(l1, l2)]
def dot_product(l1, l2):
products = multiply(l1, l2)
ret... | def add(l1, l2):
return [x + y for (x, y) in zip(l1, l2)]
def minus(l1, l2):
return [x - y for (x, y) in zip(l1, l2)]
def multiply(l1, l2):
return [x * y for (x, y) in zip(l1, l2)]
def divide(l1, l2):
return [x / y for (x, y) in zip(l1, l2)]
def dot_product(l1, l2):
products = multiply(l1, l2)
... |
# Inverted full pyramid of *
# * * * * * * * * *
# * * * * * * *
# * * * * *
# * * *
# *
rows = int(input("Enter number of rows: "))
for i in range(rows, 1, -1):
for space in range(0, rows - i):
print(" ", end="")
for j in range(i, 2 * i - 1):
print("* ", end=... | rows = int(input('Enter number of rows: '))
for i in range(rows, 1, -1):
for space in range(0, rows - i):
print(' ', end='')
for j in range(i, 2 * i - 1):
print('* ', end='')
for j in range(1, i - 1):
print('* ', end='')
print() |
def converte_entrada (texto_dos_numeros):
lista = []
texto = texto_dos_numeros
y = (texto.split(' '))
for x in y:
lista.append (int(x))
return lista
def processar_numeros (lista):
soma = 0
for x in lista:
soma += x
return (soma, len(lista))
def main (lista_dos_numeros):
soma = soma_e_con... | def converte_entrada(texto_dos_numeros):
lista = []
texto = texto_dos_numeros
y = texto.split(' ')
for x in y:
lista.append(int(x))
return lista
def processar_numeros(lista):
soma = 0
for x in lista:
soma += x
return (soma, len(lista))
def main(lista_dos_numeros):
s... |
class Solution:
def topKFrequent(self, words: List[str], k: int) -> List[str]:
count = collections.Counter(words)
heap = [(-freq, word) for word, freq in count.items()]
heapq.heapify(heap)
return [heapq.heappop(heap)[1] for _ in range(k)] | class Solution:
def top_k_frequent(self, words: List[str], k: int) -> List[str]:
count = collections.Counter(words)
heap = [(-freq, word) for (word, freq) in count.items()]
heapq.heapify(heap)
return [heapq.heappop(heap)[1] for _ in range(k)] |
# -*- coding: utf-8 -*-
class Settings(object):
def __init__(self):
self._slow_test_threshold = .075
self._enable_code_coverage = False
self._enable_file_watcher = False
self._format = 'documentation'
self._no_color = False
@property
def format(self):
retu... | class Settings(object):
def __init__(self):
self._slow_test_threshold = 0.075
self._enable_code_coverage = False
self._enable_file_watcher = False
self._format = 'documentation'
self._no_color = False
@property
def format(self):
return self._format
@for... |
# Space: O(n)
# Time: O(n)
# DFS approach(recursive)
# 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 sumOfLeftLeaves(self, root):
if root is... | class Solution:
def sum_of_left_leaves(self, root):
if root is None:
return 0
def helper(root, flag):
if root is None:
return 0
if root.left is None and root.right is None and flag:
return root.val
return helper(root.l... |
'''
We have two monkeys, a and b, and the parameters a_smile and b_smile indicate
if each is smiling. We are in trouble if they are both smiling or if neither
of them is smiling. Return True if we are in trouble.
'''
def monkey_trouble(a_smile, b_smile):
return a_smile and b_smile or not a_smile and not b_smile
| """
We have two monkeys, a and b, and the parameters a_smile and b_smile indicate
if each is smiling. We are in trouble if they are both smiling or if neither
of them is smiling. Return True if we are in trouble.
"""
def monkey_trouble(a_smile, b_smile):
return a_smile and b_smile or (not a_smile and (not b_smile)... |
__author__ = 'karunab'
def get_resolution():
return 2880, 1800
| __author__ = 'karunab'
def get_resolution():
return (2880, 1800) |
#
# PySNMP MIB module Unisphere-Data-PPP-Profile-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-PPP-Profile-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 21:25:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pytho... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ... |
configs = {
"cifar10": {
"depth": 28,
"width": 10,
"epochs": 200,
"batch_size": 128,
"lr": 0.1,
"lr_decay": 0.2,
"schedule": "60|120|160",
"momentum": 0.9,
"dropout": 0.3,
"preprocess_method": "cifar10",
"seed": None,
},
"svhn": {
"depth": 16,
"width": 8... | configs = {'cifar10': {'depth': 28, 'width': 10, 'epochs': 200, 'batch_size': 128, 'lr': 0.1, 'lr_decay': 0.2, 'schedule': '60|120|160', 'momentum': 0.9, 'dropout': 0.3, 'preprocess_method': 'cifar10', 'seed': None}, 'svhn': {'depth': 16, 'width': 8, 'epochs': 160, 'batch_size': 128, 'lr': 0.01, 'lr_decay': 0.1, 'sched... |
def insertion(nums):
for i in range(len(nums)):
key=nums[i]
j=i-1
while j>=0 and key < nums[j]:
nums[j+1]=nums[j]
j-=1
... | def insertion(nums):
for i in range(len(nums)):
key = nums[i]
j = i - 1
while j >= 0 and key < nums[j]:
nums[j + 1] = nums[j]
j -= 1
nums[j + 1] = key
nums = [8, 6, 9, 3, 4, 1]
insertion(nums)
print('sorted arry')
for i in range(len(nums)):
print(nums[... |
x = 0
while x<6:
print(x)
x+=1 | x = 0
while x < 6:
print(x)
x += 1 |
@app.route("/url/<int:id>/type/<any(html, xlsx):format>")
@role_required("specialist")
def project_results(id, format):
#Get project from database by id
project = get_my_project(id)
#Builder report based on project and format
report_builder = get_report_builder(project, format)
if project.id == 48:... | @app.route('/url/<int:id>/type/<any(html, xlsx):format>')
@role_required('specialist')
def project_results(id, format):
project = get_my_project(id)
report_builder = get_report_builder(project, format)
if project.id == 48:
colors_iterator = itertools.cycle((color for color in bg_colors if color != '... |
def factorial(n):
if n == 0 or n == 1:
return 1
counter = 1
result = 1
while counter <= n:
result *= counter
counter += 1
return result
print (factorial(0))
print (factorial(1))
print (factorial(5))
print (10 * '-')
def fibonacci(n):
if n == 1:
return [1]
... | def factorial(n):
if n == 0 or n == 1:
return 1
counter = 1
result = 1
while counter <= n:
result *= counter
counter += 1
return result
print(factorial(0))
print(factorial(1))
print(factorial(5))
print(10 * '-')
def fibonacci(n):
if n == 1:
return [1]
result ... |
def solution(n):
cnt = 0
while n:
if n % 2 == 0:
n = n // 2
elif n % 2 == 1:
n -= 1
cnt += 1
return cnt
| def solution(n):
cnt = 0
while n:
if n % 2 == 0:
n = n // 2
elif n % 2 == 1:
n -= 1
cnt += 1
return cnt |
class RuntimeError:
@classmethod
def cast_error(cls, type_, cast_type):
cls._halt(f"Cannot cast {type_} to {cast_type}")
@classmethod
def _halt(cls, message):
print("Runtime error:", message)
exit(1)
| class Runtimeerror:
@classmethod
def cast_error(cls, type_, cast_type):
cls._halt(f'Cannot cast {type_} to {cast_type}')
@classmethod
def _halt(cls, message):
print('Runtime error:', message)
exit(1) |
class Rom:
def __init__(self, rom_data, header):
self.rom_data = rom_data
self.header = header
def patch_rom(self, bytes, address):
start_address = address - len(self.header)
end_address = start_address + len(bytes)
self.rom_data[start_address:end_address] = bytes
... | class Rom:
def __init__(self, rom_data, header):
self.rom_data = rom_data
self.header = header
def patch_rom(self, bytes, address):
start_address = address - len(self.header)
end_address = start_address + len(bytes)
self.rom_data[start_address:end_address] = bytes
... |
for n in range(1, 21):
print(n)
for n in range(1, 21):
print(f"{n}", end=', ')
| for n in range(1, 21):
print(n)
for n in range(1, 21):
print(f'{n}', end=', ') |
def DoTheThing(lines):
myDict = dict()
for line in lines:
numb = int(line.strip())
pair = 2020-numb
if pair in myDict:
return myDict[pair] * numb
else:
myDict[numb] = numb
return None
f = f = open('input.txt', 'r')
lines = f.readlines()
print(DoTheThi... | def do_the_thing(lines):
my_dict = dict()
for line in lines:
numb = int(line.strip())
pair = 2020 - numb
if pair in myDict:
return myDict[pair] * numb
else:
myDict[numb] = numb
return None
f = f = open('input.txt', 'r')
lines = f.readlines()
print(do_t... |
with open('input') as f:
grid = list(map(list, f.read().splitlines()))
w = len(grid[0])
h = len(grid)
moves = [
(0, 1),
(0, -1),
(1, 0),
(-1, 0),
(1, -1),
(-1, 1),
(1, 1),
(-1, -1),
]
def adjacent(grid, x, y):
for mx, my in moves:
X = x + mx
Y = y + my
i... | with open('input') as f:
grid = list(map(list, f.read().splitlines()))
w = len(grid[0])
h = len(grid)
moves = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, -1), (-1, 1), (1, 1), (-1, -1)]
def adjacent(grid, x, y):
for (mx, my) in moves:
x = x + mx
y = y + my
if 0 <= X < w and 0 <= Y < h:
... |
class HostStatus:
def __init__(self, host):
self.host = host
self.currentState = "UNKNOWN"
self.goalState = "UNKNOWN"
self.services = None
| class Hoststatus:
def __init__(self, host):
self.host = host
self.currentState = 'UNKNOWN'
self.goalState = 'UNKNOWN'
self.services = None |
def factorial(n: int) -> int:
if n<0: return None
if n==0 or n==1: return 1
else:
return n*factorial(n-1)
n = int(input())
if(factorial(n)):
print(factorial(n))
else:
print("VALUE ERROR") | def factorial(n: int) -> int:
if n < 0:
return None
if n == 0 or n == 1:
return 1
else:
return n * factorial(n - 1)
n = int(input())
if factorial(n):
print(factorial(n))
else:
print('VALUE ERROR') |
#!/usr/bin/env python3
if 'raw_input' in vars(__builtins__): input = raw_input #Fix for Python 2.x raw_input
print('["Hello, World!",{"id":"Press Me","v":false}]')
input()
print('[null,"You pressed the button!"]')
| if 'raw_input' in vars(__builtins__):
input = raw_input
print('["Hello, World!",{"id":"Press Me","v":false}]')
input()
print('[null,"You pressed the button!"]') |
class Solution:
def XXX(self, root: TreeNode) -> List[List[int]]:
if not root:
return []
stack = [root]
level = []
cur_level = []
res = []
while stack:
for cur_node in stack:
cur_level.append(cur_node.val)
if cur... | class Solution:
def xxx(self, root: TreeNode) -> List[List[int]]:
if not root:
return []
stack = [root]
level = []
cur_level = []
res = []
while stack:
for cur_node in stack:
cur_level.append(cur_node.val)
if cu... |
benchmark_name = "Benchmark factorial_recursive"
fact_num = 500
def run_benchmark():
def factorial_recursive(num):
if num == 1:
return 1
return num * factorial_recursive(num - 1)
def warmup():
i = 0
while i < 50:
factorial_recursive(fact_num)
... | benchmark_name = 'Benchmark factorial_recursive'
fact_num = 500
def run_benchmark():
def factorial_recursive(num):
if num == 1:
return 1
return num * factorial_recursive(num - 1)
def warmup():
i = 0
while i < 50:
factorial_recursive(fact_num)
... |
class OrbisimSemanticError(Exception):
@property
def error_info(self):
return self.args[0]
class OrbisimExecutionError(Exception):
@property
def error_info(self):
return self.args[0]
class OrbisimLexerError(Exception):
@property
def error_info(self):
return self.args[... | class Orbisimsemanticerror(Exception):
@property
def error_info(self):
return self.args[0]
class Orbisimexecutionerror(Exception):
@property
def error_info(self):
return self.args[0]
class Orbisimlexererror(Exception):
@property
def error_info(self):
return self.args... |
a = 1
while True:
found = False
for x in range(56 * 48):
if not ({2, 4, 8, 12, 15} <= (not ({3, 6, 8, 15}) or (a))):
found = True
break
if not found:
print(a)
break
a += 1
| a = 1
while True:
found = False
for x in range(56 * 48):
if not {2, 4, 8, 12, 15} <= (not {3, 6, 8, 15} or a):
found = True
break
if not found:
print(a)
break
a += 1 |
# Multiple Inheritence example
# class SapleBase1:
# def sampleBase1Function(self):
# print("Sample Base 1 Function")
# class SampleBase2:
# def sampleBase2Function(self):
# print("Sample Base 2 Function")
# class MultiInheritenceExample(SapleBase1, SampleBase2):
# pass
# multipleInherit... | class Level1:
pass
class Level2(Level1):
pass
class Multiplelevel(Level2):
pass
multi_level_inheritence_object = multiple_level()
print(MultipleLevel.__mro__)
print(MultipleLevel.__bases__) |
txt = "Hello, And Welcome To My World!"
x = txt.casefold()
print(x)
# Author: Bryan G
| txt = 'Hello, And Welcome To My World!'
x = txt.casefold()
print(x) |
#
# PySNMP MIB module HP-SwitchStack-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-SwitchStack-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:36:52 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint) ... |
class state_params():
def __init__(self):
self._pos = 0
self._vel = 0
self._acc = 0
self._time = 0
class state_organizer():
def __init__(self):
self.pos = state_params()
self.vel = state_params()
self.acc = state_params() | class State_Params:
def __init__(self):
self._pos = 0
self._vel = 0
self._acc = 0
self._time = 0
class State_Organizer:
def __init__(self):
self.pos = state_params()
self.vel = state_params()
self.acc = state_params() |
OFFLINE=0
INSPIRATIONAL=1
DESIGN=2
URL_INSPIRATIONAL="https://zenquotes.io/api/random"
URL_DESIGN="https://quotesondesign.com/wp-json/wp/v2/posts/?orderby=rand"
REFRESH_TIME_SEC=7200
| offline = 0
inspirational = 1
design = 2
url_inspirational = 'https://zenquotes.io/api/random'
url_design = 'https://quotesondesign.com/wp-json/wp/v2/posts/?orderby=rand'
refresh_time_sec = 7200 |
# Problem 1 - Summing all integers between user inputted number and 1
# Colin Morrow - Wed 27/02/2018
# Asking the user to input a number to define "n"
n = int(input("Enter a positive integer..."))
# total is a reference point for the addition of each integer
total = 0
if n <= 0:
print("Not really the positive ... | n = int(input('Enter a positive integer...'))
total = 0
if n <= 0:
print('Not really the positive integer I was looking for...')
elif n == 1:
print('You should try a bigger number')
else:
while n > 0:
total += n
n -= 1
print(total) |
class Cloud(object):
def __init__(self, cloud, log):
self.log = log
self.cloud = cloud
def create_instance(self, name, inst_info, ssh_user, ssh_key, wait=False):
pass
def create_client(self, inst_info, prefix, num_instances, ssh_username,
... | class Cloud(object):
def __init__(self, cloud, log):
self.log = log
self.cloud = cloud
def create_instance(self, name, inst_info, ssh_user, ssh_key, wait=False):
pass
def create_client(self, inst_info, prefix, num_instances, ssh_username, ssh_key):
return 0
def create... |
class Source(object):
SOURCES = []
@classmethod
def can_use(cls, source):
return False
@classmethod
def register(cls, subcls):
cls.SOURCES.append(subcls)
return subcls
@classmethod
def find(cls, path):
for source in cls.SOURCES:
... | class Source(object):
sources = []
@classmethod
def can_use(cls, source):
return False
@classmethod
def register(cls, subcls):
cls.SOURCES.append(subcls)
return subcls
@classmethod
def find(cls, path):
for source in cls.SOURCES:
if source.can_us... |
__version__ = '0.1.0'
__author__ = 'AnyThund'
__email__ = 'seaventhunder@gmail.com'
__description__ = 'Portable for your scoop.'
| __version__ = '0.1.0'
__author__ = 'AnyThund'
__email__ = 'seaventhunder@gmail.com'
__description__ = 'Portable for your scoop.' |
class QueryException(Exception):
def __init__(self, message, httpcode):
self.message = message
self.httpcode = httpcode
| class Queryexception(Exception):
def __init__(self, message, httpcode):
self.message = message
self.httpcode = httpcode |
#!/usr/bin/env python3
'''
Implement a function that adds two numbers together and returns their sum in binary. The conversion can be done before, or after the addition.
The binary number returned should be a string.
'''
def add_binary(a,b):
sum = a + b
print(bin(sum)[2:])
add_binary(1,1)
#Alternative ... | """
Implement a function that adds two numbers together and returns their sum in binary. The conversion can be done before, or after the addition.
The binary number returned should be a string.
"""
def add_binary(a, b):
sum = a + b
print(bin(sum)[2:])
add_binary(1, 1)
def add_binary(a, b):
return bin(a + ... |
defined_environments = [
'test',
'production'
]
def has_environment(name):
return name in defined_environments
| defined_environments = ['test', 'production']
def has_environment(name):
return name in defined_environments |
'''
This software is derived from the OpenNMT project at
https://github.com/OpenNMT/OpenNMT.
Modified 2017, Idiap Research Institute, http://www.idiap.ch/ (Xiao PU)
'''
PAD = 0
UNK = 1
BOS = 2
EOS = 3
PAD_WORD = '<blank>'
UNK_WORD = '<unk>'
BOS_WORD = '<s>'
EOS_WORD = '</s>'
| """
This software is derived from the OpenNMT project at
https://github.com/OpenNMT/OpenNMT.
Modified 2017, Idiap Research Institute, http://www.idiap.ch/ (Xiao PU)
"""
pad = 0
unk = 1
bos = 2
eos = 3
pad_word = '<blank>'
unk_word = '<unk>'
bos_word = '<s>'
eos_word = '</s>' |
# Python program to demonstract perfect num :
n = int(input('Enter a number : '))
sum = 0
for i in range(1, n) :
if (n % i == 0) :
sum = sum + i
if (sum == n) :
print('Perfect num ...')
else :
print('Not perfect num...')
| n = int(input('Enter a number : '))
sum = 0
for i in range(1, n):
if n % i == 0:
sum = sum + i
if sum == n:
print('Perfect num ...')
else:
print('Not perfect num...') |
if __name__ == '__main__':
n = int(input())
a = list(map(int, input().split()))
start = 0
while start + 1 < n and a[start] < a[start + 1]:
start += 1
end = start
while end + 1 < n and a[end] > a[end + 1]:
end += 1
b = a[:start] + a[start:end + 1][::-1] + a[end + 1:]
a.so... | if __name__ == '__main__':
n = int(input())
a = list(map(int, input().split()))
start = 0
while start + 1 < n and a[start] < a[start + 1]:
start += 1
end = start
while end + 1 < n and a[end] > a[end + 1]:
end += 1
b = a[:start] + a[start:end + 1][::-1] + a[end + 1:]
a.sor... |
# gets key presses. Only helpful for key down strokes
class KeyboardListener:
def KeyDown (self, event):
pass
def get_keydown (oldkeystate, newkeystate, keys):
return any ([newkeystate[k] and not oldkeystate[k] for k in keys]) | class Keyboardlistener:
def key_down(self, event):
pass
def get_keydown(oldkeystate, newkeystate, keys):
return any([newkeystate[k] and (not oldkeystate[k]) for k in keys]) |
_base_ = (
"./FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_01_02MasterChefCan_bop_test.py"
)
OUTPUT_DIR = "output/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/13_24Bowl"
DATASETS = dict(TRAIN=("ycbv_024_bowl_train_pbr"... | _base_ = './FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_01_02MasterChefCan_bop_test.py'
output_dir = 'output/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/13_24Bowl'
datasets = dict(TRAIN=('ycbv_024_bowl_train_pbr',)) |
class TestResult:
def __init__(self) -> None:
self.__details = {}
self.run_count = 0
self.error_count = 0
def test_started(self):
self.run_count += 1
def test_failed(self, test_name: str, failure_reason: str):
self.__details.update({test_name: failure_reason... | class Testresult:
def __init__(self) -> None:
self.__details = {}
self.run_count = 0
self.error_count = 0
def test_started(self):
self.run_count += 1
def test_failed(self, test_name: str, failure_reason: str):
self.__details.update({test_name: failure_reason})
... |
# -*- coding: utf-8 -*-
__author__ = 'Syd Logan'
__email__ = 'slogan621@gmail.com'
__version__ = '0.1.0'
| __author__ = 'Syd Logan'
__email__ = 'slogan621@gmail.com'
__version__ = '0.1.0' |
# Advent of Code 2021 Solution
# By: Bailey Carothers
# For: Day 3, Part 1
# Objective:
# Inputs are structured as binary numbers. ex "01011"
# See requirements.txt for full explanation
if __name__ == "__main__":
# Declare variables as needed by requirements
onesFound = []
zerosFound = []
gamma = ""
... | if __name__ == '__main__':
ones_found = []
zeros_found = []
gamma = ''
epsilon = ''
total_lines = 0
with open('input.txt', 'r') as infile:
first_line = infile.readline()
list_length = len(firstLine) - 1
binary_size = listLength
for x in range(0, listLength, 1):
... |
cnt = 0
def new_employee(name, job, cnt):
cnt += 1
return ({'name': name, 'job':job}, cnt)
def get_name(employee):
print(employee['name'])
def change_job(employee, job):
employee['job'] = job
return employee
# dodajemy komputer
def new_computer(name, type):
return {'name': ... | cnt = 0
def new_employee(name, job, cnt):
cnt += 1
return ({'name': name, 'job': job}, cnt)
def get_name(employee):
print(employee['name'])
def change_job(employee, job):
employee['job'] = job
return employee
def new_computer(name, type):
return {'name': name, 'type': type}
def give_compute... |
class Tag(object):
def __init__(self, store, location, tagid, name):
self.store = store
self.location = location
self.tagid = tagid
self.name = name
def __str__(self):
return str(self.__unicode__())
def __unicode__(self):
return self.name
class TagDoc(obje... | class Tag(object):
def __init__(self, store, location, tagid, name):
self.store = store
self.location = location
self.tagid = tagid
self.name = name
def __str__(self):
return str(self.__unicode__())
def __unicode__(self):
return self.name
class Tagdoc(obje... |
def task8():
f = open('input.txt', 'r')
line = f.readline()
f.close()
op = ['[', '(']
cl = [']', ')']
res = 0
stack = []
for c in line.strip():
if c in op:
stack.insert(0, c)
else:
if len(stack) == 0:
res = -1
break
... | def task8():
f = open('input.txt', 'r')
line = f.readline()
f.close()
op = ['[', '(']
cl = [']', ')']
res = 0
stack = []
for c in line.strip():
if c in op:
stack.insert(0, c)
else:
if len(stack) == 0:
res = -1
break
... |
base = 2 ** 8
def get_hash(text):
ans = 0
for c in text:
ans *= base
ans += ord(c)
return ans | base = 2 ** 8
def get_hash(text):
ans = 0
for c in text:
ans *= base
ans += ord(c)
return ans |
s = "Global Variable"
def func():
s=50
print(locals()) #will print all local variables in a dictionary
print(globals()['s']) # will print 'Global Variable'
return s
print(func())
def hello(name='Jack'):
return "hello "+ name
print("hello",hello())
## Assign a label to a function
mynewgreet = hello
print("... | s = 'Global Variable'
def func():
s = 50
print(locals())
print(globals()['s'])
return s
print(func())
def hello(name='Jack'):
return 'hello ' + name
print('hello', hello())
mynewgreet = hello
print('mynewgreet', mynewgreet())
def greetings(name='Sean'):
print('The greetings() function has bee... |
#
# PySNMP MIB module TPLINK-SYSMONITOR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-SYSMONITOR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:26:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, constraints_union, value_size_constraint) ... |
# Pharmacy Drawer 4 (1052132) | Kerning City Pharmacy (103000002)
middleman = 2852
firstAid = 4033036
if sm.hasQuest(middleman):
if sm.canHold(firstAid) and not sm.hasItem(firstAid):
sm.giveItem(firstAid)
sm.sendSayOkay("(You searched the drawer and took out an emergency kit.)")
elif sm.hasIte... | middleman = 2852
first_aid = 4033036
if sm.hasQuest(middleman):
if sm.canHold(firstAid) and (not sm.hasItem(firstAid)):
sm.giveItem(firstAid)
sm.sendSayOkay('(You searched the drawer and took out an emergency kit.)')
elif sm.hasItem(firstAid):
sm.sendSayOkay('(The drawer is now empty.)')... |
#
# PySNMP MIB module CISCO-UNITY-EXPRESS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNITY-EXPRESS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:18:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) ... |
input = open('input', 'r').read().strip()
input = [[list(map(frozenset, x.split())) for x in r.split('|')] for r in input.splitlines()]
# Preparing smart key table based on fixed digits
segments = list(map(frozenset, 'abcefg cf acdeg acdfg bcdf abdfg abdefg acf abcdefg abcdfg'.split()))
count = {}
for n, seg in enum... | input = open('input', 'r').read().strip()
input = [[list(map(frozenset, x.split())) for x in r.split('|')] for r in input.splitlines()]
segments = list(map(frozenset, 'abcefg cf acdeg acdfg bcdf abdfg abdefg acf abcdefg abcdfg'.split()))
count = {}
for (n, seg) in enumerate(segments):
count.setdefault(len(seg), [])... |
items_by_category = {
"logistics": {
"storage": ["wooden-chest", "iron-chest", "steel-chest", "storage-tank"],
"belt-transport": ["transport-belt", "fast-transport-belt", "express-transport-belt",
"underground-belt", "fast-underground-belt", "express-underground-belt", "splitter",
... | items_by_category = {'logistics': {'storage': ['wooden-chest', 'iron-chest', 'steel-chest', 'storage-tank'], 'belt-transport': ['transport-belt', 'fast-transport-belt', 'express-transport-belt', 'underground-belt', 'fast-underground-belt', 'express-underground-belt', 'splitter', 'fast-splitter', 'express-splitter'], 'i... |
while True:
try:
hh, mm = str(input()).split()
hh = int(hh) // 30
mm = int(mm) // 6
print('{:02}:{:02}'.format(hh, mm))
except EOFError:
break
| while True:
try:
(hh, mm) = str(input()).split()
hh = int(hh) // 30
mm = int(mm) // 6
print('{:02}:{:02}'.format(hh, mm))
except EOFError:
break |
for i in range(2, 21):
for j in range(2, i):
if i % j == 0:
print(f"{i} = {j} times {i // j}")
break
else:
print(i, " is a prime number!")
print("Done")
| for i in range(2, 21):
for j in range(2, i):
if i % j == 0:
print(f'{i} = {j} times {i // j}')
break
else:
print(i, ' is a prime number!')
print('Done') |
#!/usr/bin/python3
#coding=utf-8
def debug_run():
a = 1
a += 1
print('python debug run success')
if __name__ == "__main__":
debug_run() | def debug_run():
a = 1
a += 1
print('python debug run success')
if __name__ == '__main__':
debug_run() |
projections = [
{
"name": "app_display mona",
"configuration": {},
"projection": {
"image_data": {
"type": "linked",
"location": "event",
"stream": "primary",
"field": ":exchan... | projections = [{'name': 'app_display mona', 'configuration': {}, 'projection': {'image_data': {'type': 'linked', 'location': 'event', 'stream': 'primary', 'field': ':exchange:data'}, 'sample_name': {'type': 'configuration', 'field': ':measurement:sample:name', 'location': 'start'}, 'instrument_name': {'type': 'configur... |
def bitn(i, n):
return (i >> n) & 1
def blen(n):
return n.bit_length()
def masknbits(n):
return ((1<<n)-1)
def rotl(i, n, order=8):
return ((i << n) | (i >> order-n)) & masknbits(order)
# Apply a function column-wise
def map_columns(func, state):
s2 = bytearray()
for i in range(4):
s2 += func(state[i * ... | def bitn(i, n):
return i >> n & 1
def blen(n):
return n.bit_length()
def masknbits(n):
return (1 << n) - 1
def rotl(i, n, order=8):
return (i << n | i >> order - n) & masknbits(order)
def map_columns(func, state):
s2 = bytearray()
for i in range(4):
s2 += func(state[i * 4:i * 4 + 4])... |
class StructureCode:
def __init__(self, file_name, line_number, record_descriptor_word,
hexadecimal_identifier, structure_code):
self.fields = {
'record_descriptor_word': record_descriptor_word,
'hexadecimal_identifier': hexadecimal_identifier,
'structure... | class Structurecode:
def __init__(self, file_name, line_number, record_descriptor_word, hexadecimal_identifier, structure_code):
self.fields = {'record_descriptor_word': record_descriptor_word, 'hexadecimal_identifier': hexadecimal_identifier, 'structure_code': structure_code}
self.length = int(rec... |
SELECT = 'SELECT'
PMTGAIN = 'PMTG'
MSTART = 'MSTART'
MSTOP = 'MSTOP'
| select = 'SELECT'
pmtgain = 'PMTG'
mstart = 'MSTART'
mstop = 'MSTOP' |
'''
Anas Albedaiwi
albedaiwi1994@gmail.com
'''
seconds = int(input('Enter number of seconds: '))
print("hoursHappend")
hoursHappend =input(seconds/3600)
print("minsHappend")
minsHappend = input((seconds%3600)/60)
print("secondHappend")
secondHappend = input((seconds%3600)%60)
| """
Anas Albedaiwi
albedaiwi1994@gmail.com
"""
seconds = int(input('Enter number of seconds: '))
print('hoursHappend')
hours_happend = input(seconds / 3600)
print('minsHappend')
mins_happend = input(seconds % 3600 / 60)
print('secondHappend')
second_happend = input(seconds % 3600 % 60) |
def algo():
return 1 + 2
def is_prime(n):
for i in range(3, n):
if n % i == 0:
return False
return True
def get_primes(input_list):
return (e for e in input_list if is_prime(e))
'''def gerar_numero():
yield 1
yield 2
yield 3
for i in gerar_numero():
print('{}'.format(i), end=' ')
try:
nosso_gerador ... | def algo():
return 1 + 2
def is_prime(n):
for i in range(3, n):
if n % i == 0:
return False
return True
def get_primes(input_list):
return (e for e in input_list if is_prime(e))
"def gerar_numero():\n\tyield 1\n\tyield 2\n\tyield 3\n\nfor i in gerar_numero():\n\tprint('{}'.format(i... |
with open('words.txt', 'r') as fin:
lines = fin.readlines()
words = []
for line in lines:
words.append(line.strip())
def bisect(words, target):
if len(words) == 0:
return False
mid_value = len(words)//2
if target == words[mid_value]:
return True
if target < words[mid_value]:
... | with open('words.txt', 'r') as fin:
lines = fin.readlines()
words = []
for line in lines:
words.append(line.strip())
def bisect(words, target):
if len(words) == 0:
return False
mid_value = len(words) // 2
if target == words[mid_value]:
return True
if target < words[mid_value]:
... |
god_wills_it_line_one = "The very earth will disown you"
disown_placement = god_wills_it_line_one.find("disown")
print(disown_placement)
| god_wills_it_line_one = 'The very earth will disown you'
disown_placement = god_wills_it_line_one.find('disown')
print(disown_placement) |
population_output_schema = [
{
"name": "STATE",
"type": "STRING"
},
{
"name": "COUNTY",
"type": "STRING"
... | population_output_schema = [{'name': 'STATE', 'type': 'STRING'}, {'name': 'COUNTY', 'type': 'STRING'}, {'name': 'TRACT', 'type': 'STRING'}, {'name': 'BLOCK', 'type': 'STRING'}, {'name': 'HOUSEHOLD_ID', 'type': 'INTEGER'}, {'name': 'HOUSEHOLD_TYPE', 'type': 'INTEGER'}, {'name': 'LATITUDE', 'type': 'STRING'}, {'name': 'L... |
class ColorModeMeta(type):
def __new__(
metacls,
cls,
bases,
attributes,
):
if "__str__" not in attributes.keys():
raise AttributeError(
"ColorModeMeta must be __str__ value"
)
if "__call__" not in attributes.keys():
... | class Colormodemeta(type):
def __new__(metacls, cls, bases, attributes):
if '__str__' not in attributes.keys():
raise attribute_error('ColorModeMeta must be __str__ value')
if '__call__' not in attributes.keys():
raise attribute_error('ColorModeMeta must be __call__ value')
... |
class MathError(Exception):
pass
class MathSyntaxError(MathError):
def __init__(self, reason="", visualisation=""):
self.reason = reason
self.visualisation = visualisation
def __str__(self):
return f"Syntax error:\n" \
f"{self.reason}\n" \
... | class Matherror(Exception):
pass
class Mathsyntaxerror(MathError):
def __init__(self, reason='', visualisation=''):
self.reason = reason
self.visualisation = visualisation
def __str__(self):
return f"Syntax error:\n{self.reason}\n{(self.visualisation if self.visualisation else '')... |
people=['mom','dad','sister']
print("Now there will be a larger dining-table.")
people.insert(0,'brother')
people.insert(2,'friend')
people.append('teacher')
print("Dear "+people[0]+", I'd like to invite you to have dinner with me on Friday at my home.")
print("Dear "+people[1]+", I'd like to invite you to have dinner ... | people = ['mom', 'dad', 'sister']
print('Now there will be a larger dining-table.')
people.insert(0, 'brother')
people.insert(2, 'friend')
people.append('teacher')
print('Dear ' + people[0] + ", I'd like to invite you to have dinner with me on Friday at my home.")
print('Dear ' + people[1] + ", I'd like to invite you t... |
while True:
answer = input("Enter something, q to quit outer: ")
if answer == "q":
break
while True:
next_answer = input("Enter something else, q to quit inner: ")
if next_answer == "q":
break
else:
# rest of loop...
continue
... | while True:
answer = input('Enter something, q to quit outer: ')
if answer == 'q':
break
while True:
next_answer = input('Enter something else, q to quit inner: ')
if next_answer == 'q':
break
else:
continue
break |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.